0

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.

2
  • 1
    Hi, I'm having a similar issue, were you able to solve this? Commented May 1 at 10:41
  • Yea. Change the order_type = STOP instead of order_type="LIMIT", Commented May 22 at 13:53

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.