Skip to content

Commit b68db9c

Browse files
Update README.md with additional filter parameters section (#484)
1 parent 31d47cb commit b68db9c

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

README.md

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,35 @@ quotes = client.list_quotes(ticker=ticker, timestamp="2022-01-04")
5656
for quote in quotes:
5757
print(quote)
5858
```
59-
Note: For parameter argument examples check out our docs. All required arguments are annotated with red asterisks " * " and argument examples are set.
60-
Check out an example for Aggregates(client.get_aggs) [here](https://polygon.io/docs/stocks/get_v2_aggs_ticker__stocksticker__range__multiplier___timespan___from___to)
59+
60+
### Additional Filter Parameters
61+
62+
Many of the APIs in this client library support the use of additional filter parameters to refine your queries. Please refer to the specific API documentation for details on which filter parameters are supported for each endpoint. These filters can be applied using the following operators:
63+
64+
- `.gt`: greater than
65+
- `.gte`: greater than or equal to
66+
- `.lt`: less than
67+
- `.lte`: less than or equal to
68+
69+
Here's a sample code snippet that demonstrates how to use these filter parameters when requesting an Options Chain using the `list_snapshot_options_chain` method. In this example, the filter parameters ensure that the returned options chain data will only include options with an expiration date that is greater than or equal to "2024-03-16" and a strike price that falls between 29 and 30 (inclusive).
70+
71+
```python
72+
options_chain = []
73+
for o in client.list_snapshot_options_chain(
74+
"HCP",
75+
params={
76+
"expiration_date.gte": "2024-03-16",
77+
"strike_price.gte": 29,
78+
"strike_price.lte": 30,
79+
},
80+
):
81+
options_chain.append(o)
82+
83+
print(options_chain)
84+
print(len(options_chain))
85+
```
86+
87+
Also, please refer to the API documentation to get a full understanding of how the API works and the supported arguments. All required arguments are annotated with red asterisks " * " and argument examples are set.
6188

6289
## WebSocket Client
6390

0 commit comments

Comments
 (0)