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
  • image.png

  • Posts

    • ASX: NATIONAL AUSTRALIA BANK LIMITED - NAB Elliott Elliott Wave Technical Analysis TradingLounge (1D Chart) Greetings, Our Elliott Wave analysis today updates the Australian Stock Exchange (ASX) with NATIONAL AUSTRALIA BANK LIMITED - NAB. We identify wave ((iv))-green as having ended, and the potential for wave ((v))-green is open to push higher. ASX: NATIONAL AUSTRALIA BANK LIMITED - NAB Elliott Wave Technical Analysis   ASX: NATIONAL AUSTRALIA BANK LIMITED - NAB 1D Chart (Semilog Scale) Analysis Function: Major trend (Minute degree, green) Mode: Motive Structure: Impulse Position: Wave ((v))-green Details: The short-term outlook shows that wave ((iv))-green has just ended, and the push up quite high since 32.60 also suggests the return of wave ((v))-green. Invalidation point: 32.60       ASX: NATIONAL AUSTRALIA BANK LIMITED - NAB Elliott Wave Technical Analysis TradingLounge (4-Hour Chart) ASX: NATIONAL AUSTRALIA BANK LIMITED - NAB Elliott Wave Technical Analysis ASX: NATIONAL AUSTRALIA BANK LIMITED - NAB 4-Hour Chart Analysis   Function: Major trend (Minute degree, green) Mode: Motive Structure: Impulse Position: Wave i-blue of Wave ((v))-green Details: The shorter-term outlook suggests that the ((iii))-green wave has recently peaked, and the ((iv))-green wave has unfolded in the form of a Flat correction, with the ((iv))-wave likely completed. The ((v))-green wave is now unfolding to push prices higher. We are closely monitoring NAB, and there will soon be a long-term trading opportunity with NAB. It looks like wave ii-blue is opening up, pushing a little lower, before wave iii-blue returns to push even higher. Invalidation point: 32.60         Conclusion:   Our analysis, forecast of contextual trends, and short-term outlook for ASX: NATIONAL AUSTRALIA BANK LIMITED - NAB aim to provide readers with insights into the current market trends and how to capitalize on them effectively. We offer specific price points that act as validation or invalidation signals for our wave count, enhancing the confidence in our perspective. By combining these factors, we strive to offer readers the most objective and professional perspective on market trends. Technical Analyst: Hua (Shane) Cuong, CEWA-M (Master’s Designation). Source : Tradinglounge.com get trial here!  
    • Elliott Wave Analysis TradingLounge Daily Chart ChainLink/ U.S. dollar(LINKUSD) LINKUSD Elliott Wave Technical Analysis Function: Counter Trend Mode: Corrective Structure: Zigzag Position: Wave C Direction Next higher Degrees: Wave (I) of Impulse Wave Cancel invalid Level: 8.498 Details: the corrective of Wave (II) is equal to 61.8% of Wave (I) at 8.702 Log scale chart ChainLink/ U.S. dollar(LINKUSD)Trading Strategy: The second wave correction is likely to go down to test the 10.585 level before rising again in the third wave. Therefore, the overall picture is a short-term pullback to continue rising. Wait for the correction to complete to rejoin the trend. ChainLink/ U.S. dollar(LINKUSD)Technical Indicators: The price is above the MA200 indicating a Downtrend, The Wave Oscillator is a Bearish Momentum. Elliott Wave Analysis TradingLounge H4 Chart ChainLink/ U.S. dollar(LINKUSD) LINKUSD Elliott Wave Technical Analysis Function: Follow Trend Mode: Motive Structure: Impulse Position: Wave 5 Direction Next higher Degrees: Wave ((C)) of Zigzag Wave Cancel invalid Level: 81.238 Details: The Five-Wave Decline of Wave ((C)) trend to test 11.582 Level ChainLink/ U.S. dollar(LINKUSD)Trading Strategy: The second wave correction is likely to go down to test the 10.585 level before rising again in the third wave. Therefore, the overall picture is a short-term pullback to continue rising. Wait for the correction to complete to rejoin the trend. ChainLink/ U.S. dollar(LINKUSD)Technical Indicators: The price is above the MA200 indicating a Downtrend, The Wave Oscillator is a Bearish Momentum. Technical Analyst : Kittiampon Somboonsod Source : Tradinglounge.com get trial here!      
    • Okay, I'll grab the ultimate sloth at a lower price😑😑
×
×
  • Create New...
us