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

14 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
Guest Simon

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
Guest simon

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

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
      16,693
    • Total Posts
      79,594
    • Total Members
      65,200
    • Most Online
      7,522
      10/06/21 10:53

    Newest Member
    MamaTee
    Joined 08/12/21 13:06
  • Posts

    • Pfizer Inc. and BioNTech SE said initial lab studies show a third dose of their Covid-19 vaccine neutralizes the omicron variant, results that will accelerate booster shot drives around the world.  A booster with the current version of the vaccine raises antibodies 25-fold, providing a similar level as observed after two doses against the original virus and other variants, the companies said. So-called T-cells still provide protection against severe illness, they said. Full story: Bloomberg
    • LONDON — The U.K. government could be poised to announced more Covid restrictions for England amid concerns over the spread of the omicron variant, according to a report in the Financial Times on Wednesday. The paper, which cited three unnamed senior Whitehall officials, said the sources had told the newspaper that the government had decided to implement its so-called “Plan B” of increased restrictions, including vaccine passports for large venues and an order to work from home. The new restrictions could be announced at a press conference as early as Wednesday with regulations laid before Parliament on Thursday, according to government insiders speaking to the paper. Full story: CNBC The emergence of a video in which staff are joking about the Christmas party, which Prime Minister Boris Johnson has insisted never took place, could further undermine public confidence in the government and adherence to Covid restrictions. This is a breaking news story, please check for further updates. CNBC
    • Bank of Canada Preview: How Will the Canadian Dollar (CAD) React?   USD/CAD, BOC Price Analysis & News CAD Reaction Dependent on Absorption of Economic Slack Assessment Risks are Geared Towards Disappointment Prompting a CAD Pullback OVERVIEW: The Bank of Canada is expected to maintain its current monetary policy stance with the overnight rate to remain at 0.25%. The current stance from the BoC is that the policy rate will remain on hold until economic slack is absorbed, which is expected to happen sometime in the middle quarters of 2022. That said, while expectations over a possible Q1 rate rise has increased, with no monetary policy report until January, there is a risk of disappointment should the BoC maintain its current stance and not bring forward expectations that economic slack will be absorbed in Q1. How to Trade Forex News: An Introduction ECONOMIC DATA: While economic data has largely evolved as the Bank had anticipated, the main data point that has prompted an increase in BoC tightening bets had been the stellar labour market report, which crushed expectations with Canada appearing to move beyond full employment. However, the key focus is whether this is enough to lead to the BoC bringing forward the expected closure of economic slack to Q1, particularly in light of the new Omicron variant, which could see the BoC stick to its current stance. Taking a look at the BoC’s MPR assumptions, the central bank based its assumptions on Brent and WTI at $80/bbl and $75/bbl respectively. In turn, with oil prices seeing a notable correction, this could somewhat temper the BoC’s optimistic message and thus provide another reason for sticking to its current stance. MPR OCTOBER ASSUMPTIONS Brent close to $80 (Currently $75) WTI close to $75 (Currently $72) WCS close to $65 (Currently $54) MARKET REACTION: My view is that the BoC meeting is gearing up for a slight disappointment and thus will result in a slight pullback for the Canadian Dollar. The trigger will be the guidance surrounding the Bank’s assessment on when economic slack is expected to be absorbed. Therefore, given that money markets are pricing in five rate hikes throughout 2022 and surprisingly a slight chance of a hike at this meeting (14%), the bar has been set high to surprise on the hawkish side, however, a hawkish surprise can be achieved if the Bank sees slack absorbed in Q1. Although, with no new forecasts or press conference, I suspect the Bank maintains current guidance and thus the Loonie will come under initial short term pressure. Additionally, with CAD buying picking up into the meeting, market participants are leaning on the bullish side, which in turn could exacerbate the short term pullback. As it stands, the option implied move for USD/CAD is at 62pips, therefore, a disappointment would likely see the 1.2700 handle come into play. With that being said, risk appetite and oil prices are likely to have a bigger role in determining the trajectory for the Canadian Dollar in the longer term. By Justin McQueen, Analyst, 8th December 2021. DailyFX
×
×
  • Create New...