Skip to content

Commit

Permalink
py 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
lsbardel committed Jan 28, 2024
1 parent e01871e commit efe9a17
Show file tree
Hide file tree
Showing 28 changed files with 1,628 additions and 1,559 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
FMP_API_KEY: ${{ secrets.FMP_API_KEY }}
strategy:
matrix:
python-version: ["3.10", "3.11"]
python-version: ["3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ dist
.venv
.mypy_cache
.pytest_cache
.python-version

# Jupyter
*.ipynb
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2023 Quantmind
Copyright (c) 2024 Quantmind

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Expand Down
11 changes: 8 additions & 3 deletions dev/lint
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ if [ "$1" = "fix" ] ; then
RUFF_ARG="--fix"
fi

black quantflow tests ${BLACK_ARG}
ruff quantflow tests ${RUFF_ARG}
mypy quantflow tests
echo black
black quantflow quantflow_tests ${BLACK_ARG}
echo ruff
ruff quantflow quantflow_tests ${RUFF_ARG}
echo mypy
mypy quantflow
echo mypy tests
mypy quantflow_tests --explicit-package-bases
3,136 changes: 1,597 additions & 1,539 deletions poetry.lock

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ Repository = "https://github.com/quantmind/quantflow"
Documentation = "https://quantmind.github.io/quantflow/"

[tool.poetry.dependencies]
python = ">=3.10,<3.12"
python = ">=3.10,<3.13"
numpy = "^1.22.3"
scipy = "^1.10.1"
pandas = "^2.0.1"
aiohttp = {version = "^3.8.1", optional = true}
pydantic = "^2.0.2"

[tool.poetry.group.dev.dependencies]
black = "^23.3.0"
black = "^24.1.1"
pytest-cov = "^4.0.0"
mypy = "^1.4.0"
ghp-import = "^2.0.2"
ruff = "^0.0.285"
pytest-asyncio = "^0.21.1"
ruff = "^0.1.14"
pytest-asyncio = "^0.23.3"


[tool.poetry.extras]
Expand Down Expand Up @@ -53,7 +53,7 @@ formats = "ipynb,myst"
[tool.pytest.ini_options]
asyncio_mode = "auto"
testpaths = [
"tests"
"quantflow_tests"
]

[tool.isort]
Expand All @@ -74,7 +74,7 @@ disallow_untyped_defs = true
warn_no_return = true

[[tool.mypy.overrides]]
module = "tests.*"
module = "quantflow_tests.*"
disallow_untyped_defs = false

[[tool.mypy.overrides]]
Expand Down
1 change: 1 addition & 0 deletions quantflow/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
"""Quantitative analysis and pricing"""

__version__ = "0.2.4"
3 changes: 1 addition & 2 deletions quantflow/options/surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@


class VolSurfaceSecurity(Protocol):
def vol_surface_type(self) -> VolSecurityType:
...
def vol_surface_type(self) -> VolSecurityType: ...


S = TypeVar("S", bound=VolSurfaceSecurity)
Expand Down
1 change: 1 addition & 0 deletions quantflow/sp/cir.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class CIR(IntensityProcess):
:param sigma: Volatility parameter :math:`\sigma`
:param theta: Long term mean rate :math:`\theta`
"""

sigma: float = Field(default=1.0, gt=0, description="Volatility")
theta: float = Field(default=1.0, gt=0, description="Mean rate")
sample_algo: SamplingAlgorithm = Field(
Expand Down
1 change: 1 addition & 0 deletions quantflow/sp/copula.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class FrankCopula(Copula):
u\right)-1\right)\left(\exp\left(-\kappa
v\right)-1\right)}{\exp\left(-\kappa\right)-1}\right]
"""

kappa: Decimal = Field(default=ZERO, description="Frank copula parameter")

def __call__(self, u: FloatArrayLike, v: FloatArrayLike) -> FloatArrayLike:
Expand Down
1 change: 1 addition & 0 deletions quantflow/sp/dsp.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class DSP(PoissonBase):
:param intensity: the stochastic intensity of the Poisson
"""

intensity: IntensityProcess = Field( # type ignore
default_factory=CIR, description="intensity process"
)
Expand Down
1 change: 1 addition & 0 deletions quantflow/sp/heston.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class Heston(StochasticProcess1D):
d v_t = (a - \kappa v_t) dt + \nu \sqrt{v_t} dw^2_t
\rho dt = \E[dw^1 dw^2]
"""

variance_process: CIR = Field(default_factory=CIR, description="Variance process")
rho: float = Field(default=0, ge=-1, le=1, description="Correlation")

Expand Down
1 change: 1 addition & 0 deletions quantflow/sp/jump_diffusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class JumpDiffusion(StochasticProcess1D, Generic[D]):
where N_t is a compound poisson process with intensity \lambda
and jump distribution D
"""

diffusion: WeinerProcess = Field(
default_factory=WeinerProcess, description="diffusion"
)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/test_heston.py → quantflow_tests/test_heston.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest

from quantflow.sp.heston import Heston, HestonJ
from tests.utils import characteristic_tests
from quantflow_tests.utils import characteristic_tests


@pytest.fixture
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions tests/test_options.py → quantflow_tests/test_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
surface_from_inputs,
)
from quantflow.sp.heston import Heston
from tests.utils import has_plotly
from quantflow_tests.utils import has_plotly

a = np.asarray
CROSS_SECTIONS = 8
Expand All @@ -27,7 +27,7 @@ def heston() -> OptionPricer[Heston]:

@pytest.fixture
def vol_surface() -> VolSurface:
with open("tests/volsurface.json") as fp:
with open("quantflow_tests/volsurface.json") as fp:
return surface_from_inputs(VolSurfaceInputs(**json.load(fp)))


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from quantflow.options.pricer import OptionPricer
from quantflow.sp.heston import HestonJ
from tests.utils import has_plotly
from quantflow_tests.utils import has_plotly


@pytest.fixture
Expand Down
2 changes: 1 addition & 1 deletion tests/test_ou.py → quantflow_tests/test_ou.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from quantflow.sp.bns import BNS
from quantflow.sp.ou import GammaOU, Vasicek
from tests.utils import characteristic_tests, analytical_tests
from quantflow_tests.utils import characteristic_tests, analytical_tests


@pytest.fixture
Expand Down
2 changes: 1 addition & 1 deletion tests/test_poisson.py → quantflow_tests/test_poisson.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from quantflow.sp.dsp import DSP
from quantflow.sp.poisson import CompoundPoissonProcess, PoissonProcess
from quantflow.utils.distributions import Exponential
from tests.utils import analytical_tests, characteristic_tests
from quantflow_tests.utils import analytical_tests, characteristic_tests


@pytest.fixture
Expand Down
2 changes: 1 addition & 1 deletion tests/test_weiner.py → quantflow_tests/test_weiner.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from quantflow.sp.weiner import WeinerProcess
from quantflow.utils.paths import Paths
from tests.utils import characteristic_tests
from quantflow_tests.utils import characteristic_tests


@pytest.fixture
Expand Down
File renamed without changes.
File renamed without changes.
Empty file removed tests/__init__.py
Empty file.

0 comments on commit efe9a17

Please sign in to comment.