Initial commit: Vault Dashboard for options hedging
- 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
This commit is contained in:
40
app/strategies/base.py
Normal file
40
app/strategies/base.py
Normal file
@@ -0,0 +1,40 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
from dataclasses import dataclass
|
||||
|
||||
from app.models.portfolio import LombardPortfolio
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class StrategyConfig:
|
||||
"""Common research inputs used by all strategy implementations."""
|
||||
|
||||
portfolio: LombardPortfolio
|
||||
spot_price: float
|
||||
volatility: float
|
||||
risk_free_rate: float
|
||||
|
||||
|
||||
class BaseStrategy(ABC):
|
||||
"""Abstract strategy interface for paper-based hedge analysis."""
|
||||
|
||||
def __init__(self, config: StrategyConfig) -> None:
|
||||
self.config = config
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
def name(self) -> str: # pragma: no cover - interface only
|
||||
raise NotImplementedError
|
||||
|
||||
@abstractmethod
|
||||
def calculate_cost(self) -> dict:
|
||||
raise NotImplementedError
|
||||
|
||||
@abstractmethod
|
||||
def calculate_protection(self) -> dict:
|
||||
raise NotImplementedError
|
||||
|
||||
@abstractmethod
|
||||
def get_scenarios(self) -> list[dict]:
|
||||
raise NotImplementedError
|
||||
Reference in New Issue
Block a user