@@ -65,8 +65,10 @@ public void DefaultDataFeeds_CanBeOverwritten_Successfully()
6565
6666 // new forex - should be tradebar
6767 var forexQuote = algo . AddForex ( "EURUSD" ) ;
68- Assert . IsTrue ( forexQuote . Subscriptions . Count ( ) == 1 ) ;
68+ // The quote bar subscription is kept
69+ Assert . IsTrue ( forexQuote . Subscriptions . Count ( ) == 2 ) ;
6970 Assert . IsTrue ( GetMatchingSubscription ( algo , forexQuote . Symbol , typeof ( TradeBar ) ) != null ) ;
71+ Assert . IsTrue ( GetMatchingSubscription ( algo , forexQuote . Symbol , typeof ( QuoteBar ) ) != null ) ;
7072
7173 // reset to empty string, affects other tests because config is static
7274 Config . Set ( "security-data-feeds" , "" ) ;
@@ -91,9 +93,20 @@ public void DefaultDataFeeds_AreAdded_Successfully()
9193
9294 // equity low resolution
9395 var equityDaily = algo . AddSecurity ( SecurityType . Equity , "goog" , Resolution . Daily ) ;
94- Assert . IsTrue ( equityDaily . Subscriptions . Count ( ) == 2 ) ;
96+ Assert . IsTrue ( equityDaily . Subscriptions . Count ( ) == 3 ) ;
9597 Assert . IsTrue ( GetMatchingSubscription ( algo , equityDaily . Symbol , typeof ( TradeBar ) ) != null ) ;
98+ Assert . IsTrue ( GetMatchingSubscription ( algo , equityMinute . Symbol , typeof ( QuoteBar ) ) != null ) ;
99+
100+ Assert . IsTrue ( ReferenceEquals ( equityMinute , equityDaily ) ) ;
96101
102+ var equitySubscriptions = algo . SubscriptionManager . SubscriptionDataConfigService
103+ . GetSubscriptionDataConfigs ( equityMinute . Symbol ) ;
104+ Assert . IsTrue ( equitySubscriptions . SingleOrDefault (
105+ s => s . TickType == TickType . Trade && s . Type == typeof ( TradeBar ) && s . Resolution == Resolution . Minute ) != null ) ;
106+ Assert . IsTrue ( equitySubscriptions . SingleOrDefault (
107+ s => s . TickType == TickType . Quote && s . Type == typeof ( QuoteBar ) && s . Resolution == Resolution . Minute ) != null ) ;
108+ Assert . IsTrue ( equitySubscriptions . SingleOrDefault (
109+ s => s . TickType == TickType . Trade && s . Type == typeof ( TradeBar ) && s . Resolution == Resolution . Daily ) != null ) ;
97110
98111 // option
99112 var option = algo . AddSecurity ( SecurityType . Option , "goog" ) ;
@@ -116,16 +129,29 @@ public void DefaultDataFeeds_AreAdded_Successfully()
116129 Assert . IsTrue ( future . Subscriptions . FirstOrDefault ( x => typeof ( FutureUniverse ) == x . Type ) != null ) ;
117130
118131 // Crypto high resolution
119- var cryptoMinute = algo . AddSecurity ( SecurityType . Equity , "goog " ) ;
132+ var cryptoMinute = algo . AddSecurity ( SecurityType . Crypto , "btcusd " ) ;
120133 Assert . IsTrue ( cryptoMinute . Subscriptions . Count ( ) == 2 ) ;
121134 Assert . IsTrue ( GetMatchingSubscription ( algo , cryptoMinute . Symbol , typeof ( TradeBar ) ) != null ) ;
122135 Assert . IsTrue ( GetMatchingSubscription ( algo , cryptoMinute . Symbol , typeof ( QuoteBar ) ) != null ) ;
123136
124137 // Crypto low resolution
125138 var cryptoHourly = algo . AddSecurity ( SecurityType . Crypto , "btcusd" , Resolution . Hour ) ;
126- Assert . IsTrue ( cryptoHourly . Subscriptions . Count ( ) == 2 ) ;
139+ Assert . IsTrue ( cryptoHourly . Subscriptions . Count ( ) == 4 ) ;
127140 Assert . IsTrue ( GetMatchingSubscription ( algo , cryptoHourly . Symbol , typeof ( TradeBar ) ) != null ) ;
128141 Assert . IsTrue ( GetMatchingSubscription ( algo , cryptoHourly . Symbol , typeof ( QuoteBar ) ) != null ) ;
142+
143+ Assert . IsTrue ( ReferenceEquals ( cryptoMinute , cryptoHourly ) ) ;
144+
145+ var cryptoSubscriptions = algo . SubscriptionManager . SubscriptionDataConfigService
146+ . GetSubscriptionDataConfigs ( cryptoMinute . Symbol ) ;
147+ Assert . IsTrue ( cryptoSubscriptions . SingleOrDefault (
148+ s => s . TickType == TickType . Trade && s . Type == typeof ( TradeBar ) && s . Resolution == Resolution . Minute ) != null ) ;
149+ Assert . IsTrue ( cryptoSubscriptions . SingleOrDefault (
150+ s => s . TickType == TickType . Quote && s . Type == typeof ( QuoteBar ) && s . Resolution == Resolution . Minute ) != null ) ;
151+ Assert . IsTrue ( cryptoSubscriptions . SingleOrDefault (
152+ s => s . TickType == TickType . Trade && s . Type == typeof ( TradeBar ) && s . Resolution == Resolution . Hour ) != null ) ;
153+ Assert . IsTrue ( cryptoSubscriptions . SingleOrDefault (
154+ s => s . TickType == TickType . Quote && s . Type == typeof ( QuoteBar ) && s . Resolution == Resolution . Hour ) != null ) ;
129155 }
130156
131157
0 commit comments