Skip to content

Commit d8e363d

Browse files
authored
Merge pull request #12 from mbk-dev/dev
Version 1.0.0: Portfolio is an asset and can be included in the AssetList
2 parents f65307f + bb9bde5 commit d8e363d

File tree

137 files changed

+35275
-7070
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+35275
-7070
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ install:
88
- pip install -r requirements_test.txt
99
- pip install pytest-cov
1010
- pip install coveralls
11+
- pip install ipykernel
1112
# command to run tests
1213
script:
1314
- pytest tests --cov=okama/
1415
after_success:
15-
- coveralls
16+
- coveralls

README.md

Lines changed: 16 additions & 13 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.99-brightgreen.svg"
7+
<img src="https://img.shields.io/badge/pypi-v1.0.0-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'
@@ -87,15 +87,16 @@ The latest development version can be installed directly from GitHub:
8787

8888
```python
8989
import okama as ok
90+
9091
x = ok.AssetList(['SPY.US', 'BND.US', 'DBXD.XETR'], ccy='USD')
91-
print(x)
92+
x # all examples are for Jupyter Notebook/iPython. For raw Python interpreter use 'print(x)' instead.
9293

9394
```
9495
![](../images/images/readmi01.jpg?raw=true)
9596

9697
Get the main parameters for the set:
9798
```python
98-
x.describe(tickers=False)
99+
x.describe()
99100
```
100101
![](../images/images/readmi02.jpg?raw=true)
101102

@@ -108,37 +109,39 @@ x.wealth_indexes.plot()
108109
### 2. Create a dividend stocks portfolio with base currency EUR
109110

110111
```python
111-
import okama.portfolio
112-
113112
weights = [0.3, 0.2, 0.2, 0.2, 0.1]
114113
assets = ['T.US', 'XOM.US', 'FRE.XETR', 'SNW.XETR', 'LKOH.MOEX']
115-
pf = okama.portfolio.Portfolio(assets, weights=weights, ccy='EUR')
116-
print(pf)
114+
pf = ok.Portfolio(assets, weights=weights, ccy='EUR')
115+
pf.table
117116
```
118117
![](../images/images/readmi04.jpg?raw=true)
119118

120-
Plot the dividend yield for each group of assets (based on stock currency).
119+
Plot the dividend yield of the portfolio (adjusted to the base currency).
120+
121121
```python
122122
pf.dividend_yield.plot()
123123
```
124-
![](../images/images/readmi05.jpg?raw=true)
124+
![](../images/images/readmi05.png?raw=true)
125125

126-
### 3. Draw an Efficient Frontier for 2 poular ETF: SPY and GLD
126+
### 3. Draw an Efficient Frontier for 2 popular ETF: SPY and GLD
127127
```python
128128
ls = ['SPY.US', 'GLD.US']
129129
curr = 'USD'
130-
frontier = ok.EfficientFrontierReb(ls, last_date='2020-10', ccy=curr, reb_period='year') # Rebalancing periods is one year (dafault value)
130+
last_date='2020-10'
131+
frontier = ok.EfficientFrontierReb(ls, last_date=last_date', ccy=curr, reb_period='year') # Rebalancing periods is one year (dafault value)
131132
frontier.names
132133
```
133134
![](../images/images/readmi06.jpg?raw=true)
134135

