Skip to content

Commit d18456e

Browse files
authored
py 3.14 (#32)
1 parent 7f675bf commit d18456e

File tree

8 files changed

+2458
-2128
lines changed

8 files changed

+2458
-2128
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
FMP_API_KEY: ${{ secrets.FMP_API_KEY }}
1717
strategy:
1818
matrix:
19-
python-version: ["3.11", "3.12", "3.13"]
19+
python-version: ["3.11", "3.12", "3.13", "3.14"]
2020

2121
steps:
2222
- uses: actions/checkout@v4
@@ -37,17 +37,17 @@ jobs:
3737
- name: run tests
3838
run: make tests
3939
- name: upload coverage reports to codecov
40-
if: matrix.python-version == '3.12'
40+
if: matrix.python-version == '3.13'
4141
uses: codecov/codecov-action@v3
4242
with:
4343
token: ${{ secrets.CODECOV_TOKEN }}
4444
files: ./build/coverage.xml
4545
- name: build book
46-
if: ${{ matrix.python-version == '3.12' }}
46+
if: ${{ matrix.python-version == '3.13' }}
4747
run: make book
4848
- name: publish book
49-
if: ${{ matrix.python-version == '3.12' }}
49+
if: ${{ matrix.python-version == '3.13' }}
5050
run: make publish-book
5151
- name: publish
52-
if: ${{ matrix.python-version == '3.12' && github.event.head_commit.message == 'release' }}
52+
if: ${{ matrix.python-version == '3.13' && github.event.head_commit.message == 'release' }}
5353
run: make publish

.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"args": [
1515
"-x",
1616
"-vvv",
17-
"quantflow_tests/test_vault.py",
17+
"quantflow_tests/test_data.py::test_fed_yc",
1818
]
1919
},
2020
]

poetry.lock

Lines changed: 2411 additions & 2093 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "quantflow"
3-
version = "0.4.2"
3+
version = "0.4.3"
44
description = "quantitative analysis"
55
authors = [{ name = "Luca Sbardella", email = "luca@quantmind.com" }]
66
license = "BSD-3-Clause"
@@ -42,6 +42,7 @@ ghp-import = "^2.0.2"
4242
ruff = "^0.12.2"
4343
pytest-asyncio = "^1.0.0"
4444
isort = "^6.0.1"
45+
types-python-dateutil = "^2.9.0.20251115"
4546

4647
[tool.poetry.group.book]
4748
optional = true

quantflow/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""Quantitative analysis and pricing"""
22

3-
__version__ = "0.4.1"
3+
__version__ = "0.4.3"

quantflow/data/fiscal_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
class FiscalData(AioHttpClient):
1212
"""Fiscal Data API client.
1313
14-
THis class is used to fetch data from the
14+
This class is used to fetch data from the
1515
[fiscal data api](https://fiscaldata.treasury.gov/api-documentation/)
1616
"""
1717

quantflow_tests/test_data.py

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
from typing import AsyncIterator
22

33
import pytest
4-
from aiohttp.client_exceptions import ClientError
54

65
from quantflow.data.fed import FederalReserve
76
from quantflow.data.fiscal_data import FiscalData
87
from quantflow.data.fmp import FMP
8+
from quantflow_tests.utils import skip_network_issue
99

10-
pytestmark = pytest.mark.skipif(not FMP().key, reason="No FMP API key found")
10+
skip_fmp = not FMP().key
1111

1212

1313
@pytest.fixture
@@ -16,49 +16,46 @@ async def fmp() -> AsyncIterator[FMP]:
1616
yield fmp
1717

1818

19+
@pytest.mark.skipif(skip_fmp, reason="No FMP API key found")
1920
def test_client(fmp: FMP) -> None:
2021
assert fmp.url
2122
assert fmp.key
2223

2324

25+
@pytest.mark.skipif(skip_fmp, reason="No FMP API key found")
2426
async def test_historical(fmp: FMP) -> None:
2527
df = await fmp.prices("BTCUSD", fmp.freq.one_hour)
2628
assert df["close"] is not None
2729

2830

31+
@pytest.mark.skipif(skip_fmp, reason="No FMP API key found")
2932
async def test_dividends(fmp: FMP) -> None:
3033
data = await fmp.dividends()
3134
assert data is not None
3235

3336

37+
@skip_network_issue
3438
async def test_fed_yc() -> None:
35-
try:
36-
async with FederalReserve() as fed:
37-
df = await fed.yield_curves()
38-
assert df is not None
39-
assert df.shape[0] > 0
40-
assert df.shape[1] == 12
41-
except (ConnectionError, ClientError) as e:
42-
pytest.skip(f"Skipping test_fed due to network issue: {e}")
39+
async with FederalReserve() as fed:
40+
df = await fed.yield_curves()
41+
assert df is not None
42+
assert df.shape[0] > 0
43+
assert df.shape[1] == 12
4344

4445

46+
@skip_network_issue
4547
async def test_fed_rates() -> None:
46-
try:
47-
async with FederalReserve() as fed:
48-
df = await fed.ref_rates()
49-
assert df is not None
50-
assert df.shape[0] > 0
51-
assert df.shape[1] == 2
52-
except (ConnectionError, ClientError) as e:
53-
pytest.skip(f"Skipping test_fed due to network issue: {e}")
48+
async with FederalReserve() as fed:
49+
df = await fed.ref_rates()
50+
assert df is not None
51+
assert df.shape[0] > 0
52+
assert df.shape[1] == 2
5453

5554

55+
@skip_network_issue
5656
async def __test_fiscal_data() -> None:
57-
try:
58-
async with FiscalData() as fd:
59-
df = await fd.securities()
60-
assert df is not None
61-
assert df.shape[0] > 0
62-
assert df.shape[1] == 2
63-
except (ConnectionError, ClientError) as e:
64-
pytest.skip(f"Skipping test_fed due to network issue: {e}")
57+
async with FiscalData() as fd:
58+
df = await fd.securities()
59+
assert df is not None
60+
assert df.shape[0] > 0
61+
assert df.shape[1] == 2

quantflow_tests/utils.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
from typing import cast
22

33
import numpy as np
4+
import pytest
5+
from aiohttp.client_exceptions import ClientError
46

57
from quantflow.sp.base import StochasticProcess1D
68
from quantflow.utils.marginal import Marginal1D
@@ -30,3 +32,15 @@ def analytical_tests(pr: StochasticProcess1D, tol: float = 1e-3):
3032
np.testing.assert_allclose(m.mean(), m.mean_from_characteristic(), tol)
3133
np.testing.assert_allclose(m.std(), m.std_from_characteristic(), tol)
3234
np.testing.assert_allclose(m.variance(), m.variance_from_characteristic(), tol)
35+
36+
37+
def skip_network_issue(func):
38+
"""Decorator to skip tests in case of network issues."""
39+
40+
async def wrapper(*args, **kwargs):
41+
try:
42+
await func(*args, **kwargs)
43+
except (ConnectionError, ClientError) as e:
44+
pytest.skip(f"Skipping {func.__name__} due to network issue: {e}")
45+
46+
return wrapper

0 commit comments

Comments
 (0)