Example #1
0
        internal override async Task RefreshLastTrade(
            TradingPair tradingPair)
        {
            // https://www.binance.com/api/v1/trades?symbol=ETHBTC&limit=1
            List <BinanceTradeJson> tradeHistory = await Get <List <BinanceTradeJson> >(
                $"api/v1/trades?symbol={GetPairId(tradingPair)}&limit=1");

            if (tradeHistory.Count > 0)
            {
                BinanceTradeJson history = tradeHistory[0];
                decimal          price   = decimal.Parse(history.price);
                tradingPair.lastTrade = new LastTrade(price);
            }
        }
Example #2
0
 /// <summary>
 /// Override if the last trade is not already available
 /// from an API which auto-refreshes.
 /// </summary>
 internal virtual Task RefreshLastTrade(
     TradingPair tradingPair)
 {
     return(Task.CompletedTask);
 }
Example #3
0
 /// <summary>
 /// Override if the last trade is not already available
 /// from an API which auto-refreshes.
 /// </summary>
 internal virtual Task RefreshLastTrade(
     TradingPair tradingPair)
 {
     return(null);
 }
Example #4
0
 internal LastTrade(
     TradingPair tradingPair)
 {
     this.tradingPair = tradingPair;
 }