diff options
Diffstat (limited to 'python-empyrial.spec')
| -rw-r--r-- | python-empyrial.spec | 996 |
1 files changed, 996 insertions, 0 deletions
diff --git a/python-empyrial.spec b/python-empyrial.spec new file mode 100644 index 0000000..3fbdca0 --- /dev/null +++ b/python-empyrial.spec @@ -0,0 +1,996 @@ +%global _empty_manifest_terminate_build 0 +Name: python-empyrial +Version: 2.0.1 +Release: 1 +Summary: An Open Source Portfolio Management Framework for Everyone 投资组合管理 +License: MIT +URL: https://github.com/ssantoshp/Empyrial +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/0e/b1/18cfd6aff0494c7476da16f2163520a76a39b88dd89710679397800c8522/empyrial-2.0.1.tar.gz +BuildArch: noarch + +Requires: python3-numpy +Requires: python3-matplotlib +Requires: python3-datetime +Requires: python3-empyrical +Requires: python3-quantstats +Requires: python3-yfinance +Requires: python3-ipython +Requires: python3-fpdf +Requires: python3-pyportfolioopt + +%description +# By Investors, For Investors. + +<br><br><br><br> + +<div align="center"> +<img src="https://user-images.githubusercontent.com/61618641/120909011-98f8a180-c670-11eb-8844-2d423ba3fa9c.png"/> +<br><br><br><br><br><br> + + + + + + + +[](https://colab.research.google.com/drive/1NqTkkP2u1p1g8W8erU-Y-rSSVbPUDvq2?usp=sharing) + + </div> + +<br> + +Empyrial is a Python-based **open-source quantitative investment** library dedicated to **financial institutions** and **retail investors**, officially released in March 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 the best of **performance and risk analysis** in an **easy-to-understand**, **flexible** and **powerful framework**. + +With Empyrial, you can easily analyze security or a portfolio in order to **get the best insights from it**. + +<br> + +<br> + +<div align="center"> + +| Table of Contents 📖 | +| -- +| 1. [Installation](#installation) | +| 2. [Features](#features) | +| 3. [Documentation](#documentation) | +| 4. [Usage example](#usage) | +| 5. [Download the tearsheet](#download-the-tearsheet) | +| 6. [Contribution and Issues](#contribution-and-issues) | +| 7. [Contributors](#contributors) | +| 8. [Contact](#contact) | +| 9. [License](#license) | + +</div> + +## Installation + +You can install Empyrial using pip: + +``` +pip install empyrial +``` + +For a better experience, **we advise you to use Empyrial on a notebook** (e.g., Jupyter, Google Colab) + +_Note: macOS users will need to install [Xcode Command Line Tools](https://osxdaily.com/2014/02/12/install-command-line-tools-mac-os-x/)._ + +_Note: Windows users will need to install C++. ([download](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools&rel=16), [install instructions](https://drive.google.com/file/d/0B4GsMXCRaSSIOWpYQkstajlYZ0tPVkNQSElmTWh1dXFaYkJr/view))_ + +## Features + +<div align="center"> + +| Feature 📰 | Status | +| -- | ------ | +| Engine (backtesting + performance analysis) | :star: [Released](https://github.com/ssantoshp/Empyrial/releases/tag/1.2.4) on May 30, 2021 | +| Optimizer | :star: [Released](https://github.com/ssantoshp/Empyrial/releases/tag/1.3.6) on Jun 7, 2021 | +| Rebalancing | :star: [Released](https://github.com/ssantoshp/Empyrial/releases/tag/1.5.0) on Jun 27, 2021 | +| Risk manager | :star: [Released](https://github.com/ssantoshp/Empyrial/releases/tag/v1.7.3) on Jul 5, 2021 | +| Sandbox | :star: [Released](https://github.com/ssantoshp/Empyrial/releases/tag/v1.9.1) on Jul 17, 2021 | + +</div> + +## Documentation + +[Full documentation](https://empyrial.gitbook.io/empyrial/) (website) + +[Full documentation](https://github.com/ssantoshp/Empyrial/blob/main/empyrial_documentation.pdf) (PDF) + +## Usage + +### Empyrial Engine + +```py +from empyrial import empyrial, Engine + +portfolio = Engine( + start_date = "2018-06-09", + portfolio = ["BABA", "PDD", "KO", "AMD","^IXIC"], + weights = [0.2, 0.2, 0.2, 0.2, 0.2], # equal weighting is set by default + benchmark = ["SPY"] # SPY is set by default +) + +empyrial(portfolio) +``` + +### Calendar Rebalancing + +A portfolio can be rebalanced for either a specific time period or for specific dates using the `rebalance` option. + +#### Rebalance for Time Period + +Time periods available for rebalancing are +`2y`, `1y`, `6mo`, `quarterly`, `monthly` + +```py +from empyrial import empyrial, Engine + +portfolio = Engine( + start_date = "2018-06-09", + portfolio = ["BABA", "PDD", "KO", "AMD","^IXIC"], + weights = [0.2, 0.2, 0.2, 0.2, 0.2], # equal weighting is set by default + benchmark = ["SPY"], # SPY is set by default + rebalance = "1y" +) + +empyrial(portfolio) +``` + +#### Rebalance for Custom Dates + +You can rebalance a portfolio by specifying a list of custom dates. +⚠️ When using custom dates, the first date of the list must correspond with the `start_date` and the last element should correspond to the `end_date` which is **today's date** by default. + +```py +from empyrial import empyrial, Engine + +portfolio = Engine( + start_date = "2018-06-09", + portfolio = ["BABA", "PDD", "KO", "AMD","^IXIC"], + weights = [0.2, 0.2, 0.2, 0.2, 0.2], # equal weighting is set by default + benchmark = ["SPY"], # SPY is set by default + rebalance = ["2018-06-09", "2019-01-01", "2020-01-01", "2021-01-01"] +) + +empyrial(portfolio) +``` + +### Optimizer + +The default optimizer is **equal weighting**. You can specify custom weights, if desired. + +```py +from empyrial import empyrial, Engine + +portfolio = Engine( + start_date = "2018-01-01", + portfolio = ["BABA", "PDD", "KO", "AMD","^IXIC"], + weights = [0.1, 0.3, 0.15, 0.25, 0.2], # custom weights + rebalance = "1y" # rebalance every year +) + +empyrial(portfolio) +``` + +You can also use the **built-in optimizers**. There are 4 optimizers available: + +- `"EF"`: **Global Efficient Frontier** [Example](https://empyrial.gitbook.io/empyrial/optimization/global-efficient-frontier) +- `"MEANVAR"`: **Mean-Variance** [Example](https://empyrial.gitbook.io/empyrial/optimization/mean-variance) +- `"HRP"`: **Hierarchical Risk Parity** [Example](https://empyrial.gitbook.io/empyrial/optimization/hierarchical-risk-parity) +- `"MINVAR"`: **Minimum-Variance** [Example](https://empyrial.gitbook.io/empyrial/optimization/minimum-variance) + +```py +from empyrial import empyrial, Engine + +portfolio = Engine( + start_date = "2018-01-01", + portfolio = ["BABA", "PDD", "KO", "AMD","^IXIC"], + optimizer = "EF", + rebalance = "1y" # rebalance every year +) + +portfolio.weights +``` + +> Output: + +``` +[0.0, 0.0, 0.0348, 0.9652, 0.0] +``` + +We can see that the allocation has been optimized. + +### Risk Manager + +3 Risk Managers are available: + +- **Max Drawdown**: `{"Max Drawdown" : -0.3}` [Example](https://empyrial.gitbook.io/empyrial/risk-management/max-drawdown) +- **Take Profit**: `{"Take Profit" : 0.4}` [Example](https://empyrial.gitbook.io/empyrial/risk-management/take-profit) +- **Stop Loss**: `{"Stop Loss" : -0.2}` [Example](https://empyrial.gitbook.io/empyrial/risk-management/stop-loss) + +```py +from empyrial import empyrial, Engine + +portfolio = Engine( + start_date = "2018-01-01", + portfolio= ["BABA", "PDD", "KO", "AMD","^IXIC"], + optimizer = "EF", + rebalance = "1y", # rebalance every year + risk_manager = {"Max Drawdown" : -0.2} # Stop the investment when the drawdown becomes superior to -20% +) + +empyrial(portfolio) +``` + +### Empyrial Outputs + +<div align="center"> + + + + + + + + + + + + + +</div> + +## Download the Tearsheet + +You can use the `get_report()` function of Empyrial to generate a tearsheet, and then download this as a PDF document. + +```py +from empyrial import get_report, Engine + +portfolio = Engine( + start_date = "2018-01-01", + portfolio = ["BABA", "PDD", "KO", "AMD","^IXIC"], + optimizer = "EF", + rebalance = "1y", #rebalance every year + risk_manager = {"Stop Loss" : -0.2} +) + +get_report(portfolio) +``` + +> Output: + + + +## Stargazers over time + +<div align="center"> + + + +</div> + +## Contribution and Issues + +Empyrial uses GitHub to host its source code. _Learn more about the [Github flow](https://docs.github.com/en/get-started/quickstart/github-flow)._ + +For larger changes (e.g., new feature request, large refactoring), please open an issue to discuss first. + +- If you wish to create a new Issue, then [click here to create a new issue](https://github.com/ssantoshp/Empyrial/issues/new/choose). + +Smaller improvements (e.g., document improvements, bugfixes) can be handled by the Pull Request process of GitHub: [pull requests](https://github.com/ssantoshp/Empyrial/pulls). + +- To contribute to the code, you will need to do the following: + +- [Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo#forking-a-repository) [Empyrial](https://github.com/ssantoshp/Empyrial) - Click the **Fork** button at the upper right corner of this page. +- [Clone your own fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo#cloning-your-forked-repository). E.g., `git clone https://github.com/ssantoshp/Empyrial.git` + _If your fork is out of date, then will you need to manually sync your fork: [Synchronization method](https://help.github.com/articles/syncing-a-fork/)_ +- [Create a Pull Request](https://github.com/ssantoshp/Empyrial/pulls) using **your fork** as the `compare head repository`. + +You contributions will be reviewed, potentially modified, and hopefully merged into Empyrial. + +## Contributors + +Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): + +[](#contributors-) + +<table> + <tr> + <td align="center"><a href="https://github.com/rslopes"><img src="https://avatars.githubusercontent.com/u/24928343?v=4" width="100px;" alt=""/><br /><sub><b>Renan Lopes</b></sub></a><br /><a title="Code">💻</a> <a title="Bug report">🐛</a></td> + <td align="center"><a href="https://github.com/markthebault"><img src="https://avatars.githubusercontent.com/u/3846664?v=4" width="100px;" alt=""/><br /><sub><b>Mark Thebault</b></sub></a><br /><a title="Code">💻</a></td> + <td align="center"><a href="https://github.com/diegodalvarez"><img src="https://avatars.githubusercontent.com/u/48641554?v=4" width="100px;" alt=""/><br /><sub><b>Diego Alvarez</b></sub></a><br /><a title="Code">💻🐛</a></td> + <td align="center"><a href="https://github.com/rakeshbhat9"><img src="https://avatars.githubusercontent.com/u/11472305?v=4" width="100px;" alt=""/><br /><sub><b>Rakesh Bhat</b></sub></a><br /><a title="Code">💻</a></td> + <td align="center"><a href="https://github.com/Haizzz"><img src="https://avatars.githubusercontent.com/u/5275680?v=4" width="100px;" alt=""/><br /><sub><b>Anh Le</b></sub></a><br /><a title="Bug report">🐛</a></td> + <td align="center"><a href="https://github.com/TonyZhangkz"><img src="https://avatars.githubusercontent.com/u/65281213?v=4" width="100px;" alt=""/><br /><sub><b>Tony Zhang</b></sub></a><br /><a title="Code">💻</a></td> + <td align="center"><a href="https://github.com/eltociear"><img src="https://avatars.githubusercontent.com/u/22633385?v=4" width="100px;" alt=""/><br /><sub><b>Ikko Ashimine</b></sub></a><br /><a title="Code">✒️</a></td> + <td align="center"><a href="https://www.youtube.com/watch?v=-4qx3tbtTgs"><img src="https://avatars.githubusercontent.com/u/50767660?v=4" width="100px;" alt=""/><br /><sub><b>QuantNomad</b></sub></a><br /><a title="Code">📹</a></td> + <td align="center"><a href="https://github.com/buckleyc"><img src="https://avatars.githubusercontent.com/u/4175900?v=4" width="100px;" alt=""/><br /><sub><b>Buckley</b></sub></a><br /><a title="Code">✒️💻</a></td> + <td align="center"><a href="https://github.com/agn35"><img src="https://lh3.googleusercontent.com/a-/AOh14GhXGFHHpVQTL2r23oEXFssH0f7RyoGDihrS_HmT=s48" width="100px;" alt=""/><br /><sub><b>Adam Nelsson</b></sub></a><br /><a title="Code">📓</a></td> + </tr> +</table> + +This project follows the [all-contributors](https://github.com/all-contributors/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](https://github.com/ssantoshp/Empyrial/discussions) + +## License + +MIT + + + + +%package -n python3-empyrial +Summary: An Open Source Portfolio Management Framework for Everyone 投资组合管理 +Provides: python-empyrial +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-empyrial +# By Investors, For Investors. + +<br><br><br><br> + +<div align="center"> +<img src="https://user-images.githubusercontent.com/61618641/120909011-98f8a180-c670-11eb-8844-2d423ba3fa9c.png"/> +<br><br><br><br><br><br> + + + + + + + +[](https://colab.research.google.com/drive/1NqTkkP2u1p1g8W8erU-Y-rSSVbPUDvq2?usp=sharing) + + </div> + +<br> + +Empyrial is a Python-based **open-source quantitative investment** library dedicated to **financial institutions** and **retail investors**, officially released in March 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 the best of **performance and risk analysis** in an **easy-to-understand**, **flexible** and **powerful framework**. + +With Empyrial, you can easily analyze security or a portfolio in order to **get the best insights from it**. + +<br> + +<br> + +<div align="center"> + +| Table of Contents 📖 | +| -- +| 1. [Installation](#installation) | +| 2. [Features](#features) | +| 3. [Documentation](#documentation) | +| 4. [Usage example](#usage) | +| 5. [Download the tearsheet](#download-the-tearsheet) | +| 6. [Contribution and Issues](#contribution-and-issues) | +| 7. [Contributors](#contributors) | +| 8. [Contact](#contact) | +| 9. [License](#license) | + +</div> + +## Installation + +You can install Empyrial using pip: + +``` +pip install empyrial +``` + +For a better experience, **we advise you to use Empyrial on a notebook** (e.g., Jupyter, Google Colab) + +_Note: macOS users will need to install [Xcode Command Line Tools](https://osxdaily.com/2014/02/12/install-command-line-tools-mac-os-x/)._ + +_Note: Windows users will need to install C++. ([download](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools&rel=16), [install instructions](https://drive.google.com/file/d/0B4GsMXCRaSSIOWpYQkstajlYZ0tPVkNQSElmTWh1dXFaYkJr/view))_ + +## Features + +<div align="center"> + +| Feature 📰 | Status | +| -- | ------ | +| Engine (backtesting + performance analysis) | :star: [Released](https://github.com/ssantoshp/Empyrial/releases/tag/1.2.4) on May 30, 2021 | +| Optimizer | :star: [Released](https://github.com/ssantoshp/Empyrial/releases/tag/1.3.6) on Jun 7, 2021 | +| Rebalancing | :star: [Released](https://github.com/ssantoshp/Empyrial/releases/tag/1.5.0) on Jun 27, 2021 | +| Risk manager | :star: [Released](https://github.com/ssantoshp/Empyrial/releases/tag/v1.7.3) on Jul 5, 2021 | +| Sandbox | :star: [Released](https://github.com/ssantoshp/Empyrial/releases/tag/v1.9.1) on Jul 17, 2021 | + +</div> + +## Documentation + +[Full documentation](https://empyrial.gitbook.io/empyrial/) (website) + +[Full documentation](https://github.com/ssantoshp/Empyrial/blob/main/empyrial_documentation.pdf) (PDF) + +## Usage + +### Empyrial Engine + +```py +from empyrial import empyrial, Engine + +portfolio = Engine( + start_date = "2018-06-09", + portfolio = ["BABA", "PDD", "KO", "AMD","^IXIC"], + weights = [0.2, 0.2, 0.2, 0.2, 0.2], # equal weighting is set by default + benchmark = ["SPY"] # SPY is set by default +) + +empyrial(portfolio) +``` + +### Calendar Rebalancing + +A portfolio can be rebalanced for either a specific time period or for specific dates using the `rebalance` option. + +#### Rebalance for Time Period + +Time periods available for rebalancing are +`2y`, `1y`, `6mo`, `quarterly`, `monthly` + +```py +from empyrial import empyrial, Engine + +portfolio = Engine( + start_date = "2018-06-09", + portfolio = ["BABA", "PDD", "KO", "AMD","^IXIC"], + weights = [0.2, 0.2, 0.2, 0.2, 0.2], # equal weighting is set by default + benchmark = ["SPY"], # SPY is set by default + rebalance = "1y" +) + +empyrial(portfolio) +``` + +#### Rebalance for Custom Dates + +You can rebalance a portfolio by specifying a list of custom dates. +⚠️ When using custom dates, the first date of the list must correspond with the `start_date` and the last element should correspond to the `end_date` which is **today's date** by default. + +```py +from empyrial import empyrial, Engine + +portfolio = Engine( + start_date = "2018-06-09", + portfolio = ["BABA", "PDD", "KO", "AMD","^IXIC"], + weights = [0.2, 0.2, 0.2, 0.2, 0.2], # equal weighting is set by default + benchmark = ["SPY"], # SPY is set by default + rebalance = ["2018-06-09", "2019-01-01", "2020-01-01", "2021-01-01"] +) + +empyrial(portfolio) +``` + +### Optimizer + +The default optimizer is **equal weighting**. You can specify custom weights, if desired. + +```py +from empyrial import empyrial, Engine + +portfolio = Engine( + start_date = "2018-01-01", + portfolio = ["BABA", "PDD", "KO", "AMD","^IXIC"], + weights = [0.1, 0.3, 0.15, 0.25, 0.2], # custom weights + rebalance = "1y" # rebalance every year +) + +empyrial(portfolio) +``` + +You can also use the **built-in optimizers**. There are 4 optimizers available: + +- `"EF"`: **Global Efficient Frontier** [Example](https://empyrial.gitbook.io/empyrial/optimization/global-efficient-frontier) +- `"MEANVAR"`: **Mean-Variance** [Example](https://empyrial.gitbook.io/empyrial/optimization/mean-variance) +- `"HRP"`: **Hierarchical Risk Parity** [Example](https://empyrial.gitbook.io/empyrial/optimization/hierarchical-risk-parity) +- `"MINVAR"`: **Minimum-Variance** [Example](https://empyrial.gitbook.io/empyrial/optimization/minimum-variance) + +```py +from empyrial import empyrial, Engine + +portfolio = Engine( + start_date = "2018-01-01", + portfolio = ["BABA", "PDD", "KO", "AMD","^IXIC"], + optimizer = "EF", + rebalance = "1y" # rebalance every year +) + +portfolio.weights +``` + +> Output: + +``` +[0.0, 0.0, 0.0348, 0.9652, 0.0] +``` + +We can see that the allocation has been optimized. + +### Risk Manager + +3 Risk Managers are available: + +- **Max Drawdown**: `{"Max Drawdown" : -0.3}` [Example](https://empyrial.gitbook.io/empyrial/risk-management/max-drawdown) +- **Take Profit**: `{"Take Profit" : 0.4}` [Example](https://empyrial.gitbook.io/empyrial/risk-management/take-profit) +- **Stop Loss**: `{"Stop Loss" : -0.2}` [Example](https://empyrial.gitbook.io/empyrial/risk-management/stop-loss) + +```py +from empyrial import empyrial, Engine + +portfolio = Engine( + start_date = "2018-01-01", + portfolio= ["BABA", "PDD", "KO", "AMD","^IXIC"], + optimizer = "EF", + rebalance = "1y", # rebalance every year + risk_manager = {"Max Drawdown" : -0.2} # Stop the investment when the drawdown becomes superior to -20% +) + +empyrial(portfolio) +``` + +### Empyrial Outputs + +<div align="center"> + + + + + + + + + + + + + +</div> + +## Download the Tearsheet + +You can use the `get_report()` function of Empyrial to generate a tearsheet, and then download this as a PDF document. + +```py +from empyrial import get_report, Engine + +portfolio = Engine( + start_date = "2018-01-01", + portfolio = ["BABA", "PDD", "KO", "AMD","^IXIC"], + optimizer = "EF", + rebalance = "1y", #rebalance every year + risk_manager = {"Stop Loss" : -0.2} +) + +get_report(portfolio) +``` + +> Output: + + + +## Stargazers over time + +<div align="center"> + + + +</div> + +## Contribution and Issues + +Empyrial uses GitHub to host its source code. _Learn more about the [Github flow](https://docs.github.com/en/get-started/quickstart/github-flow)._ + +For larger changes (e.g., new feature request, large refactoring), please open an issue to discuss first. + +- If you wish to create a new Issue, then [click here to create a new issue](https://github.com/ssantoshp/Empyrial/issues/new/choose). + +Smaller improvements (e.g., document improvements, bugfixes) can be handled by the Pull Request process of GitHub: [pull requests](https://github.com/ssantoshp/Empyrial/pulls). + +- To contribute to the code, you will need to do the following: + +- [Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo#forking-a-repository) [Empyrial](https://github.com/ssantoshp/Empyrial) - Click the **Fork** button at the upper right corner of this page. +- [Clone your own fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo#cloning-your-forked-repository). E.g., `git clone https://github.com/ssantoshp/Empyrial.git` + _If your fork is out of date, then will you need to manually sync your fork: [Synchronization method](https://help.github.com/articles/syncing-a-fork/)_ +- [Create a Pull Request](https://github.com/ssantoshp/Empyrial/pulls) using **your fork** as the `compare head repository`. + +You contributions will be reviewed, potentially modified, and hopefully merged into Empyrial. + +## Contributors + +Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): + +[](#contributors-) + +<table> + <tr> + <td align="center"><a href="https://github.com/rslopes"><img src="https://avatars.githubusercontent.com/u/24928343?v=4" width="100px;" alt=""/><br /><sub><b>Renan Lopes</b></sub></a><br /><a title="Code">💻</a> <a title="Bug report">🐛</a></td> + <td align="center"><a href="https://github.com/markthebault"><img src="https://avatars.githubusercontent.com/u/3846664?v=4" width="100px;" alt=""/><br /><sub><b>Mark Thebault</b></sub></a><br /><a title="Code">💻</a></td> + <td align="center"><a href="https://github.com/diegodalvarez"><img src="https://avatars.githubusercontent.com/u/48641554?v=4" width="100px;" alt=""/><br /><sub><b>Diego Alvarez</b></sub></a><br /><a title="Code">💻🐛</a></td> + <td align="center"><a href="https://github.com/rakeshbhat9"><img src="https://avatars.githubusercontent.com/u/11472305?v=4" width="100px;" alt=""/><br /><sub><b>Rakesh Bhat</b></sub></a><br /><a title="Code">💻</a></td> + <td align="center"><a href="https://github.com/Haizzz"><img src="https://avatars.githubusercontent.com/u/5275680?v=4" width="100px;" alt=""/><br /><sub><b>Anh Le</b></sub></a><br /><a title="Bug report">🐛</a></td> + <td align="center"><a href="https://github.com/TonyZhangkz"><img src="https://avatars.githubusercontent.com/u/65281213?v=4" width="100px;" alt=""/><br /><sub><b>Tony Zhang</b></sub></a><br /><a title="Code">💻</a></td> + <td align="center"><a href="https://github.com/eltociear"><img src="https://avatars.githubusercontent.com/u/22633385?v=4" width="100px;" alt=""/><br /><sub><b>Ikko Ashimine</b></sub></a><br /><a title="Code">✒️</a></td> + <td align="center"><a href="https://www.youtube.com/watch?v=-4qx3tbtTgs"><img src="https://avatars.githubusercontent.com/u/50767660?v=4" width="100px;" alt=""/><br /><sub><b>QuantNomad</b></sub></a><br /><a title="Code">📹</a></td> + <td align="center"><a href="https://github.com/buckleyc"><img src="https://avatars.githubusercontent.com/u/4175900?v=4" width="100px;" alt=""/><br /><sub><b>Buckley</b></sub></a><br /><a title="Code">✒️💻</a></td> + <td align="center"><a href="https://github.com/agn35"><img src="https://lh3.googleusercontent.com/a-/AOh14GhXGFHHpVQTL2r23oEXFssH0f7RyoGDihrS_HmT=s48" width="100px;" alt=""/><br /><sub><b>Adam Nelsson</b></sub></a><br /><a title="Code">📓</a></td> + </tr> +</table> + +This project follows the [all-contributors](https://github.com/all-contributors/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](https://github.com/ssantoshp/Empyrial/discussions) + +## License + +MIT + + + + +%package help +Summary: Development documents and examples for empyrial +Provides: python3-empyrial-doc +%description help +# By Investors, For Investors. + +<br><br><br><br> + +<div align="center"> +<img src="https://user-images.githubusercontent.com/61618641/120909011-98f8a180-c670-11eb-8844-2d423ba3fa9c.png"/> +<br><br><br><br><br><br> + + + + + + + +[](https://colab.research.google.com/drive/1NqTkkP2u1p1g8W8erU-Y-rSSVbPUDvq2?usp=sharing) + + </div> + +<br> + +Empyrial is a Python-based **open-source quantitative investment** library dedicated to **financial institutions** and **retail investors**, officially released in March 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 the best of **performance and risk analysis** in an **easy-to-understand**, **flexible** and **powerful framework**. + +With Empyrial, you can easily analyze security or a portfolio in order to **get the best insights from it**. + +<br> + +<br> + +<div align="center"> + +| Table of Contents 📖 | +| -- +| 1. [Installation](#installation) | +| 2. [Features](#features) | +| 3. [Documentation](#documentation) | +| 4. [Usage example](#usage) | +| 5. [Download the tearsheet](#download-the-tearsheet) | +| 6. [Contribution and Issues](#contribution-and-issues) | +| 7. [Contributors](#contributors) | +| 8. [Contact](#contact) | +| 9. [License](#license) | + +</div> + +## Installation + +You can install Empyrial using pip: + +``` +pip install empyrial +``` + +For a better experience, **we advise you to use Empyrial on a notebook** (e.g., Jupyter, Google Colab) + +_Note: macOS users will need to install [Xcode Command Line Tools](https://osxdaily.com/2014/02/12/install-command-line-tools-mac-os-x/)._ + +_Note: Windows users will need to install C++. ([download](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools&rel=16), [install instructions](https://drive.google.com/file/d/0B4GsMXCRaSSIOWpYQkstajlYZ0tPVkNQSElmTWh1dXFaYkJr/view))_ + +## Features + +<div align="center"> + +| Feature 📰 | Status | +| -- | ------ | +| Engine (backtesting + performance analysis) | :star: [Released](https://github.com/ssantoshp/Empyrial/releases/tag/1.2.4) on May 30, 2021 | +| Optimizer | :star: [Released](https://github.com/ssantoshp/Empyrial/releases/tag/1.3.6) on Jun 7, 2021 | +| Rebalancing | :star: [Released](https://github.com/ssantoshp/Empyrial/releases/tag/1.5.0) on Jun 27, 2021 | +| Risk manager | :star: [Released](https://github.com/ssantoshp/Empyrial/releases/tag/v1.7.3) on Jul 5, 2021 | +| Sandbox | :star: [Released](https://github.com/ssantoshp/Empyrial/releases/tag/v1.9.1) on Jul 17, 2021 | + +</div> + +## Documentation + +[Full documentation](https://empyrial.gitbook.io/empyrial/) (website) + +[Full documentation](https://github.com/ssantoshp/Empyrial/blob/main/empyrial_documentation.pdf) (PDF) + +## Usage + +### Empyrial Engine + +```py +from empyrial import empyrial, Engine + +portfolio = Engine( + start_date = "2018-06-09", + portfolio = ["BABA", "PDD", "KO", "AMD","^IXIC"], + weights = [0.2, 0.2, 0.2, 0.2, 0.2], # equal weighting is set by default + benchmark = ["SPY"] # SPY is set by default +) + +empyrial(portfolio) +``` + +### Calendar Rebalancing + +A portfolio can be rebalanced for either a specific time period or for specific dates using the `rebalance` option. + +#### Rebalance for Time Period + +Time periods available for rebalancing are +`2y`, `1y`, `6mo`, `quarterly`, `monthly` + +```py +from empyrial import empyrial, Engine + +portfolio = Engine( + start_date = "2018-06-09", + portfolio = ["BABA", "PDD", "KO", "AMD","^IXIC"], + weights = [0.2, 0.2, 0.2, 0.2, 0.2], # equal weighting is set by default + benchmark = ["SPY"], # SPY is set by default + rebalance = "1y" +) + +empyrial(portfolio) +``` + +#### Rebalance for Custom Dates + +You can rebalance a portfolio by specifying a list of custom dates. +⚠️ When using custom dates, the first date of the list must correspond with the `start_date` and the last element should correspond to the `end_date` which is **today's date** by default. + +```py +from empyrial import empyrial, Engine + +portfolio = Engine( + start_date = "2018-06-09", + portfolio = ["BABA", "PDD", "KO", "AMD","^IXIC"], + weights = [0.2, 0.2, 0.2, 0.2, 0.2], # equal weighting is set by default + benchmark = ["SPY"], # SPY is set by default + rebalance = ["2018-06-09", "2019-01-01", "2020-01-01", "2021-01-01"] +) + +empyrial(portfolio) +``` + +### Optimizer + +The default optimizer is **equal weighting**. You can specify custom weights, if desired. + +```py +from empyrial import empyrial, Engine + +portfolio = Engine( + start_date = "2018-01-01", + portfolio = ["BABA", "PDD", "KO", "AMD","^IXIC"], + weights = [0.1, 0.3, 0.15, 0.25, 0.2], # custom weights + rebalance = "1y" # rebalance every year +) + +empyrial(portfolio) +``` + +You can also use the **built-in optimizers**. There are 4 optimizers available: + +- `"EF"`: **Global Efficient Frontier** [Example](https://empyrial.gitbook.io/empyrial/optimization/global-efficient-frontier) +- `"MEANVAR"`: **Mean-Variance** [Example](https://empyrial.gitbook.io/empyrial/optimization/mean-variance) +- `"HRP"`: **Hierarchical Risk Parity** [Example](https://empyrial.gitbook.io/empyrial/optimization/hierarchical-risk-parity) +- `"MINVAR"`: **Minimum-Variance** [Example](https://empyrial.gitbook.io/empyrial/optimization/minimum-variance) + +```py +from empyrial import empyrial, Engine + +portfolio = Engine( + start_date = "2018-01-01", + portfolio = ["BABA", "PDD", "KO", "AMD","^IXIC"], + optimizer = "EF", + rebalance = "1y" # rebalance every year +) + +portfolio.weights +``` + +> Output: + +``` +[0.0, 0.0, 0.0348, 0.9652, 0.0] +``` + +We can see that the allocation has been optimized. + +### Risk Manager + +3 Risk Managers are available: + +- **Max Drawdown**: `{"Max Drawdown" : -0.3}` [Example](https://empyrial.gitbook.io/empyrial/risk-management/max-drawdown) +- **Take Profit**: `{"Take Profit" : 0.4}` [Example](https://empyrial.gitbook.io/empyrial/risk-management/take-profit) +- **Stop Loss**: `{"Stop Loss" : -0.2}` [Example](https://empyrial.gitbook.io/empyrial/risk-management/stop-loss) + +```py +from empyrial import empyrial, Engine + +portfolio = Engine( + start_date = "2018-01-01", + portfolio= ["BABA", "PDD", "KO", "AMD","^IXIC"], + optimizer = "EF", + rebalance = "1y", # rebalance every year + risk_manager = {"Max Drawdown" : -0.2} # Stop the investment when the drawdown becomes superior to -20% +) + +empyrial(portfolio) +``` + +### Empyrial Outputs + +<div align="center"> + + + + + + + + + + + + + +</div> + +## Download the Tearsheet + +You can use the `get_report()` function of Empyrial to generate a tearsheet, and then download this as a PDF document. + +```py +from empyrial import get_report, Engine + +portfolio = Engine( + start_date = "2018-01-01", + portfolio = ["BABA", "PDD", "KO", "AMD","^IXIC"], + optimizer = "EF", + rebalance = "1y", #rebalance every year + risk_manager = {"Stop Loss" : -0.2} +) + +get_report(portfolio) +``` + +> Output: + + + +## Stargazers over time + +<div align="center"> + + + +</div> + +## Contribution and Issues + +Empyrial uses GitHub to host its source code. _Learn more about the [Github flow](https://docs.github.com/en/get-started/quickstart/github-flow)._ + +For larger changes (e.g., new feature request, large refactoring), please open an issue to discuss first. + +- If you wish to create a new Issue, then [click here to create a new issue](https://github.com/ssantoshp/Empyrial/issues/new/choose). + +Smaller improvements (e.g., document improvements, bugfixes) can be handled by the Pull Request process of GitHub: [pull requests](https://github.com/ssantoshp/Empyrial/pulls). + +- To contribute to the code, you will need to do the following: + +- [Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo#forking-a-repository) [Empyrial](https://github.com/ssantoshp/Empyrial) - Click the **Fork** button at the upper right corner of this page. +- [Clone your own fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo#cloning-your-forked-repository). E.g., `git clone https://github.com/ssantoshp/Empyrial.git` + _If your fork is out of date, then will you need to manually sync your fork: [Synchronization method](https://help.github.com/articles/syncing-a-fork/)_ +- [Create a Pull Request](https://github.com/ssantoshp/Empyrial/pulls) using **your fork** as the `compare head repository`. + +You contributions will be reviewed, potentially modified, and hopefully merged into Empyrial. + +## Contributors + +Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): + +[](#contributors-) + +<table> + <tr> + <td align="center"><a href="https://github.com/rslopes"><img src="https://avatars.githubusercontent.com/u/24928343?v=4" width="100px;" alt=""/><br /><sub><b>Renan Lopes</b></sub></a><br /><a title="Code">💻</a> <a title="Bug report">🐛</a></td> + <td align="center"><a href="https://github.com/markthebault"><img src="https://avatars.githubusercontent.com/u/3846664?v=4" width="100px;" alt=""/><br /><sub><b>Mark Thebault</b></sub></a><br /><a title="Code">💻</a></td> + <td align="center"><a href="https://github.com/diegodalvarez"><img src="https://avatars.githubusercontent.com/u/48641554?v=4" width="100px;" alt=""/><br /><sub><b>Diego Alvarez</b></sub></a><br /><a title="Code">💻🐛</a></td> + <td align="center"><a href="https://github.com/rakeshbhat9"><img src="https://avatars.githubusercontent.com/u/11472305?v=4" width="100px;" alt=""/><br /><sub><b>Rakesh Bhat</b></sub></a><br /><a title="Code">💻</a></td> + <td align="center"><a href="https://github.com/Haizzz"><img src="https://avatars.githubusercontent.com/u/5275680?v=4" width="100px;" alt=""/><br /><sub><b>Anh Le</b></sub></a><br /><a title="Bug report">🐛</a></td> + <td align="center"><a href="https://github.com/TonyZhangkz"><img src="https://avatars.githubusercontent.com/u/65281213?v=4" width="100px;" alt=""/><br /><sub><b>Tony Zhang</b></sub></a><br /><a title="Code">💻</a></td> + <td align="center"><a href="https://github.com/eltociear"><img src="https://avatars.githubusercontent.com/u/22633385?v=4" width="100px;" alt=""/><br /><sub><b>Ikko Ashimine</b></sub></a><br /><a title="Code">✒️</a></td> + <td align="center"><a href="https://www.youtube.com/watch?v=-4qx3tbtTgs"><img src="https://avatars.githubusercontent.com/u/50767660?v=4" width="100px;" alt=""/><br /><sub><b>QuantNomad</b></sub></a><br /><a title="Code">📹</a></td> + <td align="center"><a href="https://github.com/buckleyc"><img src="https://avatars.githubusercontent.com/u/4175900?v=4" width="100px;" alt=""/><br /><sub><b>Buckley</b></sub></a><br /><a title="Code">✒️💻</a></td> + <td align="center"><a href="https://github.com/agn35"><img src="https://lh3.googleusercontent.com/a-/AOh14GhXGFHHpVQTL2r23oEXFssH0f7RyoGDihrS_HmT=s48" width="100px;" alt=""/><br /><sub><b>Adam Nelsson</b></sub></a><br /><a title="Code">📓</a></td> + </tr> +</table> + +This project follows the [all-contributors](https://github.com/all-contributors/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](https://github.com/ssantoshp/Empyrial/discussions) + +## License + +MIT + + + + +%prep +%autosetup -n empyrial-2.0.1 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-empyrial -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Fri May 05 2023 Python_Bot <Python_Bot@openeuler.org> - 2.0.1-1 +- Package Spec generated |
