Пример #1
0
 public ExchangeServices(
     ICryptopiaService cryptopiaService,
     IBittrexService bittrexService,
     IBinanceService binanceService
     )
 {
     _cryptopiaService = cryptopiaService;
     _bittrexService   = bittrexService;
     _binanceService   = binanceService;
 }
 public ExchangeNormalizerService(
     IBinanceService binanceService,
     IBittrexService bittrexService,
     ICryptopiaService cryptopiaService
     )
 {
     _binanceService   = binanceService;
     _bittrexService   = bittrexService;
     _cryptopiaService = cryptopiaService;
 }
Пример #3
0
        private async Task <List <PairData> > FormDataAsync()
        {
            var testDate1 = new DateTime(2020, 1, 1);
            var testDate2 = new DateTime(2020, 1, 5);

            _bittrexService = new BittrexService(TestApiDbContext);
            var testPairs = new List <PairData>
            {
                new PairData
                {
                    PairName       = "BTC-USD",
                    BuyPrice       = 254.0m,
                    SellPrice      = 254.0m,
                    LastTradePrice = 254.0m,
                    HighPrice      = 254.0m,
                    LowPrice       = 254.0m,
                    Volume         = 1234567,
                    Updated        = testDate1
                },
                new PairData
                {
                    PairName       = "LTC-XRP",
                    BuyPrice       = 123.0m,
                    SellPrice      = 123.0m,
                    LastTradePrice = 123.0m,
                    HighPrice      = 123.0m,
                    LowPrice       = 123.0m,
                    Volume         = 999999,
                    Updated        = testDate2
                }
            };

            await TestApiDbContext.Pairs.AddRangeAsync(testPairs);

            await TestApiDbContext.SaveChangesAsync();

            return(testPairs);
        }
Пример #4
0
 public TradingLogicManager(string market, IBittrexService bittrexService, string orderStatus)
 {
     _BitrexService        = bittrexService;
     _Market               = market;
     _CurrentPrice         = _BitrexService.GetCurrentPrice(_Market);
     _LastTransactionPrice = _CurrentPrice.Last;
     _OrderStatus          = orderStatus;
     if (_OrderStatus == PLANINGTOBUY)
     {
         //get base coin
         _CurrentBalance = _BitrexService.GetBalance(_Market.Split('-')[0]);
     }
     else
     {
         //get Alt Coin
         _CurrentBalance = _BitrexService.GetBalance(_Market.Split('-')[1]);
     }
     _CurrentTrend     = new List <CurrentPriceModel>();
     _LastCurrentPrice = _CurrentPrice;
     for (int i = 0; i < 20; i++)
     {
         _CurrentTrend.Add(new CurrentPriceModel(_CurrentPrice.Last, _CurrentPrice.Bid, _CurrentPrice.Ask, _CurrentPrice.Avg));
     }
 }
Пример #5
0
 /// <summary>
 /// Конструктор.
 /// </summary>
 /// <param name="logger">Логгер.</param>
 /// <param name="apiDbContext">Контекст подключения к EFCore БД.</param>
 /// <param name="bittrexService">Сервис взаимодействия с Bittrex.</param>
 public UpdateDataJob(ILogger <UpdateDataJob> logger, ApiDbContext apiDbContext, IBittrexService bittrexService)
 {
     _logger         = logger;
     _apiDbContext   = apiDbContext;
     _bittrexService = bittrexService;
 }
Пример #6
0
 public new void SetUp()
 {
     _bittrexService = new BittrexService(TestApiDbContext);
 }
Пример #7
0
 /// <summary>
 /// Конструктор.
 /// </summary>
 /// <param name="bittrexService">Сервис взаимодействия с Bittrex.</param>
 public ApiController(IBittrexService bittrexService)
 {
     _bittrexService = bittrexService;
 }