Skip to content

Commit

Permalink
New version 1.4.5 (#58)
Browse files Browse the repository at this point in the history
* clean up ewma_vol_func()

* dev dep update

* simulation cleanup. removed Heston CIR & OU

* improved argument logic in ReturnSimulation

* fixed test coverage

* major remake of merton model

* fixed calculation result tests after changing merton model simulation

* added cast of NDArray[float64] in new simulation code

* doc string cleanup

* new version 1.4.5
  • Loading branch information
karrmagadgeteer2 authored Nov 6, 2023
1 parent 8b8c5cd commit dc388b4
Show file tree
Hide file tree
Showing 18 changed files with 848 additions and 1,353 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: build
on: workflow_dispatch

env:
POETRY_VER: 1.6.1
POETRY_VER: 1.7.0

jobs:
build:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- "**" # matches every branch

env:
POETRY_VER: 1.6.1
POETRY_VER: 1.7.0

jobs:
run_checks:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: deploy
on: workflow_dispatch

env:
POETRY_VER: 1.6.1
POETRY_VER: 1.7.0

jobs:
deploy:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- "**" # matches every branch

env:
POETRY_VER: 1.6.1
POETRY_VER: 1.7.0

jobs:
run_tests:
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.1.3'
rev: 'v0.1.4'
hooks:
- id: ruff
args: [ --fix, --exit-non-zero-on-fix ]
Expand Down Expand Up @@ -43,7 +43,7 @@ repos:
- id: mixed-line-ending
args: [--fix=auto]
- repo: https://github.com/python-poetry/poetry
rev: 1.6.1
rev: 1.7.0
hooks:
- id: poetry-check
- id: poetry-lock
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
At some point we will start documenting changes in release documentation instead.
For now this is the only place where we log summary descriptions.

## Version [1.4.5] - 2023-11-06

- Cleaned up function for exponentially weighted moving average "EWMA" volatility
- Some dev dependency updates such as ruff and Poetry
- Major cleanup of simulation module. Removed Heston CIR & OU models as I have never checked them. Also rewrote Merton JDM from scratch to make it consisten with GBM model.
- Rewrite of simulation required update of many calculation result tests

## Version [1.4.4] - 2023-10-30

- Fixed two pct_change() methods missing fill_method.
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ venv:
python3 -m venv ./venv
venv/bin/python --version
venv/bin/python -m pip install --upgrade pip
venv/bin/pip install poetry==1.6.1
venv/bin/pip install poetry==1.7.0

install:
rm -f poetry.lock
Expand Down
4 changes: 2 additions & 2 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ Without an x next to a version below you can assume that it works as intended.

| Version | Supported |
|---------|--------------------|
| 1.4.5 | :white_check_mark: |
| 1.4.4 | :white_check_mark: |
| 1.4.3 | :white_check_mark: |
| 1.4.2 | :white_check_mark: |
| 1.3.9 | :white_check_mark: |
| 1.3.8 | :white_check_mark: |
| < 1.3.8 | :x: |
| < 1.3.9 | :x: |

## Reporting a Vulnerability

Expand Down
4 changes: 2 additions & 2 deletions make.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ elseif ($task -eq "make") {
$env:PYTHONPATH = "$env:PYTHONPATH;$pwd"
.\venv\Scripts\activate
python.exe -m pip install --upgrade pip
pip install poetry==1.6.1
pip install poetry==1.7.0
Remove-Item -Path 'poetry.lock' -Force -ErrorAction SilentlyContinue
poetry install --with dev
pre-commit install
poetry run pre-commit install
}
elseif ($task -eq "test") {
# run tests and report coverage
Expand Down
1 change: 1 addition & 0 deletions openseries/common_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,7 @@ def arithmetic_ret_func(
return float(result.iloc[0])
return Series(
data=result,
index=self.tsdf.columns,
name="Arithmetic return",
dtype="float64",
)
Expand Down
2 changes: 1 addition & 1 deletion openseries/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -1597,7 +1597,7 @@ def make_portfolio(
portfolio = dframe.dot(self.weights)
portfolio = portfolio.add(1.0).cumprod().to_frame()
portfolio.columns = [[name], [ValueType.PRICE]]
return DataFrame(portfolio)
return DataFrame(data=portfolio, dtype="float64")

def rolling_info_ratio(
self: OpenFrame,
Expand Down
13 changes: 8 additions & 5 deletions openseries/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ def ewma_vol_func(
from_date: Optional[dt.date] = None,
to_date: Optional[dt.date] = None,
periods_in_a_year_fixed: Optional[DaysInYearType] = None,
) -> DataFrame:
) -> Series[float]:
"""
Exponentially Weighted Moving Average Model for Volatility.
Expand All @@ -725,7 +725,7 @@ def ewma_vol_func(
Returns
-------
Pandas.DataFrame
Pandas.Series[float]
Series EWMA volatility
"""
earlier, later = self.calc_range(months_from_last, from_date, to_date)
Expand Down Expand Up @@ -765,9 +765,12 @@ def ewma_vol_func(
),
)

data.loc[:, (self.label, ValueType.EWMA)] = rawdata # type: ignore[index]

return data.loc[:, (self.label, ValueType.EWMA)] # type: ignore[index]
return Series(
data=rawdata,
index=data.index,
name=(self.label, ValueType.EWMA),
dtype="float64",
)

def running_adjustment(
self: OpenTimeSeries,
Expand Down
Loading

0 comments on commit dc388b4

Please sign in to comment.