All Projects → mbk-dev → okama

mbk-dev / okama

Licence: MIT license
Investment portfolio and stocks analyzing tools for Python with free historical data

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to okama

Strategems.jl
Quantitative systematic trading strategy development and backtesting in Julia
Stars: ✭ 106 (+21.84%)
Mutual labels:  finance, time-series, optimization, quantitative-finance
Pyportfolioopt
Financial portfolio optimisation in python, including classical efficient frontier, Black-Litterman, Hierarchical Risk Parity
Stars: ✭ 2,502 (+2775.86%)
Mutual labels:  finance, portfolio-optimization, quantitative-finance, efficient-frontier
Awesome Quant
A curated list of insanely awesome libraries, packages and resources for Quants (Quantitative Finance)
Stars: ✭ 8,205 (+9331.03%)
Mutual labels:  finance, quantitative-finance, financial-data
Mlfinlab
MlFinLab helps portfolio managers and traders who want to leverage the power of machine learning by providing reproducible, interpretable, and easy to use tools.
Stars: ✭ 2,676 (+2975.86%)
Mutual labels:  finance, portfolio-optimization, quantitative-finance
FinanceKit
FinanceKit is a Framework for iOS and Mac to build apps working with financial data, like money, currencies, stocks, portfolio, transactions and other concepts.
Stars: ✭ 15 (-82.76%)
Mutual labels:  portfolio, finance, financial-data
Systemicrisk
A framework for systemic risk valuation and analysis.
Stars: ✭ 72 (-17.24%)
Mutual labels:  time-series, quantitative-finance, financial-data
Go Finance
⚠️ Deprecrated in favor of https://github.com/piquette/finance-go
Stars: ✭ 536 (+516.09%)
Mutual labels:  finance, quantitative-finance, financial-data
QuantResearch
Quantitative analysis, strategies and backtests
Stars: ✭ 1,013 (+1064.37%)
Mutual labels:  quantitative-finance, asset-allocation, risk-management
fhub
Python client for Finnhub API
Stars: ✭ 31 (-64.37%)
Mutual labels:  finance, quantitative-finance, financial-data
Alpha Mind
quantitative security portfolio analysis. The analysis pipeline including data storage abstraction, alpha calculation, ML based alpha combining and portfolio calculation.
Stars: ✭ 171 (+96.55%)
Mutual labels:  portfolio, finance, quantitative-finance
HistoricalVolatility
A framework for historical volatility estimation and analysis.
Stars: ✭ 22 (-74.71%)
Mutual labels:  time-series, quantitative-finance, financial-data
lakshmi
Investing library and command-line interface inspired by the Bogleheads philosophy
Stars: ✭ 107 (+22.99%)
Mutual labels:  portfolio, finance, asset-allocation
Quant Notes
Quantitative Interview Preparation Guide, updated version here ==>
Stars: ✭ 180 (+106.9%)
Mutual labels:  finance, optimization, quantitative-finance
Node Finance
Module for portfolio optimization, prices and options
Stars: ✭ 101 (+16.09%)
Mutual labels:  portfolio, finance, optimization
quantlib
The idiomatic rust implementation of the QuantLib C++ quantitative finance library
Stars: ✭ 89 (+2.3%)
Mutual labels:  finance, mathematics, quantitative-finance
portfoliolab
PortfolioLab is a python library that enables traders to take advantage of the latest portfolio optimisation algorithms used by professionals in the industry.
Stars: ✭ 104 (+19.54%)
Mutual labels:  finance, portfolio-optimization, quantitative-finance
effective-interest-rate
Calculate effective interest, XIRR or effective APR.
Stars: ✭ 20 (-77.01%)
Mutual labels:  finance, mathematics
fin
finance
Stars: ✭ 38 (-56.32%)
Mutual labels:  finance, portfolio-optimization
pybacen
This library was developed for economic analysis in the Brazilian scenario (Investments, micro and macroeconomic indicators)
Stars: ✭ 40 (-54.02%)
Mutual labels:  finance, time-series
wetterdienst
Open weather data for humans
Stars: ✭ 190 (+118.39%)
Mutual labels:  time-series, historical-data

