File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
src/ExchangeSharp/API/Exchanges/BinanceGroup Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -269,11 +269,21 @@ protected override async Task<IWebSocket> OnGetTickersWebSocketAsync(Action<IRea
269
269
JToken token = JToken . Parse ( msg . ToStringFromUTF8 ( ) ) ;
270
270
List < KeyValuePair < string , ExchangeTicker > > tickerList = new List < KeyValuePair < string , ExchangeTicker > > ( ) ;
271
271
ExchangeTicker ticker ;
272
- foreach ( JToken childToken in token [ "data" ] )
272
+
273
+ // if it is the tickers stream, data will be an array, else it is an direct item.
274
+ var data = token [ "data" ] ;
275
+ if ( data is JArray )
276
+ foreach ( JToken childToken in data )
277
+ {
278
+ ticker = await ParseTickerWebSocketAsync ( childToken ) ;
279
+ tickerList . Add ( new KeyValuePair < string , ExchangeTicker > ( ticker . MarketSymbol , ticker ) ) ;
280
+ }
281
+ else
273
282
{
274
- ticker = await ParseTickerWebSocketAsync ( childToken ) ;
283
+ ticker = await ParseTickerWebSocketAsync ( data ) ;
275
284
tickerList . Add ( new KeyValuePair < string , ExchangeTicker > ( ticker . MarketSymbol , ticker ) ) ;
276
285
}
286
+
277
287
if ( tickerList . Count != 0 )
278
288
{
279
289
callback ( tickerList ) ;
You can’t perform that action at this time.
0 commit comments