Giter VIP home page Giter VIP logo

gokiteconnect's People

Contributors

abhinandkakkadi avatar bhumitattarde avatar de-sh avatar imjayanth avatar kalbhor avatar knadh avatar mr-karan avatar ranjanrak avatar rhnvrm avatar techie-subhadeep avatar utekaravinash avatar varunbatrait avatar vishnus avatar vividvilla avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gokiteconnect's Issues

ticker Order update not called

ticker.OnOrderUpdate fails to unmarshal order JSON

logs

message type 1

message: {order map[account_id:REMOVED app_id:00000 average_price:0 cancelled_quantity:0 checksum: disclosed_quantity:0 exchange:NSE exchange_order_id: exchange_timestamp: exchange_update_timestamp: filled_quantity:0 guid:10982Xg2D0yM5lJyIG instrument_token:41729 market_protection:0 meta:map[] meta_raw: order_id:200106003187256 order_timestamp:2020-01-06 17:34:22 order_type:LIMIT parent_order_id: pending_quantity:0 placed_by:KITEID price:160.65 product:BO quantity:1 status:REJECTED status_message:BO: auto square off executed status_message_raw:BO: auto square off executed tag:bs tags:[bs] tradingsymbol:APOLLOTYRE transaction_type:BUY trigger_price:0 unfilled_quantity:0 validity:DAY variety:bo]}

error parsing order json: cannot unmarshal object into Go struct field Order.data.meta of type string

error code: zerodhatech/gokiteconnect/ticker/ticker.go
error line: 604 if err := json.Unmarshal(inp, &order); err != nil {}

it was working good previous version. request for hot fix. thanks

Update zerodhatech->zerodha

Currenly github is handling the switch we made to the organization name but we should update and make a new release. Will have to update the README and go module files.

No depth information

There is no depth information for any of the tokens subscribed.

{quote 951809 true false 0001-01-01 00:00:00 +0000 UTC 0001-01-01 00:00:00 +0000 UTC 994 27 131528 99456 1161487 0 0 987.4 0 0 0 0 {0 999 1001.35 980.4 995.4} {[{0 0 0} {0 0 0} {0 0 0} {0 0 0} {0 0 0}] [{0 0 0} {0 0 0} {0 0 0} {0 0 0} {0 0 0}]}}

above is the sample for voltas. I have tested for option tokens as well getting zero on them as well.

Modify Websocket checkConnectionAlive Logic to Ping/Pong Message Based

Currently Ticker websocket checkConnectionAlive logic is based on the timestamp last message (Tick or OrderUpdate) was received.

The major issue with this is that If I only want to get OrderUpdates and have not subscribed for any tick data, the current checkConnectionAlive keeps on closing the connection and marking it for auto connect.

It would be better to change the checkConnectionAlive logic to be based on Ping/Pong message (i.e Client will send ping message on a regular interval and connection alive lease can be reseted once the Pong message is received). I see same is being done in pyKiteConnect too.

Let me know if this is something you find valid and I will raise a PR for same, else Pls correct my understanding.

get quotes library json error

when i try following I get below response for most of the quotes

quotes, err := s.kiteClient.GetQuote(symbols...)
response:
Error parsing JSON response: invalid character '<' looking for beginning of value

symbols are in format 'NSE:ADANIPOWER' so on...

Cannot get latest version: module contains a go.mod file, so module path should be github.com/zerodhatech/gokiteconnect/v3

Background

The github.com/zerodhatech/gokiteconnect uses Go modules and the current release version is v3. And it’s module path is "github.com/zerodhatech/gokiteconnect", instead of "github.com/zerodhatech/gokiteconnect/v3". It must comply with the specification of "Releasing Modules for v2 or higher" available in the Modules documentation. Quoting the specification:

A package that has opted in to modules must include the major version in the import path to import any v2+ modules
To preserve import compatibility, the go command requires that modules with major version v2 or later use a module path with that major version as the final element. For example, version v2.0.0 of example.com/m must instead use module path example.com/m/v2.
https://github.com/golang/go/wiki/Modules#releasing-modules-v2-or-higher

Steps to Reproduce

GO111MODULE=on, run go get targeting any version >= v3.0.0 of the zerodhatech/gokiteconnect:

$ go get github.com/zerodhatech/[email protected]
go: finding github.com/zerodhatech/gokiteconnect v3.0.0
go: finding github.com/zerodhatech/gokiteconnect v3.0.0
go get github.com/zerodhatech/[email protected]: github.com/zerodhatech/[email protected]: invalid version: module contains a go.mod file, so major version must be compatible: should be v0 or v1, not v3

SO anyone using Go modules will not be able to easily use any newer version of zerodhatech/gokiteconnect.

Solution

1. Kill the go.mod files, rolling back to GOPATH.

This would push them back to not being managed by Go modules (instead of incorrectly using Go modules).
Ensure compatibility for downstream module-aware projects and module-unaware projects projects

