Skip to main content

GET ORDER MARGIN INFO

This API retrieves margin requirements for one or more order legs for authorized end users through a middleware-based integration.

It can be used to calculate approximate margin, available margin, brokerage, and margin shortfall before placing or modifying an order.

🔑 Header Parameters

FieldsTypeRequiredDescriptionExample
AuthorizationstringYesBearer token for authenticationaccess_token
x-api-keystringYesAPI key providedx-api-key

📦 Request Body Schema

FieldsTypeRequiredDescriptionExample/Enum
NoOfLegsintegerYesNumber of order legs2
ModestringYesMargin calculation modeN
FETraceIdstringNoClient request identifier returned in responseMARGIN12345
LegDetailsarray(object)YesMargin calculation request detailsSee below table

📑 Leg Details Object Fields

FieldsTypeRequiredDescriptionExample/Enum
LegNointegerYesLeg number1
BuyOrSellintegerYesTransaction type1
MarketSegmentIdintegerYesExchange Segment ID2
TokenintegerYesScrip token56838
QuantityintegerYesOrder quantity50
PriceintegerYesOrder price in paise250000
MktFlagintegerYesMarket order flag0
OldPriceintegerNoPrevious order price in paise (for order modification)240000
OldQuantityintegerNoPrevious order quantity (for order modification)25
ProductTypestringYesProduct typeM
LegIndicatorintegerNoLeg Indicator1

🟢 Success Response - 200 OK

FieldsTypeDescriptionExample
statusstringStatus of API call"success"
codestringResponse code"s-101"
messagestringSuccess message"Margin calculated successfully"
dataobjectOrder margin detailsSee below table

📘 Data Object Fields

FieldsTypeDescriptionExample
statusintegerMargin request status code0
resultobjectMargin calculation resultSee below table

📘 Result Object Fields

FieldsTypeDescriptionExample
MarketSegmentIdstringExchange Segment ID"2"
TokenstringScrip token"56838"
ApproxMarginstringApproximate margin required"125000"
AvailableMarginstringAvailable margin"450000"
RequestTraceIdstringEcho-back request identifier"MARGIN12345"
ProductTypestringProduct type"M"
ShortFallstringMargin shortfall amount"0"
BrokeragestringBrokerage amount"25"

📝 Notes

  • Used to calculate margin requirements before placing or modifying an order.
  • Supports single-leg and multi-leg margin calculations.
  • Mode = N should be used for fresh orders.
  • Mode = M should be used when calculating margin impact for order modifications.