Exemple #1
0
        public MockCryptopiaTradeRepository(IExchangeRepository exchangeRepository)
        {
            var exchange = _exchangeRepository.Find("cryptopia");

            _trades = new List <ITrade>
            {
                new BuyTrade {
                    Amount                = 262.1512756M,
                    BaseCurrency          = new Currency("BTC"),
                    CounterCurrency       = new Currency("FLIK"),
                    Exchange              = exchange,
                    ExchangeTransactionId = "2035424",
                    Fee       = 0.00001286M,
                    NetTotal  = 0.00858783M,
                    Price     = 0.00003271M,
                    Timestamp = DateTime.Parse("10/20/2017 2:54:21"),
                    Total     = 0.00857497M
                },
                new SellTrade {
                    Amount                = 226.28148727M,
                    BaseCurrency          = new Currency("BTC"),
                    CounterCurrency       = new Currency("FLIK"),
                    Exchange              = exchange,
                    ExchangeTransactionId = "2031982",
                    Fee       = 0.0000124M,
                    NetTotal  = 0.00825593M,
                    Price     = 0.00003654M,
                    Timestamp = DateTime.Parse("10/20/2017 0:03:12"),
                    Total     = 0.00826833M
                }
            };
        }
 public RepositoryBootstrapper(
     IExchangeFactory exchangeFactory,
     IIntervalFactory intervalFactory,
     ICurrencyFactory currencyFactory,
     ISymbolFactory symbolFactory,
     IOrderSideFactory orderSideFactory,
     IStorageTransactionFactory <HistorianDbContext> storageTransactionFactory,
     IHistorianRepository historianRepository,
     IExchangeRepository exchangeRepository,
     IIntervalRepository intervalRepository,
     ICurrencyRepository currencyRepository,
     ISymbolRepository symbolRepository,
     IOrderSideRepository orderSideRepository)
 {
     ExchangeFactory           = exchangeFactory;
     IntervalFactory           = intervalFactory;
     CurrencyFactory           = currencyFactory;
     SymbolFactory             = symbolFactory;
     OrderSideFactory          = orderSideFactory;
     StorageTransactionFactory = storageTransactionFactory;
     HistorianRepository       = historianRepository;
     ExchangeRepository        = exchangeRepository;
     IntervalRepository        = intervalRepository;
     CurrencyRepository        = currencyRepository;
     SymbolRepository          = symbolRepository;
     OrderSideRepository       = orderSideRepository;
 }
Exemple #3
0
        public BaseService(CosDbContext dbContext)
        {
            this.DbContext = dbContext;

            this.MailingAddressRepository   = RepositoryFactory.CreateObj <MailingAddressRepository>(dbContext);
            this.ExchangeRepository         = RepositoryFactory.CreateObj <ExchangeRepository>(dbContext);
            this.ExchangeExamineRepository  = RepositoryFactory.CreateObj <ExchangeExamineRepository>(dbContext);
            this.CooperationRepository      = RepositoryFactory.CreateObj <CooperationRepository>(dbContext);
            this.ImgRepository              = RepositoryFactory.CreateObj <ImgRepository>(dbContext);
            this.ExchangeReplyRepository    = RepositoryFactory.CreateObj <ExchangeReplyRepository>(dbContext);
            this.CooperationReplyRepository = RepositoryFactory.CreateObj <CooperationReplyRepository>(dbContext);
            this.ExchangePersonRepository   = RepositoryFactory.CreateObj <ExchangePersonRepository>(dbContext);
            this.MemberRepository           = RepositoryFactory.CreateObj <MemberRepository>(dbContext);
            this.RechargeRecordRepository   = RepositoryFactory.CreateObj <RechargeRecordRepository>(dbContext);
            this.SysParaRepository          = RepositoryFactory.CreateObj <SysParaRepository>(dbContext);
            this.ExchangeEventRepository    = RepositoryFactory.CreateObj <ExchangeEventRepository>(dbContext);
            this.DepositControlRepository   = RepositoryFactory.CreateObj <DepositControlRepository>(dbContext);
            this.LogisticRepository         = RepositoryFactory.CreateObj <LogisticRepository>(dbContext);
            this.LoginCodeRepository        = RepositoryFactory.CreateObj <LoginCodeRepository>(dbContext);
            this.ShipperCompanyRepository   = RepositoryFactory.CreateObj <ShipperCompanyRepository>(dbContext);
            this.AdminMemberRepository      = RepositoryFactory.CreateObj <AdminMemberRepository>(dbContext);
            this.CooperationClassRepository = RepositoryFactory.CreateObj <CooperationClassRepository>(dbContext);
            this.RefundRepository           = RepositoryFactory.CreateObj <RefundRepository>(dbContext);
            this.QuickNavigationRepository  = RepositoryFactory.CreateObj <QuickNavigationRepository>(dbContext);
            this.PostageRepository          = RepositoryFactory.CreateObj <PostageRepository>(dbContext);
            this.CosFileStatRepository      = RepositoryFactory.CreateObj <CosFileStatRepository>(dbContext);
            this.ExchangeClassRepository    = RepositoryFactory.CreateObj <ExchangeClassRepository>(dbContext);
            this.VoucherRepository          = RepositoryFactory.CreateObj <VoucherRepository>(dbContext);
            this.LoginIpRepository          = RepositoryFactory.CreateObj <LoginIPRepository>(dbContext);
            this.IntegralChangeRepository   = RepositoryFactory.CreateObj <IntegralChangeRepository>(dbContext);
            this.LoggingRepository          = RepositoryFactory.CreateObj <LoggingRepository>(dbContext);
            this.MemberRegisterRepository   = RepositoryFactory.CreateObj <MemberRegisterRepository>(dbContext);
            this.VersionNotesRepository     = RepositoryFactory.CreateObj <VersionNotesRepository>(dbContext);
        }
 public ExchangeIntegrationHealthCheck(
     IExchangeRepository exchangeRepository,
     IExchangeIntegrationStrategyContext exchangeIntegrationStrategyContext)
 {
     _exchangeRepository = exchangeRepository;
     _exchangeIntegrationStrategyContext = exchangeIntegrationStrategyContext;
 }
 public StatsService(
     IExchangeRepository exchangeRepository,
     IExchangeEventsRepository exchangeEventsRepository)
 {
     _exchangeRepository       = exchangeRepository;
     _exchangeEventsRepository = exchangeEventsRepository;
 }
