@SRIJAN I am planning to do few computations and even place order inside on_ticks, is there any way around that to avoid mentioned problem? P.S. assume ideal network connection
@SRIJAN@vijoeyz Appreciate your responses, helped me a lot. I looked up about threading, and it's very fascinating, although I do have one query:
Ques: even if I use a different thread to perform calculations (and possibly place order), (refer this), won't I face disconnections as SRIJAN mentioned
"websocket will close connection" when I perform time taking calculations in some helper function getting called from on_ticks() in a different thread?
what I'm trying to ask is, in below attached code (by @rakeshr ), will helper_method gets called asynchronously? or are we still open to websocket disconnections if helper method takes more time to execute than time between ticks? while True: #Perform required data operation using tick data def on_ticks(ws, ticks): .......... helper_method(ticks) .........
def helper_method(ticks): ......... Perform computation here ........ #Assign callback kws.on_ticks=on_ticks
*ignore indentation errors*
I understand you are not obligated to help, but any hints are appreciated.
P.S. assume ideal network connection
https://kite.trade/forum/discussion/8019/faqs-on-pykiteconnect-specific-to-python-client#latest
I looked up about threading, and it's very fascinating, although I do have one query:
Ques: even if I use a different thread to perform calculations (and possibly place order), (refer this), won't I face disconnections as SRIJAN mentioned what I'm trying to ask is, in below attached code (by @rakeshr ), will helper_method gets called asynchronously? or are we still open to websocket disconnections if helper method takes more time to execute than time between ticks?
while True:
#Perform required data operation using tick data
def on_ticks(ws, ticks):
..........
helper_method(ticks)
.........
def helper_method(ticks):
.........
Perform computation here
........
#Assign callback
kws.on_ticks=on_ticks
*ignore indentation errors*
I understand you are not obligated to help, but any hints are appreciated.
Multithreading methods are asynchronous.
Although in Python, multi-threading is not truly multi, because of the Global Interpreter Lock, but the threaded mode does help.