@rakeshr just to understand the reason behind this
1) was the symbol (token = 85761 ) not trading at that time ?
2) or there are data gaps in the historical data API ?
Thansk @rakeshr . There is one more problem I am facing with historical data api. Below call (for symbol 'BALKRISIND') yields OHLC as 0. Could you please see if there is some issue with your historical data database entries.
kite.historical_data(in…
@sujith @zartimus
Request your urgent attention on the above item. Historical API is not reliable at all. It is actually returning data for symbols/companies which were not even listed (not even in existence) at the time of specified query dates. C…
Thanks @sujith for the explanation.
I was also debugging at my end. The same code code was working absolutely fine in the afternoon when I tried to stream NSE stocks/equities OR NSE indices OR NFO futures on stocks.
Error started coming when I tr…
Yes. I am running 3 threads in parallel and there several disconnections/connections happening very frequently (about every ~10 seconds) with below error:
Connection closed: 1006 - connection was closed uncleanly
But I am assuming reconnections sho…
Thanks @sujith
Please see if it makes sense to change the response parsing to send back the timestamp as:
1) Current Day + 8:59:59 OR
2) Last Day + 3:40:00 OR
3) datetime.datetime.now()
Reason being, these tick data represent useful values at the…
Thanks @zartimus for the detailed response again - always helpful.
For the time being, I will ignore this error message (or put an try, exception) since we are getting correct ticks post reconnection as well.
Please do inform once you have checked …
@zartimus
You can reproduce this error on the code provided by you in the following manner:
1) run the code as pasted by you above
2) after it has spawned all 3 threads, disconnect the internet
3) connect the internet again and you will face the e…
Thanks much @zartimus
while i will be able to test this tomorrow when the markets are open, I did a quick experiment and changed the piece of code to show current thread's name as well.
def on_ticks1(ws, ticks):
logging.debug ("ticker 1: {}".f…
@rakeshr
Based on your response, i tried figuring out the websocket connections and current thread by running the below mentioned "on_ticks" function. Looks like what you mentioned was correct. While the 3 different websockets are being created an…
@sujith
Thanks for the quick revert. From your response, it looks like we can subscribe for Max 9000 instruments.
I am getting the error even when I am subscribing for ~7700 instruments (2800 + 2800 + 2100). I am getting the below error:
"Can't s…
@rakeshr
To recreate the issue, you can run the standard sample code provided on https://github.com/zerodhatech/pykiteconnect with ws.connect(threaded=True) (also provided below).
1) open a shell terminal on ubuntu 16 (with latest Anaconda insta…
@sujith
I am using python websocket client and I am also facing the same issue. Attaching today's data and instrument tokens . This happens definitely in the morning from 9:00 onwards. And probably later as well. Is this issue resolved.
timestam…
Thanks @sujith for a quick response. I agree that these come under capital market segment. But was wondering if it makes sense for you to parse and segregate it so that Zerodha's clients can directly grab all equity/stock instruments by filtering.
…
@zartimus : after installing the .whl file also, it is giving the same error. Can you please see if this is working for you. Below is my system set-up.
conda version : 4.5.11
conda-build version : 3.15.1
python version : 3.7.0.final.0
platform : win…
@sujith @zartimus : any update on this. I am facing the exact same issue. Following are the details of my environment:
conda version : 4.5.11
conda-build version : 3.15.1
python version : 3.7.0.final.0
base environment : C:\Users\hnazk\Anaconda3 (…
@Shaha Thanks for info. Just wanted to understand if you are using pandas/numpy or native python datastructure like dict/list only.
Also, looks like you are creating candles on the go and not by first saving it to some database and then using a par…
@tonystark I understand that. But It should be asking for login permissions or authentication first and then once I provide authorization, it should take me to these pop-ups.
I have never once faced any situations where no authorization/authenticat…
@sauravkedia Thanks for detailed information. Also, just wanted to check as to why you chose qstrader (from quantstart) over zipline, pyalgotrader, bt or other backtesting engines. Any specific advantages that you highlight will be really helpful.
@sujith Any update on this ? and any timeline by which this will be resolved ?
Thanks for info on timestamp field. I noticed that before 9:07 and after 9:15, timestamps are correct - this should be ok.
@MAG :
Thanks for sharing the information. It is really helpful. Can you please also share the number of instrument_tokens(symbols) you are working with so that we can have a sense of this realtime performance with regards to the number of symbols…
Thanks @sujith
I specifically want to know reasons for below two queries for "NSE:ADANIPOWER":
1) why a wrong close value was being given in the datafeed today even after the patch deployment yesterday (actual close value of yesterday was 18.45 wh…
@sujith Also, can you please request your team to do a testing and post the stocks in which your team got discrepancies between actual close price and close price coming through feed (between 9:00 - 9:15).
I can post my findings on the same, if req…
@sujith : can you please confirm that your team did full testing before deployment and after deployment (yesterday and today) ?
Because, problem still persists even after two patches by tech team. Please do understand we are doing live trading based…
@sujith
My simple issue is - how do I know before placing a BO order for "MATRIMONY" that "BO" order is allowed for "MATRIMONY" ?
If there is no way for me to know that orders placed by me are/are not allowed by zerodha/RMS, then I am just shootin…
@sujith Following up on this thread. Just to clarify, this issue is present with a lot of NSE stocks as well till 9:15 am in the morning. As mentioned in the earlier thread, even during pre-market session (before 9:15 am), quote api's "close" value …
@sujith
I was going through some other articles and figured that the "close" price in the pre-market session of quote API is being taken as PREVCLOSE instead of CLOSE.
For example, "close" price through the quote api in today's pre-market session w…
@sujith
As suggested above, It will be really helpful to implement the above suggestion and provide full data as an API:
1) list of equities with MIS (margin > 1x)
2) list of equities with MIS (margin = 1x)
3) list of equities blocked for MIS tr…
I agree with the data structure and content and that is what I want.
I am facing following issues - once I start the quote api at 9:00:00 am and do the polling after every few seconds/minutes:
1) I am not getting any data with 'timestamp' field bet…
@sujith
I was trying to get live pre-market data (9:00 - 9:07) by using quote api - kite.quote("NSE:XXXX"). Is there a reason why this doesn't work while it works with websockets.
I only needed the live market data every 1 minute so thought of pol…
Thanks @sujith . Also, just to confirm, this means the documentation is not updated for this API (please check "Response attributes" section of https://kite.trade/docs/connect/v3/market-quotes/). Because this section specifies both 'change_percent' …
Correct. But it didn't upgrade the current kiteconnect 3.6.2 to kiteconnect 3.7 when i did a "pip show kiteconnect" (I am assuming that it should show version as 3.7.x post correct migration/upgradataion - correct me here).
Following is what appar…
@zartimus
I am using anaconda (64 bit) python 3.6.3 on Windows for sometime and cPython has been running smoothly (since I have been using numpy, pandas etc.) so I am guessing Microsoft Visual C+ 14 compiler version shouldn't be an issue. The break…
So, day candle's "open" is the price at which pre-market session trade happen ? And 9:15 minute candle's "open" is the first trade which happen at 9:15:00 am as soon as the market session starts ?
Please let me know if this is the correct understan…
Hi Sujith,
This is for NIFTY 50 minute wise data for 23-June-2015. You can use below request to reproduce.
tick = kite.historical(instrument_token=256265, from_date="2015-6-23", to_date="2015-6-23", interval='minute').
@sujith
ok. This is helpful to know. Also, while I tried using minute-wise historical data for 'SENSEX' (instrument_token and trading symbol mentioned below), it returned empty object. Can you please help and see if it is workign for you.
instrume…
Thanks Sujith, for the prompt reply. I was wrongly putting api_key and access_token inside a single quote which was not required (as you suggested). Now it is working.
This can be closed.
Hi @sujith ,
it is not working. I logged out from kite connect apis, kite web etc. And then I am using below standard command (given in example)
response = requests.get("https://api.kite.trade/instruments/historical/5633/minute?from=2015-12-28&…
I can't change "01/04/2017" to any other field.
For example, I can't figure out what is my profit from 1-Oct-2017 (01/10/2017) till date. I am not sure how other people doing algo trading are able to measure their performance when the reporting on …
@sujith I agree on the long CNC position.
My doubt is whether I can place a stop_loss (CNC) as well immediately after taking the long CNC position on the stocks mentioned by you in the list?
Example below:
1) I purchase "XYZ" at Rs. 100 (CNC produ…
@sujith
Just to double confirm - After taking a long CNC position today I can immediately place a stop-loss (market) sell order (CNC) today. And if the price hits the trigger price, my long position (CNC) will get squared off. Is that the understan…
Hi @sujith ,
I will send the mail to RMS as well and have initiated a separate topic on this as well since I believe this is critical for many other fellow board members and they should be aware of this before hand (lest this will result in losses d…
Hi @sujith
I am assuming that you are referring to this list : https://docs.google.com/spreadsheets/d/1-T6RlEE8Gn2fioep_Cmdx9ECRX_WpQbfJJfsU8PdOV8/edit#gid=0
There are 750 stocks in the above list which is half of the NSE stocks universe. So pract…
@sujith @Kailash @vivek :
(CCing Kailash and Vivek as well to bring their attention to this since I believe this is really critical)
I agree that XT series are always T2T segment scrips only. My concern is "How do I get to know whether a scrip is X…
@sujith:
Thanks. It kind of defeats the whole purpose of trading in stocks if we can't sell stocks for three days after purchase.
Is there a work-around in the meanwhile - e.g. are you aware of any external source from where we can get this data …
Hi @sujith :
Group (XT) is not mentioned in the "instruments" csv file that we get by "https://api.kite.trade/instruments?api_key=xxxxxxxxxxxx".
How do we know before placing a buy order that a stock belongs to XT group (hence Trade to Trade segmen…
Hi @sujith ,
I understand that intraday trades are not allowed in T2T segments. But with other brokerages, I have done trades where I have purchased shares today and sold tomorrow/day-after. Is it zerodha specific issue - as in, why zerodha's RMS is…
In my case, this error came when there were duplicate entries on one of the axes of pandas (duplicate instrument token etc.) and I was trying to use df.fillna( ) or was trying to change the dimension of the object.
Removing the duplicate index/colum…
In case, any other community member is also facing frequent disconnection issue, it might be good to check if you are doing heavy data processing/saving work inside on_tick() function. In my case, frequent disconnection was happening because heavy d…
@vivek @sujith : am using the beta version now (and running 3 websockets)
Following is the issue - first disconnection gets reconnected successfully. On second disconnection, no reconnection is made.
Can you please check the code and see if all th…
@prakash.jj : figured out a quick fix - setup.py was not building/setting up the new files in python packages hence there was an error.
I copied "__init_.py" and "exceptions.py" from the beta version package folder "C:\Users\xxxxx\Desktop\pykitecon…
@vivek @sujith : same issue. can you please use it at your end first and let us know.
AttributeError: 'WebSocket' object has no attribute 'enable_reconnect'
Issue seems to be as below:
setup.py in the beta version doesn't seem to be configured p…
@vivek Thanks a tonne.
1) Should we just do a "pip install pykiteconnect" for this upgrade ? Or we need to clone/download it?
2) where should we put the line "kws.enable_reconnect(reconnect_interval=5, reconnect_tries=50)" in our code - just befor…
@ramatius
ok. But then How are you using all the realtime data into one single program - are you storing all the data from different scripts to some database (e.g. csv files ) on harddisk and then reading the database (e.g. .csv) back into your p…
@ramatius : let me try this (I have been using full mode so far - so this may very well be the issue). Also, i am using multiple websockets by passing threaded=True in the ws.connect() method (basically inbuilt multi-threading of python websocket cl…
@sujith : is there a temporary solution. I just feel it is a quite a waste of time to restart the whole program manually whenever disconnection happens (which is happening quite frequently for a lot of us on python client).
I tried looking at the d…
@sujith @Kailash : I would agree with @ankur0101 on this. Also, since kite API is based on Python, at least python websocket client should have been a stable one and should have been the first one for new stable features like reconnect (based on tic…
@ramatius this is useful but I am facing a peculiar problem - while using multiple websocket connections (in python client), two of the websocket connections automatically die down after 15-20 min and the first websocket connection keeps on running.…
@sujith : Hi Sujith,
1) did you get a chance to look at the error.
2) Also, didn't see any update on python client reconnect feature over the weekend. Any update on the same.
@arnavsaxena : were you able to figure out a solution to this issue. Also, just to confirm, are you facing these errors while using multiple websocket clients (or single websocket client)?
I am facing this error while using multiple websocket clie…
@sujith : I took a log of error while 2 of the 3 websockets dying down automatically. Below is the error signal which seems to indicate that server is closing future connections if there is already one connection in place. First websocket is still r…
@sujith
I am subscribing for some scrips of BSE on one socket and some scrips of NSE on another socket. But for BSE scrips also, most of the time market depth data comes correctly. It is only intermittently that I am facing this issue.
@sujith :
yes, this issue is intermittent and comes randomly in between for some of the stocks. And that's the reason I believe running the above code (for two stocks) might not reproduce the error. Will take a complete log and revert on this.
@sujith :
1) as you can see in the above dump, it is showing mode as "quote" (in python client this is an error where "full" mode is also shown as "quote" mode in the received tick data). Please check below link where I reported it earlier:
https:/…
@sujith
below is the dump of tick data (i included the current timestamp in my program at my end). Can share multiple files like this where you can see depth data as empty lists of buy and sell (let me know if required).
Also, if there are 0 buy/…
@sujith Can you please share as to how many symbols/stocks did you take with each of the 3 websockets while testing. Can you please test with 200 symbols/stocks per socket and 3 sockets.
In my case, websockets closing down is a frequent thing so I …
@sujith :
Hi sujith,
Any update on this as I could actually see market depth data on kite.zerodha.com but market depth coming on websocket was empty lists of 'buy' and 'sell'.
@sujith while connecting three websocket connections, two out of three connections die -off after first 15-30 min and one remains alive. Is it the intended behavior ??
Hi @sujith ,
will it be possible to include a standard python code snippet for the reconnection using monitoring of lastTickArrived. I am also facing frequent disconnections and have been using ws.reconnect (on callback of on_close). I guess this wi…