I have tried to place a limit order in Python (using Trading-IG).
Here is the code:
resp = ig_service.create_working_order(
currency_code="GBP",
direction="BUY",
epic='IX.D.SPTRD.DAILY.IP',
expiry='DFB',
guaranteed_stop=False,
level='5445',
size='1',
force_open= 'true',
time_in_force="GOOD_TILL_CANCELLED",
order_type="LIMIT",
limit_distance='6',
stop_distance='2'
)
print(f"resp:{resp}")
print(f"Status:{resp['status']}")
print(f"Reason:{resp['reason']}")
print(f"dealId:{resp['dealId']}")
Now, since the level (level='5445') is higher than the current price and the direction is BUY (direction="BUY"), then I get this error:
Reason:ATTACHED_ORDER_LEVEL_ERROR
If the direction was "SELL", then the order would have been placed.
Does anyone know why?
I know there is similar issue here: IG Trading API, Market Order Not Working. ATTACHED_ORDER_LEVEL_ERROR
Yet I can't figure out the solution.
asked Apr 16, 2025 at 15:24
Giampaolo Levorato
1,7622 gold badges17 silver badges32 bronze badges
-
1Hi, I'm having a similar issue, were you able to solve this?classicSchmosby98– classicSchmosby982025年05月01日 10:41:34 +00:00Commented May 1, 2025 at 10:41
-
Yea. Change the order_type = STOP instead of order_type="LIMIT",Giampaolo Levorato– Giampaolo Levorato2025年05月22日 13:53:47 +00:00Commented May 22, 2025 at 13:53
lang-py