1616using System ;
1717using System . Collections . Generic ;
1818using QuantConnect . Interfaces ;
19+ using QuantConnect . Securities ;
1920
2021namespace QuantConnect . Algorithm . CSharp
2122{
@@ -54,7 +55,7 @@ public override void Initialize()
5455 throw new RegressionTestException ( "Expected the SPY CFD market hours to be the same as the underlying equity market hours." ) ;
5556 }
5657
57- if ( ! ReferenceEquals ( spyCfd . SymbolProperties , equitySymbolProperties ) )
58+ if ( ! SymbolPropertiesAreEquivalent ( spyCfd . SymbolProperties , equitySymbolProperties ) )
5859 {
5960 throw new RegressionTestException ( "Expected the SPY CFD symbol properties to be the same as the underlying equity symbol properties." ) ;
6061 }
@@ -74,12 +75,25 @@ public override void Initialize()
7475 throw new RegressionTestException ( "Expected the AUDUSD CFD market hours to be the same as the underlying forex market hours." ) ;
7576 }
7677
77- if ( ! ReferenceEquals ( audUsdCfd . SymbolProperties , audUsdForexSymbolProperties ) )
78+ if ( ! SymbolPropertiesAreEquivalent ( audUsdCfd . SymbolProperties , audUsdForexSymbolProperties ) )
7879 {
7980 throw new RegressionTestException ( "Expected the AUDUSD CFD symbol properties to be the same as the underlying forex symbol properties." ) ;
8081 }
8182 }
8283
84+ private static bool SymbolPropertiesAreEquivalent ( SymbolProperties a , SymbolProperties b )
85+ {
86+ return a . Description == b . Description &&
87+ a . QuoteCurrency == b . QuoteCurrency &&
88+ a . ContractMultiplier == b . ContractMultiplier &&
89+ a . MinimumPriceVariation == b . MinimumPriceVariation &&
90+ a . LotSize == b . LotSize &&
91+ a . MarketTicker == b . MarketTicker &&
92+ a . MinimumOrderSize == b . MinimumOrderSize &&
93+ a . PriceMagnifier == b . PriceMagnifier &&
94+ a . StrikeMultiplier == b . StrikeMultiplier ;
95+ }
96+
8397 /// <summary>
8498 /// This is used by the regression test system to indicate if the open source Lean repository has the required data to run this algorithm.
8599 /// </summary>
0 commit comments