Exemple #6
0
        public void TestInitialize()
        {
            _mockExternalService    = Substitute.For <IExternalService>();
            _mockExchangeRepository = Substitute.For <IExchangeRepository>();
            _mockLogger             = Substitute.For <ILogger <DollarManager> >();

            _target = new DollarManager(_mockExternalService, _mockExchangeRepository, _mockLogger);
        }
Exemple #7
0
 public ExchangeService(
     IExchangeRepository exchangeRepository,
     ILogger <ExchangeService> logger
     )
 {
     _exchangeRepository = exchangeRepository;
     _logger             = logger;
 }
Exemple #8
0
 public MetaService(ILoggingService loggingService, ISettingRepository settingRepository, IExchangeRepository exchangeRepository,
                    ITickerRepository tickerRepository, IExchangeTickerRepository exchangeTickerRepository)
 {
     this._loggingService           = loggingService;
     this._settingRepository        = settingRepository;
     this._exchangeRepository       = exchangeRepository;
     this._tickerRepository         = tickerRepository;
     this._exchangeTickerRepository = exchangeTickerRepository;
 }
Exemple #9
0
 public ExchangeProcessor(
     IExchangeMapper mapper,
     IExchangeRepository repository,
     ILogger <ExchangeProcessor> logger)
 {
     _mapper     = mapper;
     _repository = repository;
     _logger     = logger;
 }
Exemple #10
0
        public ApplicationManager(IHttpAPI httpAPI, IFiatRepository fiatRepository,
                                  ICryptoRepository cryptoRepository, IExchangeRepository exchangeRepository, IUserRepository userRepository)
        {
            _httpAPI = httpAPI ?? throw new ArgumentNullException(nameof(httpAPI));

            _fiatRepository     = fiatRepository ?? throw new ArgumentNullException(nameof(fiatRepository));
            _cryptoRepository   = cryptoRepository ?? throw new ArgumentNullException(nameof(cryptoRepository));
            _exchangeRepository = exchangeRepository ?? throw new ArgumentNullException(nameof(exchangeRepository));
            _userRepository     = userRepository ?? throw new ArgumentNullException(nameof(userRepository));
        }
