openseries 1.9.1__py3-none-any.whl → 1.9.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
openseries/report.py CHANGED
@@ -7,7 +7,7 @@ https://github.com/CaptorAB/openseries/blob/master/LICENSE.md
7
7
  SPDX-License-Identifier: BSD-3-Clause
8
8
  """
9
9
 
10
- # mypy: disable-error-code="assignment,index,arg-type"
10
+ # mypy: disable-error-code="assignment"
11
11
  from __future__ import annotations
12
12
 
13
13
  from inspect import stack
@@ -26,7 +26,7 @@ if TYPE_CHECKING: # pragma: no cover
26
26
  from .owntypes import LiteralPlotlyJSlib, LiteralPlotlyOutput
27
27
 
28
28
 
29
- from pandas import DataFrame, Series, concat
29
+ from pandas import DataFrame, Series, Timestamp, concat
30
30
  from plotly.io import to_html
31
31
  from plotly.offline import plot
32
32
  from plotly.subplots import make_subplots
@@ -73,8 +73,12 @@ def calendar_period_returns(
73
73
  copied.value_to_ret()
74
74
  cldr = copied.tsdf.iloc[1:].copy()
75
75
  if relabel:
76
- if freq == "BYE":
76
+ if freq.upper() == "BYE":
77
77
  cldr.index = [d.year for d in cldr.index]
78
+ elif freq.upper() == "BQE":
79
+ cldr.index = [
80
+ Timestamp(d).to_period("Q").strftime("Q%q %Y") for d in cldr.index
81
+ ]
78
82
  else:
79
83
  cldr.index = [d.strftime("%b %y") for d in cldr.index]
80
84
 
@@ -240,7 +244,7 @@ def report_html(
240
244
  x=bdf.index,
241
245
  y=bdf.iloc[:, item],
242
246
  hovertemplate="%{y:.2%}<br>%{x}",
243
- name=bdf.iloc[:, item].name[0],
247
+ name=bdf.iloc[:, item].name[0], # type: ignore[index]
244
248
  showlegend=False,
245
249
  row=2,
246
250
  col=1,
@@ -261,7 +265,7 @@ def report_html(
261
265
  ]
262
266
 
263
267
  # noinspection PyTypeChecker
264
- rpt_df = data.all_properties(properties=properties)
268
+ rpt_df = data.all_properties(properties=properties) # type: ignore[arg-type]
265
269
  alpha_frame = data.from_deepcopy()
266
270
  alpha_frame.to_cumret()
267
271
  with catch_warnings():
openseries/series.py CHANGED
@@ -7,7 +7,6 @@ https://github.com/CaptorAB/openseries/blob/master/LICENSE.md
7
7
  SPDX-License-Identifier: BSD-3-Clause
8
8
  """
9
9
 
10
- # mypy: disable-error-code="no-any-return"
11
10
  from __future__ import annotations
12
11
 
13
12
  from collections.abc import Iterable
@@ -469,7 +468,7 @@ class OpenTimeSeries(_CommonModel):
469
468
  The returns of the values in the series
470
469
 
471
470
  """
472
- returns = self.tsdf.ffill().pct_change()
471
+ returns = self.tsdf.pct_change()
473
472
  returns.iloc[0] = 0
474
473
  self.valuetype = ValueType.RTRN
475
474
  arrays = [[self.label], [self.valuetype]]
@@ -673,9 +672,9 @@ class OpenTimeSeries(_CommonModel):
673
672
 
674
673
  data = self.tsdf.loc[cast("int", earlier) : cast("int", later)].copy()
675
674
 
676
- data[self.label, ValueType.RTRN] = (
677
- data.loc[:, self.tsdf.columns.to_numpy()[0]].apply(log).diff()
678
- )
675
+ data[self.label, ValueType.RTRN] = log(
676
+ data.loc[:, self.tsdf.columns.to_numpy()[0]]
677
+ ).diff()
679
678
 
680
679
  rawdata = [
681
680
  data.loc[:, cast("int", (self.label, ValueType.RTRN))]
@@ -726,11 +725,12 @@ class OpenTimeSeries(_CommonModel):
726
725
  returns_input = True
727
726
  else:
728
727
  values = [cast("float", self.tsdf.iloc[0, 0])]
729
- ra_df = self.tsdf.ffill().pct_change()
728
+ ra_df = self.tsdf.pct_change()
730
729
  returns_input = False
731
730
  ra_df = ra_df.dropna()
732
731
 
733
732
  prev = self.first_idx
733
+ # noinspection PyTypeChecker
734
734
  dates: list[dt.date] = [prev]
735
735
 
736
736
  for idx, row in ra_df.iterrows():
openseries/simulation.py CHANGED
@@ -7,7 +7,6 @@ https://github.com/CaptorAB/openseries/blob/master/LICENSE.md
7
7
  SPDX-License-Identifier: BSD-3-Clause
8
8
  """
