Skip to content

Commit faf55de

Browse files
Fix parameter naming and add missing parameters in list_universal_snapshots (#485)
* Fix parameter naming and add missing parameters in list_universal_snapshots
1 parent b68db9c commit faf55de

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

examples/rest/universal-snapshot.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
from typing import cast, Iterator, Union
2-
32
from urllib3 import HTTPResponse
4-
53
from polygon import RESTClient
64
from polygon.rest.models import UniversalSnapshot, SnapshotMarketType
75

@@ -35,12 +33,15 @@ def print_snapshots(iterator: Union[Iterator[UniversalSnapshot], HTTPResponse]):
3533
)
3634
print_snapshots(it)
3735

38-
it = client.list_universal_snapshots(
39-
market_type=SnapshotMarketType.STOCKS, ticker_gt="A", ticker_lt="AAPL"
40-
)
36+
it = client.list_universal_snapshots(type="stocks", ticker_gt="A", ticker_lt="AAPL")
37+
print_snapshots(it)
38+
39+
it = client.list_universal_snapshots(type="stocks", ticker_gte="AAPL", ticker_lte="ABB")
4140
print_snapshots(it)
4241

4342
it = client.list_universal_snapshots(
44-
market_type=SnapshotMarketType.STOCKS, ticker_gte="AAPL", ticker_lte="ABB"
43+
type="options",
44+
ticker_gte="O:AAPL230804C00050000",
45+
ticker_lte="O:AAPL230804C00070000",
4546
)
4647
print_snapshots(it)

polygon/rest/snapshot.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
SnapshotTickerFullBook,
99
UniversalSnapshot,
1010
IndicesSnapshot,
11+
Sort,
12+
Order,
1113
)
1214
from urllib3 import HTTPResponse
1315

@@ -24,8 +26,11 @@ def get_locale(market_type: Union[SnapshotMarketType, str]):
2426
class SnapshotClient(BaseClient):
2527
def list_universal_snapshots(
2628
self,
27-
market_type: Optional[Union[str, SnapshotMarketType]] = None,
29+
type: Optional[Union[str, SnapshotMarketType]] = None,
2830
ticker_any_of: Optional[List[str]] = None,
31+
order: Optional[Union[str, Order]] = None,
32+
limit: Optional[int] = 10,
33+
sort: Optional[Union[str, Sort]] = None,
2934
ticker_lt: Optional[str] = None,
3035
ticker_lte: Optional[str] = None,
3136
ticker_gt: Optional[str] = None,
@@ -42,8 +47,11 @@ def list_universal_snapshots(
4247
- https://polygon.io/docs/forex/get_v3_snapshot
4348
- https://polygon.io/docs/crypto/get_v3_snapshot
4449
45-
:param market_type: the type of the asset
50+
:param type: the type of the asset
4651
:param ticker_any_of: Comma-separated list of tickers, up to a maximum of 250. If no tickers are passed then all
52+
:param order: The order to sort the results on. Default is asc (ascending).
53+
:param limit: Limit the size of the response per-page, default is 10 and max is 250.
54+
: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.
4755
results will be returned in a paginated manner. Warning: The maximum number of characters allowed in a URL
4856
are subject to your technology stack.
4957
:param ticker_lt search for tickers less than

0 commit comments

Comments
 (0)