I have an open position already. I have separately added an SL order (type=4) for the same symbol where LTP is 10, but when I try to modify it, I get the following error.
Code:
data = {‘id’: ‘23053000172563’, ‘stopPrice’: 3.0, ‘limitPrice’: 2.5}
response = fyersModelObject.modify_order(data=data)
Error:
{‘s’: ‘error’, ‘code’: -50, ‘message’: ‘stopPrice: Must be less than or equal to 0’, ‘id’: ‘23053000172563’}
Hi @lonevoyagerchannel-ss5,
Upon checking, it’s working fine from our end. However, use the below Python code and check.
from fyers_api import fyersModel
client_id = "SPXXXXE7-100"
access_token = "eyJ0eXAiOiJK***.eyJpc3MiOiJhcGkuZnllcnM***.IzcuRxg4tnXiULCx3***"
fyers = fyersModel.FyersModel(client_id=client_id, token=access_token, log_path="/home/user/logs")
orderId = "*3******141"
data = {
"id":orderId,
"type":4,
"limitPrice": 2.50,
"stopPrice": 3.00,
"qty":1
}
response = fyers.modify_order(data=data)
print(response) (Edited)
Hello Shurthi,
Thanks for answering. I am still getting the same error, can you please re-check or check if the issue is specific to my app?
Update:
I think I have figured that this bug appears only when ‘type’ attribute is not set. However, as type is not a mandatory attribute and it is not the one that I want to change, I am not specifying it. This should be fixed. Also the error message returned is quite wrong. Following is the error message:
{‘s’: ‘error’, ‘code’: -50, ‘message’: ‘stopPrice: Must be less than or equal to 0’, ‘id’: ‘23053100308612’}
I will be glad to give you more details if you need.