openseries 1.7.5__tar.gz → 1.7.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.
- {openseries-1.7.5 → openseries-1.7.7}/PKG-INFO +11 -13
- {openseries-1.7.5 → openseries-1.7.7}/README.md +7 -10
- {openseries-1.7.5 → openseries-1.7.7}/openseries/_common_model.py +15 -2
- {openseries-1.7.5 → openseries-1.7.7}/openseries/frame.py +2 -1
- {openseries-1.7.5 → openseries-1.7.7}/openseries/load_plotly.py +2 -2
- {openseries-1.7.5 → openseries-1.7.7}/pyproject.toml +9 -8
- {openseries-1.7.5 → openseries-1.7.7}/LICENSE.md +0 -0
- {openseries-1.7.5 → openseries-1.7.7}/openseries/__init__.py +8 -8
- {openseries-1.7.5 → openseries-1.7.7}/openseries/_risk.py +0 -0
- {openseries-1.7.5 → openseries-1.7.7}/openseries/datefixer.py +0 -0
- {openseries-1.7.5 → openseries-1.7.7}/openseries/plotly_captor_logo.json +0 -0
- {openseries-1.7.5 → openseries-1.7.7}/openseries/plotly_layouts.json +0 -0
- {openseries-1.7.5 → openseries-1.7.7}/openseries/portfoliotools.py +0 -0
- {openseries-1.7.5 → openseries-1.7.7}/openseries/series.py +0 -0
- {openseries-1.7.5 → openseries-1.7.7}/openseries/simulation.py +0 -0
- {openseries-1.7.5 → openseries-1.7.7}/openseries/types.py +0 -0
@@ -1,13 +1,13 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: openseries
|
3
|
-
Version: 1.7.
|
3
|
+
Version: 1.7.7
|
4
4
|
Summary: Tools for analyzing financial timeseries.
|
5
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
|
9
9
|
Author-email: martin.karrin@captor.se
|
10
|
-
Requires-Python: >=3.10,<3.
|
10
|
+
Requires-Python: >=3.10,<3.14
|
11
11
|
Classifier: Development Status :: 5 - Production/Stable
|
12
12
|
Classifier: Framework :: Pydantic
|
13
13
|
Classifier: Intended Audience :: Financial and Insurance Industry
|
@@ -18,13 +18,14 @@ Classifier: Programming Language :: Python :: 3
|
|
18
18
|
Classifier: Programming Language :: Python :: 3.10
|
19
19
|
Classifier: Programming Language :: Python :: 3.11
|
20
20
|
Classifier: Programming Language :: Python :: 3.12
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
21
22
|
Classifier: Topic :: Office/Business :: Financial :: Investment
|
22
23
|
Requires-Dist: holidays (>=0.30,<1.0)
|
23
24
|
Requires-Dist: numpy (>=1.23.2,<3.0.0)
|
24
25
|
Requires-Dist: openpyxl (>=3.1.2,<4.0.0)
|
25
26
|
Requires-Dist: pandas (>=2.1.2,<3.0.0)
|
26
27
|
Requires-Dist: plotly (>=5.18.0,<6.0.0)
|
27
|
-
Requires-Dist: pyarrow (>=14.0.2,<
|
28
|
+
Requires-Dist: pyarrow (>=14.0.2,<19.0.0)
|
28
29
|
Requires-Dist: pydantic (>=2.5.2,<3.0.0)
|
29
30
|
Requires-Dist: python-dateutil (>=2.8.2,<3.0.0)
|
30
31
|
Requires-Dist: requests (>=2.20.0,<3.0.0)
|
@@ -33,21 +34,18 @@ Requires-Dist: statsmodels (>=0.14.0,!=0.14.2,<1.0.0)
|
|
33
34
|
Project-URL: Repository, https://github.com/CaptorAB/openseries
|
34
35
|
Description-Content-Type: text/markdown
|
35
36
|
|
36
|
-
<img src="https://sales.captor.se/captor_logo_sv_1600_icketransparent.png" alt="Captor
|
37
|
-
Fund Management AB"
|
38
|
-
width="81" height="100" align="left" float="right"/><br/>
|
37
|
+
<a href="https://captor.se/"><img src="https://sales.captor.se/captor_logo_sv_1600_icketransparent.png" alt="Captor Fund Management AB" width="81" height="100" align="left" float="right"/></a><br/>
|
39
38
|
|
40
39
|
<br><br>
|
41
40
|
|
42
41
|
# openseries
|
43
42
|
|
44
43
|
[](https://pypi.org/project/openseries/)
|
45
|
-
[](https://anaconda.org/conda-forge/openseries)
|
46
45
|
[](https://anaconda.org/conda-forge/openseries)
|
47
46
|
[](https://www.python.org/)
|
48
47
|
[](https://github.com/CaptorAB/openseries/actions/workflows/test.yml)
|
49
48
|
[](https://github.com/CaptorAB/openseries/actions/workflows/test.yml)
|
50
|
-
[](https://github.com/CaptorAB/openseries/actions/workflows/check.yml)
|
51
49
|
[](https://python-poetry.org/)
|
52
50
|
[](https://beta.ruff.rs/docs/)
|
53
51
|
[](https://opensource.org/licenses/BSD-3-Clause)
|
@@ -55,8 +53,6 @@ width="81" height="100" align="left" float="right"/><br/>
|
|
55
53
|
This is a project with tools to analyze financial timeseries of a single
|
56
54
|
asset or a group of assets. It is solely made for daily or less frequent data.
|
57
55
|
|
58
|
-
<span style="font-size:2em;">[CHANGELOG](https://github.com/CaptorAB/openseries/blob/master/CHANGELOG.md)</span>
|
59
|
-
|
60
56
|
|
61
57
|
## Basic Usage
|
62
58
|
|
@@ -66,6 +62,8 @@ To install:
|
|
66
62
|
pip install openseries
|
67
63
|
```
|
68
64
|
|
65
|
+
or:
|
66
|
+
|
69
67
|
```bash
|
70
68
|
conda install -c conda-forge openseries
|
71
69
|
```
|
@@ -82,10 +80,10 @@ Install openseries and yfinance first.
|
|
82
80
|
from openseries import OpenTimeSeries
|
83
81
|
import yfinance as yf
|
84
82
|
|
85
|
-
|
86
|
-
history=
|
83
|
+
move=yf.Ticker("^MOVE")
|
84
|
+
history=move.history(period="max")
|
87
85
|
series=OpenTimeSeries.from_df(history.loc[:, "Close"])
|
88
|
-
_=series.
|
86
|
+
_=series.set_new_label("ICE BofAML MOVE Index")
|
89
87
|
_,_=series.plot_series()
|
90
88
|
|
91
89
|
```
|
@@ -1,18 +1,15 @@
|
|
1
|
-
<img src="https://sales.captor.se/captor_logo_sv_1600_icketransparent.png" alt="Captor
|
2
|
-
Fund Management AB"
|
3
|
-
width="81" height="100" align="left" float="right"/><br/>
|
1
|
+
<a href="https://captor.se/"><img src="https://sales.captor.se/captor_logo_sv_1600_icketransparent.png" alt="Captor Fund Management AB" width="81" height="100" align="left" float="right"/></a><br/>
|
4
2
|
|
5
3
|
<br><br>
|
6
4
|
|
7
5
|
# openseries
|
8
6
|
|
9
7
|
[](https://pypi.org/project/openseries/)
|
10
|
-
[](https://anaconda.org/conda-forge/openseries)
|
11
9
|
[](https://anaconda.org/conda-forge/openseries)
|
12
10
|
[](https://www.python.org/)
|
13
11
|
[](https://github.com/CaptorAB/openseries/actions/workflows/test.yml)
|
14
12
|
[](https://github.com/CaptorAB/openseries/actions/workflows/test.yml)
|
15
|
-
[](https://github.com/CaptorAB/openseries/actions/workflows/check.yml)
|
16
13
|
[](https://python-poetry.org/)
|
17
14
|
[](https://beta.ruff.rs/docs/)
|
18
15
|
[](https://opensource.org/licenses/BSD-3-Clause)
|
@@ -20,8 +17,6 @@ width="81" height="100" align="left" float="right"/><br/>
|
|
20
17
|
This is a project with tools to analyze financial timeseries of a single
|
21
18
|
asset or a group of assets. It is solely made for daily or less frequent data.
|
22
19
|
|
23
|
-
<span style="font-size:2em;">[CHANGELOG](https://github.com/CaptorAB/openseries/blob/master/CHANGELOG.md)</span>
|
24
|
-
|
25
20
|
|
26
21
|
## Basic Usage
|
27
22
|
|
@@ -31,6 +26,8 @@ To install:
|
|
31
26
|
pip install openseries
|
32
27
|
```
|
33
28
|
|
29
|
+
or:
|
30
|
+
|
34
31
|
```bash
|
35
32
|
conda install -c conda-forge openseries
|
36
33
|
```
|
@@ -47,10 +44,10 @@ Install openseries and yfinance first.
|
|
47
44
|
from openseries import OpenTimeSeries
|
48
45
|
import yfinance as yf
|
49
46
|
|
50
|
-
|
51
|
-
history=
|
47
|
+
move=yf.Ticker("^MOVE")
|
48
|
+
history=move.history(period="max")
|
52
49
|
series=OpenTimeSeries.from_df(history.loc[:, "Close"])
|
53
|
-
_=series.
|
50
|
+
_=series.set_new_label("ICE BofAML MOVE Index")
|
54
51
|
_,_=series.plot_series()
|
55
52
|
|
56
53
|
```
|
@@ -43,7 +43,11 @@ from ._risk import (
|
|
43
43
|
_cvar_down_calc,
|
44
44
|
_var_down_calc,
|
45
45
|
)
|
46
|
-
from .datefixer import
|
46
|
+
from .datefixer import (
|
47
|
+
_do_resample_to_business_period_ends,
|
48
|
+
date_offset_foll,
|
49
|
+
holiday_calendar,
|
50
|
+
)
|
47
51
|
from .load_plotly import load_plotly_dict
|
48
52
|
from .types import (
|
49
53
|
CountriesType,
|
@@ -52,6 +56,7 @@ from .types import (
|
|
52
56
|
LiteralJsonOutput,
|
53
57
|
LiteralLinePlotMode,
|
54
58
|
LiteralNanMethod,
|
59
|
+
LiteralPandasReindexMethod,
|
55
60
|
LiteralPlotlyJSlib,
|
56
61
|
LiteralPlotlyOutput,
|
57
62
|
LiteralQuantileInterp,
|
@@ -358,9 +363,17 @@ class _CommonModel(BaseModel):
|
|
358
363
|
Most negative month
|
359
364
|
|
360
365
|
"""
|
366
|
+
method: LiteralPandasReindexMethod = "nearest"
|
367
|
+
countries = "SE"
|
361
368
|
wmdf = self.tsdf.copy()
|
369
|
+
dates = _do_resample_to_business_period_ends(
|
370
|
+
data=wmdf,
|
371
|
+
freq="BME",
|
372
|
+
countries=countries,
|
373
|
+
)
|
374
|
+
wmdf = wmdf.reindex(index=[deyt.date() for deyt in dates], method=method)
|
362
375
|
wmdf.index = DatetimeIndex(wmdf.index)
|
363
|
-
result = wmdf.
|
376
|
+
result = wmdf.ffill().pct_change().min()
|
364
377
|
|
365
378
|
if self.tsdf.shape[1] == 1:
|
366
379
|
return float(result.iloc[0])
|
@@ -13,6 +13,7 @@ if TYPE_CHECKING:
|
|
13
13
|
|
14
14
|
import statsmodels.api as sm # type: ignore[import-untyped,unused-ignore]
|
15
15
|
from numpy import (
|
16
|
+
array,
|
16
17
|
cov,
|
17
18
|
divide,
|
18
19
|
isinf,
|
@@ -1456,7 +1457,7 @@ class OpenFrame(_CommonModel):
|
|
1456
1457
|
raise NotImplementedError(msg)
|
1457
1458
|
|
1458
1459
|
return DataFrame(
|
1459
|
-
data=(returns @ self.weights).add(1.0).cumprod(),
|
1460
|
+
data=(returns @ array(self.weights)).add(1.0).cumprod(),
|
1460
1461
|
index=self.tsdf.index,
|
1461
1462
|
columns=[[name], [ValueType.PRICE]],
|
1462
1463
|
dtype="float64",
|
@@ -8,7 +8,7 @@ from pathlib import Path
|
|
8
8
|
from typing import TYPE_CHECKING
|
9
9
|
|
10
10
|
import requests
|
11
|
-
from requests.exceptions import ConnectionError
|
11
|
+
from requests.exceptions import ConnectionError as RequestsConnectionError
|
12
12
|
|
13
13
|
if TYPE_CHECKING:
|
14
14
|
from .types import CaptorLogoType, PlotlyLayoutType # pragma: no cover
|
@@ -36,7 +36,7 @@ def _check_remote_file_existence(url: str) -> bool:
|
|
36
36
|
response = requests.head(url, timeout=30)
|
37
37
|
if response.status_code != ok_code:
|
38
38
|
return False
|
39
|
-
except
|
39
|
+
except RequestsConnectionError:
|
40
40
|
return False
|
41
41
|
return True
|
42
42
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "openseries"
|
3
|
-
version = "1.7.
|
3
|
+
version = "1.7.7"
|
4
4
|
description = "Tools for analyzing financial timeseries."
|
5
5
|
authors = ["Martin Karrin <martin.karrin@captor.se>"]
|
6
6
|
repository = "https://github.com/CaptorAB/openseries"
|
@@ -10,6 +10,7 @@ classifiers = [
|
|
10
10
|
"Programming Language :: Python :: 3.10",
|
11
11
|
"Programming Language :: Python :: 3.11",
|
12
12
|
"Programming Language :: Python :: 3.12",
|
13
|
+
"Programming Language :: Python :: 3.13",
|
13
14
|
"License :: OSI Approved :: BSD License",
|
14
15
|
"Intended Audience :: Financial and Insurance Industry",
|
15
16
|
"Topic :: Office/Business :: Financial :: Investment",
|
@@ -32,13 +33,13 @@ keywords = [
|
|
32
33
|
]
|
33
34
|
|
34
35
|
[tool.poetry.dependencies]
|
35
|
-
python = ">=3.10,<3.
|
36
|
+
python = ">=3.10,<3.14"
|
36
37
|
holidays = ">=0.30,<1.0"
|
37
38
|
numpy = ">=1.23.2,<3.0.0"
|
38
39
|
openpyxl = ">=3.1.2,<4.0.0"
|
39
40
|
pandas = ">=2.1.2,<3.0.0"
|
40
41
|
plotly = ">=5.18.0,<6.0.0"
|
41
|
-
pyarrow = ">=14.0.2,<
|
42
|
+
pyarrow = ">=14.0.2,<19.0.0"
|
42
43
|
pydantic = ">=2.5.2,<3.0.0"
|
43
44
|
python-dateutil = ">=2.8.2,<3.0.0"
|
44
45
|
requests = ">=2.20.0,<3.0.0"
|
@@ -47,19 +48,19 @@ statsmodels = ">=0.14.0,!=0.14.2,<1.0.0"
|
|
47
48
|
|
48
49
|
[tool.poetry.group.dev.dependencies]
|
49
50
|
black = ">=24.4.2,<25.0.0"
|
50
|
-
coverage = ">=7.
|
51
|
+
coverage = ">=7.2.7,<9.0.0"
|
51
52
|
genbadge = {version = ">=1.1.1,<2.0.0", extras = ["coverage"]}
|
52
|
-
mypy = "
|
53
|
+
mypy = "1.13.0"
|
53
54
|
pandas-stubs = ">=2.1.2,<3.0.0"
|
54
55
|
pre-commit = ">=3.7.1,<6.0.0"
|
55
56
|
pytest = ">=8.2.2,<9.0.0"
|
56
|
-
ruff = "
|
57
|
+
ruff = "0.8.1"
|
57
58
|
types-openpyxl = ">=3.1.2,<4.0.0"
|
58
59
|
types-python-dateutil = ">=2.8.2,<3.0.0"
|
59
60
|
types-requests = ">=2.20.0,<3.0.0"
|
60
61
|
|
61
62
|
[build-system]
|
62
|
-
requires = ["poetry-core>=1.8.
|
63
|
+
requires = ["poetry-core>=1.8.4"]
|
63
64
|
build-backend = "poetry.core.masonry.api"
|
64
65
|
|
65
66
|
[tool.coverage.run]
|
@@ -105,7 +106,7 @@ line-length = 87
|
|
105
106
|
|
106
107
|
[tool.ruff.lint]
|
107
108
|
select = ["ALL"]
|
108
|
-
ignore = ["D203", "D213"]
|
109
|
+
ignore = ["COM812", "D203", "D213", "ISC001"]
|
109
110
|
fixable = ["ALL"]
|
110
111
|
|
111
112
|
[tool.ruff.lint.pylint]
|
File without changes
|
@@ -23,20 +23,20 @@ from .types import ValueType
|
|
23
23
|
|
24
24
|
__all__ = [
|
25
25
|
"OpenFrame",
|
26
|
+
"OpenTimeSeries",
|
27
|
+
"ReturnSimulation",
|
28
|
+
"ValueType",
|
26
29
|
"constrain_optimized_portfolios",
|
27
|
-
"efficient_frontier",
|
28
|
-
"prepare_plot_data",
|
29
|
-
"sharpeplot",
|
30
|
-
"simulate_portfolios",
|
31
30
|
"date_fix",
|
32
31
|
"date_offset_foll",
|
32
|
+
"efficient_frontier",
|
33
33
|
"generate_calendar_date_range",
|
34
34
|
"get_previous_business_day_before_today",
|
35
35
|
"holiday_calendar",
|
36
|
-
"offset_business_days",
|
37
36
|
"load_plotly_dict",
|
38
|
-
"
|
37
|
+
"offset_business_days",
|
38
|
+
"prepare_plot_data",
|
39
|
+
"sharpeplot",
|
40
|
+
"simulate_portfolios",
|
39
41
|
"timeseries_chain",
|
40
|
-
"ReturnSimulation",
|
41
|
-
"ValueType",
|
42
42
|
]
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|