openseries 1.9.2__py3-none-any.whl → 1.9.4__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/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
@@ -54,6 +53,7 @@ from .owntypes import (
54
53
  LiteralSeriesProps,
55
54
  MarketsNotStringNorListStrError,
56
55
  OpenTimeSeriesPropertiesList,
56
+ ResampleDataLossError,
57
57
  Self,
58
58
  ValueListType,
59
59
  ValueType,
@@ -67,7 +67,7 @@ TypeOpenTimeSeries = TypeVar("TypeOpenTimeSeries", bound="OpenTimeSeries")
67
67
 
68
68
 
69
69
  # noinspection PyUnresolvedReferences,PyNestedDecorators
70
- class OpenTimeSeries(_CommonModel):
70
+ class OpenTimeSeries(_CommonModel): # type: ignore[misc]
71
71
  """OpenTimeSeries objects are at the core of the openseries package.
72
72
 
73
73
  The intended use is to allow analyses of financial timeseries.
@@ -587,7 +587,10 @@ class OpenTimeSeries(_CommonModel):
587
587
 
588
588
  """
589
589
  self.tsdf.index = DatetimeIndex(self.tsdf.index)
590
- self.tsdf = self.tsdf.resample(freq).last()
590
+ if self.valuetype == ValueType.RTRN:
591
+ self.tsdf = self.tsdf.resample(freq).sum()
592
+ else:
593
+ self.tsdf = self.tsdf.resample(freq).last()
591
594
  self.tsdf.index = Index(d.date() for d in DatetimeIndex(self.tsdf.index))
592
595
  return self
593
596
 
@@ -613,6 +616,14 @@ class OpenTimeSeries(_CommonModel):
613
616
  An OpenTimeSeries object
614
617
 
615
618
  """
619
+ if self.valuetype == ValueType.RTRN:
620
+ msg = (
621
+ "Do not run resample_to_business_period_ends on return series. "
622
+ "The operation will pick the last data point in the sparser series. "
623
+ "It will not sum returns and therefore data will be lost."
624
+ )
625
+ raise ResampleDataLossError(msg)
626
+
616
627
  dates = _do_resample_to_business_period_ends(
617
628
  data=self.tsdf,
618
629
  freq=freq,
@@ -660,7 +671,9 @@ class OpenTimeSeries(_CommonModel):
660
671
  Series EWMA volatility
661
672
 
662
673
  """
663
- earlier, later = self.calc_range(months_from_last, from_date, to_date)
674
+ earlier, later = self.calc_range(
675
+ months_offset=months_from_last, from_dt=from_date, to_dt=to_date
676
+ )
664
677
  if periods_in_a_year_fixed:
665
678
  time_factor = float(periods_in_a_year_fixed)
666
679
  else:
@@ -673,9 +686,9 @@ class OpenTimeSeries(_CommonModel):
673
686
 
674
687
  data = self.tsdf.loc[cast("int", earlier) : cast("int", later)].copy()
675
688
 
676
- data[self.label, ValueType.RTRN] = (
677
- data.loc[:, self.tsdf.columns.to_numpy()[0]].apply(log).diff()
678
- )
689
+ data[self.label, ValueType.RTRN] = log(
690
+ data.loc[:, self.tsdf.columns.to_numpy()[0]]
691
+ ).diff()
679
692
 
680
693
  rawdata = [
681
694
  data.loc[:, cast("int", (self.label, ValueType.RTRN))]
@@ -731,6 +744,7 @@ class OpenTimeSeries(_CommonModel):
731
744
  ra_df = ra_df.dropna()
732
745
 
733
746
  prev = self.first_idx
747
+ # noinspection PyTypeChecker
734
748
  dates: list[dt.date] = [prev]
735
749
 
736
750
  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:
@@ -464,7 +463,7 @@ class ReturnSimulation(BaseModel): # type: ignore[misc]
464
463
  [ValueType.RTRN],
465
464
  ],
466
465
  )
