コード例 #1
0
        public WebSocketManagerException(IBinanceWebSocketClient client, string message, Exception innerException)
            : base(message, innerException)
        {
            Throw.IfNull(client, nameof(client));

            Client = client;
        }
コード例 #2
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));
 }
コード例 #3
0
        /// <summary>
        /// Raise an error event on controller exception.
        /// </summary>
        /// <param name="client">The client associated with the exception.</param>
        /// <param name="exception">The inner exception.</param>
        /// <param name="message">The exception message (optional).</param>
        private void RaiseErrorEvent(IBinanceWebSocketClient client, Exception exception, string message = null)
        {
            var args = new WebSocketManagerErrorEventArgs(
                new WebSocketManagerException(client, message, exception));

            try { Error?.Invoke(this, args); }
            catch (OperationCanceledException) { }
            catch (Exception e)
            {
                _logger?.LogError(e, $"{nameof(BinanceWebSocketManager)}: Unhandled error event handler exception.");
            }
        }
コード例 #4
0
 public WebSocketManagerException(IBinanceWebSocketClient client, Exception innerException)
     : this(client, null, innerException)
 {
 }
コード例 #5
0
 public WebSocketManagerException(IBinanceWebSocketClient client, string message)
     : this(client, message, null)
 {
 }
コード例 #6
0
 public WebSocketManagerException(IBinanceWebSocketClient client)
     : this(client, null, null)
 {
 }
        /// <summary>
        /// Get the <see cref="IRetryTaskController"/> associated with the
        /// <see cref="IBinanceWebSocketClient"/> web socket stream.
        /// </summary>
        /// <param name="manager"></param>
        /// <param name="client"></param>
        /// <returns></returns>
        public static IRetryTaskController GetController(this IBinanceWebSocketManager manager, IBinanceWebSocketClient client)
        {
            Throw.IfNull(manager, nameof(manager));
            Throw.IfNull(client, nameof(client));

            return(manager.GetController(client.WebSocket));
        }
コード例 #8
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));
 }