def modify_sl_order(access_token, order_id, quantity, trigger_price):
limit_price = trigger_price + 0.5
string_order_id = str(int(order_id))
url = 'https://api.upstox.com/v2/order/modify'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': access_token,
}
data = {
'quantity': quantity,
'validity': 'DAY',
'price': limit_price,
"order_id": string_order_id,
'order_type': 'SL',
'disclosed_quantity': 0,
'trigger_price': trigger_price
}
try:
# Send the POST request
response = requests.post(url, json=data, headers=headers)
# Print the response status code and body
print('Response Code:', response.status_code)
print('Response Body:', response.json())
except Exception as e:
# Handle exceptions
print('Error:', str(e))
return response.json()
order id is 250306025719555
Response Code: 400
Response Body: {‘status’: ‘error’, ‘errors’: [{‘errorCode’: ‘UDAPI100012’, ‘message’: ‘Invalid Endpoint’, ‘propertyPath’: None, ‘invalidValue’: None, ‘error_code’: ‘UDAPI100012’, ‘property_path’: None, ‘invalid_value’: None}]}