Skip to content

Commit

Permalink
Fixed error in common_model.py geo_ret_func() (#43)
Browse files Browse the repository at this point in the history
* update

* Fixed error in common_model.py geo_ret_func()
  • Loading branch information
karrmagadgeteer2 authored Sep 10, 2023
1 parent 887c0b2 commit bc7f188
Show file tree
Hide file tree
Showing 8 changed files with 230 additions and 252 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ repos:
- id: ruff
args: [ --fix, --exit-non-zero-on-fix ]
- repo: https://github.com/psf/black
rev: 23.7.0
rev: 23.9.0
hooks:
- id: black
language: system
Expand Down
282 changes: 141 additions & 141 deletions .test_durations

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,17 @@ this log will cover all changes, and I will not attempt to go back very far in h
At some point I will also start documenting changes in release documentation instead.


## Version [1.3.2] - 2023-09-10

Found a mistake in geo_ret_func that was made when it was consolidated into the common_model.py
from frame.py and series.py. The function has worked as intended for any situations where no
arguments were provided, and therefore the geo_ret property has not been compromised.

## Version [1.3.1] - 2023-09-05

Validation of raw dates and values with a minimum of 2 items caused significant issues
downstream in our fund company because the OpenTimeSeries subclass is used as a validator also for fetching single date price data to be used in some valuations.
downstream in our fund company because the OpenTimeSeries subclass is used as a validator
also for fetching single date price data to be used in some valuations.
Because of this the validation now only requires 1 data point.

## Version [1.3.0] - 2023-09-05
Expand Down
16 changes: 2 additions & 14 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,14 @@

Given the almost non-existent audience for this project I typically only maintain the
latest version. However, please reach out if support is needed for an earlier version.
Without an x next to a version below you can assume that it works as intended.

| Version | Supported |
|---------|--------------------|
| 1.3.1 | :white_check_mark: |
| 1.3.2 | :white_check_mark: |
| 1.3.0 | :x: |
| 1.2.9 | :white_check_mark: |
| 1.2.8 | :white_check_mark: |
| 1.2.7 | :white_check_mark: |
| 1.2.6 | :white_check_mark: |
| 1.2.5 | :white_check_mark: |
| 1.2.4 | :white_check_mark: |
| 1.2.3 | :white_check_mark: |
| 1.2.2 | :white_check_mark: |
| 1.2.1 | :white_check_mark: |
| 1.2.0 | :x: |
| 1.1.7 | :white_check_mark: |
| 1.1.6 | :white_check_mark: |
| 1.1.5 | :x: |
| 1.0.1 | :white_check_mark: |
| 1.0.0 | :white_check_mark: |
| < 1.0.0 | :x: |

## Reporting a Vulnerability
Expand Down
2 changes: 1 addition & 1 deletion openseries/common_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1120,7 +1120,7 @@ def geo_ret_func(
"value being zero or a negative value.",
)

result = (self.tsdf.iloc[-1] / self.tsdf.iloc[0]) ** (1 / fraction) - 1
result = (self.tsdf.loc[later] / self.tsdf.loc[earlier]) ** (1 / fraction) - 1

if self.tsdf.shape[1] == 1:
return float(result.iloc[0])
Expand Down
158 changes: 69 additions & 89 deletions poetry.lock

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "openseries"
version = "1.3.1"
version = "1.3.2"
description = "Package for simple financial time series analysis."
authors = ["Martin Karrin <[email protected]>"]
repository = "https://github.com/CaptorAB/OpenSeries"
Expand Down Expand Up @@ -45,12 +45,12 @@ scipy = "^1.11.2"
statsmodels = "^0.14.0"

[tool.poetry.group.dev.dependencies]
black = "23.7.0"
coverage = {extras = ["toml"], version = "^7.3.0"}
black = "23.9.0"
coverage = {extras = ["toml"], version = "^7.3.1"}
coverage-badge = "^1.1.0"
mypy = "^1.5.1"
pre-commit = "^3.4.0"
pytest = "^7.4.1"
pytest = "^7.4.2"
pytest-split = "^0.8.1"
ruff = "^0.0.287"
toml = "^0.10.2"
Expand Down
5 changes: 4 additions & 1 deletion tests/test_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -946,11 +946,14 @@ def test_all_calc_properties(self: TestOpenTimeSeries) -> None:

def test_all_calc_functions(self: TestOpenTimeSeries) -> None:
"""Test all calculation methods."""
excel_geo_ret = (1.02447195802235 / 1.0102975774591) ** (
1 / ((dt.date(2019, 6, 28) - dt.date(2015, 6, 26)).days / 365.25)
) - 1
checks = {
"arithmetic_ret_func": f"{0.00885255100:.11f}",
"cvar_down_func": f"{-0.01331889836:.11f}",
"downside_deviation_func": f"{0.07335125856:.11f}",
"geo_ret_func": f"{0.00605432007:.11f}",
"geo_ret_func": f"{excel_geo_ret:.11f}",
"kurtosis_func": f"{-0.16164566028:.11f}",
"max_drawdown_func": f"{-0.20565775282:.11f}",
"positive_share_func": f"{0.50645481629:.11f}",
Expand Down

0 comments on commit bc7f188

Please sign in to comment.