Question about streaming data

Hi all,

I am a newbie to algo development and want to figure out the streaming data feature.

I see in the sample code there are many functions take variables conn, channel and bar are arguments. For example, async def on_minute(conn, channel, bar).

I see conn is defined as conn = StreamConn(). But I don’t see anywhere in the code where channel and bar are defined.

Are T.* Trades, Q.* Quotes, A.* Aggregate ( per second ), AM.* Aggregate ( per minute ) channels?

How about bar? Are those just OHLC data?

Thank you.

1 Like

The second argument, channel ,is a string object that indicates which stream of data it is.

The third argument, bar is sometimes named data in other examples but is the actual message data, in a dict type, which is basically the data field in the json message.

Thanks for the answer.

A follow up question, how is the third argument generated? Are they generated using the decorator @conn.on?

For example, in the martingale example (, where can I find how the channel and data arguments are generated/defined?

If data is streamed from Alpaca or Polygon, where’s the function that actually gets data? Is it the @conn.on decorator?


You may want to check