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.