Exemple #11
0
        public async void Add_WhenHaveNoEmail()
        {
            IExchangeRepository repository = GetInMemoryExchangeRepository();

            string[] targets  = new string[] { "EUR" };
            Exchange exchange = await repository.GetLatestAsync("USD", targets);

            Assert.True(exchange.Rates.ContainsKey("EUR"));
            Assert.NotNull(exchange);
        }
        public ExchangeMarketUpdatedDomainEventHandler(IEventBus eventBus, ITestLogger testLogger, IExchangeRepository exchangeRepository)
        {
            _eventBus           = eventBus;
            _testLogger         = testLogger ?? throw new ArgumentNullException(nameof(testLogger));
            _exchangeRepository = exchangeRepository ?? throw new ArgumentException(nameof(exchangeRepository));

            /*_profitCalculator = profitCalculator ?? throw new ArgumentNullException(nameof(profitCalculator));*/

            /*_profitCalculator = new ProfitCalculator(
             *  marketRepository ?? throw new ArgumentNullException(nameof(marketRepository)),
             *  exchangeRepository ?? throw new ArgumentNullException(nameof(exchangeRepository))
             *  );*/
        }
 public AdminController(IExchangeRepository repo,
                        IMarketRepository marketRepository,
                        ICurrencyRepository currencyRepository,
                        IExchangeCurrencyRepository exchangeCurrencyRepository,
                        IExchangeMarketRepository exchangeMarketRepository)
 {
     _repo                       = repo;
     _marketRepository           = marketRepository;
     _currencyRepository         = currencyRepository;
     _exchangeCurrencyRepository = exchangeCurrencyRepository;
     _exchangeMarketRepository   = exchangeMarketRepository;
     _httpClient                 = new HttpClient();
 }
 public ExchangeFetcher(
     IExchangeRepository exchangeRepository,
     IStartBlockService startBlockService,
     IRecentBlockProvider recentBlockProvider,
     ExchangeFetcherSettings fetcherSettings,
     Func <string, ExchangeEventsFetcher> exchangeEventsFetcherFactory,
     IExchangeEventsProcessor exchangeEventsProcessor,
     ILogger <ExchangeFetcher> logger)
 {
     _exchangeRepository           = exchangeRepository;
     _startBlockService            = startBlockService;
     _recentBlockProvider          = recentBlockProvider;
     _fetcherSettings              = fetcherSettings;
     _exchangeEventsFetcherFactory = exchangeEventsFetcherFactory;
     _exchangeEventsProcessor      = exchangeEventsProcessor;
     _logger = logger;
 }
Exemple #15
0
 public ExchangeEventsProcessor(
     ITokenLiquidityProvider tokenLiquidityProvider,
     IEthLiquidityProvider ethLiquidityProvider,
     Func <string, IExchangeGateway> exchangeGatewayFactory,
     IExchangeRepository exchangeRepository,
     IExchangeEventsRepository exchangeEventsRepository,
     IExchangeEventMapper exchangeEventMapper,
     IExchangeTotalSupplyProvider exchangeTotalSupplyProvider,
     ILogger <ExchangeEventsProcessor> logger)
 {
     _tokenLiquidityProvider      = tokenLiquidityProvider;
     _ethLiquidityProvider        = ethLiquidityProvider;
     _exchangeGatewayFactory      = exchangeGatewayFactory;
     _exchangeRepository          = exchangeRepository;
     _exchangeEventsRepository    = exchangeEventsRepository;
     _exchangeEventMapper         = exchangeEventMapper;
     _exchangeTotalSupplyProvider = exchangeTotalSupplyProvider;
     _logger = logger;
 }
 public CryptopiaTradeService(IExchangeRepository exchangeRepository, ILoggerFactory loggerFactory) :
     base(_fileName, exchangeRepository, loggerFactory, new CultureInfo(_cultureCode).DateTimeFormat, _delimiter, _strBuyIndicator, _strLimitIndicator)
 {
 }
 public StartBlockProvider(IExchangeRepository repository)
 {
     _repository = repository;
 }
Exemple #18
0
 public CommandHandler(IExchangeRepository exchangeRepository)
 {
     _exchangeRepository = exchangeRepository;
 }
Exemple #19
0
 public UnitOfWork(IStockRepository stocks, IExchangeRepository exchanges)
 {
     Stocks    = stocks;
     Exchanges = exchanges;
 }
 public AssetsController(IExchangeRepository exchangeRepository)
 {
     this._exchangeRepository = exchangeRepository ?? throw new ArgumentNullException(nameof(exchangeRepository));
 }
