Essentially my bot is checking through all nifty 500 stocks every 5 mins. Now basic stuff like stock name and all is hardcoded. Here's what is happening: For every stock it calls for data > Checks for minimum easiest condition > if true checks for all conditions > if matches places order. Else > if false > moves onto next stock.
Now what is happening is by the time it reaches let's say 400th stock, 1 min has passed and thus if I get signal, I have lost one min of movement. and this creates some weird discrepancies.
What am I missing here? Or how can I make it faster?
but since you are using python, and i assume you use websocket to get data, launch threads? but still in python it might get heavy. so in that case i would space the checks per stock 1 second apart. meaning check each stock one second apart. so you aren't hitting all 400 and the end of 5 min, but checking a stock every 5 minutes, but continuously checking.
in that case you wont need to use websocket. you can use getQuote(stock), check condition, do next stock. 60 seconds in 5 min is 300 loops, so you can do 2-3 stocks at a time hope i was able to explain my thoughts.
but since you are using python, and i assume you use websocket to get data, launch threads? but still in python it might get heavy. so in that case i would space the checks per stock 1 second apart. meaning check each stock one second apart. so you aren't hitting all 400 and the end of 5 min, but checking a stock every 5 minutes, but continuously checking.
in that case you wont need to use websocket. you can use getQuote(stock), check condition, do next stock. 60 seconds in 5 min is 300 loops, so you can do 2-3 stocks at a time
hope i was able to explain my thoughts.