示例#1
0
 /// <param name="symbol"></param>
 /// <param name="marketStrategy"></param>
 /// <param name="webSocketClient"></param>
 /// <param name="logger"></param>
 /// <param name="binanceRestClient"></param>
 /// <exception cref="ArgumentNullException"><paramref name="symbol"/> cannot be <see langword="null"/></exception>
 /// <exception cref="ArgumentNullException"><paramref name="marketStrategy"/> cannot be <see langword="null"/></exception>
 /// <exception cref="ArgumentNullException"><paramref name="webSocketClient"/> cannot be <see langword="null"/></exception>
 /// <exception cref="ArgumentNullException"><paramref name="binanceRestClient"/> cannot be <see langword="null"/></exception>
 public MarketMakerBot(
     string symbol,
     NaiveMarketMakerStrategy marketStrategy,
     IBinanceRestClient binanceRestClient,
     IBinanceWebSocketClient webSocketClient,
     Logger logger) :
     base(symbol, marketStrategy, logger)
 {
     _marketDepth       = new MarketDepth(symbol);
     _binanceRestClient = binanceRestClient ?? throw new ArgumentNullException(nameof(binanceRestClient));
     _webSocketClient   = webSocketClient ?? throw new ArgumentNullException(nameof(webSocketClient));
 }
示例#2
0
        private static async Task TestConnection(IBinanceRestClient binanceRestClient)
        {
            Logger.Info("Testing connection...");
            IResponse testConnectResponse = await binanceRestClient.TestConnectivityAsync();

            if (testConnectResponse != null)
            {
                ServerTimeResponse serverTimeResponse = await binanceRestClient.GetServerTimeAsync();

                Logger.Info($"Connection is established. Approximate ping time: {DateTime.UtcNow.Subtract(serverTimeResponse.ServerTime).TotalMilliseconds:F0} ms");
            }
        }
 public BinanceWebSocketClient(IBinanceRestClient binanceRestClient, Logger logger = null) :
     base(binanceRestClient, logger)
 {
 }
示例#4
0
 /// <summary>
 /// Create instance of <see cref="MarketDepthManager"/>
 /// </summary>
 /// <param name="binanceRestClient">Binance REST client</param>
 /// <param name="webSocketClient">Binance WebSocket client</param>
 /// <exception cref="ArgumentNullException"><paramref name="binanceRestClient"/> cannot be <see langword="null"/></exception>
 /// <exception cref="ArgumentNullException"><paramref name="webSocketClient"/> cannot be <see langword="null"/></exception>
 public MarketDepthManager(IBinanceRestClient binanceRestClient, IBinanceWebSocketClient webSocketClient)
 {
     _restClient      = binanceRestClient ?? throw new ArgumentNullException(nameof(binanceRestClient));
     _webSocketClient = webSocketClient ?? throw new ArgumentNullException(nameof(webSocketClient));
 }
 protected AbstractBinanceWebSocketClient(IBinanceRestClient binanceRestClient, Logger logger = null)
 {
     _binanceRestClient = binanceRestClient ?? throw new ArgumentNullException(nameof(binanceRestClient));
     _logger = logger ?? LogManager.GetCurrentClassLogger();
 }