Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/bump-version.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Bump version

on:
push:
branches:
- main

jobs:
bump-version:
if: "!startsWith(github.event.head_commit.message, 'bump:')"
runs-on: ubuntu-latest
name: "Bump version and create changelog with commitizen"
steps:
- name: Check out
uses: actions/checkout@v6
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
fetch-depth: 0
- name: Create bump and changelog
uses: commitizen-tools/commitizen-action@master
with:
github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
changelog_increment_filename: body.md
push: true
- name: Release
uses: ncipollo/release-action@v1
with:
tag: v${{ env.REVISION }}
bodyFile: "body.md"
skipIfReleaseExists: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59 changes: 59 additions & 0 deletions .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Tests, Code Quality, Build

on:
push:
tags:
- "*"
pull_request:
branches:
- main

jobs:

test:
name: Run unit tests
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v6
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version-file: ".python-version"
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Install dependencies
run: uv sync --group dev
- name: Run test suite
run: uv run pytest

publish:
name: Build and publish wheels
needs: [ test ]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/affidiff/
permissions:
id-token: write
contents: read
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
steps:
- name: Check out repository code
uses: actions/checkout@v6
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version-file: ".python-version"
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Build
run: uv build
- name: Publish
run: uv publish
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ __pycache__/
.venv/
*.egg-info
.coverage
dist/
6 changes: 3 additions & 3 deletions examples/try_centtend.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

from statsmodels.tsa.stattools import acf

from diffusions import CentTend, CentTendParam
from diffusions.helper_functions import (plot_trajectories, plot_final_distr,
plot_realized, take_time)
from affidiff import CentTend, CentTendParam
from affidiff.helper_functions import (plot_trajectories, plot_final_distr,
plot_realized, take_time)
from load_real_data import load_data


Expand Down
6 changes: 3 additions & 3 deletions examples/try_cir.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

import seaborn as sns

from diffusions import CIR, CIRparam
from diffusions.helper_functions import (plot_trajectories, plot_final_distr,
plot_realized, take_time)
from affidiff import CIR, CIRparam
from affidiff.helper_functions import (plot_trajectories, plot_final_distr,
plot_realized, take_time)


def try_simulation():
Expand Down
6 changes: 3 additions & 3 deletions examples/try_gbm.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
import seaborn as sns
import numpy as np

from diffusions import GBM, GBMparam
from diffusions.helper_functions import (plot_trajectories, plot_final_distr,
plot_realized, take_time)
from affidiff import GBM, GBMparam
from affidiff.helper_functions import (plot_trajectories, plot_final_distr,
plot_realized, take_time)


def try_simulation():
Expand Down
6 changes: 3 additions & 3 deletions examples/try_heston.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

from statsmodels.tsa.stattools import acf

from diffusions import Heston, HestonParam
from diffusions.helper_functions import (plot_trajectories, plot_final_distr,
plot_realized, take_time)
from affidiff import Heston, HestonParam
from affidiff.helper_functions import (plot_trajectories, plot_final_distr,
plot_realized, take_time)
from load_real_data import load_data


Expand Down
6 changes: 3 additions & 3 deletions examples/try_vasicek.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

import seaborn as sns

from diffusions import Vasicek, VasicekParam
from diffusions.helper_functions import (plot_trajectories, plot_final_distr,
plot_realized, take_time)
from affidiff import Vasicek, VasicekParam
from affidiff.helper_functions import (plot_trajectories, plot_final_distr,
plot_realized, take_time)


def try_simulation():
Expand Down
11 changes: 10 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
[project]
name = "diffusions"
name = "affidiff"
description = "Affine Diffusions. Simulation and estimation."
authors = [{ name = "Stanislav Khrapov", email = "khrapovs@gmail.com" }]
readme = "README.md"
requires-python = ">=3.14"
dependencies = [
"matplotlib>=3.10.8",
"mygmm>=0.1.0",
"numpy>=2.4.4",
"scipy>=1.17.1",
"seaborn>=0.13.2",
"statsmodels>=0.14.6",
]
dynamic = ["version"]
Expand All @@ -25,3 +28,9 @@ source = "uv-dynamic-versioning"

[tool.uv-dynamic-versioning]
fallback-version = "0.0.0"

[tool.commitizen]
version_scheme = "semver"
version_provider = "scm"
update_changelog_on_bump = true
tag_format = "v$version"
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

kwargs = {'libraries': [], 'include_dirs': [numpy.get_include()]}

ext_modules = [Extension('diffusions.simulate',
['./diffusions/simulate.pyx'], **kwargs)]
ext_modules = [Extension('affidiff.simulate',
['./src/affidiff/simulate.pyx'], **kwargs)]

setup(name='diffusions',
version='1.0',
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def update(self, state, error):
return new_state

def simulate(self, start=None, nsub=80, ndiscr=1, nobs=500, nsim=1,
diff=None, new_innov=True, cython=True):
diff=None, new_innov=True, cython=False):
"""Simulate observations from the model.

Parameters
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions tests/test_ajd.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
import numpy as np
import numpy.testing as npt

from diffusions import (GBMparam, VasicekParam, CIRparam,
HestonParam, CentTendParam)
from diffusions.helper_functions import ajd_drift, ajd_diff
from affidiff import (GBMparam, VasicekParam, CIRparam,
HestonParam, CentTendParam)
from affidiff.helper_functions import ajd_drift, ajd_diff


class DriftTestCase(ut.TestCase):
Expand Down
6 changes: 3 additions & 3 deletions tests/test_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
import unittest as ut
import numpy as np

from diffusions import (GBM, GBMparam, Vasicek, VasicekParam,
CIR, CIRparam, Heston, HestonParam,
CentTend, CentTendParam)
from affidiff import (GBM, GBMparam, Vasicek, VasicekParam,
CIR, CIRparam, Heston, HestonParam,
CentTend, CentTendParam)


class GenericModelTestCase(ut.TestCase):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import numpy.testing as npt
from statsmodels.tsa.tsatools import lagmat

from diffusions.helper_functions import (columnwise_prod, rolling_window,
nice_errors, poly_coef, instruments)
from affidiff.helper_functions import (columnwise_prod, rolling_window,
nice_errors, poly_coef, instruments)


class HelperFunctionTestCase(ut.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_param_cir.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import numpy as np
import numpy.testing as npt

from diffusions import CIRparam
from affidiff import CIRparam


class SDEParameterTestCase(ut.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_param_ct.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import numpy as np
import numpy.testing as npt

from diffusions import CentTendParam
from affidiff import CentTendParam


class SDEParameterTestCase(ut.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_param_gbm.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import numpy as np
import numpy.testing as npt

from diffusions import GBMparam
from affidiff import GBMparam


class SDEParameterTestCase(ut.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_param_heston.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import numpy as np
import numpy.testing as npt

from diffusions import HestonParam
from affidiff import HestonParam


class SDEParameterTestCase(ut.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_param_vasicek.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import numpy as np
import numpy.testing as npt

from diffusions import VasicekParam
from affidiff import VasicekParam


class SDEParameterTestCase(ut.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_rmoms_ct.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import numpy as np
import numpy.testing as npt

from diffusions import CentTend, CentTendParam
from affidiff import CentTend, CentTendParam


class RealizedMomentsCTTestCase(ut.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_rmoms_gbm.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import unittest as ut
import numpy as np

from diffusions import GBM, GBMparam
from affidiff import GBM, GBMparam


class RealizedMomentsGBMTestCase(ut.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_rmoms_heston.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import numpy as np
import numpy.testing as npt

from diffusions import Heston, HestonParam
from affidiff import Heston, HestonParam


class RealizedMomentsHestonTestCase(ut.TestCase):
Expand Down
Loading