openseries 1.5.1__py3-none-any.whl → 1.5.2__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/__init__.py +1 -1
- openseries/_common_model.py +0 -1
- openseries/datefixer.py +1 -1
- openseries/simulation.py +0 -1
- openseries/types.py +8 -5
- {openseries-1.5.1.dist-info → openseries-1.5.2.dist-info}/METADATA +25 -25
- openseries-1.5.2.dist-info/RECORD +15 -0
- openseries-1.5.1.dist-info/RECORD +0 -15
- {openseries-1.5.1.dist-info → openseries-1.5.2.dist-info}/LICENSE.md +0 -0
- {openseries-1.5.1.dist-info → openseries-1.5.2.dist-info}/WHEEL +0 -0
openseries/__init__.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"""
|
1
|
+
"""openseries.openseries.__init__.py."""
|
openseries/_common_model.py
CHANGED
openseries/datefixer.py
CHANGED
@@ -5,7 +5,7 @@ import datetime as dt
|
|
5
5
|
from typing import Optional, Union, cast
|
6
6
|
|
7
7
|
from dateutil.relativedelta import relativedelta
|
8
|
-
from holidays import (
|
8
|
+
from holidays import (
|
9
9
|
country_holidays,
|
10
10
|
list_supported_countries,
|
11
11
|
)
|
openseries/simulation.py
CHANGED
openseries/types.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
"""Declaring types used throughout the project."""
|
2
|
+
|
2
3
|
from __future__ import annotations
|
3
4
|
|
4
5
|
import datetime as dt
|
@@ -8,6 +9,7 @@ from typing import Annotated, ClassVar, Literal, Union
|
|
8
9
|
from numpy import datetime64
|
9
10
|
from pandas import Timestamp
|
10
11
|
from pydantic import BaseModel, Field, StringConstraints, conlist, conset
|
12
|
+
from typing_extensions import Self
|
11
13
|
|
12
14
|
CountryStringType = Annotated[
|
13
15
|
str,
|
@@ -119,6 +121,7 @@ LiteralLinePlotMode = Literal[
|
|
119
121
|
"lines+text",
|
120
122
|
"markers+text",
|
121
123
|
"lines+markers+text",
|
124
|
+
None,
|
122
125
|
]
|
123
126
|
LiteralHowMerge = Literal["outer", "inner"]
|
124
127
|
LiteralQuantileInterp = Literal["linear", "lower", "higher", "midpoint", "nearest"]
|
@@ -137,7 +140,7 @@ LiteralBarPlotMode = Literal["stack", "group", "overlay", "relative"]
|
|
137
140
|
LiteralPlotlyOutput = Literal["file", "div"]
|
138
141
|
LiteralPlotlyJSlib = Literal[True, False, "cdn"]
|
139
142
|
LiteralOlsFitMethod = Literal["pinv", "qr"]
|
140
|
-
LiteralPortfolioWeightings = Literal["eq_weights", "
|
143
|
+
LiteralPortfolioWeightings = Literal["eq_weights", "inv_vol"]
|
141
144
|
LiteralOlsFitCovType = Literal[
|
142
145
|
"nonrobust",
|
143
146
|
"fixed scale",
|
@@ -238,14 +241,14 @@ class OpenTimeSeriesPropertiesList(list[str]):
|
|
238
241
|
}
|
239
242
|
|
240
243
|
def __init__(
|
241
|
-
self:
|
244
|
+
self: Self,
|
242
245
|
*args: LiteralSeriesProps,
|
243
246
|
) -> None:
|
244
247
|
"""Property arguments for the OpenTimeSeries class."""
|
245
248
|
super().__init__(args)
|
246
249
|
self._validate()
|
247
250
|
|
248
|
-
def _validate(self:
|
251
|
+
def _validate(self: Self) -> None:
|
249
252
|
seen = set()
|
250
253
|
for item in self:
|
251
254
|
if item not in self.allowed_strings:
|
@@ -291,12 +294,12 @@ class OpenFramePropertiesList(list[str]):
|
|
291
294
|
"span_of_days_all",
|
292
295
|
}
|
293
296
|
|
294
|
-
def __init__(self:
|
297
|
+
def __init__(self: Self, *args: LiteralFrameProps) -> None:
|
295
298
|
"""Property arguments for the OpenFrame class."""
|
296
299
|
super().__init__(args)
|
297
300
|
self._validate()
|
298
301
|
|
299
|
-
def _validate(self:
|
302
|
+
def _validate(self: Self) -> None:
|
300
303
|
seen = set()
|
301
304
|
for item in self:
|
302
305
|
if item not in self.allowed_strings:
|
@@ -1,8 +1,8 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: openseries
|
3
|
-
Version: 1.5.
|
4
|
-
Summary:
|
5
|
-
Home-page: https://github.com/CaptorAB/
|
3
|
+
Version: 1.5.2
|
4
|
+
Summary: Tools for analyzing financial timeseries.
|
5
|
+
Home-page: https://github.com/CaptorAB/openseries
|
6
6
|
License: BSD-3-Clause
|
7
7
|
Keywords: python,finance,fintech,data-science,timeseries,timeseries-data,timeseries-analysis,investment,investment-analysis,investing
|
8
8
|
Author: Martin Karrin
|
@@ -31,7 +31,7 @@ Requires-Dist: python-dateutil (>=2.8.2,<3.0.0)
|
|
31
31
|
Requires-Dist: requests (>=2.20.0,<3.0.0)
|
32
32
|
Requires-Dist: scipy (>=1.11.4,<2.0.0)
|
33
33
|
Requires-Dist: statsmodels (>=0.14.0,<1.0.0)
|
34
|
-
Project-URL: Repository, https://github.com/CaptorAB/
|
34
|
+
Project-URL: Repository, https://github.com/CaptorAB/openseries
|
35
35
|
Description-Content-Type: text/markdown
|
36
36
|
|
37
37
|
<img src="https://sales.captor.se/captor_logo_sv_1600_icketransparent.png" alt="Captor
|
@@ -40,23 +40,23 @@ width="81" height="100" align="left" float="right"/><br/>
|
|
40
40
|
|
41
41
|
<br><br>
|
42
42
|
|
43
|
-
#
|
43
|
+
# openseries
|
44
44
|
|
45
45
|
[](https://pypi.org/project/openseries/)
|
46
46
|
[](https://anaconda.org/conda-forge/openseries)
|
47
47
|
[](https://anaconda.org/conda-forge/openseries)
|
48
48
|
[](https://www.python.org/)
|
49
|
-
[](https://github.com/CaptorAB/openseries/actions/workflows/test.yml)
|
50
|
+
[](https://github.com/CaptorAB/openseries/actions/workflows/test.yml)
|
51
|
+
[](https://github.com/CaptorAB/openseries/actions/workflows/check.yml)
|
52
52
|
[](https://python-poetry.org/)
|
53
53
|
[](https://beta.ruff.rs/docs/)
|
54
54
|
[](https://opensource.org/licenses/BSD-3-Clause)
|
55
55
|
|
56
|
-
|
56
|
+
`openseries` is a project with tools to analyse financial timeseries of a single
|
57
57
|
asset or a group of assets. It is solely made for daily or less frequent data.
|
58
58
|
|
59
|
-
<span style="font-size:2em;">[CHANGELOG](https://github.com/CaptorAB/
|
59
|
+
<span style="font-size:2em;">[CHANGELOG](https://github.com/CaptorAB/openseries/blob/master/CHANGELOG.md)</span>
|
60
60
|
|
61
61
|
|
62
62
|
## Basic Usage
|
@@ -138,8 +138,8 @@ on any attributes or methods inherited from this model.
|
|
138
138
|
### Windows Powershell
|
139
139
|
|
140
140
|
```powershell
|
141
|
-
git clone https://github.com/CaptorAB/
|
142
|
-
cd
|
141
|
+
git clone https://github.com/CaptorAB/openseries.git
|
142
|
+
cd openseries
|
143
143
|
./make.ps1 make
|
144
144
|
|
145
145
|
```
|
@@ -147,8 +147,8 @@ cd OpenSeries
|
|
147
147
|
### Mac Terminal/Linux
|
148
148
|
|
149
149
|
```bash
|
150
|
-
git clone https://github.com/CaptorAB/
|
151
|
-
cd
|
150
|
+
git clone https://github.com/CaptorAB/openseries.git
|
151
|
+
cd openseries
|
152
152
|
make
|
153
153
|
source source_me
|
154
154
|
make install
|
@@ -161,7 +161,7 @@ Ruff and Mypy checking is embedded in the pre-commit hook. Both
|
|
161
161
|
are also used in the project's GitHub workflows and are run when the `lint`
|
162
162
|
alternative is chosen in the below commands.
|
163
163
|
Any silenced error codes can be found in the
|
164
|
-
[pyproject.toml](https://github.com/CaptorAB/
|
164
|
+
[pyproject.toml](https://github.com/CaptorAB/openseries/blob/master/pyproject.toml)
|
165
165
|
file or in in-line comments.
|
166
166
|
|
167
167
|
### Windows Powershell
|
@@ -201,9 +201,9 @@ make lint
|
|
201
201
|
|
202
202
|
| File | Description |
|
203
203
|
|:-----------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
204
|
-
| [series.py](https://github.com/CaptorAB/
|
205
|
-
| [frame.py](https://github.com/CaptorAB/
|
206
|
-
| [simulation.py](https://github.com/CaptorAB/
|
204
|
+
| [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. |
|
205
|
+
| [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. The module also defines functions to simulate, optimize, and plot portfolios. |
|
206
|
+
| [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 |
|
207
207
|
|
208
208
|
### Class methods used to construct objects.
|
209
209
|
|
@@ -214,7 +214,7 @@ make lint
|
|
214
214
|
| `from_fixed_rate` | `OpenTimeSeries` | Class method to create an OpenTimeSeries object from a fixed rate, number of days and an end date. |
|
215
215
|
| `from_deepcopy` | `OpenTimeSeries`, `OpenFrame` | Creates a copy of an OpenTimeSeries object. |
|
216
216
|
|
217
|
-
### Non-numerical or "helper" properties that apply only to the [OpenTimeSeries](https://github.com/CaptorAB/
|
217
|
+
### Non-numerical or "helper" properties that apply only to the [OpenTimeSeries](https://github.com/CaptorAB/openseries/blob/master/openseries/series.py) class.
|
218
218
|
|
219
219
|
| Property | type | Applies to | Description |
|
220
220
|
|:----------------|:----------------|:-----------------|:---------------------------------------------------------------------------------------------------------------------------------------------|
|
@@ -231,7 +231,7 @@ make lint
|
|
231
231
|
| `countries` | `list` or `str` | `OpenTimeSeries` | (List of) country code(s) according to ISO 3166-1 alpha-2 used to generate business days. |
|
232
232
|
| `valuetype` | `ValueType` | `OpenTimeSeries` | Field identifies the type of values in the series. ValueType is an Enum. |
|
233
233
|
|
234
|
-
### Non-numerical or "helper" properties that apply only to the [OpenFrame](https://github.com/CaptorAB/
|
234
|
+
### Non-numerical or "helper" properties that apply only to the [OpenFrame](https://github.com/CaptorAB/openseries/blob/master/openseries/frame.py) class.
|
235
235
|
|
236
236
|
| Property | type | Applies to | Description |
|
237
237
|
|:-------------------|:-----------------------|:------------|:-------------------------------------------------------------------------|
|
@@ -245,7 +245,7 @@ make lint
|
|
245
245
|
| `lengths_of_items` | `pandas.Series` | `OpenFrame` | Number of items in each of the series in the OpenFrame. |
|
246
246
|
| `span_of_days_all` | `pandas.Series` | `OpenFrame` | Number of days from the first to the last in each of the series. |
|
247
247
|
|
248
|
-
### Non-numerical or "helper" properties that apply to both the [OpenTimeSeries](https://github.com/CaptorAB/
|
248
|
+
### 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.
|
249
249
|
|
250
250
|
| Property | type | Applies to | Description |
|
251
251
|
|:--------------------|:---------------------------------|:------------------------------|:----------------------------------------------------------------------------------|
|
@@ -258,7 +258,7 @@ make lint
|
|
258
258
|
| `periods_in_a_year` | `float` | `OpenTimeSeries`, `OpenFrame` | The number of observations in an average year for all days in the data. |
|
259
259
|
| `yearfrac` | `float` | `OpenTimeSeries`, `OpenFrame` | Length of timeseries expressed as np.float64 fraction of a year with 365.25 days. |
|
260
260
|
|
261
|
-
### Methods that apply only to the [OpenTimeSeries](https://github.com/CaptorAB/
|
261
|
+
### Methods that apply only to the [OpenTimeSeries](https://github.com/CaptorAB/openseries/blob/master/openseries/series.py) class.
|
262
262
|
|
263
263
|
| Method | Applies to | Description |
|
264
264
|
|:-------------------------|:-----------------|:-----------------------------------------------------------------------------------------------------------------------------------------------|
|
@@ -270,7 +270,7 @@ make lint
|
|
270
270
|
| `from_1d_rate_to_cumret` | `OpenTimeSeries` | Converts a series of 1-day rates into a cumulative valueseries. |
|
271
271
|
|
|
272
272
|
|
273
|
-
### Methods that apply only to the [OpenFrame](https://github.com/CaptorAB/
|
273
|
+
### Methods that apply only to the [OpenFrame](https://github.com/CaptorAB/openseries/blob/master/openseries/frame.py) class.
|
274
274
|
|
275
275
|
| Method | Applies to | Description |
|
276
276
|
|:------------------------|:------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
@@ -291,7 +291,7 @@ make lint
|
|
291
291
|
| `rolling_corr` | `OpenFrame` | Calculates and adds a series of rolling [correlations](https://www.investopedia.com/terms/c/correlation.asp) between two other series. |
|
292
292
|
| `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). |
|
293
293
|
|
294
|
-
### Methods that apply to both the [OpenTimeSeries](https://github.com/CaptorAB/
|
294
|
+
### 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.
|
295
295
|
|
296
296
|
| Method | Applies to | Description |
|
297
297
|
|:-----------------------------------|:------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------|
|
@@ -316,7 +316,7 @@ make lint
|
|
316
316
|
| `rolling_cvar_down` | `OpenTimeSeries`, `OpenFrame` | Returns a pandas.DataFrame with rolling CVaR figures. |
|
317
317
|
| `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. |
|
318
318
|
|
319
|
-
### Numerical properties available for individual [OpenTimeSeries](https://github.com/CaptorAB/
|
319
|
+
### 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).
|
320
320
|
|
321
321
|
| Property | type | Applies to | Description |
|
322
322
|
|:------------------------|:-------------------------|:------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
openseries/__init__.py,sha256=W429Ojwa-wPgHV5PDAOQOBOAzPOR4wrVHRwdZQjRKcQ,41
|
2
|
+
openseries/_common_model.py,sha256=PGJDMI305RrxThXaBXSdKrMOvUozjjNprhWilKcp-G0,72468
|
3
|
+
openseries/_risk.py,sha256=JnwAklqs2G3YIp9KTNKbumqs4VgfFIk-eFs0dZ-_jCY,3299
|
4
|
+
openseries/datefixer.py,sha256=3DQz_nUbUVBHCxM5wdqbAQUfdG-9xN3S5yqEX4F_NpI,12377
|
5
|
+
openseries/frame.py,sha256=en_GL0_l9OHsZk6AmYin5Pip7geLyTeLZNAZqIR4xcI,73772
|
6
|
+
openseries/load_plotly.py,sha256=kIjvJ2H1sIXWsjd-mZclLvj7ebh-4Hdb1dwB2gR9b-Y,1807
|
7
|
+
openseries/plotly_captor_logo.json,sha256=F5nhMzEyxKywtjvQqMTKgKRCJQYMDIiBgDSxdte8Clo,178
|
8
|
+
openseries/plotly_layouts.json,sha256=ahx8-dL4_RPzvHtBOX0SiL0AH7xQJzNRSDhGrSmU-Og,1429
|
9
|
+
openseries/series.py,sha256=jHbJkzFUeGokUJZ1Md4Hx1keSwpNMjPq1r_FDCputIE,28312
|
10
|
+
openseries/simulation.py,sha256=y9A_kNuGoIqVlFsQzxA39hBi9Nt9X1yN2VYjShYNhtE,13549
|
11
|
+
openseries/types.py,sha256=qOKWorkGsv22Q0b2RvMW8IS2pkO3PJlbhQfAviRYNts,7597
|
12
|
+
openseries-1.5.2.dist-info/LICENSE.md,sha256=cPUabMxJ6-ziqzqS6aLGkR-ilIOKe_s3Qtyp0ioTmo0,1521
|
13
|
+
openseries-1.5.2.dist-info/METADATA,sha256=5siFdLZ275Ry94LNRRA4VlD--ye9-uafpxC6HjLorjY,43661
|
14
|
+
openseries-1.5.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
15
|
+
openseries-1.5.2.dist-info/RECORD,,
|
@@ -1,15 +0,0 @@
|
|
1
|
-
openseries/__init__.py,sha256=hA7I5IFk88EnX6eyBbI1KLT_FGcmPIKF49xa5g3T8Yg,41
|
2
|
-
openseries/_common_model.py,sha256=whzIHppEGjXqv2C5ZBg7c-QTCC6dHWBjNKX40WV_c6g,72469
|
3
|
-
openseries/_risk.py,sha256=JnwAklqs2G3YIp9KTNKbumqs4VgfFIk-eFs0dZ-_jCY,3299
|
4
|
-
openseries/datefixer.py,sha256=_HNiPR6S3agwOAk8gl3wIdegR6uDbh-00J1Zgo4GMl8,12423
|
5
|
-
openseries/frame.py,sha256=en_GL0_l9OHsZk6AmYin5Pip7geLyTeLZNAZqIR4xcI,73772
|
6
|
-
openseries/load_plotly.py,sha256=kIjvJ2H1sIXWsjd-mZclLvj7ebh-4Hdb1dwB2gR9b-Y,1807
|
7
|
-
openseries/plotly_captor_logo.json,sha256=F5nhMzEyxKywtjvQqMTKgKRCJQYMDIiBgDSxdte8Clo,178
|
8
|
-
openseries/plotly_layouts.json,sha256=ahx8-dL4_RPzvHtBOX0SiL0AH7xQJzNRSDhGrSmU-Og,1429
|
9
|
-
openseries/series.py,sha256=jHbJkzFUeGokUJZ1Md4Hx1keSwpNMjPq1r_FDCputIE,28312
|
10
|
-
openseries/simulation.py,sha256=_1cYO4VnlRI6khk6Th8ziN5Toz1iry0jFKICHQub3V0,13550
|
11
|
-
openseries/types.py,sha256=Qw-ny6IZtdMeuHJF6FvIE0B2stnN3sdqq9fySIKUWK4,7660
|
12
|
-
openseries-1.5.1.dist-info/LICENSE.md,sha256=cPUabMxJ6-ziqzqS6aLGkR-ilIOKe_s3Qtyp0ioTmo0,1521
|
13
|
-
openseries-1.5.1.dist-info/METADATA,sha256=N1NAZ6l6V2pfc-EZAzF1kVTaLNAg7OrfVr1juoaUPMA,43665
|
14
|
-
openseries-1.5.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
15
|
-
openseries-1.5.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|