New to the platform. Attempting to do a basic EMA-crossover strategy that liquidates the portfolio at the end of each trading day. Have tried both OnEndOfDay and scheduler (both attached). For some reason it is instead liquidating first thing the next day. Any pointers?
//Scheduler
Schedule.On(DateRules.Every(DayOfWeek.Monday, DayOfWeek.Friday), TimeRules.At(15, 59, 30), () =>
{
Log("Daily Liquidation at : " + Time.ToString("o"));
Liquidate();
});
//OnEndOfData
public override void OnEndOfDay()
{
// close up shop each day and reset our 'last' value so we start tomorrow fresh
Log("End of day liquidating");
Liquidate();
}
Douglas Stridsberg
Hi,
What assets do you trade and what are their market hours? What is the timezone you've specified in your Initialize? Is the order being submitted on time but the fill is happening the next day, or are the submissions and the fills both happening the next day?
One way to check is to log output from the OnOrderEvent() method - it will be run both when an order is submitted and when it is filled.
Martin Molinero
Hi,
There is a bug reported about this that seems to have slipped away, I'll look into it now. Thanks for the report Saurabh Maheshwari !
https://github.com/QuantConnect/Lean/issues/2865The 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.
Sergi Stocks
Hi, i can still reproduce this error. It's being called next day morning. Any update on this bug nowadays? thanks
Jared Broad
Hi Sergi; the bug was resolved mid-2019. It sounds like you're using Daily data which is triggered at the end of the day (start of the next). If you have another report feel free to submit the code to replicate it to support@quantconnect.com
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.
Saurabh Maheshwari
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!