Esempio n. 1
0
        private void tscomboFFT_SelectedIndexChanged(object sender, EventArgs e)
        {
            string tag = tscomboFFT.SelectedItem as string;

            if (tag == null)
            {
                return;
            }

            Console.WriteLine("TAG: " + tag);

            filteredGrid.Rows.Clear();
            foreach (Fill fill in hashSymbols[tag])
            {
                FillBasic fb = new FillBasic(fill);
                displayFill(filteredGrid, fb);
            }
        }
Esempio n. 2
0
        void displayFill(DataGridView grid, FillBasic fb)
        {
            int rowIndex = grid.Rows.Add(fb.ShortTime, fb.Identifiers, fb.BuySell, fb.Quantity, fb.InstrumentName, fb.Price);

            if (tsitemAutoScroll.Checked)
            {
                grid.FirstDisplayedScrollingRowIndex = grid.RowCount - 1;
            }
            DataGridViewRow row = grid.Rows[rowIndex];

            if (fb.BuySell == BuySell.Buy)
            {
                row.DefaultCellStyle.BackColor = Color.Blue;
                row.DefaultCellStyle.ForeColor = Color.White;
            }
            else if (fb.BuySell == BuySell.Sell)
            {
                row.DefaultCellStyle.BackColor = Color.Red;
                row.DefaultCellStyle.ForeColor = Color.Black;
            }
            Message("FILL: " + fb);
        }
Esempio n. 3
0
        void processFill(FillOriginator originator, FillAction action, Fill fill)
        {
            /*
             * fill.BuySell;
             * fill.FFT2;
             * fill.FFT3;
             * fill.FillKey;
             * fill.FillType;
             * fill.InstrumentKey;
             * fill.IsHedge;   // autospreader hedge order
             * fill.IsQuoting; // autospreader quoting order
             * fill.MatchPrice;
             * fill.Quantity;
             * fill.SpreadId;
             * fill.TransactionDateTime;
             */

            // If this is the first fill for this instrument, then add it to our list and
            // subscribe to the instrument updates.
            if (!instruments.ContainsKey(fill.InstrumentKey))
            {
                InstrumentLookupSubscription ils = new InstrumentLookupSubscription(apiInstance.Session, Dispatcher.Current, fill.InstrumentKey);
                ils.Update += new EventHandler <InstrumentLookupSubscriptionEventArgs>(ils_Update);
                ils.Start();

                InstrumentInfo info = new InstrumentInfo(fill.InstrumentKey);
                instruments.Add(fill.InstrumentKey, info);
            }

            // Display the fill in the grid and play and sounds and/or send any messages related to
            // this fill.
            FillBasic fb = new FillBasic(fill);

            displayFill(fillGrid, fb);
            UpdateFillCount(fillGrid.Rows.Count);
            UpdateProfit(0);

            // See if this fill contains our '#' hashtag in either FFT field.
            string hashField = null;

            if (fill.FFT2.StartsWith("#"))
            {
                hashField = fill.FFT2;
            }
            if (fill.FFT3.StartsWith("#"))
            {
                hashField = fill.FFT3;
            }

            // If we found a valid '#' hashtag value, then put it in our dropdown combo box.
            if (hashField != null)
            {
                // Add this fill to our list of fills with this same hashsymbol
                if (!hashSymbols.ContainsKey(hashField))
                {
                    hashSymbols.Add(hashField, new List <Fill>());
                }
                List <Fill> fills = hashSymbols[hashField];
                fills.Add(fill);

                // Add this hashsymbol to our dropdown list if it is not already there
                if (!tscomboFFT.Items.Contains(hashField))
                {
                    tscomboFFT.Items.Add(hashField);
                }

                // If the user is filtering by this hash symbol then put this fill in the filter grid also
                string selectedHash = tscomboFFT.SelectedItem as string;
                if (selectedHash != null && selectedHash.Equals(hashField))
                {
                    displayFill(filteredGrid, fb);
                }
            }
        }