id: 02
0.3.3 版本修复问题列表
1. 环境信息
➜ conda list --export
# This file may be used to create an environment using:
# $ conda create --name <env> --file <this file>
# platform: osx-64
backtesting=0.3.3=pypi_0
bokeh=3.6.2=pypi_0
bzip2=1.0.8=h6c40b1e_6
ca-certificates=2024.11.26=hecd8cb5_0
contourpy=1.3.1=pypi_0
expat=2.6.3=h6d0c2b6_0
jinja2=3.1.4=pypi_0
libcxx=14.0.6=h9765a3e_0
libffi=3.4.4=hecd8cb5_1
libmpdec=4.0.0=h46256e1_0
markupsafe=3.0.2=pypi_0
ncurses=6.4=hcec6c5f_0
numpy=2.2.0=pypi_0
openssl=3.0.15=h46256e1_0
packaging=24.2=pypi_0
pandas=2.2.3=pypi_0
pillow=11.0.0=pypi_0
pip=24.2=py312hecd8cb5_0
python=3.12.8=hcd54a6c_0
python-dateutil=2.9.0.post0=pypi_0
pytz=2024.2=pypi_0
pyyaml=6.0.2=pypi_0
readline=8.2=hca72f7f_0
setuptools=75.1.0=py312hecd8cb5_0
six=1.17.0=pypi_0
sqlite=3.45.3=h6c40b1e_0
tk=8.6.14=h4d00af3_0
tornado=6.4.2=pypi_0
tzdata=2024.2=pypi_0
wheel=0.44.0=py312hecd8cb5_0
xyzservices=2024.9.0=pypi_0
xz=5.4.6=h6c40b1e_1
zlib=1.2.13=h4b97444_1
2. 修复问题
- backtesting/_plotting.py:250:ValueError: failed to validate DatetimeTickFormatter(id=‘p1046’, …).days: expected a value of type str, got [‘%d %b’, ‘%a %d’] of type list
# /Users/xx/opt/anaconda3/envs/backtesting_test/lib/python3.12/site-packages/backtesting/_plotting.py:250
# formatter=DatetimeTickFormatter(days=['%d %b', '%a %d'],
# months=['%m/%Y', "%b'%y"]),
formatter=DatetimeTickFormatter(days='%d %b',
months='%b %Y'),
- backtesting/_plotting.py:458: FutureWarning: ‘M’ is deprecated and will be removed in a future version, please use ‘ME’ instead.
.resample(resample_rule, label=‘left’)
# /Users/xxx/opt/anaconda3/envs/backtesting_test/lib/python3.12/site-packages/backtesting/_plotting.py:445
dict(day='ME', # 修改这里:从 'M' 改为 'ME'
- backtesting/test/init.py:8: FutureWarning: The argument ‘infer_datetime_format’ is deprecated and will be removed in a future version. A strict version of it is now the default, see https://pandas.pydata.org/pdeps/0004-consistent-to-datetime-parsing.html. You can safely remove this argument.
return pd.read_csv(join(dirname(file), filename),
# /Users/xxx/opt/anaconda3/envs/backtesting_test/lib/python3.12/site-packages/backtesting/test/__init__.py:8
return pd.read_csv(
join(dirname(__file__), filename),
index_col=0,
parse_dates=True
)
作者: quantgalaxy@outlook.com
blog: https://blog.youkuaiyun.com/quant_galaxy