public AccountManagement(BaseExchange ex, IServiceEventLogger log)
        {
            CurrencyRate  = 1;
            _cancellation = new CancellationPattern();
            _event        = new AutoResetEvent(false);
            Fee           = new ExchangeFee {
                TradingFee = ex.TradeFee
            };

            _obj = new object();
            _log = log;
            _ex  = ex;
        }
Exemple #2
0
        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);
        }
Exemple #3
0
 public TcpService()
 {
     _cancellation = new CancellationPattern();
 }