# generated by datamodel-codegen:
#   filename:  OptionsMarketdata/OptionsGreeks.json

from __future__ import annotations

from datetime import date
from decimal import Decimal

from msgspec import Struct

from .. import definitions


class OptionsGreeks(Struct, omit_defaults=True):
    delta: Decimal
    expiration: date
    gamma: Decimal
    implied_volatility: Decimal
    put_or_call: definitions.PutOrCall
    rho: Decimal
    strike: Decimal
    symbol: str
    theta: Decimal
    underlying: str
    vega: Decimal

    # Constructor that takes all field titles as arguments for convenience
    @classmethod
    def new(
        cls,
        delta: Decimal,
        expiration: date,
        gamma: Decimal,
        implied_volatility: Decimal,
        put_or_call: definitions.PutOrCall,
        rho: Decimal,
        strike: Decimal,
        symbol: str,
        theta: Decimal,
        underlying: str,
        vega: Decimal,
    ):
        return cls(
            delta,
            expiration,
            gamma,
            implied_volatility,
            put_or_call,
            rho,
            strike,
            symbol,
            theta,
            underlying,
            vega,
        )

    def __str__(self) -> str:
        return f"OptionsGreeks(delta={self.delta},expiration={self.expiration},gamma={self.gamma},implied_volatility={self.implied_volatility},put_or_call={self.put_or_call},rho={self.rho},strike={self.strike},symbol={self.symbol},theta={self.theta},underlying={self.underlying},vega={self.vega})"
