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

ALGO.PY: Fatal Python error: Cannot recover from stack overflow. #21

Open
BlueMistTrekker opened this issue Jun 19, 2020 · 3 comments
Open

Comments

@BlueMistTrekker
Copy link

I've read through all the issues and made corrections to algo.py as needed. Now I am getting:

Fatal Python error: Cannot recover from stack overflow.
Current thread 0x00007f089df6a740 (most recent call first):
File "/usr/lib/python3.7/asyncio/base_events.py", line 480 in _check_closed
File "/usr/lib/python3.7/asyncio/base_events.py", line 560 in run_until_complete
File "/usr/local/lib/python3.7/dist-packages/alpaca_trade_api/stream2.py", line 275 in run
File "algo.py", line 422 in run_ws
File "algo.py", line 426 in run_ws
File "algo.py", line 426 in run_ws
File "algo.py", line 426 in run_ws

@sanzgiri
Copy link

@BlueMistTrekker - I am running into the same problem. Running the code during trading hours, reduced the symbol list to 10. Let me know if you find a solution. Thanks!

@kqinvestor
Copy link

@BlueMistTrekker @sanzgiri

Alpaca changed their SDK. The A.{} channel is no longer required. Please see code update below.

channels = ['trade_updates']
for symbol in symbols:
    #symbol_channels = ['A.{}'.format(symbol), 'AM.{}'.format(symbol)]
    symbol_channels = ['AM.{}'.format(symbol)]
    channels += symbol_channels
print('Watching {} symbols.'.format(len(symbols)))
run_ws(conn, channels)

References
https://forum.alpaca.markets/t/valueerror-unknown-channel-a-tsla-you-may-need-to-specify-the-right-data-stream/1424

@sanzgiri
Copy link

sanzgiri commented Jul 2, 2020

Hi @kqinvestor,

I tried making the change you suggested. But I still get the same error:

Other things I have tried:

  • Reduced the number of symbols to a very small number (6)
  • Tried data_stream settings of "polygon" as well as "alpacadatav1" for StreamConn
  • Initially was running this on a Mac, but getting same error on GCP in an environment set up described in the blog post.

The code will start "Watching xxx symbols" for several minutes, no other output and eventually I get a long stream of "Event loop is closed" messages and then the fatal python error.

Note this is all with the paper trading api.

Thanks,
Ashutosh

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

3 participants