I am trying to use streamconn to get the minute bar for a list of tickers and have tried using the subscribe method. However there is not much on how to do this and I am having trouble getting what is below to work. Yet I also get ‘StreamConn.subscribe’ was never awaited. What I am I doing wrong and how do I get it to print the minute bar for each of tickers in my ticker list?
conn = StreamConn(base_url=base_url,key_id=api_key_id,secret_key=api_secret,)
@conn.on(r’^account_updates$’)
async def on_account_updates(conn, channel, account):
print(‘account’, account)
@conn.on(r’^status$’)
async def on_status(conn, channel, data):
print(‘polygon status update’, data)
@conn.on(r’^AM$’)
async def on_minute_bars(conn, channel, bar):
print(‘bars’, bar)
@conn.on(r’^A$’)
async def on_second_bars(conn, channel, bar):
print(‘bars’, bar)
conn.subscribe(ticker_list)
conn.run([‘account_updates’, 'AM.'l])