instructions clone repo uv sync .venv\Scripts\activate.ps1 python -m unittest tests.test_fib
source .venv/bin/activate
common commands
uvx ruff check --fix [file]
uvx ruff format [file]
uvx --from rich-cli rich -m [file]
uv run --with jupyter jupyter lab
uvx --with pydantic mypy --ignore-missing-imports --follow-imports=skip --strict-optional [file]
from importlib import reload
import pandas as pd
import tsutils as ts
from pathlib import Path
from rich.console import Console
console = Console()
df = ts.load_files(Path("~/documents/data").expanduser(), "esm5*.csv")
ts.add_indicators(df)
di = ts.day_index(df)
print(di)
dc = ts.single_day(df, di, "2025-05-12")
mx, mn = ts.local_extremes(dc, 15)
ts.display(ts.around(dc, mn[1]))
df is a dataframe of 1 minute bars ohlcv bars plus some indicators
<class 'pandas.core.frame.DataFrame'> DatetimeIndex: 75660 entries, 2025-03-12 22:00:00 to 2025-05-30 21:59:00 Data columns (total 10 columns): n Column Non-Null Count Dtype
0 open 75660 non-null float64 1 high 75660 non-null float64 2 low 75660 non-null float64 3 close 75660 non-null float64 4 volume 75660 non-null int64 5 wap 75660 non-null float64 6 barcount 20460 non-null float64 7 vwap 75660 non-null float64 8 ema 75660 non-null float64 9 strat 75660 non-null int64 10 nvol 75641 non-null int64
di is an index of trading days in the df
<class 'pandas.core.frame.DataFrame'> DatetimeIndex: 55 entries, 2025-03-13 to 2025-05-30 Data columns (total 5 columns): n Column Non-Null Count Dtype
0 first 55 non-null datetime64[ns] 1 last 55 non-null datetime64[ns] 2 rth_first 55 non-null datetime64[ns] 3 rth_last 55 non-null datetime64[ns] 4 duration 55 non-null float64 dtypes: datetime64ns, float64(1)