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.

@daniel03

Hi,

Thank you for your participation in the forum.

Is the reply below satisfactory in answering your question?

If yes please click the 'Accept' text next to the reply. This will guide all community members who have a similar question.

Otherwise please post again offering further insight into your question.

Thanks,

AHS

Upvotes
Accepted
78.9k 250 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.