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
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.10
3.13
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ dependencies = [
"market-prices",
"matplotlib",
"numpy",
"pandas",
"pandas",
"traitlets",
"tzdata",
"ipyvuetify",
Expand Down
20 changes: 10 additions & 10 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ decorator==5.2.1
# via ipython
exceptiongroup==1.3.1 ; python_full_version < '3.11'
# via ipython
exchange-calendars==4.12
exchange-calendars==4.13.1
# via
# market-analy
# market-prices
Expand All @@ -44,7 +44,7 @@ idna==3.11
# via requests
ipython==8.38.0 ; python_full_version < '3.11'
# via ipywidgets
ipython==9.9.0 ; python_full_version >= '3.11'
ipython==9.10.0 ; python_full_version >= '3.11'
# via ipywidgets
ipython-pygments-lexers==1.1.1 ; python_full_version >= '3.11'
# via ipython
Expand All @@ -69,7 +69,7 @@ korean-lunar-calendar==0.3.1
# via exchange-calendars
lxml==6.0.2
# via yahooquery
market-prices==0.12.11
market-prices==0.12.12
# via market-analy
markupsafe==3.0.3
# via jinja2
Expand All @@ -86,7 +86,7 @@ numpy==2.2.6 ; python_full_version < '3.11'
# market-prices
# matplotlib
# pandas
numpy==2.4.1 ; python_full_version >= '3.11'
numpy==2.4.2 ; python_full_version >= '3.11'
# via
# bqplot
# contourpy
Expand All @@ -95,7 +95,7 @@ numpy==2.4.1 ; python_full_version >= '3.11'
# market-prices
# matplotlib
# pandas
packaging==25.0
packaging==26.0
# via matplotlib
pandas==2.3.3
# via
Expand All @@ -116,15 +116,15 @@ ptyprocess==0.7.0 ; sys_platform != 'emscripten' and sys_platform != 'win32'
# via pexpect
pure-eval==0.2.3
# via stack-data
pycparser==2.23 ; implementation_name != 'PyPy'
pycparser==3.0 ; implementation_name != 'PyPy'
# via cffi
pygments==2.19.2
# via
# ipython
# ipython-pygments-lexers
pyluach==2.3.0
# via exchange-calendars
pyparsing==3.3.1
pyparsing==3.3.2
# via matplotlib
python-dateutil==2.9.0.post0
# via
Expand All @@ -138,13 +138,13 @@ requests-futures==1.0.2
# via yahooquery
six==1.17.0
# via python-dateutil
soupsieve==2.8.1
soupsieve==2.8.3
# via beautifulsoup4
stack-data==0.6.3
# via ipython
toolz==1.1.0
# via exchange-calendars
tqdm==4.67.1
tqdm==4.67.3
# via yahooquery
traitlets==5.14.3
# via
Expand All @@ -171,7 +171,7 @@ urllib3==2.6.3
# via requests
valimp==0.4
# via market-prices
wcwidth==0.2.14
wcwidth==0.5.3
# via prompt-toolkit
widgetsnbextension==4.0.15
# via ipywidgets
Expand Down
11 changes: 11 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,17 @@ def _mock_now(*args, **kwargs) -> pd.Timestamp:
for bi in prices.bis:
data = prices._pdata[bi]
data._ranges, data._ll, data._rl, data._table = pickle.load(file)
if data._table is not None:
# Requried as pickled with previous version of pandas when Index was
# inferred as having 'object' dtype. NB if test suit run with pandas
# 2.3.3 then columns will be inferred as 'object' regardless of
# astype("str") here
df = data._table
arrays = [
df.columns.get_level_values(i).astype("str")
for i in range(df.columns.nlevels)
]
data._table.columns = pd.MultiIndex.from_arrays(arrays)

return prices

Expand Down
7 changes: 5 additions & 2 deletions tests/test_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import numpy as np
import pandas as pd
import pytest
from pandas import Timestamp as T # noqa: N817
from pandas.testing import assert_frame_equal, assert_index_equal, assert_series_equal

from market_analy import analysis, charts, guis
Expand All @@ -30,6 +29,10 @@
# ruff: noqa: E501 # line-too-long


def T(arg: str, **kwargs) -> pd.Timestamp:
return pd.Timestamp(arg, **kwargs).as_unit("ns")


def verify_app(f, cls, *args, **kwargs):
"""Verify `f` returns instance of `cls` and displays a `ipyvuetify.App`."""
stdout = io.StringIO()
Expand Down Expand Up @@ -334,7 +337,7 @@ def test_daily_prices(self, analy, daily_pp, intraday_pp):
T("2023-01-09 00:00:00"): 1989665.0,
T("2023-01-10 00:00:00"): 3318361.0,
},
}
},
)

expected.columns.name = ""
Expand Down
5 changes: 5 additions & 0 deletions tests/test_trends.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ def assert_moves_as_saved(path: pathlib.Path, moves: list[Movement]):
loaded = pickle.load(file)
except EOFError:
break

if pd.__version__ >= "3.0.0":
loaded.line_break.index = loaded.line_break.index.as_unit("us")
loaded.line_limit.index = loaded.line_limit.index.as_unit("us")

assert m == loaded
file.close()

Expand Down
17 changes: 17 additions & 0 deletions tests/test_trends_alt.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,21 @@ def test_dji_1D(path_res, data_dji_1D_alt):
loaded = pickle.load(file)
except EOFError:
break

if pd.__version__ >= "3.0.0":
loaded.sel.index = loaded.sel.index.as_unit("us")
loaded.start_conf_line.index = loaded.start_conf_line.index.as_unit(
"us"
)
loaded.end_line_consol.index = loaded.end_line_consol.index.as_unit(
"us"
)
loaded.end_line_rvr.index = loaded.end_line_rvr.index.as_unit("us")
if loaded.end_line_rvr_opp is not None:
loaded.end_line_rvr_opp.index = (
loaded.end_line_rvr_opp.index.as_unit("us")
)
if loaded.eel is not None:
loaded.eel.index = loaded.eel.index.as_unit("us")

assert move == loaded
Loading