Closed jamesmawm closed 2 weeks ago
@jamesmawm Could you please try this?
async def run():
await asyncio.gather(
asyncio.create_task(self.stock_data_stream._run_forever()),
asyncio.create_task(self.options_data_stream._run_forever())
)
asyncio.run(run())
.run()
calls asyncio.run()
in inside. You could use ._run_forever()
instead.
But as you can see it has _
prefix in the function name, it means we have an option to change it completely at any given version of alpaca-py including the name of function _run_forever()
. So, please be aware of this.
This is perfect, thanks @hiohiohio! Absolutely, looking forward to seeing this in the official docs.
Question form pre-submit checklist.
Question
I have something like this defined:
When I try to run both:
Only the first
.run()
works. I couldn't get data from theoptions_data_stream()
. How do I stream both stock market and options at the same time?