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.
103 KB
Binary file not shown.
361 KB
Binary file not shown.

0 commit comments

Comments
 (0)