openseries 1.9.5__tar.gz → 1.9.7__tar.gz

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.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: openseries
3
- Version: 1.9.5
3
+ Version: 1.9.7
4
4
  Summary: Tools for analyzing financial timeseries.
5
5
  License: # BSD 3-Clause License
6
6
 
@@ -29,6 +29,7 @@ License: # BSD 3-Clause License
29
29
  however caused and on any theory of liability, whether in contract, strict liability,
30
30
  or tort (including negligence or otherwise) arising in any way out of the use of this
31
31
  software, even if advised of the possibility of such damage.
32
+ License-File: LICENSE.md
32
33
  Keywords: python,finance,fintech,data-science,timeseries,timeseries-data,timeseries-analysis,investment,investment-analysis,investing
33
34
  Author: Martin Karrin
34
35
  Author-email: martin.karrin@captor.se
@@ -117,9 +118,9 @@ _,_=series.plot_series()
117
118
 
118
119
  ```
119
120
 
120
- ### Sample output using the report_html() function:
121
+ ### Sample output using the report_html() function
121
122
 
122
- <img src="https://raw.githubusercontent.com/CaptorAB/openseries/master/captor_plot_image.png" alt="Two Assets Compared" width="1000" />
123
+ <img src="https://raw.githubusercontent.com/CaptorAB/openseries/master/openseries_plot.png" alt="Two Assets Compared" width="1000" />
123
124
 
124
125
  ## Development Instructions
125
126
 
@@ -151,10 +152,7 @@ source source_me
151
152
 
152
153
  ## Testing and Linting / Type-checking
153
154
 
154
- Ruff and Mypy checking is embedded in the pre-commit hook. Both
155
- are also used in the project's GitHub workflows and are run when the `lint`
156
- alternative is chosen in the below commands.
157
- Any silenced error codes can be found in the
155
+ [Ruff](https://docs.astral.sh/ruff/) and [mypy](https://mypy-lang.org/) checking is embedded in the pre-commit hook. Both are also used in the project's GitHub workflows and are run when the `lint` alternative is chosen in the below commands. Any silenced error codes can be found in the
158
156
  [pyproject.toml](https://github.com/CaptorAB/openseries/blob/master/pyproject.toml)
159
157
  file or in in-line comments.
160
158
 
@@ -200,7 +198,7 @@ make lint
200
198
  | [report.py](https://github.com/CaptorAB/openseries/blob/master/openseries/report.py) | Defines the _report_html_ function that is used to create a landscape orientation report on at least two assets. All preceding assets will be measured against the last asset in the input OpenFrame. |
201
199
  | [simulation.py](https://github.com/CaptorAB/openseries/blob/master/openseries/simulation.py) | Defines the class _ReturnSimulation_ to create simulated financial timeseries. Used in the project's test suite |
202
200
 
203
- ### Class methods used to construct objects.
201
+ ### Class methods used to construct objects
204
202
 
205
203
  | Method | Applies to | Description |
206
204
  |:------------------|:------------------------------|:---------------------------------------------------------------------------------------------------|
@@ -209,7 +207,7 @@ make lint
209
207
  | `from_fixed_rate` | `OpenTimeSeries` | Class method to create an OpenTimeSeries object from a fixed rate, number of days and an end date. |
210
208
  | `from_deepcopy` | `OpenTimeSeries`, `OpenFrame` | Creates a copy of an OpenTimeSeries object. |
211
209
 
212
- ### Non-numerical or "helper" properties that apply only to the [OpenTimeSeries](https://github.com/CaptorAB/openseries/blob/master/openseries/series.py) class.
210
+ ### Non-numerical or "helper" properties that apply only to the [OpenTimeSeries](https://github.com/CaptorAB/openseries/blob/master/openseries/series.py) class
213
211
 
214
212
  | Property | type | Applies to | Description |
215
213
  |:----------------|:---------------------|:-----------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------|
@@ -227,7 +225,7 @@ make lint
227
225
  | `markets` | `list[str]` or `str` | `OpenTimeSeries` | (List of) markets code(s) according to market code(s) input for the [pandas-market-calendars](https://pandas-market-calendars.readthedocs.io/en/latest/) package. |
228
226
  | `valuetype` | `ValueType` | `OpenTimeSeries` | Field identifies the type of values in the series. ValueType is an Enum. |
229
227
 
230
- ### Non-numerical or "helper" properties that apply only to the [OpenFrame](https://github.com/CaptorAB/openseries/blob/master/openseries/frame.py) class.
228
+ ### Non-numerical or "helper" properties that apply only to the [OpenFrame](https://github.com/CaptorAB/openseries/blob/master/openseries/frame.py) class
231
229
 
232
230
  | Property | type | Applies to | Description |
233
231
  |:-------------------|:---------------------------------|:------------|:-------------------------------------------------------------------------|
@@ -241,7 +239,7 @@ make lint
241
239
  | `lengths_of_items` | `pandas.Series[int]` | `OpenFrame` | Number of items in each of the series in the OpenFrame. |
242
240
  | `span_of_days_all` | `pandas.Series[int]` | `OpenFrame` | Number of days from the first to the last in each of the series. |
243
241
 
244
- ### Non-numerical or "helper" properties 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.
242
+ ### Non-numerical or "helper" properties 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
245
243
 
246
244
  | Property | type | Applies to | Description |
247
245
  |:--------------------|:---------------------------------|:------------------------------|:----------------------------------------------------------------------------------|
@@ -254,7 +252,7 @@ make lint
254
252
  | `periods_in_a_year` | `float` | `OpenTimeSeries`, `OpenFrame` | The number of observations in an average year for all days in the data. |
255
253
  | `yearfrac` | `float` | `OpenTimeSeries`, `OpenFrame` | Length of timeseries expressed as np.float64 fraction of a year with 365.25 days. |
256
254
 
257
- ### Methods that apply only to the [OpenTimeSeries](https://github.com/CaptorAB/openseries/blob/master/openseries/series.py) class.
255
+ ### Methods that apply only to the [OpenTimeSeries](https://github.com/CaptorAB/openseries/blob/master/openseries/series.py) class
258
256
 
259
257
  | Method | Applies to | Description |
260
258
  |:-------------------------|:-----------------|:-----------------------------------------------------------------------------------------------------------------------------------------------|
@@ -262,10 +260,9 @@ make lint
262
260
  | `set_new_label` | `OpenTimeSeries` | Method to change the pandas.DataFrame column MultiIndex. |
263
261
  | `running_adjustment` | `OpenTimeSeries` | Adjusts the series performance with a `float` factor. |
264
262
  | `ewma_vol_func` | `OpenTimeSeries` | Returns a `pandas.Series` with volatility based on [Exponentially Weighted Moving Average](https://www.investopedia.com/articles/07/ewma.asp). |
265
- | `from_1d_rate_to_cumret` | `OpenTimeSeries` | Converts a series of 1-day rates into a cumulative valueseries. |
266
- |
263
+ | `from_1d_rate_to_cumret` | `OpenTimeSeries` | Converts a series of 1-day rates into a cumulative valueseries. |
267
264
 
268
- ### Methods that apply only to the [OpenFrame](https://github.com/CaptorAB/openseries/blob/master/openseries/frame.py) class.
265
+ ### Methods that apply only to the [OpenFrame](https://github.com/CaptorAB/openseries/blob/master/openseries/frame.py) class
269
266
 
270
267
  | Method | Applies to | Description |
271
268
  |:---------------------------------|:------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
@@ -274,7 +271,7 @@ make lint
274
271
  | `add_timeseries` | `OpenFrame` | Adds a given OpenTimeSeries to the OpenFrame. |
275
272
  | `delete_timeseries` | `OpenFrame` | Deletes an OpenTimeSeries from the OpenFrame. |
276
273
  | `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*. |