2. Fix module path to strictly follow SIV rules.

Patch the go.mod file to declare the module path as github.com/zerodhatech/gokiteconnect/v3 as per the specs. And adjust all internal imports.
The downstream projects might be negatively affected in their building if they are module-unaware (Go versions older than 1.9.7 and 1.10.3; Or use third-party dependency management tools, such as: Dep, glide,govendor…).

If you don't want to break the above repos. This method can provides better backwards-compatibility.
Release a v2 or higher module through the major subdirectory strategy: Create a new v3 subdirectory (github.com/zerodhatech/gokiteconnect/v3) and place a new go.mod file in that subdirectory. The module path must end with /v3. Copy or move the code into the v3 subdirectory. Update import statements within the module to also use /v3 (import "github.com/zerodhatech/gokiteconnect/v3/…"). Tag the release with v3.x.y.

3. Suggest your downstream module users to use hash instead of a version tag.

If the standard rule of go modules conflicts with your development mode. Or not intended to be used as a library and does not make any guarantees about the API. So you can’t comply with the specification of "Releasing Modules for v2 or higher" available in the Modules documentation.
Regardless, since it's against one of the design choices of Go, it'll be a bit of a hack. Instead of go get github.com/zerodhatech/gokiteconnect@version-tag, module users need to use this following way to get the zerodhatech/gokiteconnect:
(1) Search for the tag you want (in browser)
(2) Get the commit hash for the tag you want
(3) Run go get github.com/zerodhatech/gokiteconnect@commit-hash
(4) Edit the go.mod file to put a comment about which version you actually used
This will make it difficult for module users to get and upgrade zerodhatech/gokiteconnect.

[*] You can see who will be affected here: [6 module users, e.g., sp98/mm-analyser, sivamgr/mercury, mridul-sahu/zerodha-trading]
https://github.com/search?q=zerodhatech%2Fgokiteconnect+filename%3Ago.mod&type=Code

Summary

You can make a choice to fix DM issues by balancing your own development schedules/mode against the affects on the downstream projects.

For this issue, Solution 2 can maximize your benefits and with minimal impacts to your downstream projects the ecosystem.

References

uanble to install with go get

I'm using latest go version 1.22.2

while installing with
go get github.com/zerodha/gokiteconnect/v4
getting the below error

'go get' is no longer supported outside a module.
To build and install a command, use 'go install' with a version,
like 'go install example.com/cmd@latest'
For more information, see https://golang.org/doc/go-get-install-deprecation
or run 'go help get' or 'go help install'.

with
go install -v github.com/zerodha/gokiteconnect/v4@latest

it give below error

go: downloading github.com/zerodha/gokiteconnect/v4 v4.3.2
go: downloading github.com/gocarina/gocsv v0.0.0-20180809181117-b8c38cb1ba36
go: downloading github.com/google/go-querystring v1.0.0
package github.com/zerodha/gokiteconnect/v4 is not a main package

with go install -x github.com/zerodha/gokiteconnect/v4@latest

get https://proxy.golang.org/github.com/@v/list
get https://proxy.golang.org/github.com/zerodha/gokiteconnect/v4/@v/list
get https://proxy.golang.org/github.com/zerodha/gokiteconnect/@v/list
get https://proxy.golang.org/github.com/zerodha/@v/list
get https://proxy.golang.org/github.com/@v/list: 404 Not Found (0.028s)
get https://proxy.golang.org/github.com/zerodha/gokiteconnect/@v/list: 404 Not Found (0.036s)
get https://proxy.golang.org/github.com/zerodha/gokiteconnect/v4/@v/list: 200 OK (0.037s)
get https://proxy.golang.org/github.com/zerodha/@v/list: 404 Not Found (0.037s)
package github.com/zerodha/gokiteconnect/v4 is not a main package

Suggestion : Ticker.Serve() could return something

Right now Ticker.Serve() doesn't seem to catch any signals/errors and doesn't return anything. We could enhance it to return an error. Maybe something similar along the lines of func (srv *Server) ListenAndServe() error

Even if we don't return any errors right now, it maybe nice to well define the signature and keep it open ended for the future?

Go get error

I am getting this error when trying to install. Please HELP !

go get: github.com/zerodha/gokiteconnect/v3@none updating to
	github.com/zerodha/gokiteconnect/[email protected]: parsing go.mod:
	module declares its path as: github.com/zerodhatech/gokiteconnect/v3
	        but was required as: github.com/zerodha/gokiteconnect/v3

OS: MacOS Big Sur (Version 11.4)
go version: go1.16.4 darwin/amd64

Tried:

go clean -modcache
go mod edit -replace github.com/zerodhatech/gokiteconnect/v3=github.com/zerodha/gokiteconnect/v3

Making common struct for Ticker and Connect