9
9
 
10
- # mypy: disable-error-code="no-any-return"
11
10
  from __future__ import annotations
12
11
 
13
12
  from typing import TYPE_CHECKING, cast
@@ -116,7 +115,7 @@ class ReturnSimulation(BaseModel): # type: ignore[misc]
116
115
  Simulation data
117
116
 
118
117
  """
119
- return self.dframe.add(1.0).cumprod(axis="columns").T
118
+ return self.dframe.add(1.0).cumprod(axis="columns").T # type: ignore[no-any-return]
120
119
 
121
120
  @property
122
121
  def realized_mean_return(self: Self) -> float:
@@ -130,9 +129,7 @@ class ReturnSimulation(BaseModel): # type: ignore[misc]
130
129
  """
131
130
  return cast(
132
131
  "float",
133
- (
134
- self.results.ffill().pct_change().mean() * self.trading_days_in_year
135
- ).iloc[0],
132
+ (self.results.pct_change().mean() * self.trading_days_in_year).iloc[0],
136
133
  )
137
134
 
138
135
  @property
@@ -147,10 +144,9 @@ class ReturnSimulation(BaseModel): # type: ignore[misc]
147
144
  """
148
145
  return cast(
149
146
  "float",
150
- (
151
- self.results.ffill().pct_change().std()
152
- * sqrt(self.trading_days_in_year)
153
- ).iloc[0],
147
+ (self.results.pct_change().std() * sqrt(self.trading_days_in_year)).iloc[
148
+ 0
149
+ ],
154
150
  )
155
151
 
156
152
  @classmethod
@@ -464,7 +460,7 @@ class ReturnSimulation(BaseModel): # type: ignore[misc]
464
460
  [ValueType.RTRN],
465
461
  ],
466
462
  )
467
- return sdf
463
+ return sdf # type: ignore[no-any-return]
468
464
 
469
465
  fdf = DataFrame()
470
466
  for item in range(self.number_of_sims):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: openseries
3
- Version: 1.9.1
3
+ Version: 1.9.3
4
4
  Summary: Tools for analyzing financial timeseries.
5
5
  License: # BSD 3-Clause License
6
6
 
@@ -55,8 +55,8 @@ Requires-Dist: plotly (>=5.18.0,<7.0.0)
55
55
  Requires-Dist: pydantic (>=2.5.2,<3.0.0)
56
56
  Requires-Dist: python-dateutil (>=2.8.2,<4.0.0)
57
57
  Requires-Dist: requests (>=2.20.0,<3.0.0)
58
+ Requires-Dist: scikit-learn (>=1.4.0,<2.0.0)
58
59
  Requires-Dist: scipy (>=1.11.4,<2.0.0)
59
- Requires-Dist: statsmodels (>=0.14.0,!=0.14.2,<1.0.0)
60
60
  Project-URL: Homepage, https://github.com/CaptorAB/openseries
61
61
  Project-URL: Issue Tracker, https://github.com/CaptorAB/openseries/issues
62
62
  Project-URL: Release Notes, https://github.com/CaptorAB/openseries/releases
@@ -74,7 +74,7 @@ Description-Content-Type: text/markdown
74
74
  ![Platform](https://img.shields.io/badge/platforms-Windows%20%7C%20macOS%20%7C%20Linux-blue)
75
75
  [![Python version](https://img.shields.io/pypi/pyversions/openseries.svg)](https://www.python.org/)
76
76
  [![GitHub Action Test Suite](https://github.com/CaptorAB/openseries/actions/workflows/test.yml/badge.svg)](https://github.com/CaptorAB/openseries/actions/workflows/test.yml)
77
- [![codecov](https://img.shields.io/codecov/c/github/CaptorAB/openseries/master)](https://codecov.io/gh/CaptorAB/openseries/branch/master)
77
+ [![codecov](https://img.shields.io/codecov/c/gh/CaptorAB/openseries?logo=codecov)](https://codecov.io/gh/CaptorAB/openseries/branch/master)
78
78
  [![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/)
79
79
  [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://beta.ruff.rs/docs/)
80
80
  [![GitHub License](https://img.shields.io/github/license/CaptorAB/openseries)](https://github.com/CaptorAB/openseries/blob/master/LICENSE.md)
@@ -119,7 +119,7 @@ _,_=series.plot_series()
119
119
 
120
120
  ### Sample output using the report_html() function:
121
121
 
122
- <img src="./captor_plot_image.png" alt="Two Assets Compared" width="1000" />
122
+ <img src="https://raw.githubusercontent.com/CaptorAB/openseries/master/captor_plot_image.png" alt="Two Assets Compared" width="1000" />
123
123
 
124
124
  ## Development Instructions
125
125
 
@@ -267,25 +267,26 @@ make lint
267
267
 
268
268
  ### Methods that apply only to the [OpenFrame](https://github.com/CaptorAB/openseries/blob/master/openseries/frame.py) class.
269
269
 
270
- | Method | Applies to | Description |
271
- |:------------------------|:------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
272
- | `merge_series` | `OpenFrame` | Merges the Pandas Dataframes of the constituent OpenTimeSeries. |
273
- | `trunc_frame` | `OpenFrame` | Truncates the OpenFrame to a common period. |
274
- | `add_timeseries` | `OpenFrame` | Adds a given OpenTimeSeries to the OpenFrame. |
275
- | `delete_timeseries` | `OpenFrame` | Deletes an OpenTimeSeries from the OpenFrame. |
276
- | `relative` | `OpenFrame` | Calculates a new series that is the relative performance of two others. |
277
- | `make_portfolio` | `OpenFrame` | Calculates a portfolio timeseries based on the series and weights. Weights can be provided as a list, or a weight strategy can be set as *equal weights* or *inverted volatility*. |
278
- | `ord_least_squares_fit` | `OpenFrame` | Performs a regression and an [Ordinary Least Squares](https://www.statsmodels.org/stable/examples/notebooks/generated/ols.html) fit. |
279
- | `beta` | `OpenFrame` | Calculates [Beta](https://www.investopedia.com/terms/b/beta.asp) of an asset relative a market. |
280
- | `jensen_alpha` | `OpenFrame` | Calculates [Jensen's Alpha](https://www.investopedia.com/terms/j/jensensmeasure.asp) of an asset relative a market. |
281
- | `tracking_error_func` | `OpenFrame` | Calculates the [tracking errors](https://www.investopedia.com/terms/t/trackingerror.asp) relative to a selected series in the OpenFrame. |
282
- | `info_ratio_func` | `OpenFrame` | Calculates the [information ratios](https://www.investopedia.com/terms/i/informationratio.asp) relative to a selected series in the OpenFrame. |
283
- | `capture_ratio_func` | `OpenFrame` | Calculates up, down and up/down [capture ratios](https://www.investopedia.com/terms/d/down-market-capture-ratio.asp) relative to a selected series. |
284
- | `rolling_info_ratio` | `OpenFrame` | Returns a pandas.DataFrame with the rolling [information ratio](https://www.investopedia.com/terms/i/informationratio.asp) between two series. |
285
- | `rolling_beta` | `OpenFrame` | Returns a pandas.DataFrame with the rolling [Beta](https://www.investopedia.com/terms/b/beta.asp) of an asset relative a market. |
286
- | `rolling_corr` | `OpenFrame` | Calculates and adds a series of rolling [correlations](https://www.investopedia.com/terms/c/correlation.asp) between two other series. |
287
- | `correl_matrix` | `OpenFrame` | Returns a `pandas.DataFrame` with a correlation matrix. |
288
- | `ewma_risk` | `OpenFrame` | Returns a `pandas.DataFrame` with volatility and correlation based on [Exponentially Weighted Moving Average](https://www.investopedia.com/articles/07/ewma.asp). |
270
+ | Method | Applies to | Description |
271
+ |:---------------------------------|:------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
272
+ | `merge_series` | `OpenFrame` | Merges the Pandas Dataframes of the constituent OpenTimeSeries. |
273
+ | `trunc_frame` | `OpenFrame` | Truncates the OpenFrame to a common period. |
274
+ | `add_timeseries` | `OpenFrame` | Adds a given OpenTimeSeries to the OpenFrame. |
275
+ | `delete_timeseries` | `OpenFrame` | Deletes an OpenTimeSeries from the OpenFrame. |
276
+ | `relative` | `OpenFrame` | Calculates a new series that is the relative performance of two others. |
277
+ | `make_portfolio` | `OpenFrame` | Calculates a portfolio timeseries based on the series and weights. Weights can be provided as a list, or a weight strategy can be set as *equal weights* or *inverted volatility*. |
278
+ | `ord_least_squares_fit` | `OpenFrame` | Performs a regression and an [Ordinary Least Squares](https://www.statsmodels.org/stable/examples/notebooks/generated/ols.html) fit. |
279
+ | `beta` | `OpenFrame` | Calculates [Beta](https://www.investopedia.com/terms/b/beta.asp) of an asset relative a market. |
280
+ | `jensen_alpha` | `OpenFrame` | Calculates [Jensen's Alpha](https://www.investopedia.com/terms/j/jensensmeasure.asp) of an asset relative a market. |
281
+ | `tracking_error_func` | `OpenFrame` | Calculates the [tracking errors](https://www.investopedia.com/terms/t/trackingerror.asp) relative to a selected series in the OpenFrame. |
282
+ | `info_ratio_func` | `OpenFrame` | Calculates the [information ratios](https://www.investopedia.com/terms/i/informationratio.asp) relative to a selected series in the OpenFrame. |
283
+ | `capture_ratio_func` | `OpenFrame` | Calculates up, down and up/down [capture ratios](https://www.investopedia.com/terms/d/down-market-capture-ratio.asp) relative to a selected series. |
284
+ | `rolling_info_ratio` | `OpenFrame` | Returns a pandas.DataFrame with the rolling [information ratio](https://www.investopedia.com/terms/i/informationratio.asp) between two series. |
285
+ | `rolling_beta` | `OpenFrame` | Returns a pandas.DataFrame with the rolling [Beta](https://www.investopedia.com/terms/b/beta.asp) of an asset relative a market. |
286
+ | `rolling_corr` | `OpenFrame` | Calculates and adds a series of rolling [correlations](https://www.investopedia.com/terms/c/correlation.asp) between two other series. |
287
+ | `correl_matrix` | `OpenFrame` | Returns a `pandas.DataFrame` with a correlation matrix. |
288
+ | `ewma_risk` | `OpenFrame` | Returns a `pandas.DataFrame` with volatility and correlation based on [Exponentially Weighted Moving Average](https://www.investopedia.com/articles/07/ewma.asp). |
289
+ | `multi_factor_linear_regression` | `OpenFrame` | Treats one specified series as the dependent variable (y) and uses all remaining series as independent variables (X) in a linear regression and returns a DataFrame with summary output and a series of predicted values. |
289
290
 
290
291
  ### Methods that apply to both the [OpenTimeSeries](https://github.com/CaptorAB/openseries/blob/master/openseries/series.py) and the [OpenFrame](https://github.com/CaptorAB/openseries/blob/master/openseries/frame.py) class.
291
292
 
@@ -315,52 +316,53 @@ make lint
315
316
 
316
317
  ### Numerical properties available for individual [OpenTimeSeries](https://github.com/CaptorAB/openseries/blob/master/openseries/series.py) or on all series in an [OpenFrame](https://github.com/CaptorAB/openseries/blob/master/openseries/frame.py).
317
318
 
318
- | Property | type | Applies to | Description |
319
- |:------------------------|:-------------------------|:------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
320
- | `all_properties` | `pandas.DataFrame` | `OpenTimeSeries`, `OpenFrame` | Returns most of the properties in one go. |
321
- | `arithmetic_ret` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | [Annualized arithmetic mean of returns](https://www.investopedia.com/terms/a/arithmeticmean.asp). |
322
- | `geo_ret` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | [Compound Annual Growth Rate(CAGR)](https://www.investopedia.com/terms/c/cagr.asp), a specific implementation of geometric mean. |
323
- | `value_ret` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | Simple return from first to last observation. |
324
- | `vol` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | Annualized [volatility](https://www.investopedia.com/terms/v/volatility.asp). Pandas .std() is the equivalent of stdev.s([...]) in MS excel. |
325
- | `downside_deviation` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | [Downside deviation](https://www.investopedia.com/terms/d/downside-deviation.asp) is the volatility of all negative return observations. Minimum Accepted Return (MAR) set to zero. |
326
- | `ret_vol_ratio` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | Ratio of arithmetic mean return and annualized volatility. It is the [Sharpe Ratio](https://www.investopedia.com/terms/s/sharperatio.asp) with the riskfree rate set to zero. |
327
- | `sortino_ratio` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | The [Sortino Ratio](https://www.investopedia.com/terms/s/sortinoratio.asp) is the arithmetic mean return divided by the downside deviation. This attribute assumes that the riskfree rate and the MAR are both zero. |
328
- | `omega_ratio` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | The [Omega Ratio](https://en.wikipedia.org/wiki/Omega_ratio) compares returns above a certain target level (MAR) to the total downside risk below MAR. |
329
- | `var_down` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | Downside 95% [Value At Risk](https://www.investopedia.com/terms/v/var.asp), "VaR". The equivalent of percentile.inc([...], 1-level) over returns in MS Excel. For other confidence levels use the corresponding method. |
330
- | `cvar_down` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | Downside 95% [Conditional Value At Risk](https://www.investopedia.com/terms/c/conditional_value_at_risk.asp), "CVaR". For other confidence levels use the corresponding method. |
331
- | `worst` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | Most negative percentage change of a single observation. |
332
- | `worst_month` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | Most negative month. |
333
- | `max_drawdown` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | [Maximum drawdown](https://www.investopedia.com/terms/m/maximum-drawdown-mdd.asp). |
334
- | `max_drawdown_cal_year` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | Max drawdown in a single calendar year. |
335
- | `positive_share` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | The share of percentage changes that are positive. |
336
- | `vol_from_var` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | Implied annualized volatility from the Downside VaR using the assumption that returns are normally distributed. |
337
- | `skew` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | [Skew](https://www.investopedia.com/terms/s/skewness.asp) of the return distribution. |
338
- | `kurtosis` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | [Kurtosis](https://www.investopedia.com/terms/k/kurtosis.asp) of the return distribution. |
339
- | `z_score` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | [Z-score](https://www.investopedia.com/terms/z/zscore.asp) as (last return - mean return) / standard deviation of returns. |
319
+ | Property | type | Applies to | Description |
320
+ |:------------------------|:-------------------------|:------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
321
+ | `all_properties` | `pandas.DataFrame` | `OpenTimeSeries`, `OpenFrame` | Returns most of the properties in one go. |
322
+ | `arithmetic_ret` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | [Annualized arithmetic mean of returns](https://www.investopedia.com/terms/a/arithmeticmean.asp). |
323
+ | `geo_ret` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | [Compound Annual Growth Rate(CAGR)](https://www.investopedia.com/terms/c/cagr.asp), a specific implementation of geometric mean. |
324
+ | `value_ret` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | Simple return from first to last observation. |
325
+ | `vol` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | Annualized [volatility](https://www.investopedia.com/terms/v/volatility.asp). Pandas .std() is the equivalent of stdev.s([...]) in MS excel. |
326
+ | `downside_deviation` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | [Downside deviation](https://www.investopedia.com/terms/d/downside-deviation.asp) is the volatility of all negative return observations. Minimum Accepted Return (MAR) set to zero. |
327
+ | `ret_vol_ratio` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | Ratio of arithmetic mean return and annualized volatility. It is the [Sharpe Ratio](https://www.investopedia.com/terms/s/sharperatio.asp) with the riskfree rate set to zero. |
328
+ | `sortino_ratio` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | The [Sortino Ratio](https://www.investopedia.com/terms/s/sortinoratio.asp) is the arithmetic mean return divided by the downside deviation. This attribute assumes that the riskfree rate and the MAR are both zero. |
329
+ | `kappa3_ratio` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | The Kappa-3 Ratio is the arithmetic mean return divided by the cubic-root of the lower partial moment of order 3. It penalizes larger downside outcomes more heavily than the Sortino ratio (which uses order 2). This attribute assumes that the riskfree rate and the MAR are both zero. |
330
+ | `omega_ratio` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | The [Omega Ratio](https://en.wikipedia.org/wiki/Omega_ratio) compares returns above a certain target level (MAR) to the total downside risk below MAR. |
331
+ | `var_down` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | Downside 95% [Value At Risk](https://www.investopedia.com/terms/v/var.asp), "VaR". The equivalent of percentile.inc([...], 1-level) over returns in MS Excel. For other confidence levels use the corresponding method. |
332
+ | `cvar_down` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | Downside 95% [Conditional Value At Risk](https://www.investopedia.com/terms/c/conditional_value_at_risk.asp), "CVaR". For other confidence levels use the corresponding method. |
333
+ | `worst` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | Most negative percentage change of a single observation. |
334
+ | `worst_month` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | Most negative month. |
335
+ | `max_drawdown` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | [Maximum drawdown](https://www.investopedia.com/terms/m/maximum-drawdown-mdd.asp). |
336
+ | `max_drawdown_cal_year` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | Max drawdown in a single calendar year. |
337
+ | `positive_share` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | The share of percentage changes that are positive. |
338
+ | `vol_from_var` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | Implied annualized volatility from the Downside VaR using the assumption that returns are normally distributed. |
339
+ | `skew` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | [Skew](https://www.investopedia.com/terms/s/skewness.asp) of the return distribution. |
340
+ | `kurtosis` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | [Kurtosis](https://www.investopedia.com/terms/k/kurtosis.asp) of the return distribution. |
341
+ | `z_score` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | [Z-score](https://www.investopedia.com/terms/z/zscore.asp) as (last return - mean return) / standard deviation of returns. |
340
342
 
341
343
  ### Methods below are identical to the Numerical Properties above.
342
344
 
343
345
  _They are simply methods that take different date or length inputs to return the
344
346
  properties for subset periods._
345
347
 
346
- | Method | type | Applies to | Description |
347
- |:--------------------------|:-------------------------|:------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
348
- | `arithmetic_ret_func` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | [Annualized arithmetic mean of returns](https://www.investopedia.com/terms/a/arithmeticmean.asp). |
349
- | `geo_ret_func` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | [Compound Annual Growth Rate(CAGR)](https://www.investopedia.com/terms/c/cagr.asp), a specific implementation of geometric mean. |
350
- | `value_ret_func` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | Simple return from first to last observation. |
351
- | `vol_func` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | Annualized [volatility](https://www.investopedia.com/terms/v/volatility.asp). Pandas .std() is the equivalent of stdev.s([...]) in MS excel. |
352
- | `downside_deviation_func` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | [Downside deviation](https://www.investopedia.com/terms/d/downside-deviation.asp) is the volatility of all negative return observations. MAR and riskfree rate can be set. |
353
- | `ret_vol_ratio_func` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | Ratio of arithmetic mean return and annualized volatility. It is the [Sharpe Ratio](https://www.investopedia.com/terms/s/sharperatio.asp) with the riskfree rate set to zero. A riskfree rate can be set as a float or a series chosen for the frame function. |
354
- | `sortino_ratio_func` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | The [Sortino Ratio](https://www.investopedia.com/terms/s/sortinoratio.asp) is the arithmetic mean return divided by the downside deviation. A riskfree rate can be set as a float or a series chosen for the frame function. MAR is set to zero. |
355
- | `omega_ratio_func` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | The [Omega Ratio](https://en.wikipedia.org/wiki/Omega_ratio) compares returns above a certain target level (MAR) to the total downside risk below MAR. |
356
- | `var_down_func` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | Downside 95% [Value At Risk](https://www.investopedia.com/terms/v/var.asp), "VaR". The equivalent of percentile.inc([...], 1-level) over returns in MS Excel. Default is 95% confidence level. |
357
- | `cvar_down_func` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | Downside 95% [Conditional Value At Risk](https://www.investopedia.com/terms/c/conditional_value_at_risk.asp), "CVaR". Default is 95% confidence level. |
358
- | `worst_func` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | Most negative percentage change for a given number of observations (default=1). |
359
- | `max_drawdown_func` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | [Maximum drawdown](https://www.investopedia.com/terms/m/maximum-drawdown-mdd.asp). |
360
- | `positive_share_func` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | The share of percentage changes that are positive. |
361
- | `vol_from_var_func` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | Implied annualized volatility from the Downside VaR using the assumption that returns are normally distributed. |
362
- | `skew_func` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | [Skew](https://www.investopedia.com/terms/s/skewness.asp) of the return distribution. |
363
- | `kurtosis_func` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | [Kurtosis](https://www.investopedia.com/terms/k/kurtosis.asp) of the return distribution. |
364
- | `z_score_func` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | [Z-score](https://www.investopedia.com/terms/z/zscore.asp) as (last return - mean return) / standard deviation of returns. |
365
- | `target_weight_from_var` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | A position target weight from the ratio between a VaR implied volatility and a given target volatility. |
348
+ | Method | type | Applies to | Description |
349
+ |:----------------------------|:-------------------------|:------------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
350
+ | `arithmetic_ret_func` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | [Annualized arithmetic mean of returns](https://www.investopedia.com/terms/a/arithmeticmean.asp). |
351
+ | `geo_ret_func` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | [Compound Annual Growth Rate(CAGR)](https://www.investopedia.com/terms/c/cagr.asp), a specific implementation of geometric mean. |
352
+ | `value_ret_func` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | Simple return from first to last observation. |
353
+ | `vol_func` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | Annualized [volatility](https://www.investopedia.com/terms/v/volatility.asp). Pandas .std() is the equivalent of stdev.s([...]) in MS excel. |
354
+ | `lower_partial_moment_func` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | [Downside deviation](https://www.investopedia.com/terms/d/downside-deviation.asp) is the volatility of all negative return observations when order is set to 2. MAR and riskfree rate can be set. If order is set to 3 this function is used as the denominator when calculating the Kappa-3 Ratio. |
355
+ | `ret_vol_ratio_func` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | Ratio of arithmetic mean return and annualized volatility. It is the [Sharpe Ratio](https://www.investopedia.com/terms/s/sharperatio.asp) with the riskfree rate set to zero. A riskfree rate can be set as a float or a series chosen for the frame function. |
356
+ | `sortino_ratio_func` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | The [Sortino Ratio](https://www.investopedia.com/terms/s/sortinoratio.asp) is the arithmetic mean return divided by the downside deviation when order is set to 2. MAR and riskfree rate can be set. If order is set to 3 this function calculates the Kappa-3 Ratio. |
357
+ | `omega_ratio_func` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | The [Omega Ratio](https://en.wikipedia.org/wiki/Omega_ratio) compares returns above a certain target level (MAR) to the total downside risk below MAR. |
358
+ | `var_down_func` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | Downside 95% [Value At Risk](https://www.investopedia.com/terms/v/var.asp), "VaR". The equivalent of percentile.inc([...], 1-level) over returns in MS Excel. Default is 95% confidence level. |
359
+ | `cvar_down_func` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | Downside 95% [Conditional Value At Risk](https://www.investopedia.com/terms/c/conditional_value_at_risk.asp), "CVaR". Default is 95% confidence level. |
360
+ | `worst_func` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | Most negative percentage change for a given number of observations (default=1). |
361
+ | `max_drawdown_func` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | [Maximum drawdown](https://www.investopedia.com/terms/m/maximum-drawdown-mdd.asp). |
362
+ | `positive_share_func` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | The share of percentage changes that are positive. |
363
+ | `vol_from_var_func` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | Implied annualized volatility from the Downside VaR using the assumption that returns are normally distributed. |
364
+ | `skew_func` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | [Skew](https://www.investopedia.com/terms/s/skewness.asp) of the return distribution. |
365
+ | `kurtosis_func` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | [Kurtosis](https://www.investopedia.com/terms/k/kurtosis.asp) of the return distribution. |
366
+ | `z_score_func` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | [Z-score](https://www.investopedia.com/terms/z/zscore.asp) as (last return - mean return) / standard deviation of returns. |
367
+ | `target_weight_from_var` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | A position target weight from the ratio between a VaR implied volatility and a given target volatility. |
366
368
 
@@ -0,0 +1,17 @@
1
+ openseries/__init__.py,sha256=WAh79oE-ceGG_yl4nBukkp3UPvmLk4u_GySL2xOKbxE,1375
2
+ openseries/_common_model.py,sha256=ydS3CNqxtd5GPa9R-28ApcgjKe1d9vXPyaF2aECkv1A,84720
3
+ openseries/_risk.py,sha256=8XKZWWXrECo0Vd9r2kbcn4dzyPuo93DAEO8eSkv4w20,2357
4
+ openseries/datefixer.py,sha256=FBe0zEcCDbrMPatN9OvaKqXJd9EQOqXzknQQ1N3Ji0s,15774
5
+ openseries/frame.py,sha256=AAIHHvs0f1HoRtlXQZmF8PPFPNa134KUYaKnSVad-xY,57752
6
+ openseries/load_plotly.py,sha256=C6iQyabfi5ubSONuis3yRHb3bUktBtTDlovsDIaeHNQ,2266
7
+ openseries/owntypes.py,sha256=VrOTslL0H8hM0BL-E57inlgfV_JEto9WMH9RCE2G0Ug,9454
8
+ openseries/plotly_captor_logo.json,sha256=F5nhMzEyxKywtjvQqMTKgKRCJQYMDIiBgDSxdte8Clo,178
9
+ openseries/plotly_layouts.json,sha256=9tKAeittrjwJWhBMV8SnCDAWdhgbVnUqXcN6P_J_bos,1433
10
+ openseries/portfoliotools.py,sha256=X0byXAfLI8AOc0kWIa1edJujgTRhSP4BNLQgbE28YPk,19667
11
+ openseries/report.py,sha256=s81bPGlgyzBdWR_MZTpb9twj2N9uxtnZZrV7FRpFyNU,14238
12
+ openseries/series.py,sha256=sk6ZeFEsM9sET52y8Zzgoo7zBZvEhcYkddyIMa5Kp4s,28506
13
+ openseries/simulation.py,sha256=fc0zonz9aogRIT7p06CBOUm6-mArVIg9UJF3bdgq3CE,14359
14
+ openseries-1.9.3.dist-info/LICENSE.md,sha256=wNupG-KLsG0aTncb_SMNDh1ExtrKXlpxSJ6RC-g-SWs,1516
15
+ openseries-1.9.3.dist-info/METADATA,sha256=jQA3_jxZVvwOcCxBrDXrD4ZpnqpZkO9UyFbdPr791Z0,48301
16
+ openseries-1.9.3.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
17
+ openseries-1.9.3.dist-info/RECORD,,
@@ -1,17 +0,0 @@
1
- openseries/__init__.py,sha256=WAh79oE-ceGG_yl4nBukkp3UPvmLk4u_GySL2xOKbxE,1375
2
- openseries/_common_model.py,sha256=1RdWhdoFnEndhcKuYw7IMuxkWmITIsfFE7KgvC0p0tU,83060
3
- openseries/_risk.py,sha256=8XKZWWXrECo0Vd9r2kbcn4dzyPuo93DAEO8eSkv4w20,2357
4
- openseries/datefixer.py,sha256=FBe0zEcCDbrMPatN9OvaKqXJd9EQOqXzknQQ1N3Ji0s,15774
5
- openseries/frame.py,sha256=RKt9PA6wrETb1eBpWhJgLyktnrEcskWd-BRmHGenqBw,55925
6
- openseries/load_plotly.py,sha256=VBrjKUpips-yFSySIHYbVTuUfGkSFsulgZd2LPwmYVE,2271
7
- openseries/owntypes.py,sha256=pzT-DHtCHbEwDDYjGTT_6gI71TEA9gtfeAMw0038VqQ,9612
8
- openseries/plotly_captor_logo.json,sha256=F5nhMzEyxKywtjvQqMTKgKRCJQYMDIiBgDSxdte8Clo,178
9
- openseries/plotly_layouts.json,sha256=9tKAeittrjwJWhBMV8SnCDAWdhgbVnUqXcN6P_J_bos,1433
10
- openseries/portfoliotools.py,sha256=krEgw9DdhbKEYKGAt-8KERzCrXXi6ViSbpa-s1Em0hw,19566
11
- openseries/report.py,sha256=8CN-rCc_grDAPw2k-oU00R3M_eIjSGkquQb-1ZDb5MA,14025
12
- openseries/series.py,sha256=DyM5rdwTSz0Xvq7NuX9HEkgwsSsfWie-bU4ycjE-r2s,28536
13
- openseries/simulation.py,sha256=wRw8yKphWLmgsjOjLZd2K1rbEl-mZw3fcJswixTvZos,14402
14
- openseries-1.9.1.dist-info/LICENSE.md,sha256=wNupG-KLsG0aTncb_SMNDh1ExtrKXlpxSJ6RC-g-SWs,1516
15
- openseries-1.9.1.dist-info/METADATA,sha256=0XQ208o-zf9harMeOzcnExcIiJRE3eW6ZHipYd0BjCI,44440
16
- openseries-1.9.1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
17
- openseries-1.9.1.dist-info/RECORD,,