ATTACHED_ORDER_LEVEL_ERROR rejection when stop is larger than minNormalStopOrLimitDistance

1 post / 0 new
magoo
ATTACHED_ORDER_LEVEL_ERROR rejection when stop is larger than minNormalStopOrLimitDistance

Hi

I've been writing something to use the REST API for trading and hit an issue this morning where a deal was REJECTED due to "ATTACHED_ORDER_LEVEL_ERROR". However, the stop I had in place was above the minimum points.

Is anyone able to spot where I am going wrong, or perhaps this is a quirk of the Demo API?

Any thoughts would be very helpful.

Details below:

My first call was to get the market details for EURUSD (https://demo-api.ig.com/gateway/deal/markets/CS.D.EURUSD.TODAY.IP). This told me in dealing rules the minNormalStopOrLimitDistance was 2.0 POINTS - sent at 2020-07-31 08:58:05 UK time (07:58:05 UTC).

"minNormalStopOrLimitDistance":
"unit": "POINTS",
"value": 2.0

My next call was to create the position (https://demo-api.ig.com/gateway/deal/positions/otc) where I sent this (not stopDistance of 4.0):

"epic": "CS.D.EURUSD.TODAY.IP",
"expiry": "DFB",
"direction": "BUY",
"size": 0.5,
"level": null,
"orderType": "MARKET",
"guaranteedStop": false,
"stopLevel": null,
"stopDistance": 4.0,
"trailingStop": false,
"trailingStopIncrement": null,
"forceOpen": true,
"limitLevel": null,
"limitDistance": null,
"quoteId": null,
"currencyCode": "GBP"

Then on attempting to confirm the position (https://demo-api.ig.com/gateway/deal/confirms/DEALREFERENCE) I got the rejected response:

"date": "2020-07-31T07:58:05.371",
"status": null,
"reason": "ATTACHED_ORDER_LEVEL_ERROR",
"dealStatus": "REJECTED",
"epic": "CS.D.EURUSD.TODAY.IP",
"expiry": null,
"dealReference": "xxx",
"dealId": "xxx",
"affectedDeals": [],
"level": null,
"size": null,
"direction": "BUY",
"stopLevel": null,
"limitLevel": null,
"stopDistance": null,
"limitDistance": null,
"guaranteedStop": false,

Thanks