Exemplo n.º 1
0
        void processFill(FillOriginator originator, FillAction action, ReadOnlyCollection <Fill> fills)
        {
            foreach (Fill fill in fills)
            {
                processFill(FillOriginator.TRADER, FillAction.ADD, fill);
                Thread.Sleep(5);
            }

            processSystemMessage(SystemMessage.FILL_BOOK_DOWNLOAD);
        }
Exemplo n.º 2
0
 void processFill(FillOriginator originator, FillAction action)
 {
     if (action == FillAction.LIST_START)
     {
         processSystemMessage(SystemMessage.FILL_LIST_START);
     }
     else if (action == FillAction.LIST_END)
     {
         processSystemMessage(SystemMessage.FILL_LIST_END);
     }
 }
Exemplo n.º 3
0
 void api_OnFill(FillOriginator originator, FillAction action, EZInstrument ttInstrument, EZFill fill, EZFill newFill)
 {
     //cross thread - so you don't get the cross theading exception
     if (this.InvokeRequired)
     {
         this.BeginInvoke((MethodInvoker) delegate
         {
             api_OnFill(originator, action, ttInstrument, fill, newFill);
         });
         return;
     }
 }
Exemplo n.º 4
0
        void processFill(FillOriginator originator, FillAction action, Fill fill, params Fill[] fills)
        {
            TTFill newFill = null;

            /*
             * 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 AutoSubscribeInstruments is true.
            if (!_ttInstruments.ContainsKey(fill.InstrumentKey))
            {
                if (AutoSubscribeInstruments)
                {
                    //TODO: Make the subscribe to instrument work
                    //SubscribeToInstrument(fill.InstrumentKey);

                    /*InstrumentLookupSubscription ils = new InstrumentLookupSubscription(apiSession, Dispatcher.Current, fill.InstrumentKey);
                     * ils.Update += new EventHandler<InstrumentLookupSubscriptionEventArgs>(ils_Update);
                     * ils.Start();*/
                }

                TTInstrument tti = new TTInstrument(fill.InstrumentKey);
                _ttInstruments.Add(fill.InstrumentKey, tti);
            }

            TTFill ttf = NewTTFill(fill);

            #region LOOK FOR '#' IN THE FFT FIELDS
            // 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> hashFills = _hashSymbols[hashField];
                hashFills.Add(fill);
            }
            #endregion

            // There are definitely times when the fill key already exists in the dictionary. In those
            // cases I am just overwriting the previous fill with the new one (asuming it is an updated
            // fill or whatever).
            _currentTTFills[fill.FillKey] = ttf;

            if (OnFill != null)
            {
                OnFill(originator, action, _ttInstruments[fill.InstrumentKey], ttf, newFill);
            }
        }
Exemplo n.º 5
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);
                }
            }
        }