@@ -36,7 +36,7 @@ Once you've created the streamer, you can subscribe/unsubscribe to events, like
36
36
break
37
37
print (quotes)
38
38
39
- >>> [{' SPY' : Quote(eventSymbol = ' SPY' , eventTime = 0 , sequence = 0 , timeNanoPart = 0 , bidTime = 0 , bidExchangeCode = ' Q' , bidPrice = 411.58 , bidSize = 400.0 , askTime = 0 , askExchangeCode = ' Q' , askPrice = 411.6 , askSize = 1313.0 ), ' SPX' : Quote(eventSymbol = ' SPX' , eventTime = 0 , sequence = 0 , timeNanoPart = 0 , bidTime = 0 , bidExchangeCode = ' \x00 ' , bidPrice = 4122.49 , bidSize = ' NaN' , askTime = 0 , askExchangeCode = ' \x00 ' , askPrice = 4123.65 , askSize = ' NaN' )}]
39
+ >>> [{' SPY' : Quote(event_symbol = ' SPY' , event_time = 0 , sequence = 0 , time_nano_part = 0 , bid_time = 0 , bid_exchange_code = ' Q' , bid_price = 411.58 , bid_size = 400.0 , ask_time = 0 , ask_exchange_code = ' Q' , ask_price = 411.6 , ask_size = 1313.0 ), ' SPX' : Quote(event_symbol = ' SPX' , event_time = 0 , sequence = 0 , time_nano_part = 0 , bid_time = 0 , bid_exchange_code = ' \x00 ' , bid_price = 4122.49 , bid_size = ' NaN' , ask_time = 0 , ask_exchange_code = ' \x00 ' , ask_price = 4123.65 , ask_size = ' NaN' )}]
40
40
41
41
Note that these are ``asyncio `` calls, so you'll need to run this code asynchronously. Here's an example:
42
42
@@ -51,7 +51,7 @@ Note that these are ``asyncio`` calls, so you'll need to run this code asynchron
51
51
52
52
asyncio.run(main(session))
53
53
54
- >>> [Quote(eventSymbol = ' SPY' , eventTime = 0 , sequence = 0 , timeNanoPart = 0 , bidTime = 0 , bidExchangeCode = ' Q' , bidPrice = 411.58 , bidSize = 400.0 , askTime = 0 , askExchangeCode = ' Q' , askPrice = 411.6 , askSize = 1313.0 ), Quote(eventSymbol = ' SPX' , eventTime = 0 , sequence = 0 , timeNanoPart = 0 , bidTime = 0 , bidExchangeCode = ' \x00 ' , bidPrice = 4122.49 , bidSize = ' NaN' , askTime = 0 , askExchangeCode = ' \x00 ' , askPrice = 4123.65 , askSize = ' NaN' )]
54
+ >>> [Quote(event_symbol = ' SPY' , event_time = 0 , sequence = 0 , time_nano_part = 0 , bid_time = 0 , bid_exchange_code = ' Q' , bid_price = 411.58 , bid_size = 400.0 , ask_time = 0 , ask_exchange_code = ' Q' , ask_price = 411.6 , ask_size = 1313.0 ), Quote(event_symbol = ' SPX' , event_time = 0 , sequence = 0 , time_nanoPart = 0 , bid_time = 0 , bid_exchange_code = ' \x00 ' , bid_price = 4122.49 , bid_size = ' NaN' , ask_time = 0 , ask_exchange_code = ' \x00 ' , ask_price = 4123.65 , ask_size = ' NaN' )]
55
55
56
56
Alternatively, you can do testing in a Jupyter notebook, which allows you to make async calls directly, or run a python shell like this: `python -m asyncio `.
57
57
@@ -72,7 +72,7 @@ We can also use the streamer to stream greeks for options symbols:
72
72
greeks = await streamer.get_event(Greeks)
73
73
print (greeks)
74
74
75
- >>> [Greeks(eventSymbol = ' .SPLG230616C23' , eventTime = 0 , eventFlags = 0 , index = 7235129486797176832 , time = 1684559855338 , sequence = 0 , price = 26.3380972233688 , volatility = 0.396983376650804 , delta = 0.999999999996191 , gamma = 4.81989763184255e-12 , theta = - 2.5212017514875e-12 , rho = 0.01834504287973133 , vega = 3.7003015672215e-12 )]
75
+ >>> [Greeks(event_symbol = ' .SPLG230616C23' , event_time = 0 , event_flags = 0 , index = 7235129486797176832 , time = 1684559855338 , sequence = 0 , price = 26.3380972233688 , volatility = 0.396983376650804 , delta = 0.999999999996191 , gamma = 4.81989763184255e-12 , theta = - 2.5212017514875e-12 , rho = 0.01834504287973133 , vega = 3.7003015672215e-12 )]
76
76
77
77
Advanced usage
78
78
--------------
@@ -145,7 +145,7 @@ Now, we can access the quotes and greeks at any time, and they'll be up-to-date
145
145
symbol = live_prices.calls[44 ].streamer_symbol
146
146
print (live_prices.quotes[symbol], live_prices.greeks[symbol])
147
147
148
- >>> Quote(eventSymbol = ' .SPY230721C387' , eventTime = 0 , sequence = 0 , timeNanoPart = 0 , bidTime = 1689365699000 , bidExchangeCode = ' X' , bidPrice = 62.01 , bidSize = 50.0 , askTime = 1689365699000 , askExchangeCode = ' X' , askPrice = 62.83 , askSize = 50.0 ) Greeks(eventSymbol = ' .SPY230721C387' , eventTime = 0 , eventFlags = 0 , index = 7255910303911641088 , time = 1689398266363 , sequence = 0 , price = 62.6049270064687 , volatility = 0.536152815048564 , delta = 0.971506591907638 , gamma = 0.001814464566110275 , theta = - 0.1440768557397271 , rho = 0.0831882577866199 , vega = 0.0436861878838861 )
148
+ >>> Quote(event_symbol = ' .SPY230721C387' , event_time = 0 , sequence = 0 , time_nano_part = 0 , bid_time = 1689365699000 , bid_exchange_code = ' X' , bid_price = 62.01 , bid_size = 50.0 , ask_time = 1689365699000 , ask_exchange_code = ' X' , ask_price = 62.83 , ask_size = 50.0 ) Greeks(event_symbol = ' .SPY230721C387' , event_time = 0 , event_flags = 0 , index = 7255910303911641088 , time = 1689398266363 , sequence = 0 , price = 62.6049270064687 , volatility = 0.536152815048564 , delta = 0.971506591907638 , gamma = 0.001814464566110275 , theta = - 0.1440768557397271 , rho = 0.0831882577866199 , vega = 0.0436861878838861 )
149
149
150
150
Retry callback
151
151
--------------
0 commit comments