datatype for weights seems changed recently
-
weights = qnbt.backtest( competition_type="stocks_s&p500", load_data=load_data, lookback_period=350, start_date="2006-01-01", strategy=strategy, window=window, analyze=True, check_correlation=False )
In the old days, i can write using as below as per documentation
qnout.write(weights)
Since some days ago, the above doesn't work, i need to change to
qnout.write(weights[0])
to make it work again, does it expect? @support
-
@angusslq Hi,
The
qnbt.backtest
function you used can return only weights (as xarray.DataArray structure), or tuple (weights, state). It depends on yourstrategy()
function, whether it has additional arguments (beside "data") or not. The "state" doesn't affect your weights if it hasn't been used in the strategy you passed, and in this case, the state is most likelyNone
.Anyway, it's not necessary to call
write()
function fromqnt.output
module after calculating weights usingqnt.backtester
, since thebacktest()
function already callswrite()
function, so the weights have been written automatically. -
@stefanm Thank you for the details