A lot of data is common yet they are separated like two island

  1. Connect has its own market depth buried in a struct and Ticker has its own independent.
  2. [5]DepthItem for ticker VS DepthItem for connect
  3. InstrumentToken is mentioned as uint32 in ticker and int in connect

Unknown time format error for parsing order via websocket

Convert Order object received via WebSocket to json and then convert again to Order object. It is throwing error as unknown time format

The use case is WebSocket is running in a separate executable and order socket notifications are processed in a separate executable. Both communicate using unix socket.

Datasocket Data race

hey, the go compiler is throwing following data race warning:
WARNING: DATA RACE
Read at 0x00c001f720f8 by goroutine 49:
github.com/zerodha/gokiteconnect/v4/ticker.(*Ticker).checkConnection()
/home/piyush/go/pkg/mod/github.com/zerodha/gokiteconnect/[email protected]/ticker/ticker.go:404 +0xf8
github.com/zerodha/gokiteconnect/v4/ticker.(*Ticker).ServeWithContext.func3()
/home/piyush/go/pkg/mod/github.com/zerodha/gokiteconnect/[email protected]/ticker/ticker.go:328 +0x64

Previous write at 0x00c001f720f8 by goroutine 48:
github.com/zerodha/gokiteconnect/v4/ticker.(*Ticker).readMessage()
/home/piyush/go/pkg/mod/github.com/zerodha/gokiteconnect/[email protected]/ticker/ticker.go:434 +0x168
github.com/zerodha/gokiteconnect/v4/ticker.(*Ticker).ServeWithContext.func2()
/home/piyush/go/pkg/mod/github.com/zerodha/gokiteconnect/[email protected]/ticker/ticker.go:323 +0x64

  1. in readMessage function there is a property being set lastPingTime in object *Ticker
  2. in checkConnection function the same property is being read from object *Ticker
  3. both the above functions run in goroutines and there is no memory syncronization to prevent data race
    @rhnvrm

Add support for new ticker mode. QuoteWithTopOffer

Ticker-Quote Mode is without Marketdepth and takes 64 bytes on wire
Ticker-Full Mode is with Marketdepth and takes 184 bytes on wire

Please add support for new ticker mode. QuoteWithTopOffer. In this mode, rather than 5 levels of depth, 1 level of depth shall be provided.

Ticker-QuoteWithTopOffer shall provide Best Bid, Besk Ask along with the Quote data. This only needs 20-24 bytes inaddition to Quote mode. 84 bytes(with no padding) - 88 bytes (with padding)

With this feature available for usecases needing only the top bid/asks, application need not to choose subscribing full-depths and help with reducing the network-streaming traffic by 50%

Allow specifying product type for NFO GTT orders

When creating a GTT (Good Till Triggered) order using the gokiteconnect library, the product type is assigned as CNC by default. However, in certain cases like trading in derivative instruments (e.g., NFO - Nifty Futures & Options), CNC product type is not allowed, and the order placement fails with the error message:

GTT for NIFTY2450222500CE was triggered: Order placement failed (Trading in NFO is not allowed using CNC product type). Try placing an order in NRML/MIS.

Proposed Solution:
Add a parameter for specifying the product type when creating a GTT order. If this parameter is left empty or not provided, the default product type can remain as CNC.

Example Usage:

gttParams := kiteconnect.GTTParams{
    // Other parameters...
    Product: "NRML", // or "MIS" for NFO
}

Additional Information:

  • Library version: v4.3.2

Websocket: bad handshake

I've used example code provided in your SDK and replaced api_key & access_key with proper credentials. Nodejs SDK is working as expected.
I'm getting this error -

Error:  websocket: bad handshake
Reconnect attempt 1 in 2.000000s
Error:  websocket: bad handshake
Reconnect attempt 2 in 4.000000s
Error:  websocket: bad handshake
Reconnect attempt 3 in 8.000000s
Error:  websocket: bad handshake
Reconnect attempt 4 in 16.000000s
Error:  websocket: bad handshake
Reconnect attempt 5 in 32.000000s
Error:  websocket: bad handshake
Reconnect attempt 6 in 60.000000s
Error:  websocket: bad handshake
Reconnect attempt 7 in 60.000000s
Error:  websocket: bad handshake
Reconnect attempt 8 in 60.000000s
Error:  websocket: bad handshake
Reconnect attempt 9 in 60.000000s
Error:  dial tcp: lookup ws.kite.trade: no such host

Go-Get-Error For V4

sahil@5511:~$ go get github.com/zerodha/gokiteconnect/v4
cannot find package "github.com/zerodha/gokiteconnect/v4" in any of:
	/usr/local/go/src/github.com/zerodha/gokiteconnect/v4 (from $GOROOT)
	/home/sahil/go/src/github.com/zerodha/gokiteconnect/v4 (from $GOPATH)

Kindly please guide me through this problem, same issue faced on Linux and Windows both.

Thanks in advance!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.