Uncertainty must be taken in a sense radically distinct from the familiar notion of Risk, from which it has never been properly separated.... The essential fact is that 'risk' means in some cases a quantity susceptible of measurement, while at other times it is something distinctly not of this character; and there are far-reaching and crucial differences in the bearings of the phenomena depending on which of the two is really present and operating.... It will appear that a measurable uncertainty, or 'risk' proper, as we shall use the term, is so far different from an unmeasurable one that it is not in effect an uncertainty at all
— Frank Knight
Our aim with the Finance Playground is to explore and analyze financial instruments (particularly stocks and options) and develop profitable trading strategies. To that end, we focus on the relation between price time-series and other factors such as market volatility, interest rates, and various economic indicators.
We started this as a learning tool. As developers, we advocate a hands-on approach, we like trying out ideas and tinkering with models.
Collaboration is welcome: by all means, if you spot a mistake or just want to add an interesting analysis you've been playing with, please submit a pull request to the project's Github repository.
Requires Python >= 3.11. We use Nix for the dev environment and uv for Python dependencies.
# Enter the dev shell (provides Python 3.13, uv, make)
nix develop
# Install core dependencies
make setup
# Install competition dependencies (ML, Bayesian, deep learning)
make sync-all
# Run all self-contained analyses
make run
# Compile-check all Python files
make checkWithout Nix, install Python >= 3.11 and uv manually, then use uv sync / uv sync --extra competitions.
Each topic lives in its own directory under research/ with a run.py that reproduces all charts.
- Ergodicity and Insurance — Non-ergodic dynamics, the insurance puzzle, and time-average growth rates.
- Evaluating Gambles — Expected values, the St. Petersburg paradox, utility functions, and Kelly criterion.
- Cooperation and Ergodicity — Why cooperation emerges under evolutionary dynamics.
- Wealth Redistribution (RGBM) — Wealth inequality simulation under re-allocating GBM.
- Diversification — Holy Grail — Ray Dalio's insight on uncorrelated return streams.
- Argentina ADR Volatility — The August 2019 crash, return distributions, and volatility smiles.
- Soy Futures Forecasting — 2019 Metadata competition (3rd place). ARIMA, Prophet, Bayesian AR, and BSTS models.
- Rainfall Forecasting — 2020 Metadata competition. LSTM, wavelet, and correlation analysis.
- Investopedia: Ray Dalio breaks down his "Holy Grail".
- Insurance makes wealth grow faster. - Peters & Adamou
- An evolutionary advantage of cooperation. - Peters & Adamou
- Wealth Inequality and the Ergodic Hypothesis: Evidence from the United States. - Berman, Peters & Adamou
- Ergodicity Economics: Lecture notes. - Ole Peters
- Tiingo
- Sharadar
- Quandl
- Intrinio
- Xignite
- Shiller's US Stocks, Dividends, Earnings, Inflation (CPI), and long term interest rates
- Fama/French US Stock Index Data
- FRED CPI, Interest Rates, Trade Data
- REIT Data
- Historical Data: International monthly government bond returns
- Treasury Bond Return Data Starting in 1962
- The 2019 Global Investment Returns Yearbook
- Centro de Estadísticas de Mercado - ROFEX