Esempio n. 1
0
        public void OnTickAction(TickQuoteCn atick)
        {
            SymbolData ldatainfo = getDataInfo(atick.abbrname);

            //logger.Info("push data into dataInfo..." + atick.abbrname + "..." + ldatainfo.getAbbrname());
            ldatainfo.push(atick);
        }
Esempio n. 2
0
        private void OnData(string strSymbol, int nStatus, int nCount)
        {
            string lsymbol   = qc.SymbolGetStringData(strSymbol, -1, 0);
            string labbrname = SymbolManager.Instance.getAbbrname(strSymbol);
            double lhhmmss   = qc.SymbolGetValueData(strSymbol, -1, 2);
            double ltrade    = qc.SymbolGetValueData(strSymbol, -1, 3) / 1000000;
            double lvolume   = qc.SymbolGetValueData(strSymbol, -1, 4);
            double lbid      = qc.SymbolGetValueData(strSymbol, -1, 30) / 1000000;
            double lask      = qc.SymbolGetValueData(strSymbol, -1, 50) / 1000000;
            double loi       = qc.SymbolGetValueData(strSymbol, -1, 91);

            if (lvolume < 0)
            {
                return;
            }

            if (ltrade < 0)
            {
                return;
            }

            lastUpdateHHMMSS = Convert.ToInt32(lhhmmss);

            //logger.Info("tick time:" + lhhmmss);
            TickQuoteCn atick = new TickQuoteCn(labbrname, lhhmmss, ltrade, lvolume, lbid, lask, loi);

            //logger.Info(atick.info());

            if (onTick == null)
            {
                return;
            }
            onTick(atick);
        }
Esempio n. 3
0
        public void push(TickQuoteCn aTick)
        {
            int intTime = Convert.ToInt32(aTick.time);

            if (time.Count == 0)
            {
                time.Add(intTime);
                trade.Add(aTick.trade);
                high.Add(aTick.trade);
                low.Add(aTick.trade);
                oi.Add(Convert.ToInt32(aTick.oi));
                volume.Add(Convert.ToInt32(aTick.volume));
            }
            else
            {
                int ltime   = time.Last();
                int lastIdx = time.Count - 1;
                //logger.Info("data in " + ltime.ToString());

                if (intTime == ltime)
                {
                    trade[lastIdx]  = aTick.trade;
                    high[lastIdx]   = Math.Max(aTick.trade, high[lastIdx]);
                    low[lastIdx]    = Math.Min(aTick.trade, low[lastIdx]);
                    oi[lastIdx]     = Convert.ToInt32(aTick.oi);
                    volume[lastIdx] = volume[lastIdx] + Convert.ToInt32(aTick.volume);
                    RedisQuoteDataHandler.Instance.insertQuote(abbrname, ltime, high[lastIdx], low[lastIdx], volume[lastIdx], oi[lastIdx]);
                }
                else
                {
                    time.Add(intTime);
                    trade.Add(aTick.trade);
                    high.Add(aTick.trade);
                    low.Add(aTick.trade);
                    oi.Add(Convert.ToInt32(aTick.oi));
                    volume.Add(Convert.ToInt32(aTick.volume));

                    //if (oichart != null)
                    //{
                    //    oichart.addData(aTick);
                    //}
                }
            }
        }