I am quite new to the Framework, and I was wondering how one can construct an ExecutionModel that consumes Minute, Tick,... data in order to execute an order at the most optimal time, e.g. something like onData() which currently does not exist in ExecutionModel? Also, how many times is Execute() called in ExecutionModel? e.g. what if the ExecutionModel is not able to execute an order for one or the other reason (example : network problems, markets closed,....). Does ExecutionModel need to be stateless, or is it expected to manage its own state ?
Arthur Asenheimer
Hi Karel,
the ExecutionModel have one required method to implement Execute(algorithm, targets). How many times Execute() is called depends on your PortfolioConstructionModel, i.e. Execute() is called when it receives new/modified targets from your PortfolioConstructionModel.
It appears to me that your approach would effect a violation of the separation of concerns principle. The timing aspect of your signals/orders should be located in your AlphaModel.
Regarding the other questions: I am not sure but I guess the algorithm will keep the open orders in a pending status. Maybe someone of the QC staff can tell us more on this.
Karel Goderis
Hi Arthur,
Well, the ExecutionModel I want to build is based on some machine learning principles whereby it will consume Minute bar data to choose the ideal moment to execute a trade, wheres the AlphaModel will consume Day bar data on the same Symbol to decide when to enter a trade. The ExecutionModel does not have to provide an Insight, just execute wat was decided before, but it must be able to do so using its own insights. I more or less consider Alpha and Execution to be 2 different agents, as in unsupervided/re-inforced machine learning speak.
Arthur Asenheimer
You can consider AlphaModel and ExecutionModel as two different agents, but they're not independent here as the data will be piped sequentially through the Algorithm Framework modules, i.e. :
UniverseSelection --> Alpha --> PortfolioConstruction --> RiskManagement --> Execution
>> The ExecutionModel does not have to provide an Insight, just execute wat was decided before, but it must be able to do so using its own insights. <<
What do you mean by "using its own inisghts"? Can you provide an example?
>> the ExecutionModel I want to build is based on some machine learning principles whereby it will consume Minute bar data to choose the ideal moment to execute a trade, wheres the AlphaModel will consume Day bar data on the same Symbol [...] <<
If you need Minute Resolution data in your algorithm then you have to subscribe to Minute Resolution anyway for the corresponding symbols. Accordingly, the method Update() in your AlphaModel will be called every minute. On this point at least, it shouldn't be a problem to move the code to the AlphaModel.
Nevertheless, there might be cases which are not suited for the Algorithm Framework, and, if so, you should not hesitate to use the classic style (with OnData() as primary entry point).
Karel Goderis
Well, my plan is to have Alpha (or QCA) to call a new method ExecutionModel.Update() or alike, everytime Update() (onData()) is called.
ExecutionModel would contain a unsupervised agent with a neural net that takes a few inputs, but also the Minute Bars and do some time-series related forecasting/calculation so that it the agent will be rewarded for execution for example a sell order at the high of a day/..., and penalised if it is not able to execute the trade before the close of the market
Karel Goderis
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!