- FastAPI + NiceGUI web application - QuantLib-based Black-Scholes pricing with Greeks - Protective put, laddered, and LEAPS strategies - Real-time WebSocket updates - TradingView-style charts via Lightweight-Charts - Docker containerization - GitLab CI/CD pipeline for VPS deployment - VPN-only access configuration
59 lines
1.6 KiB
Python
59 lines
1.6 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
|
|
AmericanPricingResult = None
|
|
american_option_price_and_greeks = None
|
|
implied_volatility = None
|
|
else:
|
|
__all__.extend(
|
|
[
|
|
"AmericanOptionInputs",
|
|
"AmericanPricingResult",
|
|
"american_option_price_and_greeks",
|
|
"implied_volatility",
|
|
]
|
|
)
|