question

Upvotes
Accepted
3 0 0 4

Possible values of tif

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?


c++redi-apiorder
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
Accepted
79.8k 257 52 74

@daniel03

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");
        }
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
3 0 0 4

It turns out this was a problem with the broker rejecting my orders.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.