Jump to content
  • 0

Order API Behaviour - How to formally raise a bug with IG?'


Tipper258

Question

Issue 1. The API does not behave as documented

The streaming API does not behave like the documentation, it never raises a WOU, always an OPU and it can have 2 different bodies. You have to inspect the body for presence of certain properties to determine what type of message it is. No biggie, can work round this once figured out this is what happens in both demo and live spread bet accounts.

Issue 2. forceOpen behaviour

Having used IG for many years, I'm very familiar with the web platform behaviour of forceOpen. Set it to true and your working order doesn't impact existing orders when the order executes. Set it to false and the order will apply to any open position in the same epic, quite how it decides which position to impact if you have multiple open is unknown.

In the REST API, the documentation says the default for forceOpen is true for working orders. Certainly if I try to set it to true I get a 400 with invalid.forceOpen error. If I don't set it, when the order is executed it behaves as if it were set to false and closes open positions which is rather unhelpful for the strategy.

When using the API companion, and I paste in the exact request body, with forceOpen set to true, it doesn't complain, off it goes and creates a working order. Mind you it returns the dealRef I specified but doesn't create the order with the dealRef which I guess is an implementation 'thing' with the companion, but then again that says maybe it actually strip out the forceOpen true before making the real API call too? Hard to know, or have confidence it's a true reflection of the real call.

This one I can't test in live, it costs real money with this behaviour, I'm unable to create a working order with forceOpen set to true, and the behaviour without it is as per false, despite the documentation saying it's true. I can't find a workaround.

How do I get support on this from IG, and bugs fixed or ultimately debug how this is my problem? Having been a developer for way too many years I'm conscious you can be very confident in your code only to find out you did get something wrong. For me the code works perfectly, a fairly complex strategy, until I add in the "forceOpen": "true" and get the 400.

Or is this 'just how it is' with the IG API? Thanks!

Link to comment

5 answers to this question

Recommended Posts

  • 0
19 minutes ago, Tipper258 said:

Issue 1. The API does not behave as documented

The streaming API does not behave like the documentation, it never raises a WOU, always an OPU and it can have 2 different bodies. You have to inspect the body for presence of certain properties to determine what type of message it is. No biggie, can work round this once figured out this is what happens in both demo and live spread bet accounts.

Issue 2. forceOpen behaviour

Having used IG for many years, I'm very familiar with the web platform behaviour of forceOpen. Set it to true and your working order doesn't impact existing orders when the order executes. Set it to false and the order will apply to any open position in the same epic, quite how it decides which position to impact if you have multiple open is unknown.

In the REST API, the documentation says the default for forceOpen is true for working orders. Certainly if I try to set it to true I get a 400 with invalid.forceOpen error. If I don't set it, when the order is executed it behaves as if it were set to false and closes open positions which is rather unhelpful for the strategy.

When using the API companion, and I paste in the exact request body, with forceOpen set to true, it doesn't complain, off it goes and creates a working order. Mind you it returns the dealRef I specified but doesn't create the order with the dealRef which I guess is an implementation 'thing' with the companion, but then again that says maybe it actually strip out the forceOpen true before making the real API call too? Hard to know, or have confidence it's a true reflection of the real call.

This one I can't test in live, it costs real money with this behaviour, I'm unable to create a working order with forceOpen set to true, and the behaviour without it is as per false, despite the documentation saying it's true. I can't find a workaround.

How do I get support on this from IG, and bugs fixed or ultimately debug how this is my problem? Having been a developer for way too many years I'm conscious you can be very confident in your code only to find out you did get something wrong. For me the code works perfectly, a fairly complex strategy, until I add in the "forceOpen": "true" and get the 400.

Or is this 'just how it is' with the IG API? Thanks!

Hi @Tipper258,

The best way to get some support with API would be to reach out to webapisupport@ig.com.

All the best - Arvin

  • Like 1
Link to comment
  • 0