274
+ | `make_portfolio` | `OpenFrame` | Calculates a portfolio timeseries based on the series and weights. Weights an be provided as a list, or a weight strategy can be set as _equal weights_ or _inverted volatility_. |
278
275
  | `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
276
  | `beta` | `OpenFrame` | Calculates [Beta](https://www.investopedia.com/terms/b/beta.asp) of an asset relative a market. |
280
277
  | `jensen_alpha` | `OpenFrame` | Calculates [Jensen's Alpha](https://www.investopedia.com/terms/j/jensensmeasure.asp) of an asset relative a market. |
@@ -288,7 +285,7 @@ make lint
288
285
  | `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
286
  | `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. |
290
287
 
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.
288
+ ### 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
292
289
 
293
290
  | Method | Applies to | Description |
294
291
  |:-----------------------------------|:------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------|
@@ -314,7 +311,7 @@ make lint
314
311
  | `rolling_cvar_down` | `OpenTimeSeries`, `OpenFrame` | Returns a pandas.DataFrame with rolling CVaR figures. |
315
312
  | `calc_range` | `OpenTimeSeries`, `OpenFrame` | Returns the start and end dates of a range from specific period definitions. Used by the below numerical methods and not meant to be used independently. |
316
313
 
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).
314
+ ### 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)
318
315
 
319
316
  | Property | type | Applies to | Description |
320
317
  |:------------------------|:-------------------------|:------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
@@ -340,7 +337,7 @@ make lint
340
337
  | `kurtosis` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | [Kurtosis](https://www.investopedia.com/terms/k/kurtosis.asp) of the return distribution. |
341
338
  | `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. |
342
339
 
