Market positions always rejected

10 posts / 0 new
Last post
roryjohnston
Market positions always rejected

Hi - Having mastered working orders, I'm trying to open forex positions, they are accepted and I get a deal reference, but when I try to confirm them they are always rejected.

I have no frex positions open on the GUI for my demo account, and I have tried...


curl -o foo -H "X-IG-API-KEY: $IG_API_KEY" -H "Content-type: application/json; charset=UTF-8" -H "$cst" -H "$xst" "https://$IG_HOST/gateway/deal/positions/otc" -X POST -H "version: 2" -d '{
"currencyCode": "EUR",
"direction": "BUY",
"epic": "CS.D.GBPEUR.CFD.IP",
"expiry": "DFB",
"forceOpen": "true",
"guaranteedStop": "false",
"level": null,
"limitDistance": null,
"limitLevel": null,
"orderType": "MARKET",
"quoteId": null,
"size": "1",
"stopDistance": null,
"stopLevel": null,
"trailingStop": "false",
"trailingStopIncrement": null
}'

(I have also tried currencycodes of GBP and EUR, expiry of "-" or "DFB", and in this example I have no stop or limit to try to avoid any potential problems. I can open a position equivalent to above with no problems on the GUI.
When I try to confirm I always get...

{
"affectedDeals": [],
"dealId": "DIAAAAALR38MPAZ",
"dealReference": "SNL9LF2W6JSSU53",
"dealStatus": "REJECTED",
"direction": "BUY",
"epic": "CS.D.GBPEUR.CFD.IP",
"expiry": "DFB",
"guaranteedStop": false,
"level": 1.38423,
"limitDistance": null,
"limitLevel": null,
"reason": "UNKNOWN",
"size": 1.0,
"status": "OPEN",
"stopDistance": null,
"stopLevel": null
}

What am I doing wrong please??

APItrader
I had trouble too with market

I had trouble too with market orders Friday. The API Companion returned:

HTTP 0
status: error

which seems like an internal error in IG's system.

belfort
Hi APItrader,

Hi APItrader,

Did you look in the Activity History? (/history/activity)

Every confirmed deal should have an entry in the history with the same dealId. What I do when I get a rejected deal is to wait 1 second and call /history/activity to find the reason, which comes in the "result" field.

It would be much better if the reason came in the /confirms, but for now this is the only way

APItrader
Hi belfort,

Hi belfort,

Thanks for the input. There is nothing in the activity history, but I guess there shouldn't be unless you get an "HTTP 200 OK" response when entering the order. "HTTP 0 Error" probably means that the order didn't make it into the system so there is no deal to confirm.

Chris
Market positions always rejected

Hi all,

Thanks for commenting.

roryjohston, we only able to accept market orders for FX pairs that meet market convention. In the example you provide you are using the GBP/EUR pairing, however market convention is EUR/GBP. Please amend you trade so that you use EUR/GBP, and it should be accepted.

Hope that helps!

Thanks,
Chris

roryjohnston
Wow - you are right of course

Wow - you are right of course -- amended to

{
"currencyCode": "GBP",
"direction": "BUY",
"epic": "CS.D.EURGBP.TODAY.IP",
"expiry": "DFB",

and it was accepted!

I would never have figured that one out, thank you !

I do wonder why the other EPIC code "CS.D.GBPEUR.TODAY.IP" is in your system then? -- (e.g if you search for /gateway/deal/markets?searchTerm=GBREUR)

belfort
Curiously, deals on CS.D

Curiously, deals on CS.D.GBPEUR.CFD.IP are accepted on the web platform but not on the REST API...

APItrader
Chris,

Chris,

What's up with:

HTTP 0
status: error

That's an undocumented response.

belfort
Hi Chris,

Hi Chris,

I thought the same about GBPEUR, but when I tested it it worked, GBPEUR exists in IG like EURGBP, with the opposite price

Chris
Market positions always rejected

Hi Belfort,

You'll be able to trade on GBPEUR on the web platform, but these won't be market orders. As you are using Market Orders via the API that's why you need to use standard market convention. You'll notice that the Market Order option is not available on the web platorm for GBPEUR.

Thanks,
Chris

Log in or register to post comments