Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix #12

Merged
merged 26 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions belvys/tenant.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ def portfolio_pfl(
self._fetch_series(ts_tree, ts_left, ts_right, missing2zero=missing2zero)
ts_trees.append(ts_tree)
# Turn into series.
series_trees = [to_series_tree(ts_tree) for ts_tree in ts_trees]
series_trees = [to_series_tree(ts_tree, self.aftercare) for ts_tree in ts_trees]
if output_as_series:
return series_trees
# Turn into portfolio line.
Expand Down Expand Up @@ -312,7 +312,10 @@ def to_series_tree(ts_tree: TsTree, aftercare: Aftercare) -> SeriesTree:

if isinstance(ts_tree, Dict): # nested
ts_dict = ts_tree
return {name: to_series_tree(subtree) for name, subtree in ts_dict.items()}
return {
name: to_series_tree(subtree, aftercare)
for name, subtree in ts_dict.items()
}

# FlatPfLine.

Expand Down
4 changes: 3 additions & 1 deletion docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ We can also initialise from a configuration file, with the ``belvys.Api.from_fil
.. literalinclude:: ../belvys/example_api_basic.yaml
:language: yaml

(:download:`download yaml 📄<../belvys/example_api_basic.yaml>`)

--------------
Authentication
--------------
Expand Down Expand Up @@ -141,4 +143,4 @@ Class Documentation

.. autoclass:: belvys.Api
:members:
:inherited-members:
:inherited-members:
14 changes: 2 additions & 12 deletions docs/example.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,10 @@ The package provides a few examples of ``Api`` and ``Structure`` configurations.
Structure
---------

A basic and a more complex example of a structure file can be downloaded here:

* basic structure configuration (:download:`download yaml📄<../belvys/example_structure_basic.yaml>`)
* complex structure configuration (:download:`download yaml📄<../belvys/example_structure_complex.yaml>`)

To use and play around with these configurations in code, use the ``belvys.example_structure()`` function. It takes a single argument ``"basic"`` or ``"complex"``, and returns a ``Structure`` instance. With ``belvys.example_structure_to_file()`` this configuration can be saved as a ``yaml`` file.
To use and play around with these configurations in code, use the ``belvys.example_structure()`` function. It takes a single argument ``"basic"`` or ``"complex"``, and returns a ``Structure`` instance.

---
Api
---

Likewise, a basic and a more complex example of an api file can be downloaded here:

* basic api configuration (:download:`download yaml📄<../belvys/example_api_basic.yaml>`)
* complex api configuration (:download:`download yaml📄<../belvys/example_api_complex.yaml>`)

Similar functions exists: ``belvys.example_api()`` returns an ``Api`` instance, and with ``belvys.example_api_to_file()`` it can be saved as a file. These functions take the same arguments as those mentioned above - though the difference between "basic" and "complex" is much smaller here.
Likewise, ``belvys.example_api()`` returns an ``Api`` instance. It takes the same argument - though the difference between "basic" and "complex" is much smaller here.
10 changes: 7 additions & 3 deletions docs/structure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,13 @@ We can initialise a ``Structure`` instance by specifying the initialisation para

See the class documentation, below, for an explanation of the meaning of these parameters.

Alternatively, the specification can be stored in a ``yaml`` file, and used to initialise the class using the ``belvys.Structure.from_file()`` class method. Here is the corresponding file, which includes some comments for better understanding the format:
Alternatively, the specification can be stored in a ``yaml`` file, and used to initialise the class using the ``belvys.Structure.from_file()`` class method. Here is the file corresponding to the configuration above. It includes some comments for better understanding the format:

.. literalinclude:: ../belvys/example_structure_basic.yaml
:language: yaml

(:download:`download yaml 📄<../belvys/example_structure_basic.yaml>`)


-----
Usage
Expand Down Expand Up @@ -90,11 +93,12 @@ When the instance has been created, several methods tell us which data we expect
Complex example
---------------

The example shown above is a basic one. Here is a more complex example file, which shows all possibilities to specify a ``Structure``.
The example shown above is a basic one. Here is a more complex example file, which shows all possibilities to specify a ``Structure``:

.. literalinclude:: ../belvys/example_structure_complex.yaml
:language: yaml


(:download:`download yaml 📄<../belvys/example_structure_complex.yaml>`)

-------------------
Class Documentation
Expand Down
Loading