1) In live algorithm, it would be very useful to (for as long as it's running) get as many of the same rolling stats you get in a back test as possible/reasonable, for instance win rate and average profit. Main reasoning being that one aim of live testing is to verify whether the actual characteristics of the algo converge towards the backtest over time.
2) Unity-style coroutines using IEnumerator (Unity as in the most popular game engine). Main reason is those make it very easy to write code that waits for stuff in a linear method without callbacks (an alternative would be C# async, but AFAIK there are no guarantees on the thread of execution in that case and synchronization with other threads become necessary). I find myself wishing for that as currently handling order events in algo code that's being called on other events, e.g. OnData, is a pain. Example of what I would like to do:
//very simple example illustrating how control flow becomes linear
IEnumerator HandleEntry(OrderTicket ticket)
{
//main loop
for (;;)
{
yield return WaitForOrderEvent(ticket);
if (ticket.Status == OrderStatus.PartiallyFilled)
{
if (StoplossTriggered())
{
ticket.Cancel();
break;
}
}
else if (ticket.Status.IsClosed())
{
OnEntry(ticket.Status);
yield break;
}
}
//wait for order cancellation (stoploss)
yield return WaitForOrderClosed(ticket);
OrderTicket stoplossTicket = CreateStoplossOrder();
yield return Coroutine.Start(HandleStoploss, stoplossTicket);
}
Or does anyone else have a better suggestion on how to already do this?
Petter Hansson
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!