summaryrefslogtreecommitdiffstats
path: root/openbb_platform/openbb/package/derivatives_options.py
diff options
context:
space:
mode:
Diffstat (limited to 'openbb_platform/openbb/package/derivatives_options.py')
-rw-r--r--openbb_platform/openbb/package/derivatives_options.py168
1 files changed, 159 insertions, 9 deletions
diff --git a/openbb_platform/openbb/package/derivatives_options.py b/openbb_platform/openbb/package/derivatives_options.py
index 01765d5355a..8ee07ea3a21 100644
--- a/openbb_platform/openbb/package/derivatives_options.py
+++ b/openbb_platform/openbb/package/derivatives_options.py
@@ -13,6 +13,7 @@ from typing_extensions import Annotated
class ROUTER_derivatives_options(Container):
"""/derivatives/options
chains
+ snapshots
unusual
"""
@@ -42,6 +43,28 @@ class ROUTER_derivatives_options(Container):
The provider to use, by default None. If None, the priority list configured in the settings is used. Default priority: intrinio, yfinance.
date : Optional[datetime.date]
The end-of-day date for options chains data. (provider: intrinio)
+ option_type : Literal[None, Union[ForwardRef('call'), ForwardRef('put')]]
+ The option type, call or put, 'None' is both (default). (provider: intrinio)
+ moneyness : Literal['otm', 'itm', 'all']
+ Return only contracts that are in or out of the money, default is 'all'. Parameter is ignored when a date is supplied. (provider: intrinio)
+ strike_gt : Optional[int]
+ Return options with a strike price greater than the given value. Parameter is ignored when a date is supplied. (provider: intrinio)
+ strike_lt : Optional[int]
+ Return options with a strike price less than the given value. Parameter is ignored when a date is supplied. (provider: intrinio)
+ volume_gt : Optional[int]
+ Return options with a volume greater than the given value. Parameter is ignored when a date is supplied. (provider: intrinio)
+ volume_lt : Optional[int]
+ Return options with a volume less than the given value. Parameter is ignored when a date is supplied. (provider: intrinio)
+ oi_gt : Optional[int]
+ Return options with an open interest greater than the given value. Parameter is ignored when a date is supplied. (provider: intrinio)
+ oi_lt : Optional[int]
+ Return options with an open interest less than the given value. Parameter is ignored when a date is supplied. (provider: intrinio)
+ model : Literal['black_scholes', 'bjerk']
+ The pricing model to use for options chains data, default is 'black_scholes'. Parameter is ignored when a date is supplied. (provider: intrinio)
+ show_extended_price : bool
+ Whether to include OHLC type fields, default is True. Parameter is ignored when a date is supplied. (provider: intrinio)
+ include_related_symbols : bool
+ Include related symbols that end in a 1 or 2 because of a corporate action, default is False. (provider: intrinio)
Returns
-------
@@ -59,14 +82,18 @@ class ROUTER_derivatives_options(Container):
OptionsChains
-------------
- symbol : Optional[str]
- Symbol representing the entity requested in the data. Here, it is the underlying symbol for the option.
+ underlying_symbol : Optional[str]
+ Underlying symbol for the option.
+ underlying_price : Optional[float]
+ Price of the underlying stock.
contract_symbol : str
Contract symbol for the option.
eod_date : Optional[date]
Date for which the options chains are returned.
expiration : date
Expiration date of the contract.
+ dte : Optional[int]
+ Days to expiration of the contract.
strike : float
Strike price of the contract.
option_type : str
@@ -79,16 +106,28 @@ class ROUTER_derivatives_options(Container):
Theoretical value of the option.
last_trade_price : Optional[float]
Last trade price of the option.
+ last_trade_size : Optional[int]
+ Last trade size of the option.
+ last_trade_time : Optional[datetime]
+ The timestamp of the last trade.
tick : Optional[str]
Whether the last tick was up or down in price.
bid : Optional[float]
Current bid price for the option.
bid_size : Optional[int]
Bid size for the option.
+ bid_time : Optional[datetime]
+ The timestamp of the bid price.
+ bid_exchange : Optional[str]
+ The exchange of the bid price.
ask : Optional[float]
Current ask price for the option.
ask_size : Optional[int]
Ask size for the option.
+ ask_time : Optional[datetime]
+ The timestamp of the ask price.
+ ask_exchange : Optional[str]
+ The exchange of the ask price.
mark : Optional[float]
The mid-price between the latest bid and ask.
open : Optional[float]
@@ -132,7 +171,7 @@ class ROUTER_derivatives_options(Container):
change : Optional[float]
The change in the price of the option.
change_percent : Optional[float]
- Change, in normalizezd percentage points, of the option.
+ Change, in normalized percentage points, of the option.
implied_volatility : Optional[float]
Implied volatility of the option.
delta : Optional[float]
@@ -145,14 +184,10 @@ class ROUTER_derivatives_options(Container):
Vega of the option.
rho : Optional[float]
Rho of the option.
- exercise_style : Optional[str]
- The exercise style of the option, American or European. (provider: intrinio)
- dte : Optional[int]
- Days to expiration. (provider: yfinance)
in_the_money : Optional[bool]
Whether the option is in the money. (provider: yfinance)
- last_trade_timestamp : Optional[datetime]
- Timestamp for when the option was last traded. (provider: yfinance)
+ currency : Optional[str]
+ Currency of the option. (provider: yfinance)
Examples
--------
@@ -181,6 +216,121 @@ class ROUTER_derivatives_options(Container):
@exception_handler
@validate
+ def snapshots(
+ self,
+ provider: Annotated[
+ Optional[Literal["intrinio"]],
+ OpenBBField(
+ description="The provider to use, by default None. If None, the priority list configured in the settings is used. Default priority: intrinio."
+ ),
+ ] = None,
+ **kwargs
+ ) -> OBBject:
+ """Get a snapshot of the options market universe.
+
+ Parameters
+ ----------
+ provider : Optional[Literal['intrinio']]
+ The provider to use, by default None. If None, the priority list configured in the settings is used. Default priority: intrinio.
+ date : Optional[Union[datetime.date, datetime.datetime, str]]
+ The date of the data. Can be a datetime or an ISO datetime string. Data appears to go back to around 2022-06-01 Example: '2024-03-08T12:15:00+0400' (provider: intrinio)
+ only_traded : bool
+ Only include options that have been traded during the session, default is True. Setting to false will dramatically increase the size of the response - use with caution. (provider: intrinio)
+
+ Returns
+ -------
+ OBBject
+ results : List[OptionsSnapshots]
+ Serializable results.
+ provider : Optional[Literal['intrinio']]
+ Provider name.
+ warnings : Optional[List[Warning_]]
+ List of warnings.
+ chart : Optional[Chart]
+ Chart object.
+ extra : Dict[str, Any]
+ Extra info.
+
+ OptionsSnapshots
+ ----------------
+ underlying_symbol : str
+ Ticker symbol of the underlying asset.
+ contract_symbol : str
+ Symbol of the options contract.
+ expiration : date
+ Expiration date of the options contract.
+ dte : Optional[int]
+ Number of days to expiration of the options contract.
+ strike : float
+ Strike price of the options contract.
+ option_type : str
+ The type of option.
+ volume : Optional[int]
+ Total trade volume from the beginning of the session.
+ open_interest : Optional[int]
+ Open interest at the time.
+ last_price : Optional[float]
+ Last trade price at the time.
+ last_size : Optional[int]
+ Lot size of the last trade.
+ last_timestamp : Optional[datetime]
+ Timestamp of the last price.
+ open : Optional[float]
+ The open price.
+ high : Optional[float]
+ The high price.
+ low : Optional[float]
+ The low price.
+ close : Optional[float]
+ The close price.
+ bid : Optional[float]
+ The last bid price at the time. (provider: intrinio)
+ bid_size : Optional[int]
+ The size of the last bid price. (provider: intrinio)
+ bid_timestamp : Optional[datetime]
+ The timestamp of the last bid price. (provider: intrinio)
+ ask : Optional[float]
+ The last ask price at the time. (provider: intrinio)
+ ask_size : Optional[int]
+ The size of the last ask price. (provider: intrinio)
+ ask_timestamp : Optional[datetime]
+ The timestamp of the last ask price. (provider: intrinio)
+ total_bid_volume : Optional[int]
+ Total volume of bids. (provider: intrinio)
+ bid_high : Optional[float]
+ The highest bid price. (provider: intrinio)
+ bid_low : Optional[float]
+ The lowest bid price. (provider: intrinio)
+ total_ask_volume : Optional[int]
+ Total volume of asks. (provider: intrinio)
+ ask_high : Optional[float]
+ The highest ask price. (provider: intrinio)
+ ask_low : Optional[float]
+ The lowest ask price. (provider: intrinio)
+
+ Examples
+ --------
+ >>> from openbb import obb
+ >>> obb.derivatives.options.snapshots(provider='intrinio')
+ """ # noqa: E501
+
+ return self._run(
+ "/derivatives/options/snapshots",
+ **filter_inputs(
+ provider_choices={
+ "provider": self._get_provider(
+ provider,
+ "derivatives.options.snapshots",
+ ("intrinio",),
+ )
+ },
+ standard_params={},
+ extra_params=kwargs,
+ )
+ )
+
+ @exception_handler
+ @validate
def unusual(
self,
symbol: Annotated[