Kotak-Neo / kotak-neo-api

100 stars 86 forks source link

Modify order not working #36

Closed sumit12dec closed 10 months ago

sumit12dec commented 11 months ago

Below is the response from orders

[{'brkClnt': '08081', 'ordValDt': 'NA', 'exUsrInfo': 'NA', 'mfdBy': 'ATYPR0648C', 'vendorCode': '', 'rmk': '--', 'odCrt': 'NA', 'ordSrc': 'ADMINCPPAPI_TRADEAPI', 'sipInd': 'NA', 'prc': '1405.00', 'prcTp': 'L', 'cnlQty': 0, 'uSec': '960991', 'classification': '0', 'mktPro': '0.00', 'ordEntTm': '14-Aug-2023 14:27:12', 'reqId': '1', 'algSeqNo': 'NA', 'qty': 150, 'unFldSz': 150, 'mktProPct': '--', 'algCat': 'NA', 'exOrdId': '1100000030916215', 'dscQty': 0, 'actId': '9YM74', 'expDt': 'NA', 'trgPrc': '0.00', 'tok': '5258', 'symOrdId': 'NA', 'fldQty': 0, 'ordDtTm': '14-Aug-2023 14:44:40', 'avgPrc': '0.00', 'locId': '111111111111100', 'algId': 'NA', 'stat': 'Ok', 'prod': 'MIS', 'exSeg': 'nse_cm', 'GuiOrdId': '1692003432-914891-ATYPR0648C-ADMINAPI', 'usrId': 'ATYPR0648C', 'rptTp': 'NA', 'exCfmTm': '14-Aug-2023 14:27:12', 'hsUpTm': '2023/08/14 14:44:40', 'ordGenTp': 'NA', 'vldt': 'DAY', 'tckSz': '0.05', 'ordSt': 'open', 'trnsTp': 'S', 'refLmtPrc': 0.0, 'coPct': 0.0, 'nOrdNo': '230814001127432', 'ordAutSt': 'NA', 'rejRsn': 'RMS:Margin Exceeds,Cash Available:1537430.61,Additional margin required:321.49 for entity account-9YM74 across exchange across segment across product ', 'boeSec': 1692004480, 'expDtSsb': '--', 'dscQtyPct': '0', 'stkPrc': '0.00', 'sym': 'INDUSINDBK', 'trdSym': 'INDUSINDBK-EQ', 'multiplier': '1', 'precision': '2', 'noMktProFlg': '0.00', 'genNum': '1', 'series': 'EQ', 'prcNum': '1', 'genDen': '1', 'brdLtQty': '1', 'mktProFlg': '0.00', 'defMktProV': '0.00', 'lotSz': '1', 'minQty': 0, 'optTp': 'XX', 'prcDen': '1'}] ​ I am trying to modify an existing order of SELL at 1405 to 1406, I get a 200 success response but the order isn't modified to the new price of 1406.

Screenshot 2023-08-14 at 2 49 37 PM
sacbhatia commented 11 months ago

Check rejRsn. It will have reason why order is not modified. 200 status is for successful execution of command. But command accepted or rejected is returned in reject reason.

In your case, it says 'RMS:Margin Exceeds,Cash Available:1537430.61,Additional margin required:321.49 for entity account-9YM74 across exchange across segment across product '

sumit12dec commented 11 months ago

rejRsn where is that returned from the Python library? @sacbhatia

sacbhatia commented 11 months ago

It is there in object returned when calling client.modify_order. Capture the response.

Kotak-Neo commented 10 months ago

This is a known behavior, however, we have handled this in the SDK. Please refer to the documentation about Delayed Modify Order Method https://github.com/Kotak-Neo/kotak-neo-api/blob/main/docs/Modify_Order.md