Also in the example websocket script, where do we write the I/O, file reading/writing codes? If you could please indicate in the example scripts: "##Write your calculations/strategies etc here:"
For me, I would like to write streaming data in a file…
I got multiple disconnection of my websocket and it tried to reconnect every single time... (well that is not good but still it works). One time at 12:06 it stopped, reconnected and no ticks came untill I noticed around 12:19 and when I manually res…
@Kailash I hope we get more data in websockets. That will be awesome and save us from calling a lot of requests from time to time. BTW in case you guys change the syntax of api (I am using pykiteconnect), please release the documentation too. That w…
Ahhh perfect.. Thanks.. I changed it accordingly. Should I write in my code assign on_data callback-
kws.on_message = on_message
instead of
kws.on_data = on_data ?
Thanks for the guidance... Accordingly, I added the line "self.on_data = None" but it just behaves like a tick.. Only when there is a tick, I get a response. Do I need to add any line in the following?
def _on_data(self, ws, data, resp_type, data_…
I can do that. But I was wondering what does "on_message" do then? Doesn’t it show us that the connection is active if it spits out something all the time? The moment it stops then it means that the heartbeat stops? Am I wrong? Because I do not want…
"These are the threads before reconnection was implemented. Now we have implemented reconnection, you don't have to check for ticks for 5 seconds Python Kite Connect is already doing it for you."
Sure the reconnection works well but after reconnecti…
I think reading all your comments on other threads, I need to get the heartbeat in pykiteconnect and see if I do not get heartbeat let's say after 5 seconds, I will restart the connection automatically. Now if you could please help me with the pytho…
I think it is the same problem. The code is just normal example code.
https://kite.trade/forum/discussion/1364/websocket-stops-streaming-frequently-is-there-a-way-to-catch-an-exception
or this-
https://kite.trade/forum/discussion/927/issue-with-web…
Well yes definitely not every tick but since I am trading more than 20 stocks, I need to fetch margin kind of every 5 seconds on an average. So that is a problem.. If we get margin data on tick data, that will be great. I cannot think of an alternat…
last traded time is not the part of websocket respnse. What we do is a workaround. We follow volume change. Only a change in volume means that trade happened. Hope that helps. You can implement a timestamp at your end.
Thanks @vivek . As getting the order book is crucial in trading (you always need to modify, cancel or exit positions), gateway timeout errors are a big hindrance. You cant lose money if you cant enter a trade but if you cant exit, you can incur loss…
Thanks @vivek , just a thought:
When we send the call-
kite.orders(order_id='xxxxx')
it simply gives us all the information about that order right from placing the order to "validation pending" to "complete" or "rejected". These are recorded as a l…
Hi @sabyasm , I also do that but then also I get the getway timeout. I actually need to have the child order ids of my executed Bracket orders. For that, I compulsorily need to call the orderbook and then I look for child order IDs with the same par…
@vivek When placing a squareof absolute value of 0.55, the error "Sqr Off Absolute should be multiple of tick size " pops up. Please look into it. Its harming trading
OK so in case 2, when I just have the parent order id, I write-
kite.order_cancel(order_id='None', variety='bo', parent_order_id='xxxx')
will that work?
@vivek case 2- You said that I need to know the parent order id only. But then in the code-
kite.order_cancel(order_id='pppp', variety='bo', parent_order_id='xxxx')
you suggest that I put 'pppp' in order_id but I don't know the child order id. In th…
I have also seen that when you stream more scrips then many scrips are just ignored and are streamed with a big delay. So many trades would have happened by then. So I dont know how reliable is it to stream so many scrips using one websocket connect…
@Kailash @vivek @nithin Even today I am getting "Gateway timed out" on seeking multiple order status in succession. Is anyone listening? Please look into it.
Hi @sabyasm I also faced it today. The same problem. Well I am sending many requests to get the order statuses of my trades in quick succession. Can you please let us know if you were able to solve the problem. The whole community would be informed …
@vivek It has happened in all tokens. The script was running fine before. But I ran the same script today after a week and this happened. I will send you the script later. Thanks
yes, I will send you later today in your inbox? A mail id would be perfect then I can attach my python script as well. It will be better if you try my script during market hours.
Thanks
Hi @Kailash and @vivek , today I tested different scrip numbers (from 20 to 150).
----------------------------------------------------------------------------------------------------------------------
My implementation is-
def on_tick(tick, ws):
..…
There is also a problem with python websocket if you subscribe more than 20 symbols and write their output in separate files, the memory usage exceeds 100% afte 15 minutes and then automatically Linux stops the python script. Python uses only one co…
Well, isnt the latest traded volume the current volume and the previous "latest traded volume", the Previous Volume? Are they not the same things? Correct me from wrong
Hi @sameer I think user @maravinthkumar has given a brilliant answer to it. You can simply use timestamp at your end along with @maravinthkumar's approach to filter your actual LTP against non-traded LTPs.
@Kailash Is it not the OHLC of the entire day right till the current time? i.e. OHLC right from the starting time till the time we requested the webstreaming? I presume the ohlc in the webstreaming cannot be used for charting 1 min candlestick since…
UPDATE: I installed wireshark and when I use "ws", it shows me stream of websocket protocols with packet sizes. However when I use "wss", nothing comes in the wireshark.
I can connect to other "wss" sites and get a response from them. But only wss…
@vivek @Kailash SO after a lot of googling and trying out things, I figured out the problem- Connections to "wss" are rejected whereas if I change the "root" in init.py to _root = "ws://websocket.kite.trade/", live streaming starts immediately.
I d…
Alright let me see what I can do. But given my code, I should get the data right?
There is no "print" command in my script. But WebSocket should stream the data just after the command "kws.connect()". Please let me know if thats correct.
I will se…
Hi Vivek,
Thanks for the code. I ran it after putting the right values of api_key, public_token,user_id, access_token but the problem still exists.
The terminal just comes back without streaming any data or showing any errors.
There is no log out…
I am checking it now. It just doesnt give any outputs. May I know wha params did you change? If you could kindly give me a pice of working code, I can just test it on my Linux terminal.
My Linux terminal just returns back just after I run the abov…
@Kailash the default instructions on the python client documentation doesnt work. If someone simply executes what is written in the "Getting Started" section of WebSocket, it just doesnt stream data.
Am I missing something? I want to have a live s…
Hi Kailash,
I read the link that you mentioned.
I am quite new to HTTP REST etc. I code in python but only limitedly. I use selenium for using Mozilla firefox. It will be much better if you kindly guide me for what actually I need to do. Do I need …