internal void InitCSVReader(int Index, string filepath, bool saveticks, int interval)
            {
                var    s        = ChimeraDataUtils.SecurityFromFileName(filepath);
                string strQuote = ChimeraDataUtils.QuotePathFromTradePath(filepath);
                string strNBBO  = ChimeraDataUtils.NBBOPathFromTradePath(filepath);

                trCSV = new CSVtoTikReader(filepath, strQuote, strNBBO, s.symbol, s.Date);


                if (_saveticks)
                {
                    ticks = new List <Tick>(trCSV.ApproxTicks);
                }
                else
                {
                    ticks = new List <Tick>();
                }
                _saveticks = saveticks;
                idx        = Index;
                if (interval == 0)
                {
                    trCSV.gotTick += new TickDelegate(tr_gotTick);
                }
                else
                {
                    bl             = new BarListImpl(trCSV.Symbol, interval, BarInterval.CustomTime);
                    bl.GotNewBar  += new SymBarIntervalDelegate(bl_GotNewBar);
                    trCSV.gotTick += new TickDelegate(tr_gotTick2);
                }
            }
Exemple #2
0
        public CSVtoTikReader(string strTradesPath, string strQuotesPath, string strNbboPath, string sym, int date)
            : base(new FileStream(strTradesPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
        {
            quotesReader = new StreamReader(new FileStream(strQuotesPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite));
            nbboReader   = new StreamReader(new FileStream(strNbboPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite));
            _path        = strTradesPath;
            FileInfo fi = new FileInfo(strTradesPath);

            ApproxTicks = (int)((double)fi.Length / 39);
            _realsymbol = sym;
            _sec        = TradeLink.Common.SecurityImpl.Parse(_realsymbol);
            _sec.Date   = ChimeraDataUtils.SecurityFromFileName(_path).Date;
            // get short symbol
            _sym = _sec.symbol;

            ReadHeader();
        }