Skip to content

Commit

Permalink
Merge pull request #12 from mbk-dev/dev
Browse files Browse the repository at this point in the history
Version 1.0.0: Portfolio is an asset and can be included in the AssetList
  • Loading branch information
chilango74 committed Aug 16, 2021
2 parents f65307f + bb9bde5 commit d8e363d
Show file tree
Hide file tree
Showing 137 changed files with 35,275 additions and 7,070 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Expand Up @@ -8,8 +8,9 @@ install:
- pip install -r requirements_test.txt
- pip install pytest-cov
- pip install coveralls
- pip install ipykernel
# command to run tests
script:
- pytest tests --cov=okama/
after_success:
- coveralls
- coveralls
29 changes: 16 additions & 13 deletions README.md
Expand Up @@ -4,7 +4,7 @@
<img src="https://img.shields.io/badge/python-v3-brightgreen.svg"
alt="python"></a> &nbsp;
<a href="https://pypi.org/project/okama/">
<img src="https://img.shields.io/badge/pypi-v0.99-brightgreen.svg"
<img src="https://img.shields.io/badge/pypi-v1.0.0-brightgreen.svg"
alt="pypi"></a> &nbsp;
<a href='https://coveralls.io/github/mbk-dev/okama?branch=master'>
<img src='https://coveralls.io/repos/github/mbk-dev/okama/badge.svg?branch=master'
Expand Down Expand Up @@ -87,15 +87,16 @@ The latest development version can be installed directly from GitHub:

```python
import okama as ok

x = ok.AssetList(['SPY.US', 'BND.US', 'DBXD.XETR'], ccy='USD')
print(x)
x # all examples are for Jupyter Notebook/iPython. For raw Python interpreter use 'print(x)' instead.

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

Get the main parameters for the set:
```python
x.describe(tickers=False)
x.describe()
```
![](../images/images/readmi02.jpg?raw=true)

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

```python
import okama.portfolio

weights = [0.3, 0.2, 0.2, 0.2, 0.1]
assets = ['T.US', 'XOM.US', 'FRE.XETR', 'SNW.XETR', 'LKOH.MOEX']
pf = okama.portfolio.Portfolio(assets, weights=weights, ccy='EUR')
print(pf)
pf = ok.Portfolio(assets, weights=weights, ccy='EUR')
pf.table
```
![](../images/images/readmi04.jpg?raw=true)

Plot the dividend yield for each group of assets (based on stock currency).
Plot the dividend yield of the portfolio (adjusted to the base currency).

```python
pf.dividend_yield.plot()
```
![](../images/images/readmi05.jpg?raw=true)
![](../images/images/readmi05.png?raw=true)

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

Get the Efficient Frontier points for rebalanced portfolios and plot the chart with the assets risk/CAGR points:
```python
import matplotlib.pyplot as plt

points = frontier.ef_points

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

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

## RoadMap

Expand Down
Binary file added docs/.coverage
Binary file not shown.
20 changes: 20 additions & 0 deletions docs/Makefile
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
Binary file added docs/_build/doctrees/environment.pickle
Binary file not shown.
Binary file added docs/_build/doctrees/index.doctree
Binary file not shown.
Binary file added docs/_build/doctrees/source/modules.doctree
Binary file not shown.
Binary file added docs/_build/doctrees/source/okama.api.doctree
Binary file not shown.
Binary file added docs/_build/doctrees/source/okama.common.doctree
Binary file not shown.
Binary file added docs/_build/doctrees/source/okama.doctree
Binary file not shown.
Binary file not shown.
Binary file added docs/_build/doctrees/source/test.doctree
Binary file not shown.
Binary file added docs/_build/doctrees/stubs/okama.Asset.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4 changes: 4 additions & 0 deletions docs/_build/html/.buildinfo
@@ -0,0 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: d6e24f80ae1ad92ce334ec7911b4f28f
tags: 645f666f9bcd5a90fca523b33c5a78b7
53 changes: 53 additions & 0 deletions docs/_build/html/_sources/index.rst.txt
@@ -0,0 +1,53 @@
====================
okama documentation
====================
This is documentation.

