In the backtest trades information I have a tag for a trade: "Liquidate from delisting". What does it mean? After this trade the algorithm stops making trades for the whole period.
QUANTCONNECT COMMUNITY
In the backtest trades information I have a tag for a trade: "Liquidate from delisting". What does it mean? After this trade the algorithm stops making trades for the whole period.
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.
Alexandre Catarino
When an asset is delisted (Futures and Options are delisted at expiry), a market order is placed and tagged as "Liquidate from delisting". We would need a concrete example to see why it stopped trading.
John Newman
Hi, why is my position closed immediately with "liquidated from delisting"? I consolidated the futures data to daily bars and the holding period should be many days. Instead it closes the next day.
Jack Simonson
Hi John,
Futures contracts will be liquidated if they are about to expire/delist, so this will happen even if you enter the position the day before. For example, the trade logs show that the algorithm buys GC29Q17 on 8/29 at 00:00, which is the time that will be logged when placing a Market Order on daily data. However, the delisting warning also occurred on the 29th, which indicates that the contract will be delisted by the end of day, and so the position is liquidated automatically, and the order is filled at the first available time (this will be logged on a Monday if the warning happens and the liquidate order is filled on a Friday, so sometimes you see a 3-day lag in the logging statements). If you want to ensure your position is open for several days before liquidating, then the algorithm needs to buy contracts earlier than one day before their delisting. This would require adjusting the trading logic regarding quoteBar.Close < Line and quoteBar.Close > Line, otherwise the algorithm will likely continue to buy contracts immediately prior to their expiration.
I've attached a backtest where I add some additional logs which display all delisting warnings, which will give a warning the day before a delisting and one after it has occurred.
John Newman
Hi Jack Simonson, yes, you are right, of course, I made a mistake in selecting the contracts.
Can you just tell me, this contract selection (future.SetFilter function) occurs only once at the algo Init (StartDate) or is the selection floating (SetFilter around the current backtested day) ? I don't understand the mechanism for the Futures.
My goal is to narrow the selection to just 1 most liquid contract per each future (front contract) and ideally roll the position over to the next front contract, if nearing delisting.
Jack Simonson
John,
The SetFilter function operates continuously, adding new contracts as they meet the filter criteria and removing contracts from the universe that have fallen outside of the filter (i.e. expiration). You can view a backtest I attach below and review the logs to see how this functions.
Victor Zakharenko
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.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!