[X] I have searched the existing issues to ensure there isn't already an issue about this question.
[X] My question has to do with the Python SDK and isn't a general question about the API. (If it is please open your issue here)
[X] My question isn't about how to do a specific algorithm or asking for trade advice (answers to these are outside the scope of this repo).
Question
Hello,
I am new to the Alpaca API, thank you for making this resource available.
I have started with the examples in the documentation (ReadMe.md). I had no issues with the REST API to retrieve historical data. However, I can't run the example under Live Stream Market Data. Everything seems fine until I get to the command:
stream.run()
When I execute it, I get the error:
Traceback (most recent call last):
Input In [12] in <cell line: 1>
stream.run()
File ~/opt/anaconda3/envs/trade/lib/python3.8/site-packages/alpaca_trade_api/stream.py:1005 in run
asyncio.run(self._run_forever())
File ~/opt/anaconda3/envs/trade/lib/python3.8/asyncio/runners.py:33 in run
raise RuntimeError(
RuntimeError: asyncio.run() cannot be called from a running event loop
In case anyone encounters this problem, the issue I had was due to incompatibility between asyncio and my IDK (spyder). I switched to pycharm, seems to work fine
Question form pre-submit checklist.
Question
Hello,
I am new to the Alpaca API, thank you for making this resource available.
I have started with the examples in the documentation (ReadMe.md). I had no issues with the REST API to retrieve historical data. However, I can't run the example under Live Stream Market Data. Everything seems fine until I get to the command:
stream.run()
When I execute it, I get the error:
Traceback (most recent call last): Input In [12] in <cell line: 1> stream.run()
File ~/opt/anaconda3/envs/trade/lib/python3.8/site-packages/alpaca_trade_api/stream.py:1005 in run asyncio.run(self._run_forever())
File ~/opt/anaconda3/envs/trade/lib/python3.8/asyncio/runners.py:33 in run raise RuntimeError( RuntimeError: asyncio.run() cannot be called from a running event loop
Any guidance is much appreciated Thanks!