Beispiel #1
0
 // TODO: WHAT IF WE SUBSCRIBE TO A PRICE FIRST IN THE SPREAD GRID? WE NEED TO CHECK FOR EXISTING m_updatePriceRows ENTRY AND USE IF EXISTS
 private void AddPriceRow(string symbol)
 {
     if (m_updatePriceRows.ContainsKey(symbol))      // if the symbol is already "subscribed"...
     {
         var row = m_updatePriceRows[symbol];        // use the existing PriceRow
         row.AddNotifyGrid(m_priceGrid);            // add m_level1Grid to the grids that should be notified of updates
         m_priceGrid.AddRow(row);                   // display the row in the "Price" grid
     }
     else
     {
         var row = new PriceRow(symbol);             // create a new PriceRow for this symbol
         row.AddNotifyGrid(m_priceGrid);
         m_updatePriceRows[symbol] = row;
         m_priceGrid.AddRow(row);
         //m_prices.SubscribePrices(symbol);
     }
 }
Beispiel #2
0
        // Reload the SPREADS file into the "Spreads" grid
        private void ReloadSpreads()
        {
            //m_spreadGrid.ClearRows();

            // If our symbols text file exists, then read it and request price updates on the symbols in the file
            var df = dfReadSpreads();
            foreach (var row in df.Rows)
            {
                //string group = row[0];
                string symbol = row[1];
                string formula = row[8];
                var spreadRow = new SpreadRow(symbol, formula);
                m_spreadGrid.AddRow(spreadRow);

                foreach (var sym in spreadRow.FormulaSymbols)
                {
                    cout("Formula Symbol: {0}", sym);
                    if (m_updatePriceRows.ContainsKey(sym))
                    {
                        var priceRow = m_updatePriceRows[sym];
                        priceRow.AddNotifyGrid(m_spreadGrid);
                        AddSpreadRow(sym, spreadRow);
                    }
                    else
                    {
                        var priceRow = new PriceRow(sym);
                        priceRow.AddNotifyGrid(m_spreadGrid);
                        m_updatePriceRows[sym] = priceRow;
                        AddSpreadRow(sym, spreadRow);
                        //m_level1Grid.AddRow(row);
                        SubscribePrices(sym);
                    }
                }

                //SubscribePrices(symbol1);
                //SubscribePrices(symbol2);
            }
        }