arena / src /about.py
primenumbersam's picture
Refactor leaderboard for FRED daily return CDF and annualized metrics
041a651
Raw History Blame Contribute Delete
1.25 kB
TITLE = "Long Short Arena"
SUBTITLE = "Market benchmark distribution & annualized return metrics from FRED SQLite storage."
LLM_BENCHMARKS_TEXT = """
## Data Flow
1. Local Ingestion: Node.js (`node:sqlite` + `fetch`) pulls `NASDAQ100` and `DJIA` daily index levels from FRED (`2017-01-01` onward) into `market.db`.
2. Storage Sync: `market.db` is pushed to the Hugging Face Storage Bucket (`arena-storage`) and mounted at `/data` in the Space runtime.
3. Space Runtime: Python reads `/data/market.db`, computes daily simple returns, empirical CDFs, and annualized metrics, then serves them via Gradio Server API.
## Metrics Definition
Daily simple return: $r_t = P_t / P_{t-1} - 1$ (252 trading days/year, $R_f = 0$).
- Median (Ann. %): $\\text{median}(r_t) \\times 252 \\times 100$
- Mean (Ann. %): $\\bar{r}_t \\times 252 \\times 100$
- Std (Ann. %): $\\sigma(r_t) \\times \\sqrt{252} \\times 100$
- Sharpe Ratio: $\\text{Mean (Ann.)} / \\text{Std (Ann.)}$
- MDD (%): $\\min_t (W_t / \\max_{s \\le t} W_s - 1) \\times 100$, where $W_t = \\prod (1 + r_t)$
"""
CITATION_BUTTON_LABEL = "Copy BibTeX citation"
CITATION_BUTTON_TEXT = """@misc{long_short_arena_2026,
title={Long Short Arena},
year={2026},
url={https://huggingface.co/spaces}
}"""