예제 #1
0
        void m_instrLookupRequest_OnData(object sender, InstrumentLookupEventArgs e)
        {
            if (e.Event == ProductDataEvent.Found)
            {
                // Instrument was found
                m_instrument = e.InstrumentLookup.Instrument;
                Console.WriteLine("Found: {0}", m_instrument);

                AlgoLookupSubscription algoLookupSubscription = new AlgoLookupSubscription(tt_net_sdk.Dispatcher.Current, "TT Iceberg");
                algoLookupSubscription.OnData += AlgoLookupSubscription_OnData;
                algoLookupSubscription.GetAsync();

                // Subscribe for market Data
                m_priceSubscription                = new PriceSubscription(m_instrument, tt_net_sdk.Dispatcher.Current);
                m_priceSubscription.Settings       = new PriceSubscriptionSettings(PriceSubscriptionType.MarketDepth);
                m_priceSubscription.FieldsUpdated += m_priceSubscription_FieldsUpdated;
                m_priceSubscription.Start();
            }
            else if (e.Event == ProductDataEvent.NotAllowed)
            {
                Console.WriteLine("Not Allowed : Please check your Token access");
            }
            else
            {
                // Instrument was not found and TT API has given up looking for it
                Console.WriteLine("Cannot find instrument: {0}", e.Message);
                Dispose();
            }
        }
예제 #2
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>   Event notification for instrument lookup. </summary>
        /// <param name="sender">   Source of the event. </param>
        /// <param name="e">        Instrument lookup subscription event information. </param>
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        void m_instrLookupRequest_OnData(object sender, InstrumentLookupEventArgs e)
        {
            if (e.Event == ProductDataEvent.Found)
            {
                // Instrument was found
                Instrument instrument = e.InstrumentLookup.Instrument;
                Console.WriteLine("Found: {0}", instrument);

                // Subscribe for Detailed Depth Data
                m_priceSubsciption                = new PriceSubscription(instrument, tt_net_sdk.Dispatcher.Current);
                m_priceSubsciption.Settings       = new PriceSubscriptionSettings(PriceSubscriptionType.DetailedDepth);
                m_priceSubsciption.FieldsUpdated += m_priceSubscription_FieldsUpdated;
                m_priceSubsciption.Start();

                //subscribe for Estimated Position in Queue
                m_estimatedPositionInQueueSubscription = new EstimatedPositionInQueueSubscription(tt_net_sdk.Dispatcher.Current);
                m_estimatedPositionInQueueSubscription.EstimatedPositionInQueueUpdated += M_estimatedPositionInQueueSubscription_EstimatedPositionInQueueUpdated;
                m_estimatedPositionInQueueSubscription.Start();
            }
            else if (e.Event == ProductDataEvent.NotAllowed)
            {
                Console.WriteLine("Not Allowed : Please check your Token access");
            }
            else
            {
                // Instrument was not found and TT API has given up looking for it
                Console.WriteLine("Cannot find instrument: {0}", e.Message);
            }
        }
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>   Event notification for instrument lookup. </summary>
        /// <param name="sender">   Source of the event. </param>
        /// <param name="e">        Instrument lookup subscription event information. </param>
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        void m_instrLookupRequest_OnData(object sender, InstrumentLookupEventArgs e)
        {
            if (e.Event == ProductDataEvent.Found)
            {
                // Instrument was found
                Instrument instrument = e.InstrumentLookup.Instrument;
                Console.WriteLine("Found: {0}", instrument);

                // Subscribe for Time & Sales Data
                m_tsSubscription         = new TimeAndSalesSubscription(instrument, tt_net_sdk.Dispatcher.Current);
                m_tsSubscription.Update += m_tsSubscription_Update;
                m_tsSubscription.Start();
            }
            else if (e.Event == ProductDataEvent.NotAllowed)
            {
                Console.WriteLine("Not Allowed : Please check your Token access");
            }
            else
            {
                // Instrument was not found and TT API has given up looking for it
                Console.WriteLine("Cannot find instrument: {0}", e.Message);
            }
        }
예제 #4
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>   Event notification for instrument lookup. </summary>
        /// <param name="sender">   Source of the event. </param>
        /// <param name="e">        Instrument lookup subscription event information. </param>
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        void m_instrLookupRequest_OnData(object sender, InstrumentLookupEventArgs e)
        {
            if (e.Event == ProductDataEvent.Found)
            {
                // Instrument was found
                Instrument instrument = e.InstrumentLookup.Instrument;
                Console.WriteLine("Found: {0}", instrument);

                // Subscribe for market Data
                m_priceSubscription                = new PriceSubscription(instrument, tt_net_sdk.Dispatcher.Current);
                m_priceSubscription.Settings       = new PriceSubscriptionSettings(PriceSubscriptionType.MarketDepth);
                m_priceSubscription.FieldsUpdated += m_priceSubscription_FieldsUpdated;
                m_priceSubscription.Start();


                // Create a TradeSubscription to listen for order / fill events only for orders submitted through it
                m_instrumentTradeSubscription = new InstrumentTradeSubscription(tt_net_sdk.Dispatcher.Current, instrument);

                m_instrumentTradeSubscription.OrderUpdated      += new EventHandler <OrderUpdatedEventArgs>(m_instrumentTradeSubscription_OrderUpdated);
                m_instrumentTradeSubscription.OrderAdded        += new EventHandler <OrderAddedEventArgs>(m_instrumentTradeSubscription_OrderAdded);
                m_instrumentTradeSubscription.OrderDeleted      += new EventHandler <OrderDeletedEventArgs>(m_instrumentTradeSubscription_OrderDeleted);
                m_instrumentTradeSubscription.OrderFilled       += new EventHandler <OrderFilledEventArgs>(m_instrumentTradeSubscription_OrderFilled);
                m_instrumentTradeSubscription.OrderRejected     += new EventHandler <OrderRejectedEventArgs>(m_instrumentTradeSubscription_OrderRejected);
                m_instrumentTradeSubscription.OrderBookDownload += new EventHandler <OrderBookDownloadEventArgs>(m_instrumentTradeSubscription_OrderBookDownload);
                m_instrumentTradeSubscription.Start();
            }
            else if (e.Event == ProductDataEvent.NotAllowed)
            {
                Console.WriteLine("Not Allowed : Please check your Token access");
            }
            else
            {
                // Instrument was not found and TT API has given up looking for it
                Console.WriteLine("Cannot find instrument: {0}", e.Message);
                Dispose();
            }
        }