Jump to content
  • 0

Why is stop level required in update_open_position API endpoint?



Hi, I am struggling to figure out why IG Rest API is asking for a stop_level when I am trying to update the trailing stop.  This is the python code I am trying to run:
response = ig_service.update_open_position(deal_id='XXXXX',limit_level=None, stop_level=None, trailing_stop=True, trailing_stop_distance=25, trailing_stop_increment=1)


IGException: {"errorCode":"validation.not-null-conditional-set-value.request"}

If I change stop_level to: latest price - (the trailing_stop_distance + trailing_stop_increment) then it updates ok, but why do I need to specify the stop_level if its a trailing stop?  The stop_level will change as the price goes up and it shouldn't make a difference what I provide as stop_level surely, as long is the trailing_stop_distance meets the rules?  Am I missing something?  When I created the trade via the create_open_position endpoint, I had stop_level = None and a stop_distance and it went through ok.

Edited by wki
Link to comment

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...