public BitstampExchange( BitstampConfiguration config, TranslatedSignalsRepository translatedSignalsRepository, ILog log) : base(Name, config, translatedSignalsRepository, log) { this.config = config; this.log = log; }
public OandaExchange(OandaConfiguration config, TranslatedSignalsRepository translatedSignalsRepository, ILog log) : base(Name, config, translatedSignalsRepository, log) { var client = new ApiClient(OandaHttpClient.CreateHttpClient(OandaAuth.Token), log); accounts = new Accounts(client); prices = new Prices(client); instruments = new Instruments(client); }
public JfdExchange(JfdExchangeConfiguration config, TranslatedSignalsRepository translatedSignalsRepository, JfdOrderBooksHarvester harvester, IHandler <ExecutionReport> executionHandler, ILog log) : base(Name, config, translatedSignalsRepository, log) { _connector = new JfdTradeSessionConnector(new FixConnectorConfiguration(config.Password, config.GetTradingFixConfigAsReader()), log); _harvester = harvester; _executionHandler = executionHandler; _modelConverter = new JfdModelConverter(config); _log = log.CreateComponentScope(nameof(JfdExchange)); harvester.MaxOrderBookRate = config.MaxOrderBookRate; }
public LogsController( INoSQLTableStorage <LogEntity> logsStorage, INoSQLTableStorage <FixMessageTableEntity> fixMessagesStorage, TranslatedSignalsRepository translatedSignalsRepository) { _logsStorage = logsStorage; _fixMessagesStorage = fixMessagesStorage; _translatedSignalsRepository = translatedSignalsRepository; }
public StubExchange(StubExchangeConfiguration config, TranslatedSignalsRepository translatedSignalsRepository, IHandler <TickPrice> tickPriceHandler, IHandler <ExecutionReport> tradeHandler, ILog log) : base(Name, config, translatedSignalsRepository, log) { this.config = config; _tickPriceHandler = tickPriceHandler; _tradeHandler = tradeHandler; decimal initialValue = 100m; Positions = Instruments.ToDictionary(x => x.Name, x => new Position(x, initialValue)); ActualSignals = Instruments.ToDictionary(x => x.Name, x => new LinkedList <TradingSignal>()); }
public LykkeExchange(LykkeExchangeConfiguration config, TranslatedSignalsRepository translatedSignalsRepository, IHandler <TickPrice> tickPriceHandler, IHandler <ExecutionReport> tradeHandler, ILog log) : base(Name, config, translatedSignalsRepository, log) { _tickPriceHandler = tickPriceHandler; _tradeHandler = tradeHandler; var httpClient = new HttpClient(); httpClient.DefaultRequestHeaders.Add("api-key", Config.ApiKey); apiClient = new ApiClient(httpClient, log); _lastBids = Instruments.ToDictionary(x => x.Name, x => 0m); _lastAsks = Instruments.ToDictionary(x => x.Name, x => 0m); }
public IcmExchange(IcmTickPriceHarvester tickPriceHarvester, IcmExchangeConfiguration config, TranslatedSignalsRepository translatedSignalsRepository, IcmModelConverter converter, ILog log) : base(Name, config, translatedSignalsRepository, log) { _config = config; _converter = converter; _tickPriceHarvester = tickPriceHarvester; _tradeSessionConnector = new IcmTradeSessionConnector(new FixConnectorConfiguration(config.Password, config.GetFixConfigAsReader()), log); _log = log; }
public GdaxExchange(GdaxExchangeConfiguration configuration, TranslatedSignalsRepository translatedSignalsRepository, GdaxOrderBooksHarvester orderBookHarvester, IHandler <TickPrice> tickPriceHandler, IHandler <ExecutionReport> tradeHandler, ILog log) : base(Name, configuration, translatedSignalsRepository, log) { _configuration = configuration; _converters = new GdaxConverters(configuration.SupportedCurrencySymbols, Name); _orderBooksHarvester = orderBookHarvester; _tickPriceHandler = tickPriceHandler; _tradeHandler = tradeHandler; _restApi = CreateRestApiClient(); _websocketApi = CreateWebSocketsApiClient(); }
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"); } }
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(); }
public KrakenExchange(KrakenConfig config, TranslatedSignalsRepository translatedSignalsRepository, IHandler <TickPrice> tickPriceHandler, IHandler <ExecutionReport> tradeHandler, ILog log) : base(Name, config, translatedSignalsRepository, log) { this.config = config; _tickPriceHandler = tickPriceHandler; _tradeHandler = tradeHandler; var httpClient = new HttpClient() { Timeout = TimeSpan.FromSeconds(3) }; // TODO: HttpClient have to be Singleton publicData = new PublicData(new ApiClient(httpClient, log)); privateData = new PrivateData(new ApiClient(new HttpClient() { Timeout = TimeSpan.FromSeconds(30) }, log), config.ApiKey, config.PrivateKey, new NonceProvider(), Config.SupportedCurrencySymbols); }
public BitfinexExchange(BitfinexExchangeConfiguration configuration, TranslatedSignalsRepository translatedSignalsRepository, BitfinexOrderBooksHarvester orderBooksHarvester, BitfinexExecutionHarvester executionHarvester, ILog log) : base(Name, configuration, translatedSignalsRepository, log) { _modelConverter = new BitfinexModelConverter(configuration); _orderBooksHarvester = orderBooksHarvester; _executionHarvester = executionHarvester; var credenitals = new BitfinexServiceClientCredentials(configuration.ApiKey, configuration.ApiSecret); _exchangeApi = new BitfinexApi(credenitals) { BaseUri = new Uri(configuration.EndpointUrl) }; orderBooksHarvester.MaxOrderBookRate = configuration.MaxOrderBookRate; }
public TradingSignalsHandler(IEnumerable <Exchange> exchanges, ILog logger, IHandler <ExecutionReport> acknowledHandler, IHandler <ExecutionReport> tradeHandler, TranslatedSignalsRepository translatedSignalsRepository, TimeSpan apiTimeout, RabbitMqSubscriber <TradingSignal> messageProducer, bool enabled) { this.exchanges = exchanges.ToDictionary(k => k.Name); this.logger = logger; _acknowledHandler = acknowledHandler; _tradeHandler = tradeHandler; this.translatedSignalsRepository = translatedSignalsRepository; this.apiTimeout = apiTimeout; _messageProducer = messageProducer; _enabled = enabled; if (enabled) { messageProducer.Subscribe(Handle); } }
public HistoricalDataExchange(HistoricalDataConfig config, TranslatedSignalsRepository translatedSignalsRepository, IHandler <TickPrice> tickHandler, ILog log) : base(Name, config, translatedSignalsRepository, log) { this.config = config; _tickHandler = tickHandler; }
public OrdersController(IApplicationFacade app, AppSettings appSettings, TranslatedSignalsRepository translatedSignalsRepository) : base(app) { _translatedSignalsRepository = translatedSignalsRepository; _timeout = appSettings.AspNet.ApiTimeout; }