Installation
------------

::

pip install okama

-or- ::

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

Class Overview
--------------


.. autosummary::
:toctree: stubs

okama.Asset
okama.AssetList
okama.Portfolio


Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

.. toctree::
:maxdepth: 2
:caption: Content

source/test













7 changes: 7 additions & 0 deletions docs/_build/html/_sources/source/modules.rst.txt
@@ -0,0 +1,7 @@
okama
=====

.. toctree::
:maxdepth: 4

okama
46 changes: 46 additions & 0 deletions docs/_build/html/_sources/source/okama.api.rst.txt
@@ -0,0 +1,46 @@
okama.api package
=================

Submodules
----------

okama.api.api\_methods module
-----------------------------

.. automodule:: okama.api.api_methods
:members:
:undoc-members:
:show-inheritance:

okama.api.data\_queries module
------------------------------

.. automodule:: okama.api.data_queries
:members:
:undoc-members:
:show-inheritance:

okama.api.namespaces module
---------------------------

.. automodule:: okama.api.namespaces
:members:
:undoc-members:
:show-inheritance:

okama.api.search module
-----------------------

.. automodule:: okama.api.search
:members:
:undoc-members:
:show-inheritance:


Module contents
---------------

.. automodule:: okama.api
:members:
:undoc-members:
:show-inheritance:
22 changes: 22 additions & 0 deletions docs/_build/html/_sources/source/okama.common.rst.txt
@@ -0,0 +1,22 @@
okama.common package
====================

Submodules
----------

okama.common.helpers module
---------------------------

.. automodule:: okama.common.helpers
:members:
:undoc-members:
:show-inheritance:


Module contents
---------------

.. automodule:: okama.common
:members:
:undoc-members:
:show-inheritance:
30 changes: 30 additions & 0 deletions docs/_build/html/_sources/source/okama.frontier.rst.txt
@@ -0,0 +1,30 @@
okama.frontier package
======================

Submodules
----------

okama.frontier.multi\_period module
-----------------------------------

.. automodule:: okama.frontier.multi_period
:members:
:undoc-members:
:show-inheritance:

okama.frontier.single\_period module
------------------------------------

.. automodule:: okama.frontier.single_period
:members:
:undoc-members:
:show-inheritance:


Module contents
---------------

.. automodule:: okama.frontier
:members:
:undoc-members:
:show-inheritance:
63 changes: 63 additions & 0 deletions docs/_build/html/_sources/source/okama.rst.txt
@@ -0,0 +1,63 @@
okama package
=============

Subpackages
-----------

.. toctree::

okama.api
okama.common
okama.frontier

Submodules
----------

okama.assets module
-------------------

.. automodule:: okama.assets
:members:
:undoc-members:
:show-inheritance:

okama.macro module
------------------

.. automodule:: okama.macro
:members:
:undoc-members:
:show-inheritance:

okama.plots module
------------------

.. automodule:: okama.plots
:members:
:undoc-members:
:show-inheritance:

okama.portfolio module
----------------------

.. automodule:: okama.portfolio
:members:
:undoc-members:
:show-inheritance:

okama.settings module
---------------------

.. automodule:: okama.settings
:members:
:undoc-members:
:show-inheritance:


Module contents
---------------

.. automodule:: okama
:members:
:undoc-members:
:show-inheritance:
4 changes: 4 additions & 0 deletions docs/_build/html/_sources/source/test.rst.txt
@@ -0,0 +1,4 @@
Test File
==========

This is a test.rst file.
31 changes: 31 additions & 0 deletions docs/_build/html/_sources/stubs/okama.Asset.rst.txt
@@ -0,0 +1,31 @@
okama.Asset
===========

.. currentmodule:: okama

.. autoclass:: Asset


.. automethod:: __init__


.. rubric:: Methods

.. autosummary::

~Asset.__init__





.. rubric:: Attributes

.. autosummary::

~Asset.dividends
~Asset.nav_ts
~Asset.price
~Asset.symbol


0 comments on commit d8e363d

Please sign in to comment.