Skip to main content

Get Fund And Margin

API to retrieve user funds data for both the equity and commodity markets, including data such as the margin utilized by the user, the available margin for trading, and the total payin amount during the day.

Request

curl --location 'https://api.upstox.com/v2/user/get-funds-and-margin' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your_access_token}'

Additional samples in various languages are available in the Sample Code section on this page.


Query Parameters

NameRequiredTypeDescription
segmentfalsestringDetermines the market segment related to the transaction. Without a specified segment in the request, the response will encompass results for both commodities and equities.
Possible values: for Equity use SEC, for Commodity use COM
Responses

Response Body

{
"status": "success",
"data": {
"equity": {
"used_margin": 0.8,
"payin_amount": 200.0,
"span_margin": 0.0,
"adhoc_margin": 0.0,
"notional_cash": 0.0,
"available_margin": 15507.46,
"exposure_margin": 0.0
},
"commodity": {
"used_margin": 0,
"payin_amount": 0,
"span_margin": 0,
"adhoc_margin": 0,
"notional_cash": 0,
"available_margin": 0,
"exposure_margin": 0
}
}
}
NameTypeDescription
statusstringA string indicating the outcome of the request. Typically success for successful operations.
dataobjectResponse data for Balance
data.used_marginfloatPositive values denote the amount blocked into an Open order or position. Negative value denotes the amount being released.
data.payin_amountfloatInstant payin will reflect here
data.span_marginfloatAmount blocked on futures and options towards SPAN
data.adhoc_marginfloatPayin amount credited through a manual process
data.notional_cashfloatThe amount maintained for withdrawal
data.available_marginfloatTotal margin available for trading
data.exposure_marginfloatAmount blocked on futures and options towards Exposure

Sample Code

import requests

url = 'https://api.upstox.com/v2/user/get-funds-and-margin'

headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {your_access_token}'
}

response = requests.get(url, headers=headers)

print(response.status_code)
print(response.json())
Loading...