public async Task <IEnumerable <CryptoCoinValue> > GetAllAsync(
     CryptoCoinId coinId,
     CancellationToken cancellationToken) =>
 await AllEntities
 .Where(x => x.CoinId == coinId)
 .ToListAsync(cancellationToken)
 .ConfigureAwait(false);
        protected override void DeserializeData(dynamic data, CryptoCoinId id)
        {
            var tickerData = (CoinbaseTickerDatum)data;

            ExchangeData[id].LowestAsk  = tickerData.BestAsk;
            ExchangeData[id].HighestBid = tickerData.BestBid;
            ExchangeData[id].Rate       = tickerData.Price;
        }
        protected override void DeserializeData(dynamic data, CryptoCoinId id)
        {
            KrakenCoinInfo coinInfo = data;

            ExchangeData[id].LowestAsk  = coinInfo.Ask[0];
            ExchangeData[id].HighestBid = coinInfo.Bid[0];
            ExchangeData[id].Rate       = coinInfo.LastTrade[0];
        }
 public CryptoCoinValue(
     CryptoCoinId coinId,
     CryptoExchangeId exchangeId,
     decimal lowestAsk,
     decimal highestBid
     ) :
     this(coinId, exchangeId, lowestAsk, highestBid, DateTime.UtcNow)
 {
 }
 public async Task <IEnumerable <CryptoCoinValue> > GetLastAsync(
     CryptoCoinId coinId,
     CryptoExchangeId exchangeId,
     int count, CancellationToken cancellationToken) =>
 await AllEntities
 .Where(x => x.CoinId == coinId && x.ExchangeId == exchangeId)
 .OrderByDescending(x => x.Time)
 .Take(count)
 .ToListAsync(cancellationToken)
 .ConfigureAwait(false);
        protected override void DeserializeData(dynamic data, CryptoCoinId id)
        {
            decimal InrToUsd(dynamic amount) =>
            FiatConverter.Convert((decimal)amount, FiatCurrency.INR, FiatCurrency.USD);

            ExchangeData[id].LowestAsk  = InrToUsd(Convert.ToDecimal(data.Buy));
            ExchangeData[id].HighestBid = InrToUsd(Convert.ToDecimal(data.Sell));
            ExchangeData[id].Rate       = InrToUsd(Convert.ToDecimal(data.Market));

            ExchangeData[id].LowestAskINR  = Convert.ToDecimal(data.Buy);
            ExchangeData[id].HighestBidINR = Convert.ToDecimal(data.Sell);
        }
        protected override void DeserializeData(dynamic datum, CryptoCoinId id)
        {
            var d = (BinanceTickerDatum)datum;

            ExchangeData[id].LowestAsk  = d.BestAskPrice;
            ExchangeData[id].HighestBid = d.BestBidPrice;
            ExchangeData[id].Rate       = d.WeightedAveragePrice;

            string UsdToInr(decimal amount) => FiatConverter.Convert(amount, FiatCurrency.USD, FiatCurrency.INR).ToString("0.##");

            ExchangeData[id].LowestAskINR  = Convert.ToDecimal(UsdToInr(Convert.ToDecimal(d.BestAskPrice)));
            ExchangeData[id].HighestBidINR = Convert.ToDecimal(UsdToInr(Convert.ToDecimal(d.BestBidPrice)));
        }
Exemple #8
0
        protected override void DeserializeData(dynamic data, CryptoCoinId id)
        {
            var stats = (CoinStats)data;

            decimal InrToUsd(decimal amount) => FiatConverter.Convert(amount, FiatCurrency.INR, FiatCurrency.USD);

            ExchangeData[id].LowestAsk  = InrToUsd(Convert.ToDecimal(stats.LowestSellBid));
            ExchangeData[id].HighestBid = InrToUsd(Convert.ToDecimal(stats.HighestBuyBid));
            ExchangeData[id].Rate       = InrToUsd(Convert.ToDecimal(stats.LastTradedPrice));

            ExchangeData[id].LowestAskINR  = Convert.ToDecimal(stats.LowestSellBid);
            ExchangeData[id].HighestBidINR = Convert.ToDecimal(stats.HighestBuyBid);
        }
 public CryptoCoinValue AddCoinValue(
     CryptoCoinId coinId,
     CryptoExchangeId exchangeId,
     decimal lowestAsk,
     decimal highestBid,
     DateTime time) =>
 Add(new CryptoCoinValue(
         coinId,
         exchangeId,
         lowestAsk,
         highestBid,
         time)
     );
 public CryptoCoinValue(
     CryptoCoinId coinId,
     CryptoExchangeId exchangeId,
     decimal lowestAsk,
     decimal highestBid,
     DateTime time)
 {
     CoinId     = coinId;
     ExchangeId = exchangeId;
     LowestAsk  = lowestAsk;
     HighestBid = highestBid;
     Time       = time;
 }
