microsoft / qlib

Qlib is an AI-oriented quantitative investment platform that aims to realize the potential, empower research, and create value using AI technologies in quantitative investment, from exploring ideas to implementing productions. Qlib supports diverse machine learning modeling paradigms. including supervised learning, market dynamics modeling, and RL.
https://qlib.readthedocs.io/en/latest/
MIT License
15.5k stars 2.64k forks source link

backtest error using gru #1115

Closed LiuHao-THU closed 2 years ago

LiuHao-THU commented 2 years ago

here is the problem, i am using GRU for prediction, here is my backtest config ` ###################################

prediction, backtest & analysis

################################### port_analysis_config = { "executor": { "class": "SimulatorExecutor", "module_path": "qlib.backtest.executor", "kwargs": { "time_per_step": "day", "generate_portfolio_metrics": True, }, }, "strategy": { "class": "TopkDropoutStrategy", "module_path": "qlib.contrib.strategy.signal_strategy", "kwargs": { "model": model, "dataset": dataset, "topk":50, "n_drop": 5, }, }, "backtest": { "start_time": "2022-01-01", "end_time": '2022-05-20', "account": 100000000, "benchmark": benchmark, "exchange_kwargs": { "freq": "day", "limit_threshold": 0.0, "deal_price": "close", "open_cost": 0.0005, "close_cost": 0.0015, "min_cost": 5, }, }, }

backtest and analysis

with R.start(experiment_name="backtest_analysis"): recorder = R.get_recorder(recorder_id=rid, experiment_name="GRU") model = recorder.load_object("trained_model")

# prediction
recorder = R.get_recorder()
ba_rid = recorder.id
sr = SignalRecord(model, dataset, recorder)
sr.generate()

# backtest & analysis
par = PortAnaRecord(recorder, port_analysis_config, "day")
par.generate()

then, the ffr report nan which is very strange 'The following are analysis results of benchmark return(1day).' risk mean -0.000600 std 0.011434 annualized_return -0.142707 information_ratio -0.809016 max_drawdown -0.140281 'The following are analysis results of the excess return without cost(1day).' risk mean 0.000600 std 0.011434 annualized_return 0.142707 information_ratio 0.809016 max_drawdown -0.069261 'The following are analysis results of the excess return with cost(1day).' risk mean 0.000600 std 0.011434 annualized_return 0.142707 information_ratio 0.809016 max_drawdown -0.069261 'The following are analysis results of indicators(1day).' value ffr NaN pa NaN pos NaN

`

can someone answer this question?

LiuHao-THU commented 2 years ago

solved

davidyu0319 commented 4 months ago

solved

Could you guide me how to resolve this? I also meet this issue...