_images/ef.png

python   PyPI Latest Release   Coverage Status MIT license   MIT license  

Okama Documentation

okama is a library with investment portfolio analyzing & optimization tools. CFA recommendations are used in quantitative finance.

okama goes with free «end of day» historical stock markets data and macroeconomic indicators through API.

…entities should not be multiplied without necessity

– William of Ockham (c. 1287–1347)

Okama main features

  • Investment portfolio constrained Markowitz Mean-Variance Analysis (MVA) and optimization

  • Rebalanced portfolio optimization with constraints (multi-period Efficient Frontier)

  • Monte Carlo Simulations for financial assets and investment portfolios

  • Popular risk metrics: VAR, CVaR, semi-deviation, variance and drawdowns

  • Forecasting models according to normal and lognormal distribution

  • Testing distribution on historical data

  • Dividend yield and other dividend indicators for stocks

  • Backtesting and comparing historical performance of broad range of assets and indexes in multiple currencies

  • Methods to track the performance of index funds (ETF) and compare them with benchmarks

  • Main macroeconomic indicators: inflation, central banks rates, financial ratios

  • Matplotlib visualization scripts for the Efficient Frontier, Transition map and assets risk / return performance

Financial data and macroeconomic indicators

okama can be used with free financial data available through API.

End of day historical data

  • Stocks and ETF for main world markets

  • Mutual funds

  • Commodities

  • Currencies

  • Stock indexes

Macroeconomic indicators

For several countries (USA, United Kingdom, European Union, Russia, Israel etc.):

  • Inflation

  • Central bank rates

  • CAPE10 (Shiller P/E) Cyclically adjusted price-to-earnings ratios

Other historical data

  • Real estate prices

  • Top bank rates

Installation

Okama can be installed from PyPI:

pip install okama

The latest development version can be installed directly from GitHub:

pip install git+https://github.com/mbk-dev/okama@dev

Warning

The development version of okama can have technical and financial issues. Please use carefully at your own risk.

Main classes

Assets & Portfolio

okama.Asset([symbol])

A financial asset, that could be used in a list of assets or in portfolio.

okama.AssetList([assets, first_date, ...])

The list of financial assets implementation.

okama.Portfolio([assets, first_date, ...])

Implementation of investment portfolio.

okama.PortfolioDCF(parent)

Class to access discounted cash flow (DCF) methods of Portfolio.

Efficient Frontier

okama.EfficientFrontier([assets, ...])

Efficient Frontier with classic Mean-Variance optimization.

okama.EfficientFrontierReb([assets, ...])

Efficient Frontier with multi-period optimization.

Macroeconomics

okama.Inflation([symbol, first_date, last_date])

Inflation related data and methods.

okama.Rate([symbol, first_date, last_date])

Rates of central banks and banks.

okama.Indicator([symbol, first_date, last_date])

Macroeconomic indicators and ratios.

Indices and tables