Okama widgets

June 8, 2026 · View on GitHub

Python License Ruff

Okama widgets

Interactive financial widgets — a multi-page web application built with the okama package and the Dash (Plotly) framework.

A live instance is running at okama.io.

Okama widgets — Efficient Frontier page

Features

WidgetRouteWhat it does
Efficient Frontier/Portfolio optimization: efficient frontier chart, assets transition map, simulated portfolios
Compare assets/compareCompare assets' historical performance: wealth indexes, rate of return, risk, CVAR, drawdowns, correlation
Compare with benchmark/benchmarkCompare assets with a benchmark: tracking difference, tracking error, correlation, beta
Investment Portfolio/portfolioPortfolio analysis: rebalancing, cash flow strategies, Monte Carlo forecasts, find max withdrawal
Database/databaseSearch the financial database: stocks, ETF, mutual funds, indexes, currencies, commodities, rates
Macro indicators/macro/*Macroeconomic charts: inflation, central-bank rates, CAPE10 valuation

Wealth indexes chart in the Compare widget

Getting started

Prerequisites

  • Python 3.11+
  • Poetry for dependency management (recommended)

Installation

git clone https://github.com/mbk-dev/okama-dash.git
cd okama-dash
poetry install

Alternatively, with pip:

python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate
pip install -r requirements.txt

Run locally

poetry run python app.py

The development server starts at http://localhost:8050.

Note

By default the application caches okama data in Redis. To run without Redis, set OKAMA_CACHE_BACKEND=filesystem — caching falls back to the local cache-directory/ folder.

Environment variableDefaultDescription
OKAMA_CACHE_BACKENDredisCache backend: redis or filesystem
OKAMA_REDIS_URLredis://localhost:6379/0Redis connection URL (used when the backend is redis)

Production

For production, serve the application with Gunicorn (installed by poetry install) using the run_gunicorn.py entry point:

poetry run gunicorn run_gunicorn:server

Historical data

The widgets use free "end of day" historical data and macroeconomic indicators provided by the okama package:

  • Stocks, ETF and mutual funds for main world markets
  • Stock indexes and commodities
  • FX and crypto currencies, central bank exchange rates
  • Macroeconomic indicators (inflation, central bank rates, CAPE10) for many countries

See the okama package for the full data coverage.

Tests

poetry run pytest -m "not e2e"   # fast suite: unit + component tests
poetry run pytest -q             # everything, including browser (e2e) tests

Unit and component tests mock the okama API — no network access or Redis required. The e2e tests run in a real browser; install it once with poetry run playwright install chromium.

  • okama — Python package for investment portfolio analysis, the engine behind these widgets
  • okama-mcp — MCP server providing investment analysis tools backed by the okama library
  • okama.io — live instance of the widgets