diff --git a/alpaca/data/requests.py b/alpaca/data/requests.py index 4d829880..0aa896da 100644 --- a/alpaca/data/requests.py +++ b/alpaca/data/requests.py @@ -453,6 +453,7 @@ class OptionChainRequest(NonEmptyRequest): expiration_date_gte (Optional[Union[date, str]]): Filter contracts with expiration date greater than or equal to the specified date. expiration_date_lte (Optional[Union[date, str]]): Filter contracts with expiration date less than or equal to the specified date. root_symbol (Optional[str]): Filter contracts by the root symbol. + updated_since (Optional[datetime]): Filter to snapshots that were updated since this timestamp. """ underlying_symbol: str @@ -464,6 +465,7 @@ class OptionChainRequest(NonEmptyRequest): expiration_date_gte: Optional[Union[date, str]] = None expiration_date_lte: Optional[Union[date, str]] = None root_symbol: Optional[str] = None + updated_since: Optional[datetime] = None # ############################## Orderbooks ################################# # diff --git a/tests/data/test_historical_option_data.py b/tests/data/test_historical_option_data.py index cd9130b1..a7a3e0e7 100644 --- a/tests/data/test_historical_option_data.py +++ b/tests/data/test_historical_option_data.py @@ -1000,7 +1000,7 @@ def test_get_option_chain(reqmock, option_client: OptionHistoricalDataClient): symbol = "AAPL" reqmock.get( - f"https://data.alpaca.markets/v1beta1/options/snapshots/{symbol}", + f"https://data.alpaca.markets/v1beta1/options/snapshots/{symbol}?updated_since=2024-04-25T00%3A00%3A00%2B00%3A00", text=""" { "next_page_token": null, @@ -1037,7 +1037,9 @@ def test_get_option_chain(reqmock, option_client: OptionHistoricalDataClient): """, ) - request = OptionChainRequest(underlying_symbol=symbol) + request = OptionChainRequest( + underlying_symbol=symbol, updated_since=datetime(2024, 4, 25) + ) snapshots = option_client.get_option_chain(request)