cauldnz / Empyrial

AI and data-driven quantitative portfolio management for risk and performance analytics 投资组合管理

Home Page:https://ssantoshp.github.io/Empyrial/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

By Investors, For Investors.











Open In Colab



Want to read this in Chinese? Click here

Empyrial is a Python-based open-source quantitative investment library dedicated to financial institutions and retail investors, officially released in Mars 2021. Already used by thousands of people working in the finance industry, Empyrial aims to become an all-in-one platform for portfolio management, analysis, and optimization.

Empyrial empowers portfolio management by bringing different financial approaches such as risk analysis, quantitative analysis, fundamental analysis, factor analysis and prediction making.

With Empyrial, you can easily analyze security or a portfolio with these different approaches and get the best insights from it.



Installation

You can install Empyrial using pip:

pip install empyrial

For a better experience, we advise you to use Empyrial on a notebook (Jupyter, Google Colab...)

Features

Feature 📰 Status
Empyrial (backtesting + performance analysis) Released on May 30, 2021
Oracle (prediction lens using several ML models) 👽 Beta on Jun 1, 2021
Fundamental lens 👽 Beta on Jun 6, 2021
Optimizer Released on Jun 7, 2021
Rebalancing Released on Jun 27, 2021
Risk factors lens 😸 In development...
Sentiment lens 😸 In development...

Here are the functions available with Empyrial:

  • empyrial : quantitative portfolio analytics | Quickstart | Documentation

  • oracle : prediction generation on your portfolio using several prediction models (Prophet, Auto-ARIMA, Fast Fourier Transform...) | Quickstart | Documentation

  • fundlens : fundamental analysis of each of the assets in your portfolio | Quickstart | Documentation

  • optimizer : optimize the asset's allocation in your portfolio | Quickstart

Usage

Empyrial

from empyrial import empyrial, Engine

portfolio = Engine(    
                  start_date= "2018-06-09", 
                  portfolio= ["BABA", "RELIANCE.NS", "KO", "^DJI","^IXIC"], 
                  weights = [0.2, 0.2, 0.2, 0.2, 0.2], #equal weighting by default
                  benchmark = ["SPY"] #SPY by default
)

empyrial(portfolio)

>> See the output

If you want to add rebalancing (calendar-based) to your strategy you can do that:

from empyrial import empyrial, Engine

portfolio = Engine(    
                  start_date= "2018-06-09", 
                  portfolio= ["BABA", "RELIANCE.NS", "KO", "^DJI","^IXIC"], 
                  benchmark = ["SPY"], #SPY by default
		  optimizer = "EF",
		  rebalance = "1y"
)

empyrial(portfolio)

Time periods available for rebalancing are 2y,1y,6mo,quarterly,monthly


Fundlens

from empyrial import fundlens, Engine

portfolio = Engine(    
                  start_date= "2020-06-09", 
                  portfolio= ["BABA", "RELIANCE.NS", "KO", "^DJI","^IXIC"], 
                  weights = [0.2, 0.2, 0.2, 0.2, 0.2], #optional
                  benchmark = ["SPY"] #optional
)

fundlens(portfolio)

>> See the output

Oracle

from empyrial import oracle, Engine

portfolio = Engine(    
                  start_date= "2020-06-09", 
                  portfolio= ["BABA", "RELIANCE.NS", "KO", "^DJI","^IXIC"], 
                  weights = [0.2, 0.2, 0.2, 0.2, 0.2], 
                  benchmark = ["SPY"] 
)

oracle(portfolio)

>> See the output


Optimizer

There are 3 optimizers available:

  • "EF": Global Efficient Frontier

  • "MEANVAR": Mean-Variance (in this case, you'll have to define a max volatility that you don't want to exceed)

  • "HRP": Hierarchical Risk Parity

  • "MINVAR": Minimum-Variance

  • "BL": Black Litterman

Note: the default optimizer is equal weighting

There is two ways to use the Empyrial's optimizer :

  1. Optimize allocation directly with Engine
from empyrial import*

portfolio = Engine(
      start_date = "2018-01-01",
      portfolio = ["BLK", "BAC", "AAPL", "TM", "JPM","JD", "INTU", "NVDA", "DIS", "TSLA"],
      optimizer = "EF" 
)

portfolio.weights

Output:

[0.31409, 0.0, 0.03472, 0.00046, 0.0, 0.0, 0.069, 0.08831, 0.00854, 0.48489]
  1. See the performance of an optimizer
from empyrial import*

portfolio = Engine(
      start_date = "2018-01-01",
      portfolio = ["BLK", "BAC", "AAPL", "TM", "JPM","JD", "INTU", "NVDA", "DIS", "TSLA"]
)

#for efficient frontier
optimizer(portfolio, "EF")

#for hierarchical risk parity
optimizer(portfolio, "HRP")

#for mean variance
optimizer(portfolio, "MV", vol_max=0.15)

>> See the output

Download the Tearsheet

Want to download a tear sheet of the analysis as a PDF or HTML file? You can check out documentation to find out how to do this.

Stargazers over time

追星族的时间

Contribution and Issues

  • Create Issue - For the larger changes (such as new features, large refactoring, etc.) it is best to first open an issue to discuss, and smaller improvements (such as document improvements, bugfixes, etc.) can be sent directly to PR

  • Fork Empyrial - Click the Fork button in the upper right corner

  • Clone your own fork: git clone https://github.com/ssantoshp/Empyrial.git

  • Empyrial uses GitHub to host its source code, if you wish to contribute code please use the PR (Pull Request) process of GitHub: pull requests. It'll waiting for review, checked/modified and be merged!

Contributors

Thanks goes to these wonderful people (emoji key):

All Contributors


Renan Lopes

💻 🐛

Diego Alvarez

💻🐛

Rakesh Bhat

💻

Anh Le

🐛

Tony Zhang

💻

Ikko Ashimine

✒️

QuantNomad

📹

Adam Nelsson

📓

This project follows the all-contributors specification. Contributions of any kind are welcome!

Contact

You are welcome to contact us by email at santoshpassoubady@gmail.com or in Empyrial's discussion space

License

MIT

About

AI and data-driven quantitative portfolio management for risk and performance analytics 投资组合管理

https://ssantoshp.github.io/Empyrial/

License:MIT License


Languages

Language:Python 100.0%