https://github.com/vnpy/vnpy/blob/master/examples/spread_backtesting/backtesting.ipynb
我按照上面的步骤,
rom vnpy_spreadtrading.backtesting import BacktestingEngine
from vnpy_spreadtrading.strategies.statistical_arbitrage_strategy import (StatisticalArbitrageStrategy)
from vnpy_spreadtrading.base import LegData, SpreadData
from datetime import datetime
spread = SpreadData(
name="IF-Spread",
legs=[LegData("IF1911.CFFEX"), LegData("IF1912.CFFEX")],
price_multipliers={"IF1911.CFFEX": 1, "IF1912.CFFEX": -1},
trading_multipliers={"IF1911.CFFEX": 1, "IF1912.CFFEX": -1},
active_symbol="IF1911.CFFEX",
inverse_contracts={"IF1911.CFFEX": False, "IF1912.CFFEX": False},
min_volume=1
)
...
其中 IF1911.CFFEX和IF1912.CFFEX提前用data_manager.import_data_from_csv()把本地csv数据导入到.vntrader下面的database.db中,数据为分钟频率的open, high, low, close, volume, open_interest.
但 engine.load_data() 后反馈“历史数据加载完成,数据量:0”。
请问如何合成价差数据?或者说怎么做才能用命令回测spread_trading, 多谢.