Skip to content

Commit f81920c

Browse files
authored
Merge pull request #11 from mbk-dev/dev
feat: several improvements to Portoflio and AssetList classes, CONTRIBUTING.md
2 parents c651547 + f6a0138 commit f81920c

18 files changed

+927
-561
lines changed

CONTRIBUTING.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Contributing to Okama
2+
3+
Thank you for your interest in _okama_ and wanting to contribute. Your help is much appreciated.
4+
5+
Here are some guidelines for contributing.
6+
7+
Please refer to the [RoadMap](https://github.com/mbk-dev/okama/blob/master/README.md#roadmap) for a list of areas where _okama_ could benefit
8+
from. In addition, the following is always welcome:
9+
10+
- Report bugs using [Issues](https://github.com/mbk-dev/okama/issues)
11+
- Request new functionality and enhancement in [Discussions](https://github.com/mbk-dev/okama/discussions)
12+
- Improve performance of existing code
13+
- Help us to write tests. If you learn about quantitative finance and/or unit testing in python it's a good place to start. Test coverage of _okama_ could be verified at [Coveralls](https://coveralls.io/github/mbk-dev/okama?branch=dev).
14+
15+
## Guidelines
16+
17+
### Seek early feedback
18+
19+
Before you start coding your contribution, it may be wise to raise an issue on GitHub to discuss whether the contribution is appropriate for the project.
20+
21+
### Create a fork
22+
First off, you should create a fork. Within your fork, create a new branch. Depending on what you want to do, choose one of the following prefixes for your branch:
23+
- fix: <name of your fix> to be used for bug fixes
24+
- feat: <name of new feature> to be used for adding a new feature
25+
26+
### Commit your changes
27+
Make your changes to the code, and write sensible commit messages.
28+
29+
In general [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) is recommended for the commits.
30+
31+
### Code style
32+
33+
To keep everything consistent, please use [Black](https://github.com/psf/black) with default settings.
34+
35+
### Testing
36+
37+
Any contributions **must** be accompanied by unit tests (written with `pytest`). These are very simple to write. Just find the relevant test file (or create a new one), and write some `assert` statements. If you need a data presets please use [tests/conftests.py](tests/conftests.py) fixtures. Tests should cover core functionality, warnings/errors (check that they are raised as expected), and limiting behaviour or edge cases.
38+
39+
### Documentation
40+
41+
We would appreciate if changes are accompanied by relevant documentation.
42+
43+
Inline comments (and docstrings!) are great when needed, but don't go overboard. A lot of the explanation can and should be offloaded to ReadTheDocs. Docstrings should follow [PEP257](https://stackoverflow.com/questions/2557110/what-to-put-in-a-python-module-docstring) semantically. Okama uses `sphinx` and "numpy" style generate Documentation automatically from docstrings.
44+
45+
### Create a Pull Request
46+
Create a new [Pull Request](https://github.com/mbk-dev/okama/pulls). Describe what your changes are in the Pull Request. If your contribution fixes a bug, or adds a features listed under [issues](https://github.com/mbk-dev/okama/issues) as "#12", please add "fixes #12" or "closes #12".
47+
48+
## Questions
49+
50+
If you have any questions related to the project, it is probably easiest to ask it in [Discussions](https://github.com/mbk-dev/okama/discussions).
51+
52+
## Bugs/issues
53+
54+
If you find any bugs, feel free to [raise an issue](https://github.com/mbk-dev/okama/issues) include as many details as possible and follow the following guidelines:
55+
56+
- Descriptive title so that other users can see the existing issues
57+
- Operating system, python version, and python distribution (optional)
58+
- _okama_ version you are using
59+
- Minimal example for reproducing the issue
60+
- What you expected to happen
61+
- What actually happened
62+
- error messages if applicable

README.md

Lines changed: 38 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<img src="https://img.shields.io/badge/python-v3-brightgreen.svg"
55
alt="python"></a> &nbsp;
66
<a href="https://pypi.org/project/okama/">
7-
<img src="https://img.shields.io/badge/pypi-v0.98-brightgreen.svg"
7+
<img src="https://img.shields.io/badge/pypi-v0.99-brightgreen.svg"
88
alt="pypi"></a> &nbsp;
99
<a href='https://coveralls.io/github/mbk-dev/okama?branch=master'>
1010
<img src='https://coveralls.io/repos/github/mbk-dev/okama/badge.svg?branch=master'
@@ -24,10 +24,24 @@ The package is supplied with **free** «end of day» historical stock markets da
2424
>...entities should not be multiplied without necessity
2525
>
2626
> -- <cite>William of Ockham (c. 1287–1347)</cite>
27+
28+
## Table of contents
29+
30+
- [Okama main features](#okama-main-features)
31+
- [Financial data and macroeconomic indicators](#financial-data-and-macroeconomic-indicators)
32+
- [End of day historical data](#end-of-day-historical-data)
33+
- [Macroeconomic indicators](#macroeconomic-indicators)
34+
- [Other historical data](#other-historical-data)
35+
- [Installation](#installation)
36+
- [Getting started](#getting-started)
37+
- [RoadMap](#roadmap)
38+
- [Contributing to okama](#contributing-to-okama)
39+
- [Communication](#communication)
40+
2741
## Okama main features
2842

2943
- Investment portfolio constrained Markowitz Mean-Variance Analysis (MVA) and optimization
30-
- Rebalanced portfolio optimization
44+
- Rebalanced portfolio optimization with constraints (multi-period Efficient Frontier)
3145
- Monte Carlo Simulations for financial assets and investment portfolios
3246
- Popular risk metrics: VAR, CVaR, semi-deviation, variance and drawdowns
3347
- Forecasting models according to normal and lognormal distribution
@@ -50,7 +64,7 @@ The package is supplied with **free** «end of day» historical stock markets da
5064

5165
### Macroeconomic indicators
5266

53-
- Inflation
67+
- Inflation for many countries (USA, United Kingdom, European Union, Russia etc.)
5468
- Central bank rates
5569

5670
### Other historical data
@@ -62,9 +76,10 @@ The package is supplied with **free** «end of day» historical stock markets da
6276

6377
`pip install okama`
6478

65-
or:
79+
The latest development version can be installed directly from GitHub:
80+
81+
`pip install git+https://github.com/mbk-dev/okama@dev`
6682

67-
`pip install git+https://github.com/mbk-dev/okama`
6883

6984
## Getting started
7085

@@ -139,17 +154,29 @@ map = ok.Plots(ls, ccy='USD').plot_transition_map(cagr=False)
139154

140155
More examples are available in [Jupyter Notebooks](https://github.com/mbk-dev/okama/tree/master/notebooks).
141156

142-
## Communication
157+
## RoadMap
143158

144-
For basic usage questions (e.g., "_Is XXX currency supported by okama?_") and for sharing ideas please use [GitHub Discussions](https://github.com/mbk-dev/okama/discussions/3).
145-
Russian language community is available at [okama.io forums](https://community.okama.io/c/python-okama).
146-
## Issues
159+
The plan for _okama_ is to add more functions that will be useful to investors and asset managers.
147160

148-
We encourage you to report issues using the [Github tracker](https://github.com/mbk-dev/okama/issues). We welcome all kinds of issues, especially those related to correctness, documentation, performance, and feature requests.
161+
- Make documentation for the package. Finish docstrings for modules, classes, methods and functions.
162+
- Add Sharpe, Sortino and Diversification ratios to EfficientFrontier, EfficientFrontierReb and Portfolio classes.
163+
- Make rebalancing period an attribute of Portfolio class.
164+
- Add withdrawals as an attribute of Portfolio class.
165+
- Make AssetList class accept Portfolio instances in a list of assets
166+
- Add Black-Litterman asset allocation
167+
- Accelerate optimization for multi-period Efficient Frontier: minimize_risk and maximize_risk methods of EfficientFrontierReb class.
168+
- Make a single EfficientFrontier class for all optimizations: single-period or multu-period with rebalancing period as a parameter.
169+
- Add different utility functions for optimizers: semi-deviation, VaR, CVaR, drawdowns etc.
170+
- Add more functions based on suggestion of users.
149171

150172
## Contributing to okama
151173

152-
All contributions, bug reports, bug fixes, documentation improvements, enhancements, frontend implementation and ideas are welcome.
174+
Contributions are *most welcome*. Have a look at the [Contribution Guide](https://github.com/mbk-dev/okama/blob/master/CONTRIBUTING.md) for more.
175+
176+
## Communication
177+
178+
For basic usage questions (e.g., "_Is XXX currency supported by okama?_") and for sharing ideas please use [GitHub Discussions](https://github.com/mbk-dev/okama/discussions/3).
179+
Russian language community is available at [okama.io forums](https://community.okama.io/c/python-okama).
153180

154181
## License
155182

main.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
import okama as ok
22

3-
x = ok.AssetList()
4-
print(x.get_cumulative_return(period=0))
3+
lse = ok.AssetList(['INRG.LSE'], ccy='GBP')

notebooks/01 howto.ipynb

Lines changed: 203 additions & 202 deletions
Large diffs are not rendered by default.

notebooks/02 index funds perfomance.ipynb

Lines changed: 13 additions & 20 deletions
Large diffs are not rendered by default.

notebooks/03 efficient frontier single period.ipynb

Lines changed: 90 additions & 90 deletions
Large diffs are not rendered by default.

notebooks/04 efficient frontier multi-period.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -807,9 +807,9 @@
807807
],
808808
"metadata": {
809809
"kernelspec": {
810-
"display_name": "py38",
810+
"display_name": "py39",
811811
"language": "python",
812-
"name": "py38"
812+
"name": "py39"
813813
},
814814
"language_info": {
815815
"codemirror_mode": {
@@ -821,7 +821,7 @@
821821
"name": "python",
822822
"nbconvert_exporter": "python",
823823
"pygments_lexer": "ipython3",
824-
"version": "3.8.5"
824+
"version": "3.9.1"
825825
}
826826
},
827827
"nbformat": 4,

okama/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@
3838
from okama.common.helpers import Float, Frame, Rebalance, Date
3939
import okama.settings
4040

41-
__version__ = "0.98"
41+
__version__ = "0.99"

okama/api/api_methods.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
class API:
77
"""
88
Set of methods to data from API.
9-
TODO: introduce 'from' & 'to' for dates.
109
"""
10+
# TODO: introduce 'from' & 'to' for dates.
1111

1212
api_url = "http://185.63.191.70:5000"
1313

0 commit comments

Comments
 (0)