Ejemplo n.º 1
0
        public static Symbol UpdateStatistics(this Symbol sy, Interface.SymbolStats st)
        {
            sy.SymbolStatistics.PriceChangePercent = decimal.Round(st.PriceChangePercent, 2, MidpointRounding.AwayFromZero);
            sy.PriceChangePercentDirection         = sy.SymbolStatistics.PriceChangePercent > 0 ? 1 : sy.SymbolStatistics.PriceChangePercent < 0 ? -1 : 0;
            sy.LastPriceChangeDirection            = st.LastPrice > sy.SymbolStatistics.LastPrice ? 1 : st.LastPrice < sy.SymbolStatistics.LastPrice ? -1 : 0;
            sy.SymbolStatistics.LastPrice          = st.LastPrice.Trim(sy.PricePrecision);
            sy.SymbolStatistics.Volume             = Convert.ToInt64(st.Volume);

            sy.SymbolStatistics.FirstTradeId         = st.FirstTradeId;
            sy.SymbolStatistics.CloseTime            = st.CloseTime;
            sy.SymbolStatistics.OpenTime             = st.OpenTime;
            sy.SymbolStatistics.QuoteVolume          = st.QuoteVolume;
            sy.SymbolStatistics.LowPrice             = st.LowPrice;
            sy.SymbolStatistics.HighPrice            = st.HighPrice;
            sy.SymbolStatistics.OpenPrice            = st.OpenPrice;
            sy.SymbolStatistics.AskQuantity          = st.AskQuantity;
            sy.SymbolStatistics.AskPrice             = st.AskPrice;
            sy.SymbolStatistics.BidQuantity          = st.BidQuantity;
            sy.SymbolStatistics.BidPrice             = st.BidPrice;
            sy.SymbolStatistics.LastQuantity         = st.LastQuantity;
            sy.SymbolStatistics.PreviousClosePrice   = st.PreviousClosePrice;
            sy.SymbolStatistics.WeightedAveragePrice = st.WeightedAveragePrice;
            sy.SymbolStatistics.PriceChange          = st.PriceChange;
            sy.SymbolStatistics.Period      = st.Period;
            sy.SymbolStatistics.LastTradeId = st.LastTradeId;
            sy.SymbolStatistics.TradeCount  = st.TradeCount;

            return(sy);
        }
Ejemplo n.º 2
0
 public static SymbolStatistics GetViewSymbolStatistics(this Interface.SymbolStats s)
 {
     return(new SymbolStatistics
     {
         FirstTradeId = s.FirstTradeId,
         CloseTime = s.CloseTime,
         OpenTime = s.OpenTime,
         QuoteVolume = s.QuoteVolume,
         Volume = Convert.ToInt64(s.Volume),
         LowPrice = s.LowPrice,
         HighPrice = s.HighPrice,
         OpenPrice = s.OpenPrice,
         AskQuantity = s.AskQuantity,
         AskPrice = s.AskPrice,
         BidQuantity = s.BidQuantity,
         BidPrice = s.BidPrice,
         LastQuantity = s.LastQuantity,
         LastPrice = s.LastPrice,
         PreviousClosePrice = s.PreviousClosePrice,
         WeightedAveragePrice = s.WeightedAveragePrice,
         PriceChangePercent = decimal.Round(s.PriceChangePercent, 2, MidpointRounding.AwayFromZero),
         PriceChange = s.PriceChange,
         Period = s.Period,
         Symbol = s.Symbol,
         LastTradeId = s.LastTradeId,
         TradeCount = s.TradeCount
     });
 }
Ejemplo n.º 3
0
 public static Symbol UpdateStatistics(this Symbol sy, Interface.SymbolStats st)
 {
     sy.SymbolStatistics.PriceChangePercent = decimal.Round(st.PriceChangePercent, 2, MidpointRounding.AwayFromZero);
     sy.PriceChangePercentDirection         = sy.SymbolStatistics.PriceChangePercent > 0 ? 1 : sy.SymbolStatistics.PriceChangePercent < 0 ? -1 : 0;
     sy.LastPriceChangeDirection            = st.LastPrice > sy.SymbolStatistics.LastPrice ? 1 : st.LastPrice < sy.SymbolStatistics.LastPrice ? -1 : 0;
     sy.SymbolStatistics.LastPrice          = st.LastPrice.Trim(sy.PricePrecision);
     sy.SymbolStatistics.Volume             = Convert.ToInt64(st.Volume);
     return(sy);
 }