JKorf / Binance.Net

A C# .netstandard client library for the Binance REST and Websocket Spot and Futures API focusing on clear usage and models
https://jkorf.github.io/Binance.Net/
MIT License
1.03k stars 421 forks source link

SubscribeToSymbolMiniTickerUpdatesAsync: no invalid symbol exception is thrown #620

Closed BobMakhlin closed 3 years ago

BobMakhlin commented 3 years ago

When I pass invalid symbol to the SubscribeToSymbolMiniTickerUpdatesAsync method, no exception is thrown:

BinanceSocketClient socketClient = new BinanceSocketClient();

CallResult<UpdateSubscription> callResult = await socketClient.Spot
    .SubscribeToSymbolMiniTickerUpdatesAsync("XRPXRP", response =>
    {
        Console.WriteLine(response.LastPrice);
    });

Console.WriteLine($"Error: {callResult.Error}"); // null
Console.WriteLine($"Success: {callResult.Success}"); // true

I am passing "XRPXRP" as the symbol. As you can see, it's an invalid symbol, so here we should have an exception. But nothing happens.

Debug logging

2021/02/24 15:34:03:909 | Binance    | Debug | Client configuration: LogVerbosity: Debug, Writers: 1, Credentials: Set, BaseAddress: wss://stream.binance.com:9443/, Proxy: -, AutoR
econnect: True, ReconnectInterval: 00:00:05, SocketResponseTimeout: 00:00:10, SocketSubscriptionsCombineTarget:
2021/02/24 15:34:04:047 | Binance    | Debug | Created new socket for wss://stream.binance.com:9443/stream?streams=xrpxrp@miniTicker
2021/02/24 15:34:04:127 | Binance    | Debug | Socket 1 connecting
2021/02/24 15:34:06:362 | Binance    | Debug | Socket 1 connected
JKorf commented 3 years ago

This is how Binance has implemented it. It doesn't return an error if you try to subscribe to symbols which don't exist. Not much I can do about that.

BobMakhlin commented 3 years ago

I understood. Thanks!