When I create a new ORDER object in c# what values can I put in order.TIF? I tried
ORDER order = new ORDER();
order.TIF = "IOC";
but I get an error when I submit:
Invalid TIF.
Is there a somewhere of what values are valid?
You can use the following code to get all available TIF values. You need to specify the symbol and exchange.
private void GetTIF(string symbol, string exchange) { ORDER objOrder = new ORDER(); objOrder.Symbol = symbol; objOrder.Exchange = exchange; object objTIFCount = null; objOrder.GetTIFCount(ref objTIFCount); Console.WriteLine("Tif count: {0}", objTIFCount); for(int i=0;i<(int)objTIFCount; i++) { object tif = null; objOrder.GetTIFX(i, ref tif); Console.WriteLine("Tif Value: {0}", tif); } }
I have also tested the IOC TIF and it works fine.
private void TestOrder() { ORDER hOrder = new ORDER(); object error = null; hOrder.Symbol = "PTT.BK"; hOrder.Side = "BUY"; hOrder.Quantity = "100"; hOrder.Exchange = "DEMO DMA"; hOrder.PriceType = "Limit"; hOrder.Price = 38.50; hOrder.TIF = "IOC"; hOrder.Account = "EQUITY-TR"; hOrder.Ticket = "Bypass"; bool result = hOrder.Submit(ref error); if(result == false) { Console.WriteLine(error); } GetTIF("PTT.BK", "DEMO DMA"); }