/// <summary>
        /// Upon the application form loading, the TTDropHandler and TTInstrNotify objects 
        /// are initialized, and the required events are subscribed.
        /// </summary>
        public frmTimeAndSales()
        {
            // Required for Windows Form Designer support
            InitializeComponent();

            // Instantiate the drag and drop handler class.
            m_TTDropHandler = new XTAPI.TTDropHandlerClass();

            // Register the active form for drag and drop.
            m_TTDropHandler.RegisterDropWindow((int)this.Handle);

            // Subscribe to the drop and drag callback event.
            m_TTDropHandler.OnNotifyDrop +=new XTAPI._ITTDropHandlerEvents_OnNotifyDropEventHandler(m_TTDropHandler_OnNotifyDrop);

            // Instantiate the instrument notification class
            m_TTInstrNotify = new XTAPI.TTInstrNotifyClass();

            // Turn on trade data updates
            m_TTInstrNotify.DeliverAllPriceUpdates = 1;
            m_TTInstrNotify.EnablePriceUpdates = 1;

            // Setup instrument notifier callbacks
            m_TTInstrNotify.OnNotifyFound +=new XTAPI._ITTInstrNotifyEvents_OnNotifyFoundEventHandler(m_TTInstrNotify_OnNotifyFound);
            m_TTInstrNotify.OnPriceListUpdate +=new XTAPI._ITTInstrNotifyEvents_OnPriceListUpdateEventHandler(m_TTInstrNotify_OnPriceListUpdate);
        }
Beispiel #2
0
        public void init(XTAPI.TTInstrNotifyClass TTInstrNotify)
        {
            if (TTOrderSet != null && TTInstrObj != null && TTInstrNotify != null)
            {
                TTInstrNotify.DetachInstrument(TTInstrObj);
            }

            TTOrderSet = new XTAPI.TTOrderSetClass();

            TTOrderSet.Alias             = instrument.Product;
            TTOrderSet.EnableFillCaching = 1;
            TTOrderSet.EnableOrderSend   = 1;
            TTOrderSet.Set("NetLimits", false);
            TTOrderSet.EnableOrderSetUpdates = 1;
            TTOrderSet.EnableOrderFillData   = 1;
            TTOrderSet.EnableOrderAutoDelete = 1;
            TTOrderSet.ClearQuotePosition(0, 0, 0);

            TTInstrObj          = new XTAPI.TTInstrObjClass();
            TTInstrObj.Exchange = instrument.Exchange;
            TTInstrObj.Product  = instrument.Product;
            TTInstrObj.Contract = instrument.Contract;
            TTInstrObj.ProdType = instrument.ProductType;
            TTInstrObj.Alias    = instrument.Product;


            TTInstrNotify.AttachInstrument(TTInstrObj);


            XTAPI.TTOrderSelector orderSelector = TTInstrObj.CreateOrderSelector;


            //match orders per account
            XTAPI.TTOrderSelector acctSelector = new XTAPI.TTOrderSelectorClass();
            acctSelector.AddTest("Acct", instrument.Account);
            acctSelector.AllMatchesRequired = 1;

            orderSelector.AddSelector(acctSelector);
            orderSelector.AllMatchesRequired = 1;


            TTOrderSet.OrderSelector = orderSelector;

            TTOrderSet.Open(true);

            TTInstrObj.OrderSet = TTOrderSet;
            TTInstrObj.Open(1);



            if (log.IsInfoEnabled)
            {
                System.Text.StringBuilder msg = new System.Text.StringBuilder("trading started for ")
                                                .AppendFormat("{0} {1} {2} {3}"
                                                              , instrument.Account, instrument.Contract, instrument.Product, instrument.Exchange);
                log.Info(msg);
            }
        }
Beispiel #3
0
        private SpreadProc()
        {
            TTGate.RapidFillDelivery = 1;

            TTInstrNotify = new XTAPI.TTInstrNotifyClass();
            TTInstrNotify.UpdateFilter = "BID,ASK";

            if(log.IsInfoEnabled)
                log.Info("trading started for spread");
        }
