public SelfHost() { _log = new ServiceEventLogger(ServiceName.InitService, new DbRepositoryService()); _limitMinutes = Int32.Parse(ConfigurationManager.AppSettings["IntervalMinutes"]); _timer = new Timer(_limitMinutes * 60000); _timer.Elapsed += OnTimerElapsed; }
public BittrexArbitrage(ServiceEventLogger log) { _pairs = new List <BittrexData>(); _timer = new Timer(40000); _log = log; _timer.Elapsed += OnTimerElapsed; }
public SyncBalanceService(ServiceEventLogger log) { int timeout = Int32.Parse(ConfigurationManager.AppSettings["SyncBalancesTimeoutMinutes"]); _dbRepo = (DbRepositoryService)log.DbRepository; _log = log; _timer = new Timer(timeout * 60000); _timer.Elapsed += OnTimerElapsed; }
public RestExchangeListener(DbGatewayService dbGateway, ServiceEventLogger log) { var config = (BotcoinConfigSection)ConfigurationManager.GetSection("botcoin"); _instrument = (CurrencyName)Enum.Parse(typeof(CurrencyName), config.RestExchanges.Instrument.Split(',')[0].Trim().ToUpper()); _dbGateway = dbGateway; _tcp = new TcpService(); _log = log; }
public RestScheduler(ServiceEventLogger log) { var config = (BotcoinConfigSection)ConfigurationManager.GetSection("botcoin"); _connections = new List <Tuple <CurrencyName, IPEndPoint> >(); _tcpClient = new TcpService(); _obj = new object(); _timeout = config.Settings.RestScheduler.TimeoutSeconds * 1000; _log = log; _timer = new Timer(); _timer.Elapsed += OnTimerElapsed; }
public TickerService(Dictionary <CurrencyName, Instrument> restInstruments, //Dictionary<CurrencyName, Instrument> wsInstruments, ExchangeSettingsData[] settings, ServiceEventLogger log) { _bitfinex = new BitfinexClient(settings.Where(s => s.Exchange == ExchangeName.Bitfinex).Single().RestUrl); _timer = new Timer(60 * 60000); _log = log; _restInstruments = restInstruments; //_wsInstruments = wsInstruments; _timer.Elapsed += OnTimerElapsed; }
public PricesPublisher(ServiceEventLogger log) { _restInstruments = new Dictionary <CurrencyName, Instrument>(); _restExchanges = new Dictionary <ExchangeName, BaseExchange>(); _wsExchanges = new Dictionary <ExchangeName, BaseExchange>(); _wsInstruments = new Dictionary <CurrencyName, Instrument>(); _dbGateway = (DbGatewayService)log.DbRepository; _dbRepo = new DbRepositoryService(); _restSubscriber = new RestExchangeListener(_dbGateway, log); _tcp = new TcpService(); _log = log; Instrument.InitWebsocketInstruments(_wsInstruments); Instrument.InitRestInstruments(_restInstruments); _restSubscriber.ExchangePricesUpdate += RestRequestHandler; }
public SelfHost() { var log = new ServiceEventLogger(DataType.ServiceName.Arbitrage, new DbRepositoryService()); _msgHandling = new MessageHandling(log, new RestScheduler(log)); _matching = new MatchingEngine(log, _msgHandling); _rateService = new CurrencyRateService(); _tcp = new TcpService(); _msgHandling.MatchingEngine = _matching; _msgHandling.ExchangePrices += _matching.OnExchangePrices; if (!EventLog.SourceExists(ServiceName)) { EventLog.CreateEventSource(ServiceName, ServiceName + "Log"); } }
public VwapIndicator(ServiceEventLogger log) { _initTimers = new Dictionary <int, Timer>(); _timers = new Dictionary <int, Timer>(); _frames = new Dictionary <int, List <DateTime> >(); _dbRepo = (DbRepositoryService)log.DbRepository; _log = log; Periods = new Tuple <int, string>[] { new Tuple <int, string>(3, "3m") //new Tuple<int, string>(5, "5m"), //new Tuple<int, string>(15, "15m"), //new Tuple<int, string>(30, "30m"), //new Tuple<int, string>(45, "45m"), //new Tuple<int, string>(60, "1h"), //new Tuple<int, string>(120, "2h"), //new Tuple<int, string>(240, "4h"), //new Tuple<int, string>(480, "8h") }; }
public static void SubscribeTicker(BitstampExchange exch, ServiceEventLogger log) { exch.TickerTimer.Elapsed += (s, e) => { try { var dbRepo = (DbRepositoryService)exch.Log.DbRepository; var ticker = exch.Exchange.GetTicker(); dbRepo.SaveTicker(new TickerEventArgs { Instrument1 = CurrencyName.BTC, Instrument2 = CurrencyName.USD, Exchange = ExchangeName.Bitstamp, BitstampTicker = ticker }); } catch (Exception ex) { log.WriteError(String.Format("[{0}] {1} {2}", ex.GetType(), ex.Message, ex.StackTrace)); } }; }
public MatchingEngine(ServiceEventLogger log, MessageHandling msgHandling) { _singleInstrument = new CancellationPattern(); _manyInstruments = new CancellationPattern(); _orderPlacement = new OrderPlacement(); _cancelMonitoring = new CancellationPattern(); _wsExchanges = new Dictionary <ExchangeName, BaseExchange>(); _exchanges = new Dictionary <ExchangeName, IExchange>(); _profitRatios = new Dictionary <ExchangeName, double>(); _instruments = new Dictionary <CurrencyName, Instrument>(); _wsInstruments = new Dictionary <CurrencyName, Instrument>(); _balance = new BalanceManagement(); _matchingEvent = new AutoResetEvent(false); _stopEvent1 = new AutoResetEvent(false); _stopEvent2 = new AutoResetEvent(false); _bittrex = new BittrexArbitrage(log); _orderBook = new OrderBook(); _obj = new object(); _dbRepo = (DbRepositoryService)log.DbRepository; _syncService = new SyncBalanceService(log); _msgHandling = msgHandling; _log = log; Instrument.InitWebsocketInstruments(_wsInstruments); _instruments.Add(CurrencyName.BTC, new InstrumentBTC()); _instruments.Add(CurrencyName.BCH, new InstrumentBCH()); _instruments.Add(CurrencyName.LTC, new InstrumentLTC()); _instruments.Add(CurrencyName.ETH, new InstrumentETH()); _instruments.Add(CurrencyName.XRP, new InstrumentXRP()); _instruments.Add(CurrencyName.DSH, new InstrumentDASH()); _instruments.Add(CurrencyName.IOTA, new InstrumentIOTA()); _spreadMono = new SpreadMono(this, _dbRepo, ExchangeName.OkEx); _spreadIota = new SpreadIOTA(this, _dbRepo); _spread = new InstrumentSpreadBTC(this, _dbRepo); }
public SelfHost() { _log = new ServiceEventLogger(ServiceName.TradeDataBot, new DbRepositoryService()); _exchanges = new List <IExchange>(); }
public MessageHandling(ServiceEventLogger log, RestScheduler scheduler) { DbRepository = new DbRepositoryService(); _restScheduler = scheduler; _log = log; }
public BinanceVwapIndicator(ServiceEventLogger log) : base(log) { }
static SelfHost() { Log = new ServiceEventLogger(ServiceName.WebApi, new DbRepositoryService()); }
public BitmexVwapIndicator(BitmexExchange ex, List <string> contracts, ServiceEventLogger log) : base(log) { _contracts = contracts; _bitmex = ex; }
public SelfHost() { _log = new ServiceEventLogger(ServiceName.OrderBook, new DbGatewayService(ServiceName.Arbitrage)); _publisher = new PricesPublisher(_log); }