-
Notifications
You must be signed in to change notification settings - Fork 558
Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
`import logging
import config
from alpaca_trade_api.stream import Stream
log = logging.getLogger(name)
async def print_trade(t):
print('trade', t)
async def print_quote(q):
if q["x"] == "FTXU":
print('quote', q)
async def print_trade_update(tu):
print('trade update', tu)
async def print_crypto_trade(t):
print('crypto trade', t)
def main():
logging.basicConfig(level=logging.INFO)
feed = 'iex' # <- replace to SIP if you have PRO subscription
stream = Stream(key_id=config.API_KEY,secret_key=config.SECRET_KEY,data_feed=feed, raw_data=True)
stream.subscribe_trade_updates(print_trade_update)
stream.subscribe_trades(print_trade, 'AAPL')
stream.subscribe_quotes(print_quote, 'IBM')
stream.subscribe_crypto_trades(print_crypto_trade, 'ETHUSD')
stream.subscribe_crypto_quotes(print_quote, 'ETHUSD')
@stream.on_bar('MSFT')
async def _(bar):
print('bar', bar)
@stream.on_updated_bar('MSFT')
async def _(bar):
print('updated bar', bar)
@stream.on_status("*")
async def _(status):
print('status', status)
@stream.on_luld('AAPL', 'MSFT')
async def _(luld):
print('LULD', luld)
stream.run()
if name == "main":
main()
`
Expected Behavior
In the provided example, all functions work as expected but "stream.subscribe_trade_updates".
It gives the following error:
INFO:alpaca_trade_api.stream:started trading stream
INFO:alpaca_trade_api.stream:starting trading websocket connection
ERROR:alpaca_trade_api.stream:error during websocket communication: failed to authenticate
SDK Version I encountered this issue in
alpaca_trade_api version 2.1.0
Steps To Reproduce
run stream.subscribe_trade_updatesFilled out the Steps to Reproduce section?
- I have entered valid steps to reproduce my issue or have attached a minimally reproducible case in code that shows my issue happening; and understand that without this my issue will be flagged as invalid and closed after 30 days.
Anything else?
No response