135136
Get the Efficient Frontier points for rebalanced portfolios and plot the chart with the assets risk/CAGR points:
136137
```python
138+
import matplotlib.pyplot as plt
139+
137140
points = frontier.ef_points
138141

139142
fig = plt.figure(figsize=(12,6))
140143
fig.subplots_adjust(bottom=0.2, top=1.5)
141-
ok.Plots(ls, ccy=curr).plot_assets(kind='cagr') # plots the assets points on the chart
144+
ok.Plots(ls, ccy=curr, last_date=last_date).plot_assets(kind='cagr') # plots the assets points on the chart
142145
ax = plt.gca()
143146
ax.plot(points.Risk, points.CAGR)
144147
```
@@ -152,7 +155,7 @@ map = ok.Plots(ls, ccy='USD').plot_transition_map(cagr=False)
152155
```
153156
![](../images/images/readmi08.jpg?v23-11-2020,raw=true "Transition map")
154157

155-
More examples are available in [Jupyter Notebooks](https://github.com/mbk-dev/okama/tree/master/notebooks).
158+
More examples are available in form of [Jupyter Notebooks](https://github.com/mbk-dev/okama/tree/master/examples).
156159

157160
## RoadMap
158161

docs/.coverage

52 KB
Binary file not shown.

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = .
9+
BUILDDIR = _build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
112 KB
Binary file not shown.

docs/_build/doctrees/index.doctree

9.63 KB
Binary file not shown.
2.54 KB
Binary file not shown.
91.6 KB
Binary file not shown.
Binary file not shown.
361 KB
Binary file not shown.
Binary file not shown.
2.38 KB
Binary file not shown.
15.1 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

docs/_build/html/.buildinfo

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Sphinx build info version 1
2+
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3+
config: d6e24f80ae1ad92ce334ec7911b4f28f
4+
tags: 645f666f9bcd5a90fca523b33c5a78b7
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
====================
2+
okama documentation
3+
====================
4+
This is documentation.
5+
6+
Installation
7+
------------
8+
9+
::
10+
11+
pip install okama
12+
13+
-or- ::
14+
15+
pip install git+https://github.com/mbk-dev/okama
16+
17+
Class Overview
18+
--------------
19+
20+
21+
.. autosummary::
22+
:toctree: stubs
23+
24+
okama.Asset
25+
okama.AssetList
26+
okama.Portfolio
27+
28+
29+
Indices and tables
30+
==================
31+
32+
* :ref:`genindex`
33+
* :ref:`modindex`
34+
* :ref:`search`
35+
36+
.. toctree::
37+
:maxdepth: 2
38+
:caption: Content
39+
40+
source/test
41+
42+
43+
44+
45+
46+
47+
48+
49+
50+
51+
52+
53+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
okama
2+
=====
3+
4+
.. toctree::
5+
:maxdepth: 4
6+
7+
okama
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
okama.api package
2+
=================
3+
4+
Submodules
5+
----------
6+
7+
okama.api.api\_methods module
8+
-----------------------------
9+
10+
.. automodule:: okama.api.api_methods
11+
:members:
12+
:undoc-members:
13+
:show-inheritance:
14+
15+
okama.api.data\_queries module
16+
------------------------------
17+
18+
.. automodule:: okama.api.data_queries
19+
:members:
20+
:undoc-members:
21+
:show-inheritance:
22+
23+
okama.api.namespaces module
24+
---------------------------
25+
26+
.. automodule:: okama.api.namespaces
27+
:members:
28+
:undoc-members:
29+
:show-inheritance:
30+
31+
okama.api.search module
32+
-----------------------
33+
34+
.. automodule:: okama.api.search
35+
:members:
36+
:undoc-members:
37+
:show-inheritance:
38+
39+
40+
Module contents
41+
---------------
42+
43+
.. automodule:: okama.api
44+
:members:
45+
:undoc-members:
46+
:show-inheritance:
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
okama.common package
2+
====================
3+
4+
Submodules
5+
----------
6+
7+
okama.common.helpers module
8+
---------------------------
9+
10+
.. automodule:: okama.common.helpers
11+
:members:
12+
:undoc-members:
13+
:show-inheritance:
14+
15+
16+
Module contents
17+
---------------
18+
19+
.. automodule:: okama.common
20+
:members:
21+
:undoc-members:
22+
:show-inheritance:
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
okama.frontier package
2+
======================
3+
4+
Submodules
5+
----------
6+
7+
okama.frontier.multi\_period module
8+
-----------------------------------
9+
10+
.. automodule:: okama.frontier.multi_period
11+
:members:
12+
:undoc-members:
13+
:show-inheritance:
14+
15+
okama.frontier.single\_period module
16+
------------------------------------
17+
18+
.. automodule:: okama.frontier.single_period
19+
:members:
20+
:undoc-members:
21+
:show-inheritance:
22+
23+
24+
Module contents
25+
---------------
26+
27+
.. automodule:: okama.frontier
28+
:members:
29+
:undoc-members:
30+
:show-inheritance:
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
okama package
2+
=============
3+
4+
Subpackages
5+
-----------
6+
7+
.. toctree::
8+
9+
okama.api
10+
okama.common
11+
okama.frontier
12+
13+
Submodules
14+
----------
15+
16+
okama.assets module
17+
-------------------
18+
19+
.. automodule:: okama.assets
20+
:members:
21+
:undoc-members:
22+
:show-inheritance:
23+
24+
okama.macro module
25+
------------------
26+
27+
.. automodule:: okama.macro
28+
:members:
29+
:undoc-members:
30+
:show-inheritance:
31+
32+
okama.plots module
33+
------------------
34+
35+
.. automodule:: okama.plots
36+
:members:
37+
:undoc-members:
38+
:show-inheritance:
39+
40+
okama.portfolio module
41+
----------------------
42+
43+
.. automodule:: okama.portfolio
44+
:members:
45+
:undoc-members:
46+
:show-inheritance:
47+
48+
okama.settings module
49+
---------------------
50+
51+
.. automodule:: okama.settings
52+
:members:
53+
:undoc-members:
54+
:show-inheritance:
55+
56+
57+
Module contents
58+
---------------
59+
60+
.. automodule:: okama
61+
:members:
62+
:undoc-members:
63+
:show-inheritance:
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Test File
2+
==========
3+
4+
This is a test.rst file.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
okama.Asset
2+
===========
3+
4+
.. currentmodule:: okama
5+
6+
.. autoclass:: Asset
7+
8+
9+
.. automethod:: __init__
10+
11+
12+
.. rubric:: Methods
13+
14+
.. autosummary::
15+
16+
~Asset.__init__
17+
18+
19+
20+
21+
22+
.. rubric:: Attributes
23+
24+
.. autosummary::
25+
26+
~Asset.dividends
27+
~Asset.nav_ts
28+
~Asset.price
29+
~Asset.symbol
30+
31+

0 commit comments

Comments
 (0)