question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

WARNING:root:code = 1009 (message too big), no reason

See original GitHub issue

I’m simply trying to stream the data of all NASDAQ aggregate minute bar data. and I’m getting the above error. @shlomikushchi would be very thankful if you can help me with this issue 😃

ERROR

3610
authorized
Entity({'action': 'authenticate', 'status': 'authorized'})
listening
Entity({'streams': ['trade_updates']})
authorized
Entity({'action': 'authenticate', 'status': 'authorized'})
WARNING:root:code = 1009 (message too big), no reason
Traceback (most recent call last):
  File "paper.py", line 34, in <module>
    conn.run(['trade_updates']+symbol_list[:700])
  File "/Users/dinesh/Desktop/muon-capital/lib/python3.8/site-packages/alpaca_trade_api/stream2.py", line 298, in run
    loop.run_until_complete(self.consume())
  File "/usr/local/opt/python@3.8/Frameworks/Python.framework/Versions/3.8/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
asyncio.exceptions.CancelledError

CODE

conn = StreamConn(key_id=KEY_ID, secret_key=SECRET_KEY, base_url=BASE_URL, data_url=DATA_URL, data_stream='alpacadatav1')
api = tradeapi.REST(key_id=KEY_ID, secret_key=SECRET_KEY, base_url=BASE_URL)
account = api.get_account()
assets = api.list_assets(status="active", asset_class="us_equity")
assets = filter(lambda a: a.exchange == "NASDAQ", assets)

def get_alpaca_symbol(asset):
	symbol = asset.symbol
	return 'alpacadatav1/AM.'+symbol

symbol_list = list(map(get_alpaca_symbol, assets))

print(len(symbol_list))


@conn.on(r'.*')
async def on_data(conn, channel, data):
    print(channel)
    pprint(data)

# A.SPY will work, because it only goes to Polygon
# conn.run(['A.SPY'])

# account_updates fail, being sent to websocket stream
conn.run(['trade_updates']+symbol_list)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
dinnu93commented, Nov 7, 2020

Thanks @shlomikushchi this is one step closer to what I’m looking for. I guess I’ll fork the library and change the read_limit to suit my needs 👍

0reactions
shlomikushchicommented, Nov 7, 2020

we are using the websockets package. maybe this will help: https://websockets.readthedocs.io/en/stable/design.html?highlight=read_limit#buffers

Read more comments on GitHub >

github_iconTop Results From Across the Web

Spring Stomp Websocket - too big SEND message generates ...
I use Spring Java Stomp Client to send payloads. It seems an additional configuration is needed either for websocket server or for the...
Read more >
Confusing error when max_size is too small #368 - GitHub
ConnectionClosed: WebSocket connection is closed: code = 1009 (message too big), no reason. The server exits messily as above.
Read more >
WebSocket Status Codes Cheat Sheet - Kapeli
1009 indicates that an endpoint is terminating the connection because it has received a message that is too big for it to process....
Read more >
How to deal with large data in Websocket message?
If the messages are huge, it introduces problems. The more connections you will keep open at the same time, the higher the application's...
Read more >
WebSocketCloseStatus Enum (System.Net.WebSockets)
MessageTooBig, 1009. (1009) The client or server is terminating the connection because it has received a message that is too big for it...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found