Skip to Main Content
POST/NorenWClientAPI/Limits

Funds & Limits

Fetch available margin, cash balance, and a full breakdown of margin utilization across segments and products.

Overview

Funds & Limits returns your account's current cash and margin picture — what's available, what's been used, and a detailed breakdown of exactly what's consuming margin (SPAN, exposure, premium, brokerage) segmented by equity/derivative/FX/commodity and by intraday/margin/carry-forward. Check this before sizing any order rather than discovering insufficient margin via a rejection from RMS.

Parameters

FieldTypeRequiredDescription
uid / actidstringRequiredUser and account ID.
product_typestringOptionalRestrict the response to a single product.
segmentstringOptionalCM (equity), FO (derivatives), or FX (currency).
exchangestringOptionalRestrict to a single exchange.

Request example

import requests, json
 
payload = {"uid": "AB1234", "actid": "AB1234"}
data = f"jData={json.dumps(payload)}&jKey={accessToken}"
 
resp = requests.post("https://api.shoonya.com/NorenWClientAPI/Limits", data=data)
limits = resp.json()
available = float(limits["cash"]) - float(limits["marginused"])
print("Available margin:", available)
const payload = { uid: "AB1234", actid: "AB1234" };
const data = `jData=${JSON.stringify(payload)}&jKey=${accessToken}`;
 
const res = await fetch("https://api.shoonya.com/NorenWClientAPI/Limits", {
  method: "POST",
  headers: { "Content-Type": "application/x-www-form-urlencoded" },
  body: data,
});
const limits = await res.json();
console.log("Available margin:", Number(limits.cash) - Number(limits.marginused));
curl -X POST https://api.shoonya.com/NorenWClientAPI/Limits \
  -H "Content-Type: application/x-www-form-urlencoded" \
  --data-urlencode 'jData={"uid":"AB1234","actid":"AB1234"}' \
  --data-urlencode "jKey=$ACCESS_TOKEN"

Response

json
{
  "stat": "Ok",
  "request_time": "18:07:31 15-12-2024",
  "cash": "1500000.00",
  "payin": "0.00",
  "payout": "0.00",
  "brkcollamt": "0.00",
  "marginused": "394554.00",
  "span": "210300.00",
  "expo": "48200.00",
  "premium": "0.00",
  "brokerage": "412.50",
  "collateral": "0.00",
  "turnoverlmt": "50000000.00",
  "pendordvallmt": "20000000.00",
  "turnover": "391500.00",
  "pendordval": "287100.00",
  "rpnl": "1200.00",
  "unmtom": "3054.00"
}
Field groupKey fieldsMeaning
Cashcash, payin, payout, unclearedcash, daycashCore margin available and today's fund movements.
Margin utilizedmarginused, mtomcurperTotal margin/funds consumed today and current MTM percentage.
Margin componentsspan, expo, premium, varelm, marprt, brokerage, collateralWhat's actually consuming the used margin — SPAN, exposure, option premium, VaR/ELM, covered-product margin, brokerage, and pledged collateral value.
Risk limitsturnoverlmt, pendordvallmt, turnover, pendordvalConfigured ceilings vs. current usage for turnover and pending order value.
Segment/product breakuprzpnl_e_i, uzpnl_d_m, span_c_i, brkage_f_h, etc.Every core figure above also comes broken out by segment (e=equity, d=derivative, f=FX, c=commodity) and product (i=intraday, m=margin/carry-forward, c=CNC, h=cover, b=bracket).
Segment/product suffix conventionFields ending in _<segment>_<product> (e.g. rzpnl_d_i = realized P&L, derivatives, intraday) repeat the same handful of metrics per bucket. Parse them generically with a suffix split rather than hardcoding every field name.

Error handling

json
{ "stat": "Not_Ok", "emsg": "Server Timeout :  " }

Best practices

  • Check available margin here before every order that materially changes exposure — don't rely on RMS rejection as your sizing feedback loop, since that rejection happens after the order has already left your system.
  • For a strategy running across multiple segments, use the segment-suffixed fields to see per-segment margin consumption rather than only the aggregate.
  • Not every field is populated on every account — treat undocumented/missing fields as 0 or absent rather than erroring.

Notes

This is the same underlying data as the Limits/Margin view in the Shoonya terminal. Field names shown follow standard NorenOMS convention — confirm the exact set returned for your account type before building alerting logic on top of it.