Exemple #1
0
        public OrderBooksService(
            IB2С2RestClient b2C2RestClient,
            IOrderBookPublisher orderBookPublisher,
            ITickPricePublisher tickPricePublisher,
            OrderBooksServiceSettings settings,
            B2C2ClientSettings webSocketC2ClientSettings,
            ILogFactory logFactory)
        {
            _withWithoutSuffixMapping = new ConcurrentDictionary <string, string>();
            _withoutWithSuffixMapping = new ConcurrentDictionary <string, string>();
            _orderBooksCache          = new ConcurrentDictionary <string, OrderBook>();
            _subscriptions            = new ConcurrentDictionary <string, string>();

            _instrumentsLevels = settings.InstrumentsLevels == null || !settings.InstrumentsLevels.Any()
                ? throw new ArgumentOutOfRangeException(nameof(_instrumentsLevels)) : settings.InstrumentsLevels;

            _b2C2RestClient            = b2C2RestClient ?? throw new NullReferenceException(nameof(b2C2RestClient));
            _webSocketC2ClientSettings = webSocketC2ClientSettings ?? throw new NullReferenceException(nameof(webSocketC2ClientSettings));

            _orderBookPublisher = orderBookPublisher ?? throw new NullReferenceException(nameof(orderBookPublisher));
            _tickPricePublisher = tickPricePublisher ?? throw new NullReferenceException(nameof(tickPricePublisher));

            _logFactory = logFactory;
            _log        = logFactory.CreateLog(this);

            _reconnectIfNeededInterval = settings.ReconnectIfNeededInterval;
            _reconnectIfNeededTrigger  = new TimerTrigger(nameof(OrderBooksService), settings.ReconnectIfNeededInterval, logFactory, ReconnectIfNeeded);
            _forceReconnectTrigger     = new TimerTrigger(nameof(OrderBooksService), settings.ForceReconnectInterval, logFactory, ForceReconnect);

            _settings = settings;
        }
 public TradeHistoryService(IB2С2RestClient b2C2RestClient, string sqlConnString, bool enableAutoUpdate, ILogFactory logFactory)
 {
     _b2C2RestClient   = b2C2RestClient;
     _sqlConnString    = sqlConnString;
     _enableAutoUpdate = enableAutoUpdate;
     _logFactory       = logFactory;
     _log = logFactory.CreateLog(this);
 }
 public ExternalExchangeService(
     IB2С2RestClient client,
     IAssetPairLinkService assetPairLinkService,
     ILogFactory logFactory)
 {
     _client = client;
     _assetPairLinkService = assetPairLinkService;
     _log = logFactory.CreateLog(this);
 }
Exemple #4
0
 public PrivateService(
     B2c2AdapterSettings settings,
     IB2С2RestClient b2C2RestClient,
     ILogger <PrivateService> logger
     )
 {
     _settings       = settings;
     _b2C2RestClient = b2C2RestClient;
     _logger         = logger;
 }
        public BalanceHistoryService(
            IB2С2RestClient b2C2RestClient,
            string sqlConnString,
            bool enableAutoUpdate,
            IReadOnlyDictionary <string, string> assetMappings,
            ILogFactory logFactory)
        {
            _b2C2RestClient   = b2C2RestClient;
            _sqlConnString    = sqlConnString;
            _enableAutoUpdate = enableAutoUpdate;
            _assetMappings    = assetMappings;

            _logFactory = logFactory;
            _log        = logFactory.CreateLog(this);
        }