Jump to content
  • 0

Close Position Using rest API


Guest oliver3146

Question

Guest oliver3146

Hi all,

I'm currently using IG rest API top open and positions. I don't have any issue opening a position but when I try to close it I get below error message:

"errorCode": "validation.mutual-exclusive-value.request"

I also get this error when using API companion:

Deal Id: DIAAAADQNQBZCAH
Epic: IX.D.SPTRD.IFE.IP
Expiry: -
Direction:  SELL (because my position is BUY)
Deal Size: 1
Closing order Level: 
Order Type:  MARKET
Time In Force: 
Quote ID: 

 (DELETE /positions/otc)

 

After I press GO I get error: "errorCode": "validation.mutual-exclusive-value.request" the same I get using python API.

Could you please help ? What am I doing wrong?

 

Thanks in advance

Link to comment

17 answers to this question

Recommended Posts

  • 0
On 05/05/2020 at 19:14, Guest oliver3146 said:

Hi all,

I'm currently using IG rest API top open and positions. I don't have any issue opening a position but when I try to close it I get below error message:

"errorCode": "validation.mutual-exclusive-value.request"

I also get this error when using API companion:

Deal Id: DIAAAADQNQBZCAH
Epic: IX.D.SPTRD.IFE.IP
Expiry: -
Direction:  SELL (because my position is BUY)
Deal Size: 1
Closing order Level: 
Order Type:  MARKET
Time In Force: 
Quote ID: 

 (DELETE /positions/otc)

 

After I press GO I get error: "errorCode": "validation.mutual-exclusive-value.request" the same I get using python API.

Could you please help ? What am I doing wrong?

 

Thanks in advance

 

Link to comment
  • 0

Deal Id: DIAAAADQNQBZCAH
Epic:
Expiry:
Direction:  SELL (because my position is BUY)
Deal Size: 1
Closing order Level:
Order Type:  MARKET
Time In Force:
Quote ID:

 (DELETE /positions/otc)

When i send this request via command: "Call oXMLHTTP.SEND(requestBodyString)"

i get this error: "errorCode": "validation.null-not-allowed.request"

if i copy request text to API companion . It runs perfectly

Any body got a solution to this?

Link to comment
  • 0

request body string :{"dealId":"DIAAAAGVJZBK3AZ","direction":"SELL","size":"1","orderType":"MARKET","timeInForce":"EXECUTE_AND_ELIMINATE"}
Method : (DELETE /positions/otc)
When i send this request via command: "Call oXMLHTTP.SEND(requestBodyString)"
i get this error: "errorCode": "validation.null-not-allowed.request"
if i copy request text to API companion . It runs perfectly

Any body got a solution to this?

Link to comment
  • 0

request body string :{"dealId":"DIAAAAGVJZBK3AZ","direction":"SELL","size":"1","orderType":"MARKET","timeInForce":"EXECUTE_AND_ELIMINATE"}
Method : (DELETE /positions/otc)
position : "BUY"
When i send this request via command: "Call oXMLHTTP.SEND(requestBodyString)"
i get this error: "errorCode": "validation.null-not-allowed.request"
if i copy request text to API companion . It runs perfectly

Any body got a solution to this?

Link to comment
  • 0
On 28/10/2021 at 18:14, Guest Simon said:

Deal Id: DIAAAADQNQBZCAH
Epic:
Expiry:
Direction:  SELL (because my position is BUY)
Deal Size: 1
Closing order Level:
Order Type:  MARKET
Time In Force:
Quote ID:

 (DELETE /positions/otc)

When i send this request via command: "Call oXMLHTTP.SEND(requestBodyString)"

i get this error: "errorCode": "validation.null-not-allowed.request"

if i copy request text to API companion . It runs perfectly

Any body got a solution to this?

I think so expiry needs a '-' as value.

 

Link to comment
  • 0

I am also running into issue when trying to delete a position when following payload 

{
   "dealId": "DIAAAAJBD8TYKAT",
   "direction": "SELL",
   "orderType": "MARKET",
   "timeInForce": "FILL_OR_KILL",
   "size": 1.16,
   "expiry": "DFB"
}

 

endpoint https://demo-api.ig.com/gateway/deal/positions/otc

when I use POST method with _method header as DELETE, it returns 

{
"errorCode": "error.service.marketdata.position.notional.details.null.error"
}
 
when I use DELETE method 
validation.null-not-allowed.request
 
Will appreciate any help in this regard. 
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
      21,632
    • Total Posts
      91,899
    • Total Members
      41,912
    • Most Online
      7,522
      10/06/21 10:53

    Newest Member
    PBEE
    Joined 25/03/23 10:02
  • Posts

    • Charting the Markets: 24 March The FTSE 100, DAX 40 and Nasdaq 100 slide on renewed banking woes while EUR/USD, EUR/GBP and GBP/USD drop as the US dollar, gold appreciate due to flight-to-quality flows. Crude oil and copper tumble on recession fears.  Axel Rudolph FSTA | Senior Financial Analyst, London | Publication date: Friday 24 March 2023         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.  
    • Market Breakdown | WTI Oil, EURUSD, GBPNZD, EURAUDHere are the updates & outlook for multiple instruments in my watchlist.1️⃣ WTI Oil daily time frame️The market is trading in a long term bearish trend .After the last sharp bearish movement, the market is steadily recovering.Ahead, I see a major horizontal supply area.Probabilities are high, that the next bearish wave will initiate from there.2️⃣ EURUSD daily time frameAfter a breakout of a solid daily resistance, the market is preparing for its retest.Watch carefully the underlined zone and look for buying opportunities from there.3️⃣ EURAUD weekly time frameThe pair is currently approaching a weekly horizontal resistance cluster.Taking into consideration, that the pair is quite overbought, probabilities will be high to see a pullback from that4️⃣ GBPNZD daily time frameThe pair is currently retesting a broken neckline of an ascending triangle . As we discussed earlier, the trend line of a triangle and its neckline compose a contracting buy zone now.Chances will be high that the next bullish wave will initiate quite soon.For Additional confirmation use: Divergence Indicators
    • #CHFJPY: Classic Bearish Setup 🇨🇭🇯🇵   🔻CHFJPY has nicely respected a confluence zone based on a horizontal 4H resistance and a 0.5 retracement of the last bearish impulse.   The price formed a double top pattern on that and broke its neckline.   Probabilities will be high that the pair will drop lower soon. Goals: 141.172 / 140.363  
×
×
  • Create New...