Skip to Main Content
POST/NorenWClientAPI/TradeBook

Trade Book

Fetch every executed fill (trade) for the account today — distinct from Order Book, which lists orders, not fills.

Overview

Trade Book returns one row per fill, not per order. A single order that fills in three exchange-side matches produces three rows here, each carrying its own flid (fill ID), flqty, and flprc — while Order Book would still show that order as one row with an aggregated fillshares/avgprc.

Parameters

FieldTypeRequiredDescription
uidstringRequiredLogged-in user ID.
actidstringRequiredAccount ID of the logged-in user.

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/TradeBook", data=data)
for t in resp.json():
    print(t["tsym"], t["trantype"], t["flqty"], "@", t["flprc"])
const payload = { uid: "AB1234", actid: "AB1234" };
const data = `jData=${JSON.stringify(payload)}&jKey=${accessToken}`;
 
const res = await fetch("https://api.shoonya.com/NorenWClientAPI/TradeBook", {
  method: "POST",
  headers: { "Content-Type": "application/x-www-form-urlencoded" },
  body: data,
});
console.log(await res.json());
curl -X POST https://api.shoonya.com/NorenWClientAPI/TradeBook \
  -H "Content-Type: application/x-www-form-urlencoded" \
  --data-urlencode 'jData={"uid":"AB1234","actid":"AB1234"}' \
  --data-urlencode "jKey=$ACCESS_TOKEN"

Response

json
[
  {
    "stat": "Ok",
    "norenordno": "20121300065715",
    "exch": "NSE",
    "tsym": "ACCELYA-EQ",
    "trantype": "S",
    "qty": "180",
    "prd": "M",
    "prctyp": "LMT",
    "flid": "102",
    "fltm": "01-01-1980 00:00:00",
    "flqty": "180",
    "flprc": "800.00",
    "fillshares": "180",
    "avgprc": "800.00",
    "exchordid": "6857",
    "remarks": "WC TEST Order"
  }
]
FieldDescription
flidFill ID — unique per execution, not per order.
flqty / flprcQuantity and price of this specific fill.
fillshares / avgprcCumulative totals for the parent order, same fields as Order Book.

Error handling

json
{
  "stat": "Not_Ok",
  "emsg": "Session Expired : Invalid Session Key"
}

Best practices

  • Group rows by norenordno when you need per-order fill history; group by flid only when you need individual execution-level detail (e.g. for slippage analysis against each fill's timestamp).
  • Use this for trade-level P&L reconstruction and audit trails — Positions gives you the current net state, Trade Book gives you how it got there.

Notes

fltm/exch_tm timestamps have shown placeholder epoch values (01-01-1980) in some environments for older fills — don't rely on them for latency measurement without validating against your own environment first.