Exemple #1
0
        public HistoricalPriceRepositoryTests()
        {
            _repo = new HistoricalPriceRepository();

            // first clear out the table
            var deleted = _repo.DeleteAll().Result;

            // then add some data for testing
            datas.Add(
                new HistoricalPrice
            {
                Id         = 0,
                CurrencyId = 1,
                Exchange   = Business.Entities.Exchange.Binance,
                Pair       = "BTCUSDT",
                Price      = 4210.00M,
                Snapshot   = DateTime.UtcNow.AddHours(-4),
            });
            datas.Add(
                new HistoricalPrice
            {
                Id         = 0,
                CurrencyId = 1,
                Exchange   = Business.Entities.Exchange.Binance,
                Pair       = "BTCUSDT",
                Price      = 4100.00M,
                Snapshot   = DateTime.UtcNow.AddHours(-3),
            });
            datas.Add(
                new HistoricalPrice
            {
                Id         = 0,
                CurrencyId = 1,
                Exchange   = Business.Entities.Exchange.Binance,
                Pair       = "BTCUSDT",
                Price      = 4050.00M,
                Snapshot   = DateTime.UtcNow.AddHours(-2),
            });
            datas.Add(
                new HistoricalPrice
            {
                Id         = 0,
                CurrencyId = 1,
                Exchange   = Business.Entities.Exchange.Binance,
                Pair       = "BTCUSDT",
                Price      = 3950.00M,
                Snapshot   = DateTime.UtcNow.AddHours(-1),
            });
            datas.Add(
                new HistoricalPrice
            {
                Id         = 0,
                CurrencyId = 1,
                Exchange   = Business.Entities.Exchange.Binance,
                Pair       = "BTCUSDT",
                Price      = 3850.00M,
                Snapshot   = DateTime.UtcNow,
            });

            var addedEntites = _repo.AddAll(datas).Result;
        }
Exemple #2
0
 public HistoricalPriceBuilder(IExchangeHubBuilder exchangeHubBuilder, IHistoricalPriceRepository repo)
 {
     this._hubBldr = exchangeHubBuilder;
     this._hpRepo  = repo;
 }
Exemple #3
0
 public ProductHandler(IHistoricalPriceRepository historicalPriceRepository, ILogger <ProductHandler> logger)
 {
     _historicalPriceRepository = historicalPriceRepository;
     _logger = logger;
 }