diff --git a/examples/rest/universal-snapshot.py b/examples/rest/universal-snapshot.py index 8f4d9be6..1ab5e804 100644 --- a/examples/rest/universal-snapshot.py +++ b/examples/rest/universal-snapshot.py @@ -1,7 +1,5 @@ from typing import cast, Iterator, Union - from urllib3 import HTTPResponse - from polygon import RESTClient from polygon.rest.models import UniversalSnapshot, SnapshotMarketType @@ -35,12 +33,15 @@ def print_snapshots(iterator: Union[Iterator[UniversalSnapshot], HTTPResponse]): ) print_snapshots(it) -it = client.list_universal_snapshots( - market_type=SnapshotMarketType.STOCKS, ticker_gt="A", ticker_lt="AAPL" -) +it = client.list_universal_snapshots(type="stocks", ticker_gt="A", ticker_lt="AAPL") +print_snapshots(it) + +it = client.list_universal_snapshots(type="stocks", ticker_gte="AAPL", ticker_lte="ABB") print_snapshots(it) it = client.list_universal_snapshots( - market_type=SnapshotMarketType.STOCKS, ticker_gte="AAPL", ticker_lte="ABB" + type="options", + ticker_gte="O:AAPL230804C00050000", + ticker_lte="O:AAPL230804C00070000", ) print_snapshots(it) diff --git a/polygon/rest/snapshot.py b/polygon/rest/snapshot.py index 0fb19fd0..3d6a6ce7 100644 --- a/polygon/rest/snapshot.py +++ b/polygon/rest/snapshot.py @@ -8,6 +8,8 @@ SnapshotTickerFullBook, UniversalSnapshot, IndicesSnapshot, + Sort, + Order, ) from urllib3 import HTTPResponse @@ -24,8 +26,11 @@ def get_locale(market_type: Union[SnapshotMarketType, str]): class SnapshotClient(BaseClient): def list_universal_snapshots( self, - market_type: Optional[Union[str, SnapshotMarketType]] = None, + type: Optional[Union[str, SnapshotMarketType]] = None, ticker_any_of: Optional[List[str]] = None, + order: Optional[Union[str, Order]] = None, + limit: Optional[int] = 10, + sort: Optional[Union[str, Sort]] = None, ticker_lt: Optional[str] = None, ticker_lte: Optional[str] = None, ticker_gt: Optional[str] = None, @@ -42,8 +47,11 @@ def list_universal_snapshots( - https://polygon.io/docs/forex/get_v3_snapshot - https://polygon.io/docs/crypto/get_v3_snapshot - :param market_type: the type of the asset + :param type: the type of the asset :param ticker_any_of: Comma-separated list of tickers, up to a maximum of 250. If no tickers are passed then all + :param order: The order to sort the results on. Default is asc (ascending). + :param limit: Limit the size of the response per-page, default is 10 and max is 250. + :param sort: The field to sort the results on. Default is ticker. If the search query parameter is present, sort is ignored and results are ordered by relevance. results will be returned in a paginated manner. Warning: The maximum number of characters allowed in a URL are subject to your technology stack. :param ticker_lt search for tickers less than