Jump to content
  • 0

Why is stop level required in update_open_position API endpoint?


wki

Question

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)
print(response)

output:

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
  • image.png

  • Posts

    • Elliott Wave Analysis TradingLounge Daily Chart, Cadarno/ U.S. dollar(ADAUSD) ADAUSD Elliott Wave Technical Analysis  Function: Counter Trend Mode: Corrective Structure: Flat Position: Wave C Direction Next higher Degrees: wave (II) of Impulse Wave Cancel invalid level:  Details: Wave II Is equal to 61.8% of Wave I at 0.358 Cadarno/ U.S. dollar(ADAUSD)Trading Strategy: The second wave correction in the Expanded Flat pattern, where we are in the middle of a decline in Wave C, will have five extended internal sub-waves. But we still have one more decline left for Wave C to complete. So wait for the correction to complete to rejoin the trend. Cardano/ U.S. dollar(ADAUSD)Technical Indicators: The price is below the MA200 indicating a Dow trend, The Wave Oscillator is a Bearish Momentum.       Elliott Wave Analysis TradingLounge H4 Chart, Cadarno/ U.S. dollar(ADAUSD) ADAUSD Elliott Wave Technical Analysis  Function: Follow Trend Mode: Motive Structure: Impulse Position: Wave 4 Direction Next higher Degrees: wave C of Flat Wave Cancel invalid level:  Details: A short-term pullback in wave 4 before falling again in wave 5. Cardano/ U.S. dollar(ADAUSD)Trading Strategy: The second wave correction in the Expanded Flat pattern, where we are in the middle of a decline in Wave C, will have five extended internal sub-waves. But we still have one more decline left for Wave C to complete. So wait for the correction to complete to rejoin the trend. Cardano/ U.S. dollar(ADAUSD)Technical Indicators: The price is below the MA200 indicating a Dow trend, The Wave Oscillator is a Bearish Momentum. Technical Analyst : Kittiampon Somboonsod Source : Tradinglounge.com get trial here!    
×
×
  • Create New...
us