Hi @ArvinIG, I've written in with both bugs, not heard anything back yet, but I see you resolved something on another thread in a way which implied individual accounts need to be enabled to force open positions in opposite directions. 

If my demo account is not enabled for this, it could be a perfect explanation for the behaviour noted above. So I used the web interface and opened a position and then placed an opposing order, checking the 'open new position' box. It behaved impeccably, opening an opposing position when the price was hit. 

Guess that means my account can open opposing positions on the same epic via the web, any reason it wouldn't via the API?

Thanks

Link to comment
  • 0
5 minutes ago, Tipper258 said:

Hi @ArvinIG, I've written in with both bugs, not heard anything back yet, but I see you resolved something on another thread in a way which implied individual accounts need to be enabled to force open positions in opposite directions. 

If my demo account is not enabled for this, it could be a perfect explanation for the behaviour noted above. So I used the web interface and opened a position and then placed an opposing order, checking the 'open new position' box. It behaved impeccably, opening an opposing position when the price was hit. 

Guess that means my account can open opposing positions on the same epic via the web, any reason it wouldn't via the API?

Thanks

Stop the bus! I've just read that the API defaults to version 1 if not specified, and not as I'd assumed the latest version. Looking at the difference between the version specs, there is no forceOpen on v1, I need to explicitly set v2.

Tests under way with the appropriate header .....

Link to comment
  • 0

