How to keep pulling quote forever? Details on how the streamer works? #72
-
Hi, I am starting to get a little the hang of the code except for the async part which I am still learning how to use. I am able to run the example code but I can't get the main_loop to keep looping, retrieving quotes forever. I have this block of code to get the quotes:
I thought this would just keep looping, pulling the quotes until stopped but it seems to run once and then just sits there. I am probably forgetting to tell the loop to keep requesting the data. Any pointers of examples of looping with async and on how the streamer works in more details? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Here are a couple of things I found it that helps someone else.
This will not run properly during off hours it seems. When market is closed, this will return the requested values once and then will just wait but not get any new values. It will work properly (meaning keep pulling data) during market hours. Here is an example that I made inside the
|
Beta Was this translation helpful? Give feedback.
Here are a couple of things I found it that helps someone else.
async for item in streamer.listen():
This will not run properly during off hours it seems. When market is closed, this will return the requested values once and then will just wait but not get any new values. It will work properly (meaning keep pulling data) during market hours.
Here is an example that I made inside the
main_loop()
that allows to keep pulling data during off hours and store the data in a pandas data frame. You will need to install pandas and import. Not sure if this is clean but it works. It also works during normal hours.