예제 #1
0
        public void GotBook(Book b)
        {
            if (b.Sym != Symbol) return;
            _dt.Clear();
            for (int i = 0; i < b.ActualDepth; i++)
            {
                _dt.Rows.Add(b.UpdateTime, b.bidprice[i], b.askprice[i], b.bidsize[i], b.asksize[i],b.bidex[i],b.askex[i],i);
                if (i == 0)
                {
                    _dg.Columns[BID].DefaultCellStyle.Format = "N2";
                    _dg.Columns[ASK].DefaultCellStyle.Format = "N2";
                }
            }

        }
예제 #2
0
파일: Book.cs 프로젝트: bluejack2000/core
 public Book(Book b)
 {
     ActualDepth = b.ActualDepth;
     UpdateTime = b.UpdateTime;
     Sym = b.Sym;
     maxbook = b.maxbook;
     bidprice = new decimal[b.askprice.Length];
     bidsize = new int[b.askprice.Length];
     askprice = new decimal[b.askprice.Length];
     asksize = new int[b.askprice.Length];
     bidex = new string[b.askprice.Length];
     askex = new string[b.askprice.Length];
     Array.Copy(b.bidprice, bidprice, b.bidprice.Length);
     Array.Copy(b.bidsize, bidsize, b.bidprice.Length);
     Array.Copy(b.askprice, askprice, b.bidprice.Length);
     Array.Copy(b.asksize, asksize, b.bidprice.Length);
     for (int i = 0; i < b.ActualDepth; i++)
     {
         bidex[i] = b.bidex[i];
         askex[i] = b.askex[i];
     }
 }
예제 #3
0
 public void GotBook(Book b)
 {
     bookControl1.GotBook(b);
 }
예제 #4
0
 public void newTick(Tick k)
 {
     // make sure we update every few seconds
     if (!_bizero && ((k.time % _minbookwait) == 0))
     {
         _update = true;
     }
     bool NEWFINISHEDBOOK = false;
     // we don't need an update
     if (!_update) return;
     // we need an update, have we started?
     bool started = false;
     if (!_start.TryGetValue(k.symbol, out started))
         _start.Add(k.symbol, false);
     // haven't started and not good place to start
     if (!started && (k.depth != 0)) return;
     else if (!started) // ready to start
         _start[k.symbol] = true;
     else if (started && (k.depth == 0)) // done for now
     {
         // FINISHED FIRST BOOK IN THIS INTERVAL
         NEWFINISHEDBOOK = true;
         // reset flags
         _start[k.symbol] = false;
         _update = false;
     }
     // make sure book exists 
     Book b;
     if (!_book.TryGetValue(k.symbol, out b))
     {
         b = new Book(k.symbol);
         _book.Add(k.symbol, b);
     }
     // if we have new book, notify 
     if (NEWFINISHEDBOOK && (NewBook != null))
         NewBook(k.symbol);
     // pass tick
     b.GotTick(k);
     // save book
     _book[k.symbol] = b;
 }