tastytrade.metrics¶
- pydantic model tastytrade.metrics.DividendInfo(*, occurred_date: date, amount: Decimal)¶
Bases:
TastytradeDataDataclass representing dividend information for a given symbol.
Show JSON schema
{ "title": "DividendInfo", "description": "Dataclass representing dividend information for a given symbol.", "type": "object", "properties": { "occurred-date": { "format": "date", "title": "Occurred-Date", "type": "string" }, "amount": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Amount" } }, "required": [ "occurred-date", "amount" ] }
- pydantic model tastytrade.metrics.EarningsInfo(*, occurred_date: date, eps: Decimal)¶
Bases:
TastytradeDataDataclass representing earnings information for a given symbol.
Show JSON schema
{ "title": "EarningsInfo", "description": "Dataclass representing earnings information for a given symbol.", "type": "object", "properties": { "occurred-date": { "format": "date", "title": "Occurred-Date", "type": "string" }, "eps": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Eps" } }, "required": [ "occurred-date", "eps" ] }
-
pydantic model tastytrade.metrics.EarningsReport(*, estimated: bool, late_flag: int, visible: bool, actual_eps: Decimal | None =
None, consensus_estimate: Decimal | None =None, expected_report_date: date | None =None, quarter_end_date: date | None =None, time_of_day: str | None =None, updated_at: datetime | None =None)¶ Bases:
TastytradeDataDataclass containing information about a recent earnings report, or the expected date of the next one.
Show JSON schema
{ "title": "EarningsReport", "description": "Dataclass containing information about a recent earnings report, or the\nexpected date of the next one.", "type": "object", "properties": { "estimated": { "title": "Estimated", "type": "boolean" }, "late-flag": { "title": "Late-Flag", "type": "integer" }, "visible": { "title": "Visible", "type": "boolean" }, "actual-eps": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Actual-Eps" }, "consensus-estimate": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Consensus-Estimate" }, "expected-report-date": { "anyOf": [ { "format": "date", "type": "string" }, { "type": "null" } ], "default": null, "title": "Expected-Report-Date" }, "quarter-end-date": { "anyOf": [ { "format": "date", "type": "string" }, { "type": "null" } ], "default": null, "title": "Quarter-End-Date" }, "time-of-day": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Time-Of-Day" }, "updated-at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Updated-At" } }, "required": [ "estimated", "late-flag", "visible" ] }- Fields:¶
-
pydantic model tastytrade.metrics.Liquidity(*, sum: Decimal, count: int, started_at: datetime, updated_at: datetime | None =
None)¶ Bases:
TastytradeDataDataclass representing liquidity information for a given symbol.
Show JSON schema
{ "title": "Liquidity", "description": "Dataclass representing liquidity information for a given symbol.", "type": "object", "properties": { "sum": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Sum" }, "count": { "title": "Count", "type": "integer" }, "started-at": { "format": "date-time", "title": "Started-At", "type": "string" }, "updated-at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Updated-At" } }, "required": [ "sum", "count", "started-at" ] }- Fields:¶
-
pydantic model tastytrade.metrics.MarketMetricInfo(*, symbol: str, implied_volatility_index: Decimal | None =
None, implied_volatility_index_5_day_change: Decimal | None =None, implied_volatility_index_rank: str | None =None, tos_implied_volatility_index_rank: Decimal | None =None, tw_implied_volatility_index_rank: Decimal | None =None, tos_implied_volatility_index_rank_updated_at: datetime | None =None, implied_volatility_index_rank_source: str | None =None, implied_volatility_percentile: str | None =None, implied_volatility_updated_at: datetime | None =None, liquidity_rating: int | None =None, updated_at: datetime, option_expiration_implied_volatilities: list[OptionExpirationImpliedVolatility] | None =None, beta: Decimal | None =None, corr_spy_3month: Decimal | None =None, market_cap: Decimal, earnings: EarningsReport | None =None, price_earnings_ratio: Decimal | None =None, earnings_per_share: Decimal | None =None, dividend_rate_per_share: Decimal | None =None, implied_volatility_30_day: Decimal | None =None, historical_volatility_30_day: Decimal | None =None, historical_volatility_60_day: Decimal | None =None, historical_volatility_90_day: Decimal | None =None, iv_hv_30_day_difference: Decimal | None =None, beta_updated_at: datetime | None =None, created_at: datetime | None =None, dividend_ex_date: date | None =None, dividend_next_date: date | None =None, dividend_pay_date: date | None =None, dividend_updated_at: datetime | None =None, liquidity_value: Decimal | None =None, liquidity_rank: Decimal | None =None, liquidity_running_state: Liquidity | None =None, dividend_yield: Decimal | None =None, listed_market: str | None =None, lendability: str | None =None, borrow_rate: Decimal | None =None)¶ Bases:
TastytradeDataDataclass representing market metrics for a given symbol.
Contains lots of useful information, like IV rank, IV percentile and beta.
Show JSON schema
{ "title": "MarketMetricInfo", "description": "Dataclass representing market metrics for a given symbol.\n\nContains lots of useful information, like IV rank, IV percentile and beta.", "type": "object", "properties": { "symbol": { "title": "Symbol", "type": "string" }, "implied-volatility-index": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Implied-Volatility-Index" }, "implied-volatility-index-5-day-change": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Implied-Volatility-Index-5-Day-Change" }, "implied-volatility-index-rank": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Implied-Volatility-Index-Rank" }, "tos-implied-volatility-index-rank": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Tos-Implied-Volatility-Index-Rank" }, "tw-implied-volatility-index-rank": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Tw-Implied-Volatility-Index-Rank" }, "tos-implied-volatility-index-rank-updated-at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Tos-Implied-Volatility-Index-Rank-Updated-At" }, "implied-volatility-index-rank-source": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Implied-Volatility-Index-Rank-Source" }, "implied-volatility-percentile": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Implied-Volatility-Percentile" }, "implied-volatility-updated-at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Implied-Volatility-Updated-At" }, "liquidity-rating": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Liquidity-Rating" }, "updated-at": { "format": "date-time", "title": "Updated-At", "type": "string" }, "option-expiration-implied-volatilities": { "anyOf": [ { "items": { "$ref": "#/$defs/OptionExpirationImpliedVolatility" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Option-Expiration-Implied-Volatilities" }, "beta": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Beta" }, "corr-spy-3month": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Corr-Spy-3Month" }, "market-cap": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Market-Cap" }, "earnings": { "anyOf": [ { "$ref": "#/$defs/EarningsReport" }, { "type": "null" } ], "default": null }, "price-earnings-ratio": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Price-Earnings-Ratio" }, "earnings-per-share": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Earnings-Per-Share" }, "dividend-rate-per-share": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Dividend-Rate-Per-Share" }, "implied-volatility-30-day": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Implied-Volatility-30-Day" }, "historical-volatility-30-day": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Historical-Volatility-30-Day" }, "historical-volatility-60-day": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Historical-Volatility-60-Day" }, "historical-volatility-90-day": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Historical-Volatility-90-Day" }, "iv-hv-30-day-difference": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Iv-Hv-30-Day-Difference" }, "beta-updated-at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Beta-Updated-At" }, "created-at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Created-At" }, "dividend-ex-date": { "anyOf": [ { "format": "date", "type": "string" }, { "type": "null" } ], "default": null, "title": "Dividend-Ex-Date" }, "dividend-next-date": { "anyOf": [ { "format": "date", "type": "string" }, { "type": "null" } ], "default": null, "title": "Dividend-Next-Date" }, "dividend-pay-date": { "anyOf": [ { "format": "date", "type": "string" }, { "type": "null" } ], "default": null, "title": "Dividend-Pay-Date" }, "dividend-updated-at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Dividend-Updated-At" }, "liquidity-value": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Liquidity-Value" }, "liquidity-rank": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Liquidity-Rank" }, "liquidity-running-state": { "anyOf": [ { "$ref": "#/$defs/Liquidity" }, { "type": "null" } ], "default": null }, "dividend-yield": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Dividend-Yield" }, "listed-market": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Listed-Market" }, "lendability": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Lendability" }, "borrow-rate": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Borrow-Rate" } }, "$defs": { "EarningsReport": { "description": "Dataclass containing information about a recent earnings report, or the\nexpected date of the next one.", "properties": { "estimated": { "title": "Estimated", "type": "boolean" }, "late-flag": { "title": "Late-Flag", "type": "integer" }, "visible": { "title": "Visible", "type": "boolean" }, "actual-eps": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Actual-Eps" }, "consensus-estimate": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Consensus-Estimate" }, "expected-report-date": { "anyOf": [ { "format": "date", "type": "string" }, { "type": "null" } ], "default": null, "title": "Expected-Report-Date" }, "quarter-end-date": { "anyOf": [ { "format": "date", "type": "string" }, { "type": "null" } ], "default": null, "title": "Quarter-End-Date" }, "time-of-day": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Time-Of-Day" }, "updated-at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Updated-At" } }, "required": [ "estimated", "late-flag", "visible" ], "title": "EarningsReport", "type": "object" }, "Liquidity": { "description": "Dataclass representing liquidity information for a given symbol.", "properties": { "sum": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Sum" }, "count": { "title": "Count", "type": "integer" }, "started-at": { "format": "date-time", "title": "Started-At", "type": "string" }, "updated-at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Updated-At" } }, "required": [ "sum", "count", "started-at" ], "title": "Liquidity", "type": "object" }, "OptionExpirationImpliedVolatility": { "description": "Dataclass containing implied volatility information for a given symbol\nand expiration date.", "properties": { "expiration-date": { "format": "date", "title": "Expiration-Date", "type": "string" }, "settlement-type": { "title": "Settlement-Type", "type": "string" }, "option-chain-type": { "title": "Option-Chain-Type", "type": "string" }, "implied-volatility": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Implied-Volatility" } }, "required": [ "expiration-date", "settlement-type", "option-chain-type" ], "title": "OptionExpirationImpliedVolatility", "type": "object" } }, "required": [ "symbol", "updated-at", "market-cap" ] }- Fields:¶
-
field earnings : EarningsReport | None =
None¶
-
field implied_volatility_index_5_day_change : Decimal | None =
None(alias 'implied-volatility-index-5-day-change')¶
-
field implied_volatility_index_rank_source : str | None =
None(alias 'implied-volatility-index-rank-source')¶
-
field implied_volatility_updated_at : datetime | None =
None(alias 'implied-volatility-updated-at')¶
-
field option_expiration_implied_volatilities : list[OptionExpirationImpliedVolatility] | None =
None(alias 'option-expiration-implied-volatilities')¶
-
field tos_implied_volatility_index_rank : Decimal | None =
None(alias 'tos-implied-volatility-index-rank')¶
-
field tos_implied_volatility_index_rank_updated_at : datetime | None =
None(alias 'tos-implied-volatility-index-rank-updated-at')¶
-
pydantic model tastytrade.metrics.OptionExpirationImpliedVolatility(*, expiration_date: date, settlement_type: str, option_chain_type: str, implied_volatility: Decimal | None =
None)¶ Bases:
TastytradeDataDataclass containing implied volatility information for a given symbol and expiration date.
Show JSON schema
{ "title": "OptionExpirationImpliedVolatility", "description": "Dataclass containing implied volatility information for a given symbol\nand expiration date.", "type": "object", "properties": { "expiration-date": { "format": "date", "title": "Expiration-Date", "type": "string" }, "settlement-type": { "title": "Settlement-Type", "type": "string" }, "option-chain-type": { "title": "Option-Chain-Type", "type": "string" }, "implied-volatility": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Implied-Volatility" } }, "required": [ "expiration-date", "settlement-type", "option-chain-type" ] }- Fields:¶
- async tastytrade.metrics.get_dividends(session: Session, symbol: str) list[DividendInfo]¶
Retrieves dividend information for the given symbol.
- async tastytrade.metrics.get_earnings(session: Session, symbol: str, start_date: date) list[EarningsInfo]¶
Retrieves earnings information for the given symbol.