467
- return sdf
466
+ return sdf # type: ignore[no-any-return]
468
467
 
469
468
  fdf = DataFrame()
470
469
  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.2
3
+ Version: 1.9.4
4
4
  Summary: Tools for analyzing financial timeseries.
5
5
  License: # BSD 3-Clause License
6
6
 
@@ -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=tdwuAu7qhBIc7hgUycE90gtxT4t5LAmVr-elq6bOhv0,85687
3
+ openseries/_risk.py,sha256=8XKZWWXrECo0Vd9r2kbcn4dzyPuo93DAEO8eSkv4w20,2357
4
+ openseries/datefixer.py,sha256=FBe0zEcCDbrMPatN9OvaKqXJd9EQOqXzknQQ1N3Ji0s,15774
5
+ openseries/frame.py,sha256=4NxiHJ9RQKbX4NQDdmGjWIqX1YFsoT_tJ5FhgrWHUEs,57694
6
+ openseries/load_plotly.py,sha256=C6iQyabfi5ubSONuis3yRHb3bUktBtTDlovsDIaeHNQ,2266
7
+ openseries/owntypes.py,sha256=P9CKoLtjUaFiktLb_axihrlVR5bJfdDbSFJC72kQG2o,9584
8
+ openseries/plotly_captor_logo.json,sha256=F5nhMzEyxKywtjvQqMTKgKRCJQYMDIiBgDSxdte8Clo,178
9
+ openseries/plotly_layouts.json,sha256=9tKAeittrjwJWhBMV8SnCDAWdhgbVnUqXcN6P_J_bos,1433
10
+ openseries/portfoliotools.py,sha256=o43_Y90BOpZXZfUozeJcpPkCNGdoqnsiNXhALG7Lwds,19675
11
+ openseries/report.py,sha256=Xxw858mlq4VEf08Stf6wSHX-UqogAe9Os4IikoiK4i8,14126
12
+ openseries/series.py,sha256=Wfe20nYB0Fsdv6qTBeh2-GGA4lJD0BOmHNLfUrWy0rs,29106
13
+ openseries/simulation.py,sha256=27MJCQcviETBQaym70J4AAD1U3azhCZSRAy3usfAmeQ,14421
14
+ openseries-1.9.4.dist-info/LICENSE.md,sha256=wNupG-KLsG0aTncb_SMNDh1ExtrKXlpxSJ6RC-g-SWs,1516
15
+ openseries-1.9.4.dist-info/METADATA,sha256=NwChDu5ajuR0B5SqK97tbzhptn56jwSMF0tLcXMqYLw,48301
16
+ openseries-1.9.4.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
17
+ openseries-1.9.4.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=Tvxw9UMXIpGgYhJaCQdLIm0Iq2-nJWDPyyj0_swbMyY,55646
6
- openseries/load_plotly.py,sha256=VBrjKUpips-yFSySIHYbVTuUfGkSFsulgZd2LPwmYVE,2271
7
- openseries/owntypes.py,sha256=VXn5ZoHblCa1phUOUj9uyx_fAAlScxtOITPCze0Ntc0,9390
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=mdDZ1uSobmEpEK6gmvqAnVESiAX1rRnxh5_xp99bV_4,14204
12
- openseries/series.py,sha256=DyM5rdwTSz0Xvq7NuX9HEkgwsSsfWie-bU4ycjE-r2s,28536
13
- openseries/simulation.py,sha256=wRw8yKphWLmgsjOjLZd2K1rbEl-mZw3fcJswixTvZos,14402
14
- openseries-1.9.2.dist-info/LICENSE.md,sha256=wNupG-KLsG0aTncb_SMNDh1ExtrKXlpxSJ6RC-g-SWs,1516
15
- openseries-1.9.2.dist-info/METADATA,sha256=Wvvv8pIzNYNIa6c_oeneois-grmJ270r8rb2Obx9lB0,44492
16
- openseries-1.9.2.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
17
- openseries-1.9.2.dist-info/RECORD,,