Alpha Streams

Upgrading Classic Algorithms

Upgrading Classic Algorithms

Introduction

With a few code adjustments, you can quickly turn a classic algorithm into an Alpha Streams capable strategy. The algorithm must emit Insight objects to be classified as an Alpha.

Converting Classic Algorithms

There is only one step required to convert your classic algorithm to be compatible with Alpha Streams, and this is to modify your algorithm to emit Insight objects at an appropriate time in your algorithm. The default QCAlgorithm behavior is to emit Insights whenever a trade is placed, but manually emitting Insights allows you to inject information about the magnitude and confidence of the Insight, which adds value to the Alpha and can boost your overall score.

Call EmitInsights

Insight direction generally lines up with what type of order you want to place -- Up/Buy, Down/Sell -- but Flat Insights are required for Liquidate statements. To emit Insights, you need to call the function before placing a trade. Take care in setting the insight properties and don't emit insights superfluously or they could negatively affect your overall score.

// Call EmitInsights with insights created in correct direction,
// here we're going short. The EmitInsights method can accept multiple insights
// separated by commas.
EmitInsights(
    // Creates an insight for our symbol, predicting that it will move down within
    // the fast ema period number of days
    Insight.Price(_symbol, TimeSpan.FromDays(FastEmaPeriod), InsightDirection.Down)
);
# Call EmitInsights with insights created in correct direction,
# here we're going short. The EmitInsights method can accept multiple insights
# separated by commas.
self.EmitInsights(
    # Creates an insight for our symbol, predicting that it will move down within
    #  the fast ema period number of days
    Insight.Price(self.symbol, timedelta(self.FastEmaPeriod), InsightDirection.Down)
)

In creating these insights you should think about:

  • What is the time period of my insight / expected holding period?
  • Does my trade signal give me a confidence of investment?
  • What is the expected move magnitude?

If you cannot determine these values with some intrinsic data driven hypothesis we recommend leaving them unset. This information can provide value to your algorithm that goes beyond pure performance and is one of the benefits of manual Insight creation.

Determining Insight Confidence and Magnitude

Your Insight period, magnitude and confidence are important properties that can be hard to generate when porting a classic algorithm. See the Creating Alpha section for more information.

You can also see our Tutorials and Videos. You can also get in touch with us via Chat.

Did you find this page helpful?