About converting classical algorithm to alpha

Back

Hello, I have a question about converting classical algorithms into alpha. I know I need to call self.EmitInsights to emit insight objects along with each trade. But (I guess) the behaviour of each trade in a classical algorithm and the one from an insight can be different. Do I have to manually sync these two? To be specific, there are a few examples:

1. Insight usually come with a time period. Do I have to manually get out of my trades after this amount of time accordingly in the classical algorithms? 

2. If I use a risk management model in the alpha involving maximal drawdown/profit or something like this, in order to get an accurate backtest, do I have to manually simulate them or is there an easier way?

3. If I have complicated actions in the classical algorithm, like rebalancing at the end of the day or something involving calculations about the total value of the portfolio, how should I design the insight object?

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.


Hey Honglu!

Converting from classic to framework requires letting go of some classic concepts. So for example to enforce clear separation of concerns, each module is measured by its performance in isolation. 

The alpha models' concern is solely in the creation of signals and making those as accurate as possible. The period of the prediction accuracy and the direction of the prediction accuracy is "key performance indicator" for the alpha module. From those accurate insights, the portfolio construction and execution models are responsible for building a balanced portfolio and placing and managing the trades to manage that risk,

--

Taking a classic algorithm and simply emitting insights is a patch that we allow for Alpha Streams. The goal of this is to allow institutional traders to reconcile the alpha equity curve (repeat it). There are some funds that use insights to build expected return curves -- taking the predictions made by the alpha as a factor, and seeing how accurately it predicts the future. 

There are other funds who are more trading and equity curve focused so as another way to address this, we recently built in order streaming for Alpha Streams. This means the individual orders and their events (e.g. update limit price) are also streamed to the institutions allowing them to directly copy the trades where appropriate.

--

1. Insight usually come with a time period. Do I have to manually get out of my trades after this amount of time accordingly in the classical algorithms? 

If you can I'd recommend focusing on the alpha model and using the stock portfolio construction and execution models to handle the trades. This way your alpha signals will be easily reproduced. However, if you want to make minimal changes to your code you can emit insights up when long, flat when liquidating, and down when short. 

2. If I use a risk management model in the alpha involving maximal drawdown/profit or something like this, in order to get an accurate backtest, do I have to manually simulate them or is there an easier way?

If your classic algorithm has max drawdown etc style of limit on portfolio holdings, the ideal would be to create an equivalent risk model in the framework and have it manage the exposure. However, if you do not want to do that you can also issue Direction.Flat insights as a flat signal for followers.

3. If I have complicated actions in the classical algorithm, like rebalancing at the end of the day or something involving calculations about the total value of the portfolio, how should I design the insight object?

The result of these can be added to the insight through the Weight property.

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.


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