openseries 1.8.3__py3-none-any.whl → 1.9.0__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: openseries
3
- Version: 1.8.3
3
+ Version: 1.9.0
4
4
  Summary: Tools for analyzing financial timeseries.
5
5
  License: # BSD 3-Clause License
6
6
 
@@ -46,12 +46,12 @@ Classifier: Natural Language :: English
46
46
  Classifier: Development Status :: 5 - Production/Stable
47
47
  Classifier: Operating System :: OS Independent
48
48
  Classifier: Framework :: Pydantic
49
+ Requires-Dist: exchange-calendars (>=4.10.1,<6.0)
49
50
  Requires-Dist: holidays (>=0.30,<1.0)
50
- Requires-Dist: numpy (>=1.23.2,<3.0.0)
51
+ Requires-Dist: numpy (>=1.23.2,!=2.3.0,<3.0.0)
51
52
  Requires-Dist: openpyxl (>=3.1.2,<5.0.0)
52
53
  Requires-Dist: pandas (>=2.1.2,<3.0.0)
53
54
  Requires-Dist: plotly (>=5.18.0,<7.0.0)
54
- Requires-Dist: pyarrow (>=14.0.2,<21.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)
@@ -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
- [![Coverage](https://cdn.jsdelivr.net/gh/CaptorAB/openseries@master/coverage.svg)](https://github.com/CaptorAB/openseries/actions/workflows/test.yml)
77
+ [![codecov](https://codecov.io/gh/CaptorAB/openseries/graph/badge.svg)](https://codecov.io/gh/CaptorAB/openseries)
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)
@@ -83,7 +83,6 @@ Description-Content-Type: text/markdown
83
83
  This is a project with tools to analyze financial timeseries of a single
84
84
  asset or a group of assets. It is solely made for daily or less frequent data.
85
85
 
86
-
87
86
  ## Basic Usage
88
87
 
89
88
  To install:
@@ -118,34 +117,9 @@ _,_=series.plot_series()
118
117
 
119
118
  ```
120
119
 
121
- ### Sample output using the OpenFrame.all_properties() method:
122
- ```
123
- Scilla Global Equity C (simulation+fund) Global Low Volatility index, SEK
124
- ValueType.PRICE ValueType.PRICE
125
- Total return 3.641282 1.946319
126
- Arithmetic return 0.096271 0.069636
127
- Geometric return 0.093057 0.06464
128
- Volatility 0.120279 0.117866
129
- Return vol ratio 0.800396 0.59081
130
- Downside deviation 0.085956 0.086723
131
- Sortino ratio 1.119993 0.802975
132
- Positive share 0.541783 0.551996
133
- Worst -0.071616 -0.089415
134
- Worst month -0.122503 -0.154485
135
- Max drawdown -0.309849 -0.435444
136
- Max drawdown in cal yr -0.309849 -0.348681
137
- Max drawdown dates 2020-03-23 2009-03-09
138
- CVaR 95.0% -0.01793 -0.018429
139
- VaR 95.0% -0.011365 -0.010807
140
- Imp vol from VaR 95% 0.109204 0.103834
141
- Z-score 0.587905 0.103241
142
- Skew -0.650782 -0.888109
143
- Kurtosis 8.511166 17.527367
144
- observations 4309 4309
145
- span of days 6301 6301
146
- first indices 2006-01-03 2006-01-03
147
- last indices 2023-04-05 2023-04-05
148
- ```
120
+ ### Sample output using the report_html() function:
121
+
122
+ <img src="./captor_plot_image.png" alt="Two Assets Compared" width="1000" />
149
123
 
150
124
  ## Development Instructions
151
125
 
@@ -156,7 +130,6 @@ The OpenTimeSeries and OpenFrame classes are both subclasses of
156
130
  the [Pydantic BaseModel](https://docs.pydantic.dev/usage/models/). Please refer to its documentation for information
157
131
  on any attributes or methods inherited from this model.
158
132
 
159
-
160
133
  ### Windows Powershell
161
134
 
162
135
  ```powershell
@@ -171,9 +144,8 @@ cd openseries
171
144
  ```bash
172
145
  git clone https://github.com/CaptorAB/openseries.git
173
146
  cd openseries
174
- make
175
- source source_me
176
147
  make install
148
+ source source_me
177
149
 
178
150
  ```
179
151
 
@@ -202,7 +174,6 @@ make lint
202
174
 
203
175
  ```
204
176
 
205
-
206
177
  ## Table of Contents
207
178
 
208
179
  - [Basic Usage](#basic-usage)
@@ -221,12 +192,13 @@ make lint
221
192
 
222
193
  ### On some files in the project
223
194
 
224
- | File | Description |
225
- |:-----------------------------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
226
- | [series.py](https://github.com/CaptorAB/openseries/blob/master/openseries/series.py) | Defines the class _OpenTimeSeries_ for managing and analyzing a single timeseries. The module also defines a function `timeseries_chain` that can be used to chain two timeseries objects together. |
227
- | [frame.py](https://github.com/CaptorAB/openseries/blob/master/openseries/frame.py) | Defines the class _OpenFrame_ for managing a group of timeseries, and e.g. calculate a portfolio timeseries from a rebalancing strategy between timeseries. |
228
- | [portfoliotools.py](https://github.com/CaptorAB/openseries/blob/master/openseries/portfoliotools.py) | Defines functions to simulate, optimize, and plot portfolios. |
229
- | [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 |
195
+ | File | Description |
196
+ |:-----------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
197
+ | [series.py](https://github.com/CaptorAB/openseries/blob/master/openseries/series.py) | Defines the class _OpenTimeSeries_ for managing and analyzing a single timeseries. The module also defines a function `timeseries_chain` that can be used to chain two timeseries objects together. |
198
+ | [frame.py](https://github.com/CaptorAB/openseries/blob/master/openseries/frame.py) | Defines the class _OpenFrame_ for managing a group of timeseries, and e.g. calculate a portfolio timeseries from a rebalancing strategy between timeseries. |
199
+ | [portfoliotools.py](https://github.com/CaptorAB/openseries/blob/master/openseries/portfoliotools.py) | Defines functions to simulate, optimize, and plot portfolios. |
200
+ | [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
+ | [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 |
230
202
 
231
203
  ### Class methods used to construct objects.
232
204
 
@@ -239,34 +211,35 @@ make lint
239
211
 
240
212
  ### Non-numerical or "helper" properties that apply only to the [OpenTimeSeries](https://github.com/CaptorAB/openseries/blob/master/openseries/series.py) class.
241
213
 
242
- | Property | type | Applies to | Description |
243
- |:----------------|:----------------|:-----------------|:---------------------------------------------------------------------------------------------------------------------------------------------|
244
- | `timeseries_id` | `str` | `OpenTimeSeries` | Placeholder for database identifier for the timeseries. Can be left as empty string. |
245
- | `instrument_id` | `str` | `OpenTimeSeries` | Placeholder for database identifier for the instrument associated with the timeseries. Can be left as empty string. |
246
- | `dates` | `list[str]` | `OpenTimeSeries` | Dates of the timeseries. Not edited by any method to allow reversion to original. |
247
- | `values` | `list[float]` | `OpenTimeSeries` | Values of the timeseries. Not edited by any method to allow reversion to original. |
248
- | `currency` | `str` | `OpenTimeSeries` | Currency of the timeseries. Only used if conversion/hedging methods are added. |
249
- | `domestic` | `str` | `OpenTimeSeries` | Domestic currency of the user / investor. Only used if conversion/hedging methods are added. |
250
- | `local_ccy` | `bool` | `OpenTimeSeries` | Indicates if series should be in its local currency or the domestic currency of the user. Only used if conversion/hedging methods are added. |
251
- | `name` | `str` | `OpenTimeSeries` | An identifier field. |
252
- | `isin` | `str` | `OpenTimeSeries` | ISIN code of the associated instrument. If any. |
253
- | `label` | `str` | `OpenTimeSeries` | Field used in outputs. Derived from name as default. |
254
- | `countries` | `list` or `str` | `OpenTimeSeries` | (List of) country code(s) according to ISO 3166-1 alpha-2 used to generate business days. |
255
- | `valuetype` | `ValueType` | `OpenTimeSeries` | Field identifies the type of values in the series. ValueType is an Enum. |
214
+ | Property | type | Applies to | Description |
215
+ |:----------------|:---------------------|:-----------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------|
216
+ | `timeseries_id` | `str` | `OpenTimeSeries` | Placeholder for database identifier for the timeseries. Can be left as empty string. |
217
+ | `instrument_id` | `str` | `OpenTimeSeries` | Placeholder for database identifier for the instrument associated with the timeseries. Can be left as empty string. |
218
+ | `dates` | `list[str]` | `OpenTimeSeries` | Dates of the timeseries. Not edited by any method to allow reversion to original. |
219
+ | `values` | `list[float]` | `OpenTimeSeries` | Values of the timeseries. Not edited by any method to allow reversion to original. |
220
+ | `currency` | `str` | `OpenTimeSeries` | Currency of the timeseries. Only used if conversion/hedging methods are added. |
221
+ | `domestic` | `str` | `OpenTimeSeries` | Domestic currency of the user / investor. Only used if conversion/hedging methods are added. |
222
+ | `local_ccy` | `bool` | `OpenTimeSeries` | Indicates if series should be in its local currency or the domestic currency of the user. Only used if conversion/hedging methods are added. |
223
+ | `name` | `str` | `OpenTimeSeries` | An identifier field. |
224
+ | `isin` | `str` | `OpenTimeSeries` | ISIN code of the associated instrument. If any. |
225
+ | `label` | `str` | `OpenTimeSeries` | Field used in outputs. Derived from name as default. |
226
+ | `countries` | `list[str]` or `str` | `OpenTimeSeries` | (List of) country code(s) according to ISO 3166-1 alpha-2 used in the [holidays](https://github.com/vacanza/holidays/) package to generate business days. |
227
+ | `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
+ | `valuetype` | `ValueType` | `OpenTimeSeries` | Field identifies the type of values in the series. ValueType is an Enum. |
256
229
 
257
230
  ### Non-numerical or "helper" properties that apply only to the [OpenFrame](https://github.com/CaptorAB/openseries/blob/master/openseries/frame.py) class.
258
231
 
259
- | Property | type | Applies to | Description |
260
- |:-------------------|:-----------------------|:------------|:-------------------------------------------------------------------------|
261
- | `constituents` | `list[OpenTimeSeries]` | `OpenFrame` | A list of the OpenTimeSeries that make up an OpenFrame. |
262
- | `columns_lvl_zero` | `list` | `OpenFrame` | A list of the level zero column names in the OpenFrame pandas.DataFrame. |
263
- | `columns_lvl_one` | `list` | `OpenFrame` | A list of the level one column names in the OpenFrame pandas.DataFrame. |
264
- | `item_count` | `int` | `OpenFrame` | Number of columns in the OpenFrame pandas.DataFrame. |
265
- | `weights` | `list[float]` | `OpenFrame` | Weights used in the method `make_portfolio`. |
266
- | `first_indices` | `pandas.Series` | `OpenFrame` | First dates of all the series in the OpenFrame. |
267
- | `last_indices` | `pandas.Series` | `OpenFrame` | Last dates of all the series in the OpenFrame. |
268
- | `lengths_of_items` | `pandas.Series` | `OpenFrame` | Number of items in each of the series in the OpenFrame. |
269
- | `span_of_days_all` | `pandas.Series` | `OpenFrame` | Number of days from the first to the last in each of the series. |
232
+ | Property | type | Applies to | Description |
233
+ |:-------------------|:---------------------------------|:------------|:-------------------------------------------------------------------------|
234
+ | `constituents` | `list[OpenTimeSeries]` | `OpenFrame` | A list of the OpenTimeSeries that make up an OpenFrame. |
235
+ | `columns_lvl_zero` | `list[str]` | `OpenFrame` | A list of the level zero column names in the OpenFrame pandas.DataFrame. |
236
+ | `columns_lvl_one` | `list[ValueType]` or `list[str]` | `OpenFrame` | A list of the level one column names in the OpenFrame pandas.DataFrame. |
237
+ | `item_count` | `int` | `OpenFrame` | Number of columns in the OpenFrame pandas.DataFrame. |
238
+ | `weights` | `list[float]` | `OpenFrame` | Weights used in the method `make_portfolio`. |
239
+ | `first_indices` | `pandas.Series[dt.date]` | `OpenFrame` | First dates of all the series in the OpenFrame. |
240
+ | `last_indices` | `pandas.Series[dt.date]` | `OpenFrame` | Last dates of all the series in the OpenFrame. |
241
+ | `lengths_of_items` | `pandas.Series[int]` | `OpenFrame` | Number of items in each of the series in the OpenFrame. |
242
+ | `span_of_days_all` | `pandas.Series[int]` | `OpenFrame` | Number of days from the first to the last in each of the series. |
270
243
 
271
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.
272
245
 
@@ -290,7 +263,7 @@ make lint
290
263
  | `running_adjustment` | `OpenTimeSeries` | Adjusts the series performance with a `float` factor. |
291
264
  | `ewma_vol_func` | `OpenTimeSeries` | Returns a `pandas.Series` with volatility based on [Exponentially Weighted Moving Average](https://www.investopedia.com/articles/07/ewma.asp). |
292
265
  | `from_1d_rate_to_cumret` | `OpenTimeSeries` | Converts a series of 1-day rates into a cumulative valueseries. |
293
- |
266
+ |
294
267
 
295
268
  ### Methods that apply only to the [OpenFrame](https://github.com/CaptorAB/openseries/blob/master/openseries/frame.py) class.
296
269
 
@@ -328,11 +301,11 @@ make lint
328
301
  | `to_xlsx` | `OpenTimeSeries`, `OpenFrame` | Method to save the data in the .tsdf DataFrame to an Excel file. |
329
302
  | `value_to_ret` | `OpenTimeSeries`, `OpenFrame` | Converts a value series into a percentage return series. |
330
303
  | `value_to_diff` | `OpenTimeSeries`, `OpenFrame` | Converts a value series into a series of differences. |
331
- | `value_to_log` | `OpenTimeSeries`, `OpenFrame` | Converts a value series into a logarithmic return series. |
304
+ | `value_to_log` | `OpenTimeSeries`, `OpenFrame` | Converts a value series into a cumulative log return series, useful for plotting growth relative to the starting point. |
332
305
  | `value_ret_calendar_period` | `OpenTimeSeries`, `OpenFrame` | Returns the series simple return for a specific calendar period. |
333
- | `plot_series` | `OpenTimeSeries`, `OpenFrame` | Opens a HTML [Plotly Scatter](https://plotly.com/python/line-and-scatter/) plot of the serie(s) in a browser window. |
334
- | `plot_bars` | `OpenTimeSeries`, `OpenFrame` | Opens a HTML [Plotly Bar](https://plotly.com/python/bar-charts/) plot of the serie(s) in a browser window. |
335
- | `plot_histogram` | `OpenTimeSeries`, `OpenFrame` | Opens a HTML [Plotly Histogram](https://plotly.com/python/histograms/) plot of the serie(s) in a browser window. |
306
+ | `plot_series` | `OpenTimeSeries`, `OpenFrame` | Opens a HTML [Plotly Scatter](https://plotly.com/python/line-and-scatter/) plot of the serie(s) in a browser window. |
307
+ | `plot_bars` | `OpenTimeSeries`, `OpenFrame` | Opens a HTML [Plotly Bar](https://plotly.com/python/bar-charts/) plot of the serie(s) in a browser window. |
308
+ | `plot_histogram` | `OpenTimeSeries`, `OpenFrame` | Opens a HTML [Plotly Histogram](https://plotly.com/python/histograms/) plot of the serie(s) in a browser window. |
336
309
  | `to_drawdown_series` | `OpenTimeSeries`, `OpenFrame` | Converts the series into drawdown series. |
337
310
  | `rolling_return` | `OpenTimeSeries`, `OpenFrame` | Returns a pandas.DataFrame with rolling returns. |
338
311
  | `rolling_vol` | `OpenTimeSeries`, `OpenFrame` | Returns a pandas.DataFrame with rolling volatilities. |
@@ -0,0 +1,17 @@
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.0.dist-info/LICENSE.md,sha256=wNupG-KLsG0aTncb_SMNDh1ExtrKXlpxSJ6RC-g-SWs,1516
15
+ openseries-1.9.0.dist-info/METADATA,sha256=tgn_FyzKkdGf7CKUc5ujlr_ZeQXqbdewn_8zoAwL-uo,44420
16
+ openseries-1.9.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
17
+ openseries-1.9.0.dist-info/RECORD,,
@@ -1,16 +0,0 @@
1
- openseries/__init__.py,sha256=dKw_wEfgrCwwV1IRljesrtxjE9AVFwTyhE8k4CFIck8,1053
2
- openseries/_common_model.py,sha256=eaa981RlF5fUt9t53P2Uk2_aTL1wCG7hd160Wz3cKnI,81385
3
- openseries/_risk.py,sha256=lZzoP5yjq9vHtKhYe7kU3-iG8rADcu00bkT9kIgsi_E,2086
4
- openseries/datefixer.py,sha256=5S4Ib9CRHfsVPKsDKcIW7x8G86zxkMJz2jZ_Sig2Asw,12535
5
- openseries/frame.py,sha256=lqRwNNs82TCbl1rjVpy48VpndmIgRztIBNitjaHy2Mo,55859
6
- openseries/load_plotly.py,sha256=VGDdS8ojPQK7AQr-dGi9IfShi5O0EfjM8kUQrJhG_Zw,2000
7
- openseries/owntypes.py,sha256=jVPhPTYhr_lLZd8RYTzWFmhN8Gmmj09TzvIPyDu7vbc,9409
8
- openseries/plotly_captor_logo.json,sha256=F5nhMzEyxKywtjvQqMTKgKRCJQYMDIiBgDSxdte8Clo,178
9
- openseries/plotly_layouts.json,sha256=9tKAeittrjwJWhBMV8SnCDAWdhgbVnUqXcN6P_J_bos,1433
10
- openseries/portfoliotools.py,sha256=6bgz64-B6qJVrHAE-pLp8JJCmJkO_JAExHL5G3AwPWE,19295
11
- openseries/series.py,sha256=7le45RBcBqF9exDzfXfWbY8iiqgl70UUHNOWORvHAuQ,27221
12
- openseries/simulation.py,sha256=WHmPU2sNl03YvaL7-Ots7i0I_ZZ9j0hBSCnDYWSypK0,13936
13
- openseries-1.8.3.dist-info/LICENSE.md,sha256=wNupG-KLsG0aTncb_SMNDh1ExtrKXlpxSJ6RC-g-SWs,1516
14
- openseries-1.8.3.dist-info/METADATA,sha256=MkJAQEjImJUKh8UZ9w3e1_tyzh-kyGHdXmUGiOjZKVU,45877
15
- openseries-1.8.3.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
16
- openseries-1.8.3.dist-info/RECORD,,