343
- ### Methods below are identical to the Numerical Properties above.
340
+ ### Methods below are identical to the Numerical Properties above
344
341
 
345
342
  _They are simply methods that take different date or length inputs to return the
346
343
  properties for subset periods._
@@ -52,9 +52,9 @@ _,_=series.plot_series()
52
52
 
53
53
  ```
54
54
 
55
- ### Sample output using the report_html() function:
55
+ ### Sample output using the report_html() function
56
56
 
57
- <img src="https://raw.githubusercontent.com/CaptorAB/openseries/master/captor_plot_image.png" alt="Two Assets Compared" width="1000" />
57
+ <img src="https://raw.githubusercontent.com/CaptorAB/openseries/master/openseries_plot.png" alt="Two Assets Compared" width="1000" />
58
58
 
59
59
  ## Development Instructions
60
60
 
@@ -86,10 +86,7 @@ source source_me
86
86
 
87
87
  ## Testing and Linting / Type-checking
88
88
 
89
- Ruff and Mypy checking is embedded in the pre-commit hook. Both
90
- are also used in the project's GitHub workflows and are run when the `lint`
91
- alternative is chosen in the below commands.
92
- Any silenced error codes can be found in the
89
+ [Ruff](https://docs.astral.sh/ruff/) and [mypy](https://mypy-lang.org/) checking is embedded in the pre-commit hook. Both are also used in the project's GitHub workflows and are run when the `lint` alternative is chosen in the below commands. Any silenced error codes can be found in the
93
90
  [pyproject.toml](https://github.com/CaptorAB/openseries/blob/master/pyproject.toml)
94
91
  file or in in-line comments.
95
92
 
@@ -135,7 +132,7 @@ make lint
135
132
  | [report.py](https://github.com/CaptorAB/openseries/blob/master/openseries/report.py) | Defines the _report_html_ function that is used to create a landscape orientation report on at least two assets. All preceding assets will be measured against the last asset in the input OpenFrame. |
136
133
  | [simulation.py](https://github.com/CaptorAB/openseries/blob/master/openseries/simulation.py) | Defines the class _ReturnSimulation_ to create simulated financial timeseries. Used in the project's test suite |
137
134
 
138
- ### Class methods used to construct objects.
135
+ ### Class methods used to construct objects
139
136
 
140
137
  | Method | Applies to | Description |
141
138
  |:------------------|:------------------------------|:---------------------------------------------------------------------------------------------------|
@@ -144,7 +141,7 @@ make lint
144
141
  | `from_fixed_rate` | `OpenTimeSeries` | Class method to create an OpenTimeSeries object from a fixed rate, number of days and an end date. |
145
142
  | `from_deepcopy` | `OpenTimeSeries`, `OpenFrame` | Creates a copy of an OpenTimeSeries object. |
146
143
 
147
- ### Non-numerical or "helper" properties that apply only to the [OpenTimeSeries](https://github.com/CaptorAB/openseries/blob/master/openseries/series.py) class.
144
+ ### Non-numerical or "helper" properties that apply only to the [OpenTimeSeries](https://github.com/CaptorAB/openseries/blob/master/openseries/series.py) class
148
145
 
149
146
  | Property | type | Applies to | Description |
150
147
  |:----------------|:---------------------|:-----------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------|
@@ -162,7 +159,7 @@ make lint
162
159
  | `markets` | `list[str]` or `str` | `OpenTimeSeries` | (List of) markets code(s) according to market code(s) input for the [pandas-market-calendars](https://pandas-market-calendars.readthedocs.io/en/latest/) package. |
163
160
  | `valuetype` | `ValueType` | `OpenTimeSeries` | Field identifies the type of values in the series. ValueType is an Enum. |
164
161
 
165
- ### Non-numerical or "helper" properties that apply only to the [OpenFrame](https://github.com/CaptorAB/openseries/blob/master/openseries/frame.py) class.
162
+ ### Non-numerical or "helper" properties that apply only to the [OpenFrame](https://github.com/CaptorAB/openseries/blob/master/openseries/frame.py) class
166
163
 
167
164
  | Property | type | Applies to | Description |
168
165
  |:-------------------|:---------------------------------|:------------|:-------------------------------------------------------------------------|
@@ -176,7 +173,7 @@ make lint
176
173
  | `lengths_of_items` | `pandas.Series[int]` | `OpenFrame` | Number of items in each of the series in the OpenFrame. |
177
174
  | `span_of_days_all` | `pandas.Series[int]` | `OpenFrame` | Number of days from the first to the last in each of the series. |
178
175
 
179
- ### Non-numerical or "helper" properties 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.
176
+ ### Non-numerical or "helper" properties 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
180
177
 
181
178
  | Property | type | Applies to | Description |
182
179
  |:--------------------|:---------------------------------|:------------------------------|:----------------------------------------------------------------------------------|
@@ -189,7 +186,7 @@ make lint
189
186
  | `periods_in_a_year` | `float` | `OpenTimeSeries`, `OpenFrame` | The number of observations in an average year for all days in the data. |
190
187
  | `yearfrac` | `float` | `OpenTimeSeries`, `OpenFrame` | Length of timeseries expressed as np.float64 fraction of a year with 365.25 days. |
191
188
 
192
- ### Methods that apply only to the [OpenTimeSeries](https://github.com/CaptorAB/openseries/blob/master/openseries/series.py) class.
189
+ ### Methods that apply only to the [OpenTimeSeries](https://github.com/CaptorAB/openseries/blob/master/openseries/series.py) class
193
190
 
194
191
  | Method | Applies to | Description |
195
192
  |:-------------------------|:-----------------|:-----------------------------------------------------------------------------------------------------------------------------------------------|
@@ -197,10 +194,9 @@ make lint
197
194
  | `set_new_label` | `OpenTimeSeries` | Method to change the pandas.DataFrame column MultiIndex. |
198
195
  | `running_adjustment` | `OpenTimeSeries` | Adjusts the series performance with a `float` factor. |
199
196
  | `ewma_vol_func` | `OpenTimeSeries` | Returns a `pandas.Series` with volatility based on [Exponentially Weighted Moving Average](https://www.investopedia.com/articles/07/ewma.asp). |
200
- | `from_1d_rate_to_cumret` | `OpenTimeSeries` | Converts a series of 1-day rates into a cumulative valueseries. |
201
- |
197
+ | `from_1d_rate_to_cumret` | `OpenTimeSeries` | Converts a series of 1-day rates into a cumulative valueseries. |
202
198
 
203
- ### Methods that apply only to the [OpenFrame](https://github.com/CaptorAB/openseries/blob/master/openseries/frame.py) class.
199
+ ### Methods that apply only to the [OpenFrame](https://github.com/CaptorAB/openseries/blob/master/openseries/frame.py) class
204
200
 
205
201
  | Method | Applies to | Description |
206
202
  |:---------------------------------|:------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
@@ -209,7 +205,7 @@ make lint
209
205
  | `add_timeseries` | `OpenFrame` | Adds a given OpenTimeSeries to the OpenFrame. |
210
206
  | `delete_timeseries` | `OpenFrame` | Deletes an OpenTimeSeries from the OpenFrame. |
211
207
  | `relative` | `OpenFrame` | Calculates a new series that is the relative performance of two others. |
212
- | `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*. |
208
+ | `make_portfolio` | `OpenFrame` | Calculates a portfolio timeseries based on the series and weights. Weights an be provided as a list, or a weight strategy can be set as _equal weights_ or _inverted volatility_. |
213
209
  | `ord_least_squares_fit` | `OpenFrame` | Performs a regression and an [Ordinary Least Squares](https://www.statsmodels.org/stable/examples/notebooks/generated/ols.html) fit. |
214
210
  | `beta` | `OpenFrame` | Calculates [Beta](https://www.investopedia.com/terms/b/beta.asp) of an asset relative a market. |
215
211
  | `jensen_alpha` | `OpenFrame` | Calculates [Jensen's Alpha](https://www.investopedia.com/terms/j/jensensmeasure.asp) of an asset relative a market. |
@@ -223,7 +219,7 @@ make lint
223
219
  | `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). |
224
220
  | `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. |
225
221
 
226
- ### 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.
222
+ ### 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
227
223
 
228
224
  | Method | Applies to | Description |
229
225
  |:-----------------------------------|:------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------|
@@ -249,7 +245,7 @@ make lint
249
245
  | `rolling_cvar_down` | `OpenTimeSeries`, `OpenFrame` | Returns a pandas.DataFrame with rolling CVaR figures. |
250
246
  | `calc_range` | `OpenTimeSeries`, `OpenFrame` | Returns the start and end dates of a range from specific period definitions. Used by the below numerical methods and not meant to be used independently. |
251
247
 
252
- ### 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).
248
+ ### 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)
253
249
 
254
250
  | Property | type | Applies to | Description |
255
251
  |:------------------------|:-------------------------|:------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
@@ -275,7 +271,7 @@ make lint
275
271
  | `kurtosis` | `float`, `pandas.Series` | `OpenTimeSeries`, `OpenFrame` | [Kurtosis](https://www.investopedia.com/terms/k/kurtosis.asp) of the return distribution. |
276
272
  | `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. |
277
273
 
278
- ### Methods below are identical to the Numerical Properties above.
274
+ ### Methods below are identical to the Numerical Properties above
279
275
 
280
276
  _They are simply methods that take different date or length inputs to return the
281
277
  properties for subset periods._