Error Q20 output missing when submitting
I do keep getting an error when submitting a strategy in the Q20 competition. The output is missing. The write output line is include in my strategy. But it seems unable to write the weights.
See also the value error below.
What should i do to fix this? Thanks for the help!
ValueError Traceback (most recent call last)
<ipython-input-1-3ef89a333fa7> in <module>
119 weights = qnout.clean(weights, data, "stocks_nasdaq100")
--> 121 stats = qnstats.calc_stat(data, weights.sel(time=slice("2006-01-01", None)))
/usr/local/lib/python3.7/site-packages/qnt/stats.py in calc_stat(data, portfolio_history, slippage_factor, roll_slippage_factor, min_periods, max_periods, per_asset, points_per_year)
686 roll_slippage_factor = get_default_slippage(data)
--> 688 missed_dates = find_missed_dates(portfolio_history, data)
689 if len(missed_dates) > 0:
690 log_err("WARNING: some dates are missed in the portfolio_history")
/usr/local/lib/python3.7/site-packages/qnt/stats.py in find_missed_dates(output, data)
550 out_ts = np.sort(output.coords[ds.TIME].values)
--> 552 min_out_ts = min(out_ts)
554 data_ts = data.where(data.time >= min_out_ts)
ValueError: min() arg is an empty sequence
@theflyingdutchman Hi, it looks like you are getting some corner case. Can you send some more detail?
@support The number of the strategy submit attempt that is filterde out is # 14149002. What additional info should I send?
@theflyingdutchman ok, thanks, we are checking the logs. It looks ok when run in a standard notebook container. Maybe it meets some corner case we did not think about when implementing submission filter. As soon as we find the reason, we will let you know. Sorry for the problem.
@support ok, thanks. Unfortunately I run into an error in the submitting process with another strategy as well. Could you please look into submit Number # 14265154? The precheck and backtest show no errors, but after submit the strategy shows inverted SR and weights. I am not sure whether this is related to the otter submit issue. Thanks for investigating these issues.
Hello. try to execute in a separate cell the code which saves weights. This should help.
As far as I understand, this can happen when there is no data for the first day.
The cell where the error occurs will be ignored and the next one will be executed.
qnout.check(weights, data, "stocks_nasdaq100") qnout.write(weights)
@theflyingdutchman hi, did you check for potential forward looking? For example using global means of indicators which are looking into the future?
Note that trades are taken at the OPEN, and you cannot use for example the CLOSE price of the same day.
In this case, you could see a result in the notebook but another one after submission, as the backtester used after submission will remove by brute force future data and produce a result which does not look into the future.
@vyacheslav_b The proposed solution worked, I was able to submit the strategy. Thanks for your help.
@support The strategy was still declined since there is no fundamental data before 1-1-2013. This strategy worked with fundamental data. Number is # 14333092. Wouldn't it be fair to shorten the required trade period for strategies based on fundamental data for Q20? Otherwise I won't be able to submit.
@theflyingdutchman ok, thanks for the hint. It is the first contest using fundamental data, sorry for the issue.
We will see, but probably it is too late for changing the rules.
One pragmatic solution would be to use a "base" strategy until 2013, without fundamental data, until 2013, in a way that the Sharpe ratio is still larger than 1. Is it doable?
it can help you. See topic 3) Not enough bid information.
def get_enough_bid_for(data_, weights_): time_traded = weights_.time[abs(weights_).fillna(0).sum('asset') > 0] is_strategy_traded = len(time_traded) if is_strategy_traded: return xr.where(weights_.time < time_traded.min(), data_.sel(field="is_liquid"), weights_) return weights_ weights_new = get_enough_bid_for(data, weights) weights_new = weights_new.sel(time=slice("2006-01-01",None))