Skip to content

Commit 52d509f

Browse files
committed
docs: update docstrings (several classes)
1 parent 6d40e76 commit 52d509f

File tree

6 files changed

+652
-385
lines changed

6 files changed

+652
-385
lines changed

okama/asset_list.py

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,32 +13,29 @@
1313

1414
class AssetList(make_asset_list.ListMaker):
1515
"""
16-
The list of financial assets implementation.
16+
List of financial assets.
1717
18-
AssetList can include stocks, ETF, mutual funds, commodities, currencies and stock indexes (benchmarks).
18+
AssetList can include stocks, ETFs, mutual funds, commodities, currencies and stock indexes (benchmarks).
1919
2020
Parameters
2121
----------
2222
assets : list, default None
23-
List of assets. Could include tickers or asset like objects (Asset, Portfolio).
24-
If None a single asset list with a default ticker is used.
25-
23+
List of assets. Could include tickers or asset-like objects (`Asset`, `Portfolio`).
24+
If None, a single-asset list with a default ticker is used.
2625
first_date : str, default None
2726
First date of monthly return time series.
28-
If None the first date is calculated automatically as the oldest available date for the listed assets.
29-
27+
If None, the first date is calculated automatically as the oldest available date for the listed assets.
3028
last_date : str, default None
3129
Last date of monthly return time series.
32-
If None the last date is calculated automatically as the newest available date for the listed assets.
33-
30+
If None, the last date is calculated automatically as the newest available date for the listed assets.
3431
ccy : str, default 'USD'
3532
Base currency for the list of assets. All risk metrics and returns are adjusted to the base currency.
3633
3734
inflation : bool, default True
3835
Defines whether to take inflation data into account in the calculations.
39-
Including inflation could limit available data (last_date, first_date)
36+
Including inflation could limit available data (`first_date`, `last_date`)
4037
as the inflation data is usually published with a one-month delay.
41-
With inflation = False some properties like real return are not available.
38+
With `inflation=False`, some properties like real return are not available.
4239
"""
4340

4441
def __repr__(self):
@@ -60,7 +57,7 @@ def wealth_indexes(self) -> pd.DataFrame:
6057
Wealth index (Cumulative Wealth Index) is a time series that presents the value of each asset over
6158
historical time period. Accumulated inflation time series is added if `inflation=True` in the AssetList.
6259
63-
Wealth index is obtained from the accumulated return multiplicated by the initial investments.
60+
Wealth index is obtained from the accumulated return multiplied by the initial investments.
6461
That is: 1000 * (Acc_Return + 1)
6562
Initial investments are taken as 1000 units of the AssetList base currency.
6663
@@ -449,15 +446,15 @@ def get_cagr(self, period: Optional[int] = None, real: bool = False) -> pd.Serie
449446
450447
Inflation adjusted annualized returns (real CAGR) are shown with `real=True` option.
451448
452-
Annual inflation value is calculated for the same period if inflation=True in the AssetList.
449+
Annual inflation value is calculated for the same period if `inflation=True` in the `AssetList`.
453450
454451
Parameters
455452
----------
456-
period: int, optional
457-
CAGR trailing period in years. None for the full time CAGR.
458-
real: bool, default False
453+
period : int, default None
454+
CAGR trailing period in years. If None, use the full available period.
455+
real : bool, default False
459456
CAGR is adjusted for inflation (real CAGR) if True.
460-
AssetList should be initiated with Inflation=True for real CAGR.
457+
AssetList should be initiated with `inflation=True` for real CAGR.
461458
462459
Returns
463460
-------
@@ -517,9 +514,9 @@ def get_rolling_cagr(self, window: int = 12, real: bool = False) -> pd.DataFrame
517514
----------
518515
window : int, default 12
519516
Size of the moving window in months. Window size should be at least 12 months for CAGR.
520-
real: bool, default False
517+
real : bool, default False
521518
CAGR is adjusted for inflation (real CAGR) if True.
522-
AssetList should be initiated with Inflation=True for real CAGR.
519+
AssetList should be initiated with `inflation=True` for real CAGR.
523520
524521
Returns
525522
-------
@@ -565,13 +562,13 @@ def get_cumulative_return(self, period: Union[str, int, None] = None, real: bool
565562
566563
Parameters
567564
----------
568-
period: str, int or None, default None
569-
Trailing period in years. Period should be more then 0.
565+
period : str or int or None, default None
566+
Trailing period in years. Period should be greater than 0.
570567
None - full time cumulative return.
571568
'YTD' - (Year To Date) period of time beginning the first day of the calendar year up to the last month.
572-
real: bool, default False
569+
real : bool, default False
573570
Cumulative return is adjusted for inflation (real cumulative return) if True.
574-
AssetList should be initiated with `Inflation=True` for real cumulative return.
571+
AssetList should be initiated with `inflation=True` for real cumulative return.
575572
576573
Returns
577574
-------
@@ -627,9 +624,9 @@ def get_rolling_cumulative_return(self, window: int = 12, real: bool = False) ->
627624
----------
628625
window : int, default 12
629626
Size of the moving window in months.
630-
real: bool, default False
627+
real : bool, default False
631628
Cumulative return is adjusted for inflation (real cumulative return) if True.
632-
AssetList should be initiated with `Inflation=True` for real cumulative return.
629+
AssetList should be initiated with `inflation=True` for real cumulative return.
633630
634631
Returns
635632
-------
@@ -710,11 +707,11 @@ def describe(self, years: Tuple[int, ...] = (1, 5, 10), tickers: bool = True) ->
710707
711708
Parameters
712709
----------
713-
years : tuple of (int,), default (1, 5, 10)
710+
years : tuple of int, default (1, 5, 10)
714711
List of periods for CAGR.
715712
716713
tickers : bool, default True
717-
Defines whether show tickers (True) or assets names in the header.
714+
Defines whether to show tickers (True) or asset names in the header.
718715
719716
Returns
720717
-------
@@ -727,7 +724,7 @@ def describe(self, years: Tuple[int, ...] = (1, 5, 10), tickers: bool = True) ->
727724
get_cagr : Calculate assets Compound Annual Growth Rate (CAGR).
728725
dividend_yield : Calculate dividend yield (LTM).
729726
risk_annual : Return annualized risks (standard deviation).
730-
get_cvar : Calculate historic Conditional Value at Risk (CVAR, expected shortfall).
727+
get_cvar_historic : Calculate historic Conditional Value at Risk (CVaR).
731728
drawdowns : Calculate drawdowns.
732729
733730
Examples

0 commit comments

Comments
 (0)