VaR_model / data /schema.py
MinsaitEU's picture
Claude Opus 5.5
Load VaR inputs from the Coral zip; add backtesting and stress tests
cbdae8d
Raw History Blame Contribute Delete
2.3 kB
"""
Internal column names used across the model.
Source (raw file) column names live in config.json. This module
defines the names of the tables the model builds itself, so every
module refers to them through these constants instead of literals.
"""
class Col:
"""Columns of the internal portfolio and volume tables."""
DATE = "Date"
POSITION = "position_id"
PLANT = "plant"
TECHNOLOGY = "technology"
COUNTRY = "country"
FACTOR = "factor_id"
QUANTITY = "quantity"
MULTIPLIER = "multiplier"
FX = "fx_to_reporting"
PRICE_UNIT = "price_unit"
PRICE_CURRENCY = "price_currency"
POWER_MW = "power_mw"
CAPACITY_MW = "capacity_mw"
AVG_MW = "expected_avg_mw"
CAPACITY_FACTOR = "capacity_factor"
YEARS_USED = "years_used"
ANNUAL_MW = "annual_avg_mw"
WARNING = "warning"
DELIVERY_START = "delivery_start"
DELIVERY_END = "delivery_end"
DELIVERY_HOURS = "delivery_hours"
REMAINING_HOURS = "remaining_hours"
class Out:
"""Labels of the model's result tables."""
CONFIDENCE = "Confidence"
VAR = "VaR"
ES = "Expected Shortfall"
ITEM = "Item"
PORTFOLIO_VAR = "Portfolio VaR"
STANDALONE_VAR = "Stand-alone VaR"
COMPONENT_VAR = "Component VaR"
CONTRIBUTION = "Contribution %"
DIVERSIFICATION = "Diversification effect"
COMPONENT_ES = "Component ES"
FACTOR = "Factor"
PRICE = "Price"
EXPOSURE = "Exposure"
VOLATILITY = "Volatility"
STALE_SHARE = "Zero-change share"
# Stress testing
SCENARIO = "Scenario"
SCENARIO_TYPE = "Type"
STRESS_PNL = "Stress P&L"
VAR_MULTIPLE = "Loss / VaR"
# Backtesting
DATE = "Date"
REALIZED_PNL = "Realized P&L"
REALIZED_LOSS = "Realized loss"
EXCEEDANCE = "Exceedance"
OBSERVATIONS = "Observations"
EXPECTED_EXCEEDANCES = "Expected exceedances"
EXCEEDANCES = "Exceedances"
EXCEEDANCE_RATE = "Exceedance rate"
KUPIEC_LR = "Kupiec LR"
KUPIEC_P = "Kupiec p-value"
INDEPENDENCE_LR = "Christoffersen ind. LR"
INDEPENDENCE_P = "Christoffersen ind. p-value"
CONDITIONAL_LR = "Conditional coverage LR"
CONDITIONAL_P = "Conditional coverage p-value"
ZONE = "Traffic light"
ES_RATIO = "Loss beyond VaR / predicted ES"
VERDICT = "Verdict"