Exemplo n.º 1
0
 public void plotCandle(string name, Candle cl,bool secondaryAxis = false, int area = 0)
 {
     if (cl == null) {
         Logging.log("Candle is null -> skip plot", LogPrior.Warning);
         return;
     }
     double[] candleData = new double[] { cl.value.High, cl.value.Low, cl.value.Open, cl.value.Close };
     plot(name, candleData, secondaryAxis, area);
 }
Exemplo n.º 2
0
 public NewCandleArgs(Candle candle) {
     _candle = candle;
 }
Exemplo n.º 3
0
 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);
     }
 }
Exemplo n.º 4
0
        private void onNewCandle(Candle candle) {

            if (candle == null) return;
            NewCandleArgs args = new NewCandleArgs(candle);
            onNewCandleHandler(this, args);
        }
Exemplo n.º 5
0
        public void archiveTick(ApiTicker tick) {
            string filename = string.Format("archiv\\ticks_{0:yyyyMM}.csv", DateTime.Now);
            string folder = Path.GetDirectoryName(filename);
            if (!Directory.Exists(folder)) {
                Directory.CreateDirectory(folder);
            }
            StreamWriter fout = new StreamWriter(filename, true);

            Candle c = new Candle(DateTime.Now, tick);
            fout.WriteLine(c.getCSVLine(1));

            fout.Close();
        }