Files
vault-dash/app/core/pricing/__init__.py
Bu5hm4nn 7dc5b3d734 Fix type hints and dependency issues for CI
- Add -r requirements.txt to requirements-dev.txt
- Fix mypy errors:
  - Remove slots=True from Settings dataclass
  - Add explicit list[float] type annotations in hedge.py
  - Add type ignore comments for optional QuantLib imports
  - Use Sequence instead of list in GreeksTable for covariance
  - Fix dict type annotation in options.py
  - Add type ignore for nicegui attr-defined errors
- Disable attr-defined error code in mypy config
2026-03-22 10:36:58 +01:00

63 lines
1.8 KiB
Python

"""Core options pricing utilities for the Vault dashboard.
This package provides pricing helpers for:
- European Black-Scholes valuation
- American option pricing via binomial trees when QuantLib is installed
- Implied volatility inversion when QuantLib is installed
Research defaults are based on the Vault hedging paper:
- Gold price: 4,600 USD/oz
- GLD price: 460 USD/share
- Risk-free rate: 4.5%
- Volatility: 16% annualized
- GLD dividend yield: 0%
"""
from .black_scholes import (
DEFAULT_GLD_PRICE,
DEFAULT_GOLD_PRICE_PER_OUNCE,
DEFAULT_RISK_FREE_RATE,
DEFAULT_VOLATILITY,
BlackScholesInputs,
HedgingCost,
PricingResult,
annual_hedging_cost,
black_scholes_price_and_greeks,
margin_call_threshold_price,
)
__all__ = [
"DEFAULT_GLD_PRICE",
"DEFAULT_GOLD_PRICE_PER_OUNCE",
"DEFAULT_RISK_FREE_RATE",
"DEFAULT_VOLATILITY",
"BlackScholesInputs",
"HedgingCost",
"PricingResult",
"annual_hedging_cost",
"black_scholes_price_and_greeks",
"margin_call_threshold_price",
]
try: # pragma: no cover - optional QuantLib modules
from .american_pricing import (
AmericanOptionInputs,
AmericanPricingResult,
american_option_price_and_greeks,
)
from .volatility import implied_volatility
except ImportError: # pragma: no cover - optional dependency
AmericanOptionInputs = None # type: ignore[misc,assignment]
AmericanPricingResult = None # type: ignore[misc,assignment]
american_option_price_and_greeks = None # type: ignore[assignment]
implied_volatility = None # type: ignore[assignment]
else:
__all__.extend(
[
"AmericanOptionInputs",
"AmericanPricingResult",
"american_option_price_and_greeks",
"implied_volatility",
]
)