Dear community,

I am trying to implement multiple Alpha models within the Algorithm Framework. The idea is, that trades should only occur when all the Alphas emit unanimous signals. I.e., when at one point in time there is Alpha1 signalling an Up insight and Alpha 2 a Down insight, there should not be any trade. Trading only if both are Up or Down. 

I was trying to accomplish that by iterating through the activeInsights.Direction within the PorfolioConstruction model, like:

for insight in activeInsights:
            # return insight only when all active insights have the same direction            
            if all(insight.Direction == other_insights.Direction for other_insights in activeInsights):
                result[insight] = (insight.Direction if self.RespectPortfolioBias(insight) else InsightDirection.Flat) * percent
            else:
                result[insight] = (InsightDirection.Flat) * percent

I had understood that the activeInsights should be like in the docu

“The combined stream of Insight objects is passed to the Portfolio Construction model.”

so I thought the above code should do the trick.

However, it appears that all signals are treated and executed equally. I have attached a sample for demo purposes:

  • only 1 Symbol (Ethereum)
  • Alpha model up statically emits Up signals
  • Alpha model down statically emits Down signals
  • Daily Resolution

 

Can anyone give “insights” (no pun intended…) how to accomplish that?

Thx!