samco-sdk / Python-SDK

Official Python SDK for accessing Stocknote API
MIT License
15 stars 11 forks source link

Modify order throwing error for CO order #15

Open swamy086 opened 1 year ago

swamy086 commented 1 year ago

According to docuemntation: the request for modify order should be: samco.modify_order(order_number='200616000000350',body={"quantity": "50"})

But the request giving below error,

modify order response: {'serverTime': '14/10/22 09:27:07', 'validationErrors': ['Please Enter appropriate validity for order - DAY/IOC', 'Please enter a valid order type - L/MKT/SL/SL-M or LIMIT/MARKET/STOPLIMIT/STOPLOSSMARKET']}

even if i make request with the mentioned parameters like below , throwing same error. modify_order = samco.modify_order( order_number=order_num, body={"price": new_price, "orderValidity": samco.VALIDITY_DAY, "orderType": samco.ORDER_TYPE_SLM})

cknmca commented 11 months ago

The ModifyOrder function modify_order() can be used to modify some attributes of an order as long as it is with open/pending status in system. For modification order identifier is mandatory. With order identifier you need to send the optional parameter(s) which needs to be modified. In case the optional parameters aren't sent, the default will be considered from the original order. Modifiable attributes include quantity, Order Type (L,MKT, SL,SL-M). This API cannot be used for modifying attributes of an executed/rejected/cancelled order. Only the attribute that needs to be modified should be sent in the request along with the Order Identifier. Note : In your case you should place one order in using order Api and if the order is going to pending order means you can taken that particular order number then using the above details you can modify with the specific order number means it will work.