Unable to Place order - RMS Margin Exceeds

order_ref_id: UDAPI-I-h1qTO5tdh6968OWO3kyM28Xl
order_id: ‘250121000007751’
status - ‘RMS: Margin Exceeds’

if you do the calculation of (price * qty) / 5, the amount comes under my available margin, still showing the error, this happens sometimes randomly!

Hi @Mandar_Salvi,

Thanks for sharing the details. We are checking this and will get back to you soon.

Hi @Mandar_Salvi,

We reviewed the logs for the order ID you provided and found that the required margin was approximately 60k at the time, while your available funds were less than the required margin. This is why you encountered the error.

To avoid this issue, you can use our Margin API to check the required margin for orders before placing them.

Thank you!

the post_margin API readme file is showing readme of get_brokerage in python SDK on github

1 Like
import requests
import json

url = "https://api.upstox.com/v2/charges/margin"

payload = {
  "instruments": [
    {
      "instrument_key": "NSE_EQ|INE669E01016",
      "quantity": 1,
      "transaction_type": "BUY",
      "product": "D",
      "price": 16.8
    }
  ]
}
headers = {
    "accept": "application/json",
    "Api-Version": "2.0",
    "Content-Type": "application/x-www-form-urlencoded",
    "Authorization" : f"Bearer {access_tocken}"
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

getting this error -

{"status":"error","errors":[{"errorCode":"UDAPI10000","message":"This request is not supported by Upstox API","propertyPath":null,"invalidValue":null,"error_code":"UDAPI10000","property_path":null,"invalid_value":null}]}

Hi @Mandar_Salvi,

We are checking this and will get back to you soon. Thanks.

Hi @Mandar_Salvi
I noticed two potential issues in the code you provided. First, instead of passing the payload in the data parameter, it should be passed in the json parameter. Second, the headers appear to be incorrect.

For correct example code, please refer to: Upstox Margin Details Documentation.

Thanks for pointing this out, we will get this fixed in next release.

1 Like