Skip to content

Commit

Permalink
option chain docs; fix streamer init bug (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
Graeme22 authored Jun 21, 2023
1 parent 4381669 commit 6f83d42
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tastytrade/instruments.py
Original file line number Diff line number Diff line change
Expand Up @@ -1001,6 +1001,10 @@ def get_option_chain(session: Session, symbol: str) -> dict[date, list[Option]]:
Returns a mapping of expiration date to a list of :class:`Option` objects
representing the options chain for the given symbol.
In the case that there are two expiries on the same day (e.g. SPXW and SPX AM
options), both will be returned in the same list. If you just want one expiry,
you'll need to filter the list yourself, or use ~:class:`NestedOptionChain` instead.
:param session: the session to use for the request.
:param symbol: the symbol to get the option chain for.
Expand Down Expand Up @@ -1030,6 +1034,10 @@ def get_future_option_chain(session: Session, symbol: str) -> dict[date, list[Fu
Returns a mapping of expiration date to a list of :class:`FutureOption` objects
representing the options chain for the given symbol.
In the case that there are two expiries on the same day (e.g. EW and ES options),
both will be returned in the same list. If you just want one expiry, you'll need
to filter the list yourself, or use ~:class:`NestedFutureOptionChain` instead.
:param session: the session to use for the request.
:param symbol: the symbol to get the option chain for.
Expand Down
3 changes: 3 additions & 0 deletions tastytrade/streamer.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,9 @@ async def create(cls, session: Session) -> 'DataStreamer':
# when that process concludes remotely, as there's no kind of confirmation message
# sent. This is a hacky solution to ensure streamer setup completes.
await self.oneshot(EventType.QUOTE, ['SPY'])
# clear queue if there's any lingering data
while not self._queue.empty():
self._queue.get_nowait()

return self

Expand Down

0 comments on commit 6f83d42

Please sign in to comment.