Modifying SL order via API

I am trying to modify an exiting Stop Loss order using API by the below method

fyers.update_orders(
token=token,
data={
“id”: orderid,
“type”: “3”,
“limitPrice”: 0,
“stopLoss”: slprice
}
)

The response I am getting is below .

{‘code’: 400, ‘data’: , ‘message’: ‘Nothing to Modify’}

on the above call orderid is the order id of existing SL order and slprice is the new modified SL price

The SL order is not getting modified to the new SL price . Can anyone please help me what is going wrong here

Hey, looks like you are passing the stop price / trigger price in the wrong field..

stopLoss field is used only for leg 2 orders for CO and BO product type.

You need to use stopPrice field instead. Refer this: https://api-docs.fyers.in/v2/#single-order

Hope this clarifies.

Thanks @yashas !

After doing your suggested changes it working perfectly.

I’m trying to modify stoploss of an order, which i placed.

{‘s’: ‘error’, ‘code’: -162, ‘message’: ‘This order has already traded’, ‘id’: ‘2220808363182’}

Process completed successfully

orderId = “2220808363182”

data={

   "id": orderId,

   "type": "1",

   "limitPrice": 0,

   "stopPrice": stopprice

}

print(fyers.modify_order(data))

Also tried,
print(fyers.update_order(fyers,data))

File “C:\Program Files\Ampps\www\hitstocks\Execution[ExecuteoneCommand.py](http://ExecuteoneCommand.py)”, line 179, in

print(fyers.update_order(fyers,data))

AttributeError: ‘FyersModel’ object has no attribute ‘update_order’. Did you mean: ‘place_order’?

I am facing issue,

FyersOrderManager - modifyOrder 222120915725 response {“s”: “error”, “code”: -174, “message”: “Basic Validation Fails”, “id”: “222120915725”}

I tried both:

    data = {

        *"id"*:  orderId,

        *"type"*: *'4'*, 

        *"limitPrice"*: 0,

        *"qty"*: None,

        *"stopPrice"*: *'112.0'*

    }

and

    data = {

        *"id"*:  orderId,

        *"type"*: *'4'*, 

        *"limitPrice"*: *'112.0'*,

        *"qty"*: None

    }

@tejas_khoday @yashas can you help here, many people are facing the issue

Hi,
Can you please check the parameters that you are passing, qty cannot be None,
Please refer the docs,
https://myapi.fyers.in/docs/#tag/Other-Transactions/paths/~1OtherTransactions/post

Using API, I am trying to modify an existing Stop Loss order

By writing flyers.update_orders((“SweetiePooth”),"
Token represents the token,
data={
“id”: ordered,
“type”: “3”,
As long as “limitPrice” is set to zero,
The field “stopLoss” should be filled in with the following value:
}
)

I am getting the following response in response to my question.

The code for this message is 400, the data is , and the news is ‘Nothing to Modify’.

In the above call, the order is the order id of an existing SL order, while the price is the new modified SL price based on the current SL order.

There is a problem with the SL order not being modified to reflect the new SL price. It would be greatly appreciated if someone could tell me what is wrong here and how to fix it.