Documentation Status Python PyPI Latest Release Coverage License Open In Collab Code style: black

ATTENTION: Please update okama to version 1.1.5 or higher to use the latest financial API (api.okama.io)

Okama

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)

Table of contents

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
  • Different financial ratios: Sharpe ratio, Sortino ratio, Diversification ratio
  • 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
  • Matplotlib visualization scripts for the Efficient Frontier, Transition map and assets risk / return performance

Financial data and macroeconomic indicators

End of day historical data

  • Stocks and ETF for main world markets
  • Mutual funds
  • Commodities
  • Stock indexes

Currencies

  • FX currencies
  • Crypto currencies
  • Central bank exchange rates

Macroeconomic indicators

For many 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

pip install okama

The latest development version can be installed directly from GitHub:

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

Getting started

1. Compare several assets from different stock markets. Get USD-adjusted performance

import okama as ok

x = ok.AssetList(['SPY.US', 'BND.US', 'DBXD.XFRA'], ccy='USD')
x  # all examples are for Jupyter Notebook/iPython. For raw Python interpreter use 'print(x)' instead.

Get the main parameters for the set:

x.describe()

Get the assets accumulated return, plot it and compare with the USD inflation:

x.wealth_indexes.plot()

2. Create a dividend stocks portfolio with base currency EUR

weights = [0.3, 0.2, 0.2, 0.2, 0.1]
assets = ['T.US', 'XOM.US', 'FRE.XFRA', 'SNW.XFRA', 'LKOH.MOEX']
pf = ok.Portfolio(assets, weights=weights, ccy='EUR')
pf.table

Plot the dividend yield of the portfolio (adjusted to the base currency).

pf.dividend_yield.plot()

3. Draw an Efficient Frontier for 2 popular ETF: SPY and GLD

ls = ['SPY.US', 'GLD.US']
curr = 'USD'
last_date='2020-10'
# Rebalancing periods is one year (default value)
frontier = ok.EfficientFrontierReb(ls, last_date=last_date, ccy=curr, rebalancing_period='year')
frontier.names

Get the Efficient Frontier points for rebalanced portfolios and plot the chart with the assets risk/CAGR points:

import matplotlib.pyplot as plt

points = frontier.ef_points

fig = plt.figure(figsize=(12,6))
fig.subplots_adjust(bottom=0.2, top=1.5)
frontier.plot_assets(kind='cagr')  # plots the assets points on the chart
ax = plt.gca()
ax.plot(points.Risk, points.CAGR) 


* - rebalancing period is one year.

4. Get a Transition Map for allocations

ls = ['SPY.US', 'GLD.US', 'BND.US']
map = ok.EfficientFrontier(ls, ccy='USD').plot_transition_map(cagr=False)

More examples are available in form of Jupyter Notebooks.

Documentation

The official documentation is hosted on readthedocs.org: https://okama.readthedocs.io/

RoadMap

The plan for okama is to add more functions that will be useful to investors and asset managers.

  • Add Omega ratio to EfficientFrontier, EfficientFrontierReb and Portfolio classes.
  • Add withdrawals as an attribute of Portfolio class.
  • Add Black-Litterman asset allocation
  • Accelerate optimization for multi-period Efficient Frontier: minimize_risk and maximize_risk methods of EfficientFrontierReb class.
  • Make a single EfficientFrontier class for all optimizations: single-period or multu-period with rebalancing period as a parameter.
  • Add different utility functions for optimizers: semi-deviation, VaR, CVaR, drawdowns etc.
  • Add more functions based on suggestion of users.

Contributing to okama

Contributions are most welcome. Have a look at the Contribution Guide for more.
Feel free to ask questions on Discussuions.
As contributors and maintainers to this project, you are expected to abide by okama' code of conduct. More information can be found at: Contributor Code of Conduct

Communication

For basic usage questions (e.g., "Is XXX currency supported by okama?") and for sharing ideas please use GitHub Discussions. Russian language community is available at okama.io forums.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].