Skip to main content
POST 

/us/order/estimate

Estimate Order Charges

API to estimate the charges for a US stocks order before you place it. No order is placed. All amounts are in USD.

A MARKET order is valued at the stock's last traded price. If the last traded price is unavailable, the price in the request is used instead.

Request​

curl --location --request POST 'https://api.upstox.com/v2/us/order/estimate' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {your_access_token}' \
--data '{
"instrument_key": "US_EQ|AAPL",
"transaction_type": "BUY",
"order_type": "LIMIT",
"quantity": 1,
"price": 180
}'

For samples in other languages, see the Sample Code section on this page.

Request Body​

NameRequiredTypeDescription
instrument_keyRequiredstringUS instrument key from the US instruments file, for example US_EQ|AAPL.
transaction_typeRequiredstringPossible values: BUY, SELL.
order_typeRequiredstringPossible values: MARKET, LIMIT.
quantityRequirednumberNumber of shares, up to 9 decimal places. Fractions are allowed only for stocks with fractionable: true. Maximum 999999.
priceOptionalnumberLimit price in USD. Required for a LIMIT order. Optional for a MARKET order, which is valued at the last traded price; price is used only when the last traded price is unavailable. Up to 2 decimal places at or above $1, and up to 4 below $1.

Responses​

Response Body​

{
"status": "success",
"data": {
"trade_value": 180,
"brokerage": 0.45,
"gst": 0.08,
"regulatory_fee": 0.01,
"taf_fee": 0.01,
"cat_fee": 0.01,
"total_charges": 0.56,
"estimated_total": 180.56
}
}
NameTypeDescription
statusstringOutcome of the request. Typically success.
dataobjectEstimated charges for the order.
data.trade_valuenumberQuantity × price. For a LIMIT order, the price is the limit price. For a MARKET order, it is the last traded price, or the request price when no last traded price is available.
data.brokeragenumberUpstox brokerage.
data.gstnumberGST on brokerage.
data.regulatory_feenumberRegulatory fee.
data.taf_feenumberFINRA Trading Activity Fee (TAF).
data.cat_feenumberConsolidated Audit Trail (CAT) fee.
data.total_chargesnumberSum of all charges above.
data.estimated_totalnumberFor a BUY: trade value plus charges. For a SELL: trade value minus charges. null when the estimate returns no charges.

Sample Code​

Estimate charges for an order​

import requests

url = 'https://api.upstox.com/v2/us/order/estimate'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {your_access_token}',
}
data = {
'instrument_key': 'US_EQ|AAPL',
'transaction_type': 'BUY',
'order_type': 'LIMIT',
'quantity': 1,
'price': 180
}

response = requests.post(url, json=data, headers=headers)

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