Skip to content

Instantly share code, notes, and snippets.

@ttt733
Created August 6, 2019 21:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ttt733/c8920fec2330293e874300d1a1b2972b to your computer and use it in GitHub Desktop.
Save ttt733/c8920fec2330293e874300d1a1b2972b to your computer and use it in GitHub Desktop.
Listening for Polygon data updates
# Listen for second aggregates and perform trading logic
@conn.on(r'A$', [self.symbol])
async def handle_agg(conn, channel, data):
# Update price info
tick_open = self.last_price
tick_close = data.close
self.last_price = tick_close
conn.run([f'A.{self.symbol}'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment