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))); }
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; }
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); }
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; }
public CryptoCoin this [CryptoCoinId coinId] => LastSignificantPrice[coinId];
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; }
public async Task <CryptoCoin> SingleAsync( CryptoCoinId coinId, CancellationToken cancellation ) => await CtbContext.Coins.SingleAsync(c => c.Id == coinId, cancellation).ConfigureAwait(false);
public CryptoCoin this [CryptoCoinId symbol] { get => ExchangeData.ContainsKey(symbol) ? ExchangeData[symbol] : null;
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; }
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; }