示例#1
0
 public static PriceChange From(CryptoCoin coin1, CryptoCoin coin2)
 => new PriceChange
 {
     Value        = coin1.Average - coin2.Average,
     Percentage   = (coin1.Average - coin2.Average) / (coin1.Average + coin2.Average) * 2m,
     TimeDiff     = coin1.Time - coin2.Time,
     AbsoluteTime = coin1.Time
 };
 public static PriceChange From(CryptoCoin newCoin, CryptoCoin oldCoin)
 => new PriceChange
 {
     Value      = newCoin.Average - oldCoin.Average,
     Percentage = (newCoin.Average - oldCoin.Average) /
                  (newCoin.Average + oldCoin.Average) *
                  2m,
     TimeDiff     = newCoin.Time - oldCoin.Time,
     AbsoluteTime = newCoin.Time
 };
 private static void UpdateExchangeLastUpdateInDb(CryptoExchangeBase exchange, CryptoCoin coin) =>
 UnitOfWork.Do(u => u.Exchanges.UpdateExchange(exchange.Id, lastUpdate: coin.Time.ToUniversalTime( )));
 private static void StoreCoinValueInDb(CryptoExchangeBase exchange, CryptoCoin coin) =>
 UnitOfWork.Do(u => u.CoinValues.Add(coin.ToCryptoCoinValue(exchange.Id)));