示例#1
0
文件: Myrrd.cs 项目: boehla/TradeIt
 public Candle(DateTime dt, ApiTicker tick) {
     this.dt = new DateTime(dt.Ticks);
     this.value = tick.clone();
 }
示例#2
0
文件: Myrrd.cs 项目: boehla/TradeIt
 public void AddTick(ApiTicker tick, DateTime dt) {
     if (dt < Lib.Const.NULL_DATE) {
         Logging.log("Skip addToAllNewTicker because dt < NULL_DATE", LogPrior.Warning);
         return;
     }
     DateTime normDate = getIntDate(dt);
     _lastTick = new Candle(dt, tick.clone());
     for (int i = 0; i < _candls.Count; i++) {
         if (_candls[i].dt < normDate) {
             onNewCandle(_lastCandle);
             _lastCandle = new Candle(normDate, tick.clone());
             _candls.Insert(i, _lastCandle);
             checkCandleCount();
             return;
         }
         if (_candls[i].dt.Equals(normDate)) {
             _candls[i].value.mergeNewTick(tick);
             return;
         }
     }
     if (MaxCandels - 1 > _candls.Count) {
         _lastCandle = new Candle(normDate, tick.clone());
         _candls.Add(_lastCandle);
     }
 }