I am getting this exception:
KiteConnect.order_margins() got an unexpected keyword argument 'exchange'
this is server-side code
@socketio.on('send_required_margin')
def send_required_margin(data):
print(data)
try:
margin_data = kit…
if exchange is using expired instrument tokens, how do we get reliable historical data of oi for an instrument token? how to ensure that the historical data is not for expired token?
I reframe the question: what happens to websocket connection when the access token expires? and when does access token expires? Does the expiry of access token has no effect on websocket?
what happens to the websocket connection when the token expires due to the change of date? will it restart working if I update the access_token through another function?
oh okay. so the only solution left is to use multiprocessing. create a process for websocket. use it. close it when I want. and restart it. sounds plausible?
Thanks Rakeshr, I get this much now. Facing new challenge now.
Even if I use close() function like kws.close() and later recall the function that creates the websocket and run the thread, it fails to create the websocket. How do I close and resta…
I see only log error messages, but no exception. I guess exception is raised only when there are more serious issues in network. Had there been an exception, I would have caught it and run some code.
so you mean to say that no exception will be generated and I should let the auto-reconnect feature take care of the situation? should I handle the error log by adding filter to the logger?
here is the complete code:
from kiteconnect import KiteConnect
from kiteconnect import KiteTicker
import time
import logging
logging.basicConfig(format='%(asctime)s - %(name)s - %(threadName)s - %(levelname)s - %(message)s',
lev…
I was assigning the callbacks inside a thread. That was the problem. I was working on a telegram bot and I created a command which creates a thread in which I was assigning the callbacks. That made connection very weak (for unknown reasons). As solu…
Thanks Srijan. the first link suggest that stop() should be used in on_close(). What are the affects if I use it outside on_close() ?? How does it really differ from close()
I am facing the same issue. here is the error:
2022-09-03 06:44:19,277 - kiteconnect.ticker - Thread-1 (run) - ERROR - Connection closed: 1006 - connection was closed uncleanly (WebSocket opening handshake timeout (peer did not finish the opening ha…
just commenting out 'ws.stop()' is enough? anything else to write for reconnection? Is this good enough?
def on_close(ws, code, reason):
logging.info('##################### KITE TICKER on_close function called #####################')
# On c…
Hi Srijan, this is different error, despite using try-except in while loop. This error triggered on_close function. My on_close function is:
def on_close(ws, code, reason):
logging.info('##################### KITE TICKER CONNECTION CLOSED #####…
Thanks Srijan. If I write code like this and the timed out exception occurs, will it invalidate the ticker object? or will it continue? thanks in advance
def on_ticks(ws, ticks):
global my_ticks
my_ticks.extend(ticks)
kws.on_ticks = on_ti…
Thanks Srijan
"The positions API returns two sets of positions, net and day. net is the actual, current net position portfolio, while day is a snapshot of the buying and selling activity for that particular day. This is useful for computing intrada…
@sujith thats what I am doing. using holdings() once to get the holdings and then calling quote() on each holding to get the last traded price. this is what has slowed down the application by about 2 seconds.
@sujith following your suggestion slowed the script. after a single holdings() call, I have to call quote API for each stock in holding.
Any particular reason, why kite is not sending latest price data in holdings API? Can you take it to zerodha a…
by using time delay, I can synchronize more than 3 sessions in a manner that at any time only 3 sessions query kite api. right? Is it possible? worth trying?
does the limitation of 3 sessions per api account includes the web/mobile kite access too? Can I have web access, mobile access and 3 pythons scripts using API running at the same time?