public void ShutDown()
 {
     m_Notify.OnNotifyUpdate    -= new InstrNotifyClass.OnNotifyUpdateEventHandler(OnNotifyUpdate);
     m_OrderSet.OnOrderFillData -= new OrderSetClass.OnOrderFillDataEventHandler(OnOrderFillData);
     m_Notify   = null;
     m_Instr    = null;
     m_OrderSet = null;
 }
Example #2
0
 private void OnUpdate( InstrNotifyClass pNotify, InstrObjClass pInstr )
 {
     // Get new data from the InstrObjClass using chatty calls here.
     bidQtyText.Text = pInstr.get_Get( "BIDQTY" ).ToString();
     bidPxText.Text = pInstr.get_Get("BID").ToString();
     askPxText.Text = pInstr.get_Get("ASK").ToString();
     askQtyText.Text = pInstr.get_Get("ASKQTY").ToString();
     lastPxText.Text = pInstr.get_Get("LAST").ToString();
     lastQtyText.Text = pInstr.get_Get("LASTQTY").ToString();
 }
Example #3
0
        public Instrument()
        {
            //Trade matcher below set at FIFO, AvgCost
            m_Matcher = new TradeMatcher(RoundTurnMethod.FIFO);
            //dataGridView1.DataSource = m_Matcher.BuyTable;
            //dataGridView2.DataSource = m_Matcher.SellTable;
            //dataGridView3.DataSource = m_Matcher.RoundTurns;

            // Create a new InstrObjClass object
            //Making Calls to Trader API
            m_Instr = new InstrObjClass("CME", "ES", InstrObjClass.ProdType.FUTURE, "Sep16", 125000);

            // Create a new InstrNotifyClass object from the InstrObjClass object.
            //subscribe to the observer
            m_Notify = ( InstrNotifyClass )m_Instr.CreateNotifyObj;

            // Enable price updates.
            m_Notify.EnablePriceUpdates = true;
            // Set UpdateFilter so event will fire anytime any one of these changes in the
            // associated InstrObjClass object.

            m_Notify.UpdateFilter = "LAST,LASTQTY";
            // Subscribe to the OnNotifyUpdate event.
            m_Notify.OnNotifyUpdate += new InstrNotifyClass.OnNotifyUpdateEventHandler(OnNotifyUpdate);
            // Set the exchange, product, contract and product type.


            // Open m_Instr.
            m_Instr.Open(true);

            // Create a new OrderSetClass object.
            m_OrderSet = new OrderSetClass();
            // Set the limits accordingly.  If any of these limits is reached,
            // trading through the API will be shut down automatically.
            m_OrderSet.set_Set("MAXORDERS", 1000);
            m_OrderSet.set_Set("MAXORDERQTY", 1000);
            m_OrderSet.set_Set("MAXWORKING", 1000);
            m_OrderSet.set_Set("MAXPOSITION", 1000);
            // Enable deleting of orders.  Enable the OnOrderFillData event.  Enable order sending.
            m_OrderSet.EnableOrderAutoDelete = true;
            m_OrderSet.EnableOrderFillData   = true;
            m_OrderSet.EnableOrderSend       = true;
            // Subscribe to the OnOrderFillData event.
            m_OrderSet.OnOrderFillData += new OrderSetClass.OnOrderFillDataEventHandler(OnOrderFillData);
            // Open the m_OrderSet.
            m_OrderSet.Open(true);
            // Associate m_OrderSet with m_Instr.
            m_Instr.OrderSet = m_OrderSet;
        }
Example #4
0
        public Instrument()
        {
            m_Matcher = new TradeMatcher(RoundTurnMethod.FIFO);


            // Create a new InstrObjClass object
            m_Instr = new InstrObjClass();

            // Create a new InstrNotifyClass object from the InstrObjectClass object.
            m_Notify = (InstrNotifyClass)m_Instr.CreateNotifyObj;
            // Enable price updates.
            m_Notify.EnablePriceUpdates = true;
            // Set UpdateFilter so event will fire anytime any one of these changes in the
            // associated InstrObjClass object.
            m_Notify.UpdateFilter = "LAST, LASTQTY";
            // Subscribe to the OnNotifyUpdate event.
            m_Notify.OnNotifyUpdate += new InstrNotifyClass.OnNotifyUpdateEventHandler(OnNotifyUpdate);
            // Set the exchange, product, contract and product type.
            m_Instr.Exchange = "CME";
            m_Instr.Product  = "ES";
            m_Instr.Contract = "Sep12";
            m_Instr.ProdType = "FUTURE";
            // Open m_Instr.
            m_Instr.Open(true);

            // Create a new OrderSetClass object.
            m_OrderSet = new OrderSetClass();
            // Set the limits accordingly. If any of these limits is reached,
            // trading through the API will be shut down automatically.
            m_OrderSet.set_Set("MAXORDERS", 1000);
            m_OrderSet.set_Set("MAXORDERQTY", 1000);
            m_OrderSet.set_Set("MAXWORKING", 1000);
            m_OrderSet.set_Set("MAXPOSITION", 1000);
            // Enable deleting of orders. Enable the OnOrderFillData event. Enable order sending.
            m_OrderSet.EnableOrderAutoDelete = true;
            m_OrderSet.EnableOrderFillData   = true;
            m_OrderSet.EnableOrderSend       = true;
            // Subscribe to the OnOrderFillData event.
            m_OrderSet.OnOrderFillData += new OrderSetClass.OnOrderFillDataEventHandler(OnOrderFillData);
            // Open the m_OrderSet.
            m_OrderSet.Open(true);
            // Associate m_OrderSet with m_Instr.
            m_Instr.OrderSet = m_OrderSet;
        }
Example #5
0
        public Instrument()
        {
            m_Matcher = new TradeMatcher(RoundTurnMethod.FIFO);

            // Create a new InstrObjClass object
            m_Instr = new InstrObjClass();

            // Create a new InstrNotifyClass object from the InstrObjectClass object.
            m_Notify = (InstrNotifyClass)m_Instr.CreateNotifyObj;
            // Enable price updates.
            m_Notify.EnablePriceUpdates = true;
            // Set UpdateFilter so event will fire anytime any one of these changes in the
            // associated InstrObjClass object.
            m_Notify.UpdateFilter = "LAST, LASTQTY";
            // Subscribe to the OnNotifyUpdate event.
            m_Notify.OnNotifyUpdate += new InstrNotifyClass.OnNotifyUpdateEventHandler(OnNotifyUpdate);
            // Set the exchange, product, contract and product type.
            m_Instr.Exchange = "CME";
            m_Instr.Product = "ES";
            m_Instr.Contract = "Sep12";
            m_Instr.ProdType = "FUTURE";
            // Open m_Instr.
            m_Instr.Open(true);

            // Create a new OrderSetClass object.
            m_OrderSet = new OrderSetClass();
            // Set the limits accordingly. If any of these limits is reached,
            // trading through the API will be shut down automatically.
            m_OrderSet.set_Set("MAXORDERS", 1000);
            m_OrderSet.set_Set("MAXORDERQTY", 1000);
            m_OrderSet.set_Set("MAXWORKING", 1000);
            m_OrderSet.set_Set("MAXPOSITION", 1000);
            // Enable deleting of orders. Enable the OnOrderFillData event. Enable order sending.
            m_OrderSet.EnableOrderAutoDelete = true;
            m_OrderSet.EnableOrderFillData = true;
            m_OrderSet.EnableOrderSend = true;
            // Subscribe to the OnOrderFillData event.
            m_OrderSet.OnOrderFillData += new OrderSetClass.OnOrderFillDataEventHandler(OnOrderFillData);
            // Open the m_OrderSet.
            m_OrderSet.Open(true);
            // Associate m_OrderSet with m_Instr.
            m_Instr.OrderSet = m_OrderSet;
        }
Example #6
0
 private void startButton_Click(System.Object sender, System.EventArgs e)
 {
     // Create a new InstrObjClass object
     m_Instr = new InstrObjClass();
     // Create a new InstrNotifyClass object from the InstrObjClass object.
     m_Notify = ( InstrNotifyClass )m_Instr.CreateNotifyObj;
     // Enable price updates.
     m_Notify.EnablePriceUpdates = true;
     // Set UpdateFilter so event will fire anytime any one of these changes in the
     // associated InstrObjClass object.
     m_Notify.UpdateFilter = "BIDQTY,BID,ASK,ASKQTY,LAST,LASTQTY";
     // Subscribe to the OnNotifyUpdate event.
     m_Notify.OnNotifyUpdate += new
     InstrNotifyClass.OnNotifyUpdateEventHandler(this.OnUpdate);
     // Set the exchange, product, contract and product type.
     m_Instr.Exchange = "CME";
     m_Instr.Product = "ES";
     m_Instr.Contract = "Dec12";
     m_Instr.ProdType = "FUTURE";
     // Open m_Instr.
     m_Instr.Open(true);
     // Create a new OrderSetClass object.
     m_OrderSet = new OrderSetClass();
     // Set the limits accordingly. If any of these limits is reached,
     // trading through the API will be shut down automatically.
     m_OrderSet.set_Set("MAXORDERS", 1000);
     m_OrderSet.set_Set("MAXORDERQTY", 1000);
     m_OrderSet.set_Set("MAXWORKING", 1000);
     m_OrderSet.set_Set("MAXPOSITION", 1000);
     // Enable deleting of orders. Enable the OnOrderFillData event. Enable order sending.
     m_OrderSet.EnableOrderAutoDelete = true;
     m_OrderSet.EnableOrderFillData = true;
     m_OrderSet.EnableOrderSend = true;
     // Subscribe to the OnOrderFillData event.
     m_OrderSet.OnOrderFillData += new
     OrderSetClass.OnOrderFillDataEventHandler(this.OnFill);
     // Open the m_OrderSet.
     m_OrderSet.Open(true);
     // Associate m_OrderSet with m_Instr.
     m_Instr.OrderSet = m_OrderSet;
 }
Example #7
0
 private void shutdown(object sender, EventArgs e)
 {
     // Shut down should include explicit object destruction.
     m_Notify.OnNotifyUpdate -= new InstrNotifyClass.OnNotifyUpdateEventHandler(this.OnUpdate);
     m_OrderSet.OnOrderFillData -= new OrderSetClass.OnOrderFillDataEventHandler(this.OnFill);
     m_Instr = null;
     m_OrderSet = null;
     m_Notify = null;
     GC.Collect();
 }
        private void OnNotifyUpdate(InstrNotifyClass pNotify, InstrObjClass pInstr)
        {
            Tick m_Tick = new Tick(DateTime.Now, Convert.ToDouble(pInstr.get_Get("LAST")), Convert.ToDouble(pInstr.get_Get("LASTQTY")));

            OnInstrumentUpdate(m_Tick);
        }
Example #9
0
 private void OnNotifyUpdate(InstrNotifyClass pNotify, InstrObjClass pInstr)
 {
     Tick m_Tick = new Tick(DateTime.Now, Convert.ToDouble(pInstr.get_Get("LAST")), Convert.ToDouble(pInstr.get_Get("LASTQTY")));
     OnInstrumentUpdate(m_Tick);
 }
Example #10
0
 public void ShutDown()
 {
     m_Notify.OnNotifyUpdate -= new InstrNotifyClass.OnNotifyUpdateEventHandler(OnNotifyUpdate);
     m_OrderSet.OnOrderFillData -= new OrderSetClass.OnOrderFillDataEventHandler(OnOrderFillData);
     m_Notify = null;
     m_Instr = null;
     m_OrderSet = null;
 }
 private void OnNotifyUpdate(InstrNotifyClass pNotify, InstrObjClass pInstr)
 {
     OnInstrumentUpdate();
 }