Exemple #11
0
        protected override void DeserializeData(dynamic datum, CryptoCoinId id)
        {
            var d = (HitbtcCoin)datum;

            string UsdToInr(decimal amount) => FiatConverter.Convert(amount, FiatCurrency.USD, FiatCurrency.INR).ToString("0.##");

            ExchangeData[id].LowestAskINR  = Convert.ToDecimal(UsdToInr(Convert.ToDecimal(d.Ask)));
            ExchangeData[id].HighestBidINR = Convert.ToDecimal(UsdToInr(Convert.ToDecimal(d.Bid)));

            ExchangeData[id].LowestAsk  = Convert.ToDecimal(d.Ask);
            ExchangeData[id].HighestBid = Convert.ToDecimal(d.Bid);
            ExchangeData[id].Rate       = Convert.ToDecimal(d.Last);
            //Console.WriteLine(ExchangeData);
        }
Exemple #12
0
        protected override void DeserializeData(dynamic data, CryptoCoinId id)
        {
            var cdc = (CoinDeltaCoin)data;

            decimal InrToUsd(decimal amount) => FiatConverter.Convert(amount, FiatCurrency.INR, FiatCurrency.USD);

            ExchangeData[id].LowestAsk  = InrToUsd(cdc.Ask);
            ExchangeData[id].HighestBid = InrToUsd(cdc.Bid);

            ExchangeData[id].LowestAskINR  = cdc.Ask;
            ExchangeData[id].HighestBidINR = cdc.Bid;

            ExchangeData[id].Rate = InrToUsd(cdc.Last);
        }
 protected override void DeserializeData(dynamic data, CryptoCoinId id)
 {
     if (data.type == 1)
     {
         ExchangeData[id].HighestBid = data.price;
     }
     else
     {
         ExchangeData[id].LowestAsk = data.price;
     }
     ExchangeData[id].Rate = data.price;
     ExchangeData[id].Time = DateTimeOffset
                             .FromUnixTimeSeconds((long)data.timestamp)
                             .DateTime;
     //.UtcDateTime;
 }
Exemple #14
0
 public CryptoCoin this [CryptoCoinId coinId] =>
 LastSignificantPrice[coinId];
Exemple #15
0
 public DepositFees(CryptoCoinId coinId, CryptoExchangeId exchangeId, decimal value)
 {
     CoinId     = coinId;
     ExchangeId = exchangeId;
     Value      = value;
 }
 public CryptoCoin(CryptoCoinId id, string name)
 {
     Id     = id;
     Symbol = id.ToString( );
     Name   = name;
 }
Exemple #17
0
 public async Task <CryptoCoin> SingleAsync(
     CryptoCoinId coinId,
     CancellationToken cancellation
     ) =>
 await CtbContext.Coins.SingleAsync(c => c.Id == coinId, cancellation).ConfigureAwait(false);
Exemple #18
0
 public CryptoCoin this [CryptoCoinId symbol]
 {
     get => ExchangeData.ContainsKey(symbol) ? ExchangeData[symbol] : null;
Exemple #19
0
 public CryptoCoin Single(CryptoCoinId coinId) =>
 CtbContext.Coins.Single(c => c.Id == coinId);
 public WithdrawalFees(CryptoCoinId coinId, CryptoExchangeId exchangeId, decimal value)
 {
     CoinId     = coinId;
     ExchangeId = exchangeId;
     Value      = value;
 }
 public CryptoCoin(CryptoCoinId id, string symbol, string name)
 {
     Id     = id;
     Symbol = symbol;
     Name   = name;
 }
Exemple #22
0
 protected override void DeserializeData(dynamic data, CryptoCoinId id)
 {
     ExchangeData[id].LowestAsk  = (decimal)data.ask;
     ExchangeData[id].HighestBid = (decimal)data.bid;
     ExchangeData[id].Rate       = (decimal)data.last;
 }