public void VerifyConfiguration(IExchangeConfiguration configuration) { Assert.NotNull(configuration); Assert.NotNull(configuration.BaseUri); Assert.NotNull(configuration.SupportedCurrencies); Assert.NotNull(configuration.SupportedPairs); Assert.IsTrue(TestCandidate.ExchangeSourceType == configuration.ExchangeSourceType); }
private static IExchange CreateExchangeConfiguration(IExchangeConfiguration exchangeConfiguration) { return(new Exchange( name: exchangeConfiguration.Name, type: exchangeConfiguration.Type, durable: exchangeConfiguration.Durable, autoDelete: exchangeConfiguration.AutoDelete, arguments: exchangeConfiguration.Arguments)); }
internal Exchange( IExchangeConfiguration configuration, IExchangeCommandFactory commands) { _configuration = configuration; _commands = commands; SetupSocket(); _executor = new ExecutionEngine(configuration); }
public ModelTranslationBase( IExchangeConfiguration configuration, TradingPair pair, IExchangeCommandFactory commands) { _configuration = configuration; _translator = new ResultTranslation(configuration); _commands = commands; _pair = pair; }
internal AccountBalance( IEnumerable <IExchangeResponseIntermediate <Balance> > balances, TradingPair pair, IExchangeConfiguration configuration) : base(DateTime.UtcNow, configuration.ExchangeSourceType) { BalanceByCurrency = CreateDictionary( balances .Select(x => x.Convert(pair)), configuration); }
public JfdOrderBooksHarvester( JfdExchangeConfiguration configuration, JfdModelConverter modelConverter, ILog log, IHandler <OrderBook> orderBookHandler) : base(JfdExchange.Name, configuration, new JfdQuotesSessionConnector(GetConnectorConfig(configuration), log), log, orderBookHandler) { _configuration = configuration; _modelConverter = modelConverter; HeartBeatPeriod = TimeSpan.FromSeconds(90); // Just in case if QuickFix doesn't detect connection failure. }
internal Exchange( IExchangeConfiguration configuration, IExchangeCommandFactory commands, IExchangeAuthenticator authenticator) { _configuration = configuration; _commands = commands; SetupSocket(); _executor = new ExecutionEngine( authenticator, configuration); }
internal UserTransactions( IEnumerable <IExchangeResponseIntermediate <UserTransaction> > transactions, TradingPair pair, IExchangeConfiguration configuration) : base(DateTime.UtcNow, configuration.ExchangeSourceType) { Pair = pair; TransactionsCollection = transactions .Select(x => x.Convert(pair)) .Where(x => x != default(UserTransaction)) .ToList() .AsReadOnly(); }
protected Exchange(string name, IExchangeConfiguration config, TranslatedSignalsRepository translatedSignalsRepository, ILog log) { Name = name; Config = config; State = ExchangeState.Initializing; LykkeLog = log; Instruments = config.SupportedCurrencySymbols?.Select(x => new Instrument(Name, x.LykkeSymbol)).ToList() ?? new List <Instrument>(); if (!Instruments.Any() && config.UseSupportedCurrencySymbolsAsFilter != false) { throw new ArgumentException($"There is no instruments in the settings for {Name} exchange"); } }
/* * internal Transactions(IEnumerable<Transaction> transactions, TradingPair pair, * ExchangeType sourceExchange) * : base(DateTime.UtcNow, sourceExchange) * { * Pair = pair; * * TransactionsCollection = * transactions * .Where(x => x != default(Transaction)) * .OrderByDescending(x => x.UnixCompletedTimeStamp) * .ToList() * .AsReadOnly(); * }*/ internal Transactions( IEnumerable <IExchangeResponseIntermediate <Transaction> > transactions, TradingPair pair, IExchangeConfiguration configuration) : base(DateTime.UtcNow, configuration.ExchangeSourceType) { Pair = pair; TransactionsCollection = transactions .Select(x => x.Convert(pair)) .Where(x => x != default(Transaction)) .OrderByDescending(x => x.UnixCompletedTimeStamp) .ToList() .AsReadOnly(); }
protected Exchange(string name, IExchangeConfiguration config, TranslatedSignalsRepository translatedSignalsRepository, ILog log) { Name = name; Config = config; State = ExchangeState.Initializing; LykkeLog = log; if (config.SupportedCurrencySymbols == null || config.SupportedCurrencySymbols.Count == 0) { throw new ArgumentException($"There is no instruments in the settings for {Name} exchange"); } Instruments = config.SupportedCurrencySymbols .Select(x => new Instrument(Name, x.LykkeSymbol)).ToList(); }
protected OrderBooksHarvesterBase(string exchangeName, IExchangeConfiguration exchangeConfiguration, ILog log, IHandler <OrderBook> newOrderBookHandler) { ExchangeConfiguration = exchangeConfiguration; _newOrderBookHandler = newOrderBookHandler; ExchangeName = exchangeName; Log = log.CreateComponentScope(GetType().Name); _converters = new ExchangeConverters(exchangeConfiguration.SupportedCurrencySymbols, string.Empty, exchangeConfiguration.UseSupportedCurrencySymbolsAsFilter); _orderBookSnapshots = new ConcurrentDictionary <string, OrderBookSnapshot>(); _cancellationTokenSource = new CancellationTokenSource(); CancellationToken = _cancellationTokenSource.Token; _heartBeatMonitoringTimer = new Timer(s => RestartMessenger("No messages from the exchange")); _snapshotRefreshTimer = new Timer(s => RestartMessenger("Refresh order book snapshot")); }
internal OpenOrders( IEnumerable <IExchangeResponseIntermediate <Order> > orders, TradingPair pair, IExchangeConfiguration configuration) : base(DateTime.UtcNow, configuration.ExchangeSourceType) { var allOrders = orders .Select(x => x.Convert(pair)) .Distinct(); BuyOrders = new ReadOnlyDictionary <string, Order>( allOrders .Where(x => x.IsBuyOrder) .ToDictionary(x => x.Id, x => x)); SellOrders = new ReadOnlyDictionary <string, Order>( allOrders .Where(x => x.IsSellOrder) .ToDictionary(x => x.Id, x => x)); }
protected OrderBooksHarvesterBase(string exchangeName, IExchangeConfiguration exchangeConfiguration, ILog log, OrderBookSnapshotsRepository orderBookSnapshotsRepository, OrderBookEventsRepository orderBookEventsRepository, IHandler <OrderBook> newOrderBookHandler) { ExchangeConfiguration = exchangeConfiguration; OrderBookSnapshotsRepository = orderBookSnapshotsRepository; OrderBookEventsRepository = orderBookEventsRepository; _newOrderBookHandler = newOrderBookHandler; ExchangeName = exchangeName; Log = log.CreateComponentScope(GetType().Name); _converters = new ExchangeConverters(exchangeConfiguration.SupportedCurrencySymbols, string.Empty); _orderBookSnapshots = new ConcurrentDictionary <string, OrderBookSnapshot>(); _cancellationTokenSource = new CancellationTokenSource(); CancellationToken = _cancellationTokenSource.Token; _heartBeatMonitoringTimer = new Timer(RestartMessenger); }
internal ExecutionEngine(IExchangeConfiguration configuration) { _configuration = configuration; _dispatcher = new RequestDispatcher(_configuration.BaseUri); _translator = new ResultTranslation(_configuration); }
private ReadOnlyDictionary <Currency, Balance> CreateDictionary(IEnumerable <Balance> balances, IExchangeConfiguration configuration) { var dict = new Dictionary <Currency, Balance>(); foreach (var currency in configuration.SupportedCurrencies) { var balance = balances.FirstOrDefault(x => x.BalanceCurrency == currency); if (balance == default(Balance)) { balance = new Balance( 0.00m, currency, 0.00m, DateTime.UtcNow, configuration.ExchangeSourceType, 0.00m); } dict[currency] = balance; } return(new ReadOnlyDictionary <Currency, Balance>(dict)); }
#pragma warning disable RECS0154 // Parameter is never used internal AccountBalance(IEnumerable <Balance> balances, TradingPair pair, IExchangeConfiguration configuration) #pragma warning restore RECS0154 // Parameter is never used : base(DateTime.UtcNow, configuration.ExchangeSourceType) { BalanceByCurrency = CreateDictionary(balances, configuration); }
public EndPointConfigurator(IExchangeConfiguration exchange, IQueueConfiguration queue, string routingKey) { RoutingKey = routingKey; ExchangeConfiguration = exchange; QueueConfiguration = queue; }
internal ResultTranslation(IExchangeConfiguration configuration) { _configuration = configuration; }
public SocketObservable(IExchangeConfiguration configuration, object subscribe) { _socketUri = configuration.WebSocketUri; _observable = MessageBuffer(subscribe); }
internal ExecutionEngine(IExchangeAuthenticator authenticator, IExchangeConfiguration configuration) { _dispatcher = new RequestDispatcher(configuration.BaseUri, authenticator); _translator = new ResultTranslation(configuration); _configuration = configuration; }
protected OrderBooksWebSocketHarvester(string exchangeName, IExchangeConfiguration exchangeConfiguration, IMessenger <TRequest, TResponse> messanger, ILog log, IHandler <OrderBook> orderBookHandler) : base(exchangeName, exchangeConfiguration, log, orderBookHandler) { Messenger = messanger; }