In case anyone reads this in the future, the root cause was the API call to POST an order did not specify the API version in the headers, which then defaults to v1. It is API v2 that supports the needed forceOpen behaviour, adding that header resolved the issue 2 above.

  • Like 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • General Statistics

    • Total Topics
      20,100
    • Total Posts
      88,167
    • Total Members
      69,088
    • Most Online
      7,522
      10/06/21 11:53

    Newest Member
    MCL
    Joined 04/10/22 10:15
  • Posts

    • Elbit Systems Ltd., Elliott Wave Technical Analysis Elbit Systems Ltd., (ESLT:NASDAQ): Daily Chart, October 4 2022,  ESLT Stock Market Analysis:Looking for further downside as we can see what appears to be aleading diagonal in wave {i} ESLT Elliott Wave count: {iii} of C. ESLT Technical Indicators:All indicators are signaling bearish momentum with the 20 and 200EMAs trying to cross. ESLT Trading Strategy: Looking to short on wave (iv) and {iv}. TradingLounge Analyst: Alessio Barretta Source Tradinglounge.com Get trial here!       Elbit Systems Ltd., ESLT: 4-hour Chart, October 4 2022 Elbit Systems Ltd., Elliott Wave Technical Analysis ESLT Stock Market Analysis: Looking for further downside as the whole move down appears tobe incomplete. ESLT Elliott Wave count: (iv) of {iii}. ESLT Technical Indicators:All indicator are bearish with the 20 EMA(red line) potentially actingas resistance. ESLT Trading Strategy: Looking to short even in this wave (iv) with a stop below the low ofwave (ii).
    • Top 5 Day Trading Strategies Every Rich Trader Knows   Day trading is a type of trading in which traders buy and sell stocks on the same trading day in order to profit from daily price fluctuations. With such a short time frame for trading, one needs a better trading strategy and discipline with risk management. Day trading provides traders with leverage, but at the cost of increased risk, and traders should be fully aware of how much they are willing to lose on a daily basis before entering trades. Another factor to consider when day trading is the margin required and the leverage provided by the broker. For example, some brokers provide 2:1 leverage, while others may provide 3:1 intraday leverage. Some Traders Make huge money with leverage, trick is to getting consistent results in day trading which can make an steadily rising equity curve Intraday Trading: A Systematic Approach Finding the best intraday trading strategy is one aspect of profitable trading, as one famous trader once stated- This type of goal-less thinking is difficult to develop, but with persistence and practice, you will eventually get there. Intraday trading requires patience and a systematic approach.  To develop a systematic approach to day trading, you must experiment with your trading style. Finding a strategy is not difficult, but sticking to it during drawdowns is the real challenge. Top 5 Intraday Trading Strategies   1. Momentum Trading Strategy 2. Gap Up & Gap Down Trading Strategy  3. Moving Average Crossover strategy  4. VWAP Trading Strategy  5. Range Breakout Trading Strategy     Get Complete Detailed Study of these 5 Trading Strategies -  Best Intraday Strategy – Top 5 Day Trading Strategies    
    • Early Morning Call: end of oversized interest rate hikes in sight? Europe expected up after a strong start to Q4 globally. ASX 200 up strongly after RBA raised rates only 25bps. AUD meanwhile on the way down after RBA's decision while USD sees steepest 4-day loss since July 2020.    Jeremy Naylor | Writer, London | Publication date: Tuesday 04 October 2022  Macro overview It was a positive start of the month for US indices. The Dow Jones closed yesterday’s session up 2.66%, the S&P 500 rose 2.59%, and the Nasdaq Composite by 2.27%. The Asia-Pacific region followed suit, with Australia’s S&P/ASX 200 outperforming the region as the Reserve Bank of Australia (RBA) raised interest rates by 25-basis points (bps) to 2.6%. If this makes it the highest level in more than nine years, the market was expecting a 50 basis-point hike. The move benefited the equity market but affected the Australian dollar. AUD/USD fell as much as 1% at the announcement before paring some losses. Rates are expected to increase further. The RBA repeated its commitment to bring inflation down to target levels. Inflation is still too high and should remain so for months to come. The bank expects consumer inflation to rise about 7.75% in 2022, above 4% in 2023, and around 3% in 2024. Elsewhere, several Fed presidents and board members' speeches are expected today, among them Cleveland Fed president Loretta Mester, San Francisco Fed president Mary Daly, and New York Fed chief executive John Williams. Yesterday, Williams already said that while they can see growing signs of cooling inflation, underlying price pressures remain too high: "Clearly, inflation is far too high, and persistently high inflation undermines the ability of our economy to perform at its full potential. Tighter monetary policy has begun to cool demand and reduce inflationary pressures, but our job is not yet done." Williams did not share his views on what the next Federal Reserve (Fed) rate hike should be. Many are speculating that the Fed will again hike by 0.75 percentage points. The US dollar remains on the back foot this morning. The US Dollar Basket retreated yesterday for a fifth consecutive day. This benefited commodities, and especially precious metals: gold now trades just below $1,700, platinum gained $60 in yesterday's session, and silver hit a three-month high. At 10am producer price index in the Eurozone is expected to accelerate in August. Economists see a month-on-month (MoM) increase of 4.9%, after 4% in July. The year-on-year (YoY) rise is forecast to reach 43.1%. In the US, factory orders are expected to rise by 0.3% in August on a month-on-month basis. Equities overview Elsewhere on the equity market, Greggs PLC said in a trading statement its sales rose 14.6% in the third quarter (Q3), adding its full-year (FY) outcome will be in line with expectations. Investors will remain attentive to Credit Suisse Group AG (CH). Shares of the Swiss bank recovered their losses and ended yesterday’s session down around 1% after a big market rally. The stock had dropped as much as 10% at the start of trading after the Financial Times reported the Swiss bank's executives are in talks with its major investors to reassure them amid rising concerns over the lender's financial health. Commodities Oil prices are on the rise this morning, and the market is waiting for tomorrow's OPEC+ ministerial meeting in Vienna, where members will be discussing output cuts that could go above one million barrels per day (bpd). Last month the organisation cut production by 100,000 bpd, signalling it would do what it takes to maintain oil price stability. In September, oil prices retreated for a fourth straight month.     This is here for you to catch up but if you have any ideas on markets or events you want us to relay to the TV team we’re more than happy to.
×
×
  • Create New...