orders are rejected

7 posts / 0 new
Last post
norfolkFarmer
orders are rejected

I've been trying to place orders on a demo account using the "positions/otc" function to get a deal reference. I then input the deal reference to the "confirms" function.

It seems that every order is rejected when I try to get confirmation of it.

An example otc order body is given below:
{
"epic": "TO.D.FXEPT20.14.IP",
"expiry": "18-AUG-14",
"direction": "BUY",
"size": "0.1",
"orderType": "MARKET",
"level": null,
"guaranteedStop": "false",
"stopLevel": null,
"stopDistance": null,
"forceOpen": "false",
"limitLevel": null,
"limitDistance": null,
"quoteId": null,
"currencyCode": "GBP"
}

the dealReference returned from the positions/otc function is then fed into the /confirms function, which responds with:

{
"status": "OPEN",
"dealStatus": "REJECTED",
"epic": "TO.D.FXEPT20.14.IP",
"expiry": "18-AUG-14",
"dealReference": "7E9FDSE95HZM7XU",
"dealId": "DIAAAAAKTXYQPAR",
"affectedDeals": [],
"level": 10.0,
"size": 0.1,
"direction": "BUY",
"stopLevel": null,
"limitLevel": null,
"guaranteedStop": false
}

I have been stuck on this for a few days now, and get the same "rejected" dealStatus every time. I have tried different epics, deal sizes and have checked the constraints for the order-placing function in the API reference manual. I even placed some orders through the normal IG web-interface, then read details of the open position through the API and tried to replicate the order using the API but it was rejected again.

If anybody can see a fault in my original order instruction or steer me in the right direction I'd be very grateful

Chris
orders are rejected

Hi norfolkFarmer

Through the API you can only trade Binaries using LIMIT orders, not MARKET orders.

Try changing the order body to use "orderType": "LIMIT", and add a "level" for the order. Let me know how this goes for you!

Chris

norfolkFarmer
Thanks for the reply - my

Thanks for the reply - my orders are still getting rejected I'm afraid.

I checked the epic I'm targeting is tradeable by accessing the markets information, and placed a limit order:

{
"epic": "TO.D.FXDST00.09.IP",
"expiry": "-",
"direction": "BUY",
"size": "10",
"orderType": "LIMIT",
"level": "35",
"guaranteedStop": "false",
"stopLevel": null,
"stopDistance": null,
"forceOpen": "false",
"limitLevel": null,
"limitDistance": null,
"quoteId": null,
"currencyCode": "GBP"
}

but still the returned dealReference is rejected in the response from the deal confirmation function.

I set a "level" value but not a "limitLevel" - is the "level" enough on it's own, and does the level need to be bigger or smaller then the current bid/offer prices?

Thank you so much for your help

Adam

norfolkFarmer
Actually I just got a deal to

Actually I just got a deal to go through which was accepted.

I had to set an expiry date and change the currencyCode to USD.

Thanks again
Adam

Chris
orders are rejected

Thanks Adam, glad it's sorted.

norfolkFarmer
I wondered if there is a way

I wondered if there is a way I could get the required currency code through the API, so I got market information for that epic from https://demo-api.ig.com/gateway/deal/markets/TO.D.FXDST00.09.IP

the currency data returned was :
"currencies": [{
"code": "SF",
"name": "CHF",
"symbol": "SF",
"baseExchangeRate": 1.51063,
"isDefault": false
}],

so the USD code is not included there. Do you know why the currency code must be USD for the deal to be accepted, and if this is the case for all binary FX instruments?

norfolkFarmer
I see entering "CHF" for the

I see entering "CHF" for the currencyCode field while placing an order works, and "JPY" allows an order to be accepted for the epic 'FB.D.FXPY08.17.IP', for which the markets function returns "JPY" in the currencies.name field.

Sorry to bother you, I think I have a solution now

Log in or register to post comments