Exemple #21
0
 public ExchangeRateController(IExchangeRepository repository)
 {
     _repository = repository;
 }
 public RealManager(ICurrencyManager dollarManager, IExchangeRepository repository, ILogger <RealManager> logger)
 {
     _dollarController = dollarManager;
     _repository       = repository;
     _logger           = logger;
 }
 public PriceService(IExchangeRepository exchangeRepository)
 {
     _exchangeRepository = exchangeRepository;
 }
 public StockExchangeController(IExchangeRepository repo)
 {
     _repo = repo;
 }
        public BaseTradeService(
            string fileName,
            IExchangeRepository exchangeRepository,
            ILoggerFactory loggerFactory,
            DateTimeFormatInfo dateTimeFormatInfo,
            string currencyDelimiter,
            string buyTradeIndicator,
            string sellTradeIndicator
            )
        {
            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }
            _logger = loggerFactory.CreateLogger <BaseTradeService <TExchange, TTradeDto> >();

            if (exchangeRepository == null)
            {
                throw new ArgumentNullException(nameof(exchangeRepository));
            }
            Type exchangeType = typeof(TExchange);

            _exchange = exchangeRepository.Find(exchangeType);
            if (_exchange == null)
            {
                throw new InvalidOperationException(string.Format("Could not find exchange for the given exchange type: {0}", exchangeType.ToString()));
            }

            if (string.IsNullOrWhiteSpace(fileName))
            {
                throw new ArgumentNullException(nameof(fileName));
            }
            _filePath = Path.Combine(Directory.GetCurrentDirectory(), "..\\", "..\\", "Assets", "TradeHistory", string.Concat(fileName, ".xlsx"));;
            if (!File.Exists(_filePath))
            {
                throw new FileNotFoundException("Could not locate the excel file with the trade information.", _filePath);
            }

            _dateTimeFormatInfo = dateTimeFormatInfo;
            if (_dateTimeFormatInfo == null)
            {
                throw new ArgumentNullException(nameof(dateTimeFormatInfo));
            }

            if (currencyDelimiter == null)
            {
                throw new ArgumentNullException(nameof(dateTimeFormatInfo));
            }
            _currencyDelimiter = Convert.ToChar(currencyDelimiter);

            if (buyTradeIndicator == null)
            {
                throw new ArgumentNullException(nameof(buyTradeIndicator));
            }
            _buyTradeIndicator = buyTradeIndicator.ToLower();

            if (sellTradeIndicator == null)
            {
                throw new ArgumentNullException(nameof(sellTradeIndicator));
            }
            _sellTradeIndicator = sellTradeIndicator.ToLower();
        }
Exemple #26
0
        public UnitOfWork(ITimeIntervalRepository timeIntervals, IBrokerTimeIntervalRepository brokerTimeIntervals, IBrokerRepository brokers, IInstrumentNameRepository instrumentNames, IBrokerInstrumentRepository brokerInstruments, IPriceEntryRepository priceEntries, IScreenerEntryMappingRepository screenerEntryMappings, IScreenerEntryTypeRepository screenerEntryTypes, IBrokerInstrumentScreenerTypeRepository brokerInstrumentScreenerTypes, IScreenerTypeRepository screenerTypes, IBrokerSymbolRepository brokerSymbols, ICurrencyRepository currencies, IExchangeRepository exchanges, IInstrumentTypeRepository instrumentTypes, IScreenerRepository screeners, IScreenerLineRepository screenerLines, IScreenerReferenceImageRepository screenerReferenceImages, IScreenerEntryRepository screenerEntries, IIndicatorEntryRepository indicatorEntries, ITradeRepository trades, ITradeStepRepository tradeSteps, IOrderRepository orders, ISignalRepository signals, ISignalStepRepository signalSteps, IStopLossRuleRepository stopLossRules, IExitRuleRepository exitRules)
        {
            this.TimeIntervals = timeIntervals;
            this.BrokerTimeIntervals = brokerTimeIntervals;
            this.Brokers = brokers;
            this.InstrumentNames = instrumentNames;
            this.BrokerInstruments = brokerInstruments;
            this.PriceEntries = priceEntries;
            this.ScreenerEntryMappings = screenerEntryMappings;
            this.ScreenerEntryTypes = screenerEntryTypes;
            this.BrokerInstrumentScreenerTypes = brokerInstrumentScreenerTypes;
            this.ScreenerTypes = screenerTypes;
            this.BrokerSymbols = brokerSymbols;
            this.Currencies = currencies;
            this.Exchanges = exchanges;
            this.InstrumentTypes = instrumentTypes;
            this.Screeners = screeners;
            this.ScreenerLines = screenerLines;
            this.ScreenerReferenceImages = screenerReferenceImages;
            this.ScreenerEntries = screenerEntries;
            this.IndicatorEntries = indicatorEntries;
            this.Trades = trades;
            this.TradeSteps = tradeSteps;
            this.Orders = orders;
            this.Signals = signals;
            this.SignalSteps = signalSteps;
            this.StopLossRules = stopLossRules;
            this.ExitRules = exitRules;

        }
Exemple #27
0
 public CommandHandler(IStockService stocks, IExchangeRepository exchangeRepository)
 {
     _stocks             = stocks;
     _exchangeRepository = exchangeRepository;
 }
 public ExchangeController(IExchangeRepository exchangeRepository, IUserRepository userRepository, ICurrencyRepository currencyRepository)
 {
     _exchangeRepository = exchangeRepository;
     _userRepository     = userRepository;
     _currencyRepository = currencyRepository;
 }
 public TickerService(IExchangeEventsRepository repository, IExchangeRepository exchangeRepository)
 {
     _repository         = repository;
     _exchangeRepository = exchangeRepository;
 }
Exemple #30
0
 public ExchangeBusiness(IExchangeRepository exchangeRepository)
 {
     _exchangeRepository = exchangeRepository;
 }