|
2 | 2 | [](https://pypi.org/project/tastytrade) |
3 | 3 | [](https://pepy.tech/project/tastytrade) |
4 | 4 | [](https://github.com/tastyware/tastytrade/releases) |
| 5 | +[](https://matrix.to/#/#tastyware:gitter.im) |
5 | 6 |
|
6 | 7 | # Tastytrade Python SDK |
7 | 8 |
|
@@ -48,17 +49,18 @@ from tastytrade.dxfeed import Quote |
48 | 49 | async with DXLinkStreamer(session) as streamer: |
49 | 50 | subs_list = ['SPY'] # list of symbols to subscribe to |
50 | 51 | await streamer.subscribe(Quote, subs_list) |
51 | | - # this example fetches quotes once, then exits |
| 52 | + # fetch a single quote |
52 | 53 | quote = await streamer.get_event(Quote) |
53 | 54 | print(quote) |
| 55 | + # or multiple quotes... |
| 56 | + async for quote in streamer.listen(Quote): |
| 57 | + print(quote) |
54 | 58 | ``` |
55 | 59 |
|
56 | 60 | ```python |
57 | 61 | >>> 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) |
58 | 62 | ``` |
59 | 63 |
|
60 | | -Note that this is asynchronous code, so you can't run it as is unless you're using a Jupyter notebook or something similar. |
61 | | - |
62 | 64 | ## Getting current positions |
63 | 65 |
|
64 | 66 | ```python |
@@ -118,13 +120,11 @@ async with DXLinkStreamer(session) as streamer: |
118 | 120 | ``` |
119 | 121 |
|
120 | 122 | ```python |
121 | | ->>> [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)] |
| 123 | +>>> 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) |
122 | 124 | ``` |
123 | 125 |
|
124 | 126 | For more examples, check out the [documentation](https://tastyworks-api.readthedocs.io/en/latest/). |
125 | 127 |
|
126 | 128 | ## Disclaimer |
127 | 129 |
|
128 | 130 | This is an unofficial SDK for Tastytrade. There is no implied warranty for any actions and results which arise from using it. |
129 | | - |
130 | | - |
0 commit comments