Beispiel #4
0
        private SpreadProc()
        {
            TTGate.RapidFillDelivery = 1;


            TTInstrNotify = new XTAPI.TTInstrNotifyClass();
            TTInstrNotify.UpdateFilter = "BID,ASK";

            if (log.IsInfoEnabled)
            {
                log.Info("trading started for spread");
            }
        }
        /// <summary>
        /// Upon the application form loading, the TTDropHandler, TTOrderSet, and TTInstrNotify 
        /// objects are initialized, and the required events are subscribed.
        /// </summary>
        public frmOrderUpdate()
        {
            InitializeComponent();

            // Instantiate the TTDropHandler class.
            m_TTDropHandler = new XTAPI.TTDropHandlerClass();

            // Register the active form for drag and drop.
            m_TTDropHandler.RegisterDropWindow((int) this.Handle);

            // Subscribe to the OnNotifyDrop event.
            m_TTDropHandler.OnNotifyDrop += new XTAPI._ITTDropHandlerEvents_OnNotifyDropEventHandler(this.m_TTDropHandler_OnNotifyDrop);

            // Instantiate the TTInstrNotify class.
            m_TTInstrNotify = new XTAPI.TTInstrNotifyClass();

            // Subscribe to the OnNotifyFound event.
            m_TTInstrNotify.OnNotifyFound += new XTAPI._ITTInstrNotifyEvents_OnNotifyFoundEventHandler(this.m_TTInstrNotify_OnNotifyFound);

            // Instantiate the TTOrderSet class.
            m_TTOrderSet = new XTAPI.TTOrderSetClass();

            // Enable reject events
            m_TTOrderSet.EnableOrderRejectData = 1;

            // Set normal level of detail in our order status events
            m_TTOrderSet.OrderStatusNotifyMode = XTAPI.enumOrderStatusNotifyMode.ORD_NOTIFY_NORMAL;

            // Subscribe to the order status update events
            m_TTOrderSet.OnOrderDeleted += new XTAPI._ITTOrderSetEvents_OnOrderDeletedEventHandler(m_TTOrderSet_OnOrderDeleted);
            m_TTOrderSet.OnOrderFilled += new XTAPI._ITTOrderSetEvents_OnOrderFilledEventHandler(m_TTOrderSet_OnOrderFilled);
            m_TTOrderSet.OnOrderHeld += new XTAPI._ITTOrderSetEvents_OnOrderHeldEventHandler(m_TTOrderSet_OnOrderHeld);
            m_TTOrderSet.OnOrderSubmitted += new XTAPI._ITTOrderSetEvents_OnOrderSubmittedEventHandler(m_TTOrderSet_OnOrderSubmitted);
            m_TTOrderSet.OnOrderUpdated += new XTAPI._ITTOrderSetEvents_OnOrderUpdatedEventHandler(m_TTOrderSet_OnOrderUpdated);
            m_TTOrderSet.OnOrderRejected += new XTAPI._ITTOrderSetEvents_OnOrderRejectedEventHandler(m_TTOrderSet_OnOrderRejected);

            // Set the Net Limits to false.
            m_TTOrderSet.Set("NetLimits", false);
        }
        /// <summary>
        /// Upon the application form loading, the TTDropHandler and TTInstrNotify objects 
        /// are initialized, and the required events are subscribed.
        /// </summary>
        public frmProfitLoss()
        {
            // Required for Windows Form Designer support
            InitializeComponent();

            // Instantiate the drag and drop handler class.
            m_TTDropHandler = new XTAPI.TTDropHandlerClass();

            // Register the active form for drag and drop.
            m_TTDropHandler.RegisterDropWindow((int) this.Handle);

            // Subscribe to the drop and drag callback event.
            m_TTDropHandler.OnNotifyDrop += new XTAPI._ITTDropHandlerEvents_OnNotifyDropEventHandler(m_TTDropHandler_OnNotifyDrop);

            // Instantiate the TTInstrObj array for four TTInstrObj objects.
            m_TTInstrObj = new XTAPI.TTInstrObj[4];

            // Instantiate the instrument notification class
            m_TTInstrNotify = new XTAPI.TTInstrNotifyClass();

            // Subscribe to the necessary TTInstrNotify events.
            m_TTInstrNotify.OnNotifyFound +=new XTAPI._ITTInstrNotifyEvents_OnNotifyFoundEventHandler(m_TTInstrNotify_OnNotifyFound);
            m_TTInstrNotify.OnNotifyUpdate +=new XTAPI._ITTInstrNotifyEvents_OnNotifyUpdateEventHandler(m_TTInstrNotify_OnNotifyUpdate);
            m_TTInstrNotify.OnOrderSetUpdate +=new XTAPI._ITTInstrNotifyEvents_OnOrderSetUpdateEventHandler(m_TTInstrNotify_OnOrderSetUpdate);
        }
        /// <summary>
        /// Upon the application form loading, the TTDropHandler, TTOrderSet, and 
        /// TTInstrNotify objects are initialized, and the required events are subscribed.
        /// </summary>
        public frmModifyOrder()
        {
            // Required for Windows Form Designer support
            InitializeComponent();

            // Instantiate the drag and drop handler class.
            m_TTDropHandler = new XTAPI.TTDropHandlerClass();

            // Register the active form for drag and drop.
            m_TTDropHandler.RegisterDropWindow((int) this.Handle);

            // Associate the drop and drag callback event.
            m_TTDropHandler.OnNotifyDrop += new XTAPI._ITTDropHandlerEvents_OnNotifyDropEventHandler(this.m_TTDropHandler_OnNotifyDrop);

            // Instantiate the instrument notification class.
            m_TTInstrNotify = new XTAPI.TTInstrNotifyClass();

            // Subscribe to the TTInstrNotify events.
            m_TTInstrNotify.OnNotifyFound += new XTAPI._ITTInstrNotifyEvents_OnNotifyFoundEventHandler(this.m_TTInstrNotify_OnNotifyFound);

            // Instantiate the TTOrderSet object.
            m_TTOrderSet = new XTAPI.TTOrderSetClass();
        }
        /// <summary>
        /// Upon the application form loading, the TTDropHandler and TTInstrNotify objects 
        /// are initialized, and the required events are subscribed.
        /// </summary>
        public frmPriceUpdateDepth()
        {
            // Required for Windows Form Designer support
            InitializeComponent();

            // Instantiate the drag and drop handler class.
            m_TTDropHandler = new XTAPI.TTDropHandlerClass();

            // Register the active form for drag and drop.
            m_TTDropHandler.RegisterDropWindow((int) this.Handle);

            // Associate the drop and drag callback event.
            m_TTDropHandler.OnNotifyDrop += new XTAPI._ITTDropHandlerEvents_OnNotifyDropEventHandler(this.m_TTDropHandler_OnNotifyDrop);

            // Instantiate the instrument notification class
            m_TTInstrNotify = new XTAPI.TTInstrNotifyClass();

            // Setup the instrument notification call back functions
            m_TTInstrNotify.OnNotifyFound += new XTAPI._ITTInstrNotifyEvents_OnNotifyFoundEventHandler(this.m_TTInstrNotify_OnNotifyFound);
            m_TTInstrNotify.OnNotifyDepthData += new XTAPI._ITTInstrNotifyEvents_OnNotifyDepthDataEventHandler(pNotify_OnNotifyDepthData);

            // Enable the depth updates.
            m_TTInstrNotify.EnableDepthUpdates = 1;

            // Set the Depth levels to "0" which will return all available depth.
            m_bidDepthValue = "BidDepth(0)";
            m_askDepthValue = "AskDepth(0)";
        }
        /// <summary>
        /// Upon the application form loading, the TTDropHandler and TTInstrNotify 
        /// objects are initialized, and the required events are subscribed.
        /// </summary>
        public frmOrderSelector()
        {
            // Required for Windows Form Designer support
            InitializeComponent();

            // Instantiate the drag and drop handler class.
            m_TTDropHandler = new XTAPI.TTDropHandlerClass();
            // Register the active form for drag and drop.
            m_TTDropHandler.RegisterDropWindow((int) this.Handle);
            // Associate the drop and drag callback event.
            m_TTDropHandler.OnNotifyDrop += new XTAPI._ITTDropHandlerEvents_OnNotifyDropEventHandler(this.m_TTDropHandler_OnNotifyDrop);

            // Instantiate the instrument notification class.
            m_TTInstrNotify = new XTAPI.TTInstrNotifyClass();
            // Subscribe to the TTInstrNotify events.
            m_TTInstrNotify.OnNotifyFound += new XTAPI._ITTInstrNotifyEvents_OnNotifyFoundEventHandler(this.m_TTInstrNotify_OnNotifyFound);

            // Instantiate a TTOrderSet object for submitting orders.
            m_TTOrderSetSendOrder = new XTAPI.TTOrderSetClass();
            m_TTOrderSetSendOrder.Set("NetLimits",false);
            m_TTOrderSetSendOrder.Open(1);

            // Instantiate the the TTOrderSelector object.
            m_TTOrderSelector = new XTAPI.TTOrderSelectorClass();

            // Instantiate a TTOrderSet object for receiving orders.
            m_TTOrderSetReceiveOrder = new XTAPI.TTOrderSetClass();
            m_TTOrderSetReceiveOrder.OnOrderSetUpdate += new XTAPI._ITTOrderSetEvents_OnOrderSetUpdateEventHandler(m_TTOrderSet_OnOrderSetUpdate);

            // Enable the TTOrderTracker and order updates.
            m_TTOrderSetReceiveOrder.EnableOrderUpdateData = 1;
            m_TTOrderSetReceiveOrder.EnableOrderSetUpdates = 1;
        }
        /// <summary>
        /// Upon the application form loading, the TTDropHandler and TTInstrNotify
        /// objects are initialized, and the required events are subscribed.
        /// </summary>
        public frmPriceUpdateDragDrop()
        {
            // Required for Windows Form Designer support
            InitializeComponent();

            // Instantiate the drag and drop handler class.
            m_TTDropHandler = new XTAPI.TTDropHandlerClass();

            // Register the active form for drag and drop.
            m_TTDropHandler.RegisterDropWindow((int) this.Handle);

            // Associate the drop and drag callback event.
            m_TTDropHandler.OnNotifyDrop += new XTAPI._ITTDropHandlerEvents_OnNotifyDropEventHandler(this.m_TTDropHandler_OnNotifyDrop);

            // Instantiate the instrument notification class.
            m_TTInstrNotify = new XTAPI.TTInstrNotifyClass();

            // Setup the instrument notification call back functions.
            m_TTInstrNotify.OnNotifyFound += new XTAPI._ITTInstrNotifyEvents_OnNotifyFoundEventHandler(this.m_TTInstrNotify_OnNotifyFound);
            m_TTInstrNotify.OnNotifyUpdate += new XTAPI._ITTInstrNotifyEvents_OnNotifyUpdateEventHandler(this.m_TTInstrNotify_OnNotifyUpdate);
        }
Beispiel #11
0
        private void initQuotes()
        {
            // Instantiate the instrument notification class.
            m_TTInstrNotify = new XTAPI.TTInstrNotifyClass();

            log("Loading Quotes config: " + realTimeLocation);

            string[] lines = System.IO.File.ReadAllLines(realTimeLocation);

            // Setup the instrument notification call back functions.
            m_TTInstrNotify.OnNotifyFound += new XTAPI._ITTInstrNotifyEvents_OnNotifyFoundEventHandler(this.m_TTInstrNotify_OnNotifyFound);
            m_TTInstrNotify.OnNotifyUpdate += new XTAPI._ITTInstrNotifyEvents_OnNotifyUpdateEventHandler(this.m_TTInstrNotify_OnNotifyUpdate);

            log("Init Depth config");
            m_TTInstrNotify.OnNotifyDepthData += new XTAPI._ITTInstrNotifyEvents_OnNotifyDepthDataEventHandler(pNotify_OnNotifyDepthData);
            m_TTInstrNotify.EnableDepthUpdates = 1;
            depths = new Hashtable(600);

            string[] conf = null;
            string raw = null;

            foreach(string line in lines) {
                try {

                    raw = line;
                    conf = line.Split(',');
                    XTAPI.TTInstrObj m_TTInstrObj = new XTAPI.TTInstrObj();
                    m_TTInstrObj.Exchange =conf[0];
                    m_TTInstrObj.Product =conf[1];
                    m_TTInstrObj.ProdType =conf[2];
                    m_TTInstrObj.Contract =conf[3];

                    m_TTInstrNotify.AttachInstrument(m_TTInstrObj);
                    // 1 authorize depth
                    //m_TTInstrObj.Open(1);
                    m_TTInstrObj.Open(0);

                    Console.WriteLine(conf[1]+" "+conf[3]+" Added");

                } catch (Exception e)
                {
                    log("Error!!! >>>"+e.Message+" "+line);
                }

            }

            log(lines.Length+" Quotes Parsed");
        }
        /// <summary>
        /// Upon the application form loading, the TTInstrNotify object is initialized,
        /// and the required events are subscribed.
        /// </summary>
        public frmPriceUpdateManual()
        {
            // Required for Windows Form Designer support
            InitializeComponent();

            // Instantiate the instrument notification class.
            m_TTInstrNotify = new XTAPI.TTInstrNotifyClass();

            // Setup the instrument notification call back functions.
            m_TTInstrNotify.OnNotifyFound += new XTAPI._ITTInstrNotifyEvents_OnNotifyFoundEventHandler(this.m_TTInstrNotify_OnNotifyFound);
            m_TTInstrNotify.OnNotifyUpdate += new XTAPI._ITTInstrNotifyEvents_OnNotifyUpdateEventHandler(this.m_TTInstrNotify_OnNotifyUpdate);
            m_TTInstrNotify.OnNotifyNotFound += new XTAPI._ITTInstrNotifyEvents_OnNotifyNotFoundEventHandler(m_TTInstrNotify_OnNotifyNotFound);
        }