Back

Warning: fill at stale price

Hi Jared Broad ,

I've been getting the error reported in the bottom lately. I never got it before (till a couple of weeks ago), and I've noticed:

1. the exact same version of an algorithm produces backtest results that are very different (much worse) from those produced, for example, one month ago;

2. attempting to fix the issue (changing the algorithm resolution for example) makes the algorithm perform much worse (I guess because when the warning happens there is some sort of look-ahead bias)

Is there something in LEAN you have changed recently that is causing this? Have you encountered this issue already? I haven't managed to find an existing discussion on the forum.

 

2017-01-17 10:30:00ITUSMarket$5.10 USD31BuyFilledWarning: fill at stale price (1/13/2017 4:00:00 PM America/New_York)

Update Backtest







0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Hi Liu,

Can you provide the code for the algorithm that you are running? This will help us better understand the issue, but I can say that we made a fix a few weeks ago to our Coarse Universe Selection model that prevents look-ahead bias and now is functioning as is to be expected. As for the warning, this will occur if a Market Order is placed at the end of the day as the Market Close. What happens is that this is converted to a Market On Open order, which executes at 9:30:00 exactly, but this is before any new data bars have come through and so it fills at the previous close price. When placing Market Orders on close/open, be sure to schedule these to happen at least one bar-length before/after.

Using minute can, and almost always, will affect the performance of a backtest. Using minute data provides for more realistic order fills and will certainly change the price at which is filled for nearly every order. The best way to examine this is through the trade logs and to examine the price differences, along with the trading frequency, and see what effect this might be having.

0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


I have similar issue. My backtests all fail at the exercise date of this option (May 4th or around it). I am using daily resolution for data and trade at noon. Here is a snapshot of that trade:

70944_1558118362.jpg

0

Yep, i've been bitching about this for a while now too.

0

Hi Nick,

Can you post your code or a backtest? This will help us to debug your issue.

0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Hi Jack, I worked around the issue by changing my strategy not to hit this trade. I don't have the backtest or the code anymore.

0

Hi Jack, 

Please see the code below producing the same issue as stated by Nick M.

 

We would greatly appreciate your addressing the cause of and solution to 

"

Liquidated - Warning: fill at stale price (4/25/2019 8:00:00 PM America/New_York)

"

 

0


Hello Dean,

Thank you for pointing out this issue, and sorry for the late reply. We are glad to tell you that this issue is solved now. The cause is basically a data issue. If running the same code now, there will not be Liquidated - Warning: fill at stale price (4/25/2019 8:00:00 PM America/New_York) again.

Thank you for using QuantConnect! If you have any problems in the future, please feel free to discuss with us in the community!

1

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Still seeing this problem. My algorithm will try to close positions 60 minutes before the forex market closes on friday. First I get the "Warning: fill at stale price" message and then after the market closes, the MarketOrder fails.

0


Hi Chantal Coolsma ,

Since the algorithm is subscribing to daily-resolution data, the last data is time-stamped to mid-night of the day that the scheduled event is triggered. It is a 16-hour difference that results in that warning message.

I would recommend subscribing to, at least, hourly data when using scheduled events.

Also, you don't need to schedule the same event twice in the "for Currency in self.Currencies" loop.

0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Update Backtest





0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Loading...

This discussion is closed