Spaces:
Sleeping
Sleeping
File size: 2,311 Bytes
558db1e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | import os
# βββββββββββββββββββββββββββββββββββββββββββββ
# UI & TERMINAL FORMATTING
# βββββββββββββββββββββββββββββββββββββββββββββ
class Color:
PURPLE = '\033[95m'
CYAN = '\033[96m'
DARKCYAN = '\033[36m'
BLUE = '\033[94m'
GREEN = '\033[92m'
YELLOW = '\033[93m'
RED = '\033[91m'
MAGENTA = '\033[35m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
DIM = '\033[2m'
RESET = '\033[0m'
def hr(char: str = "β", length: int = 65, color: str = Color.DIM) -> None:
"""Helper to print horizontal lines in the terminal."""
print(f"{color}{char * length}{Color.RESET}")
# βββββββββββββββββββββββββββββββββββββββββββββ
# CORE QUANTITATIVE CONSTANTS
# βββββββββββββββββββββββββββββββββββββββββββββ
DEFAULT_SEED = 42
DEFAULT_ADV = 50_000_000.0
LONG_RUN_ERP = 0.05 # Long-run Equity Risk Premium (5%)
OUTPUT_DIR = "output"
os.makedirs(OUTPUT_DIR, exist_ok=True)
COST_BASIS_FILE = os.path.join(OUTPUT_DIR, "portfolio_state.json")
CONFIG_FILE = os.path.join(OUTPUT_DIR, "portfolio_config.json")
KEYS_FILE = os.path.join(OUTPUT_DIR, "access_keys.json")
MASTER_KEY = os.getenv("MASTER_KEY", "QUANT-ALPHA-99")
MODEL_NAMES = {
1: "CAPM (Capital Asset Pricing Model)",
2: "Black-Litterman (Market Equilibrium Prior)",
3: "Bayesian Shrinkage (James-Stein)",
4: "Fama-French 3-Factor + Momentum",
5: "Machine Learning Stacking Ensemble",
6: "End-to-End Differentiable Optimization (SPO+)",
7: "Regime-Adaptive Factor Blend",
}
SPREAD_BY_SECTOR = {
"Index": 0.0003, # 3 bps for highly liquid ETFs
"Tech": 0.0005, # 5 bps for mega-cap tech
"Bonds": 0.0004, # 4 bps for treasury ETFs
"Defensive": 0.0006, # 6 bps for large-cap value
"Commodity": 0.0008, # 8 bps for commodity/gold ETFs
"International": 0.0008, # 8 bps for international ETFs
"Crypto": 0.0025, # 25 bps for crypto proxies
"Other": 0.0008 # 8 bps default fallback
}
|