Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

asyncio.run() RuntimeError following ReadMe example #636

Open
3 tasks done
PBbanana opened this issue Jul 5, 2022 · 1 comment
Open
3 tasks done

asyncio.run() RuntimeError following ReadMe example #636

PBbanana opened this issue Jul 5, 2022 · 1 comment

Comments

@PBbanana
Copy link

PBbanana commented Jul 5, 2022

Question form pre-submit checklist.

  • I have searched the existing issues to ensure there isn't already an issue about this question.
  • 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)
  • 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

Any guidance is much appreciated
Thanks!

@PBbanana
Copy link
Author

PBbanana commented Jul 8, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant