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); } }
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); } }