Skip to content

mbk-dev/okama-dash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

410 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Widget Route What it does
Efficient Frontier / Portfolio optimization: efficient frontier chart, assets transition map, simulated portfolios
Compare assets /compare Compare assets' historical performance: wealth indexes, rate of return, risk, CVAR, drawdowns, correlation
Compare with benchmark /benchmark Compare assets with a benchmark: tracking difference, tracking error, correlation, beta
Investment Portfolio /portfolio Portfolio analysis: rebalancing, cash flow strategies, Monte Carlo forecasts
Database /database Search the financial database: stocks, ETF, mutual funds, indexes, currencies, commodities, rates

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 variable Default Description
OKAMA_CACHE_BACKEND redis Cache backend: redis or filesystem
OKAMA_REDIS_URL redis://localhost:6379/0 Redis 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.

Related projects

  • 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