There's no dedicated Daily MTM endpoint — this page shows how to derive it from Positions.
Overview
Shoonya doesn't expose a standalone "Daily MTM" API. Your day's mark-to-market is derived by summing rpnl (realized P&L) and urmtom (unrealized mark-to-market) across every row returned by Positions. This page documents that derivation so it doesn't have to be rediscovered per integration.
Derivation
python
positions = client.get_positions()
mtm = 0.0
pnl = 0.0for p in positions:
mtm += float(p["urmtom"])
pnl += float(p["rpnl"])
day_mtm = mtm + pnl
print(f"{day_mtm} is your Daily MTM")
Unrealized mark-to-market on the remaining open net quantity, marked at last traded price.
Best practices
Recompute on every tick or order update if you need a live-updating MTM figure — Positions itself is a REST snapshot, not a stream. A common pattern is to hold local position state, update urmtom from tick LTPs directly (netqty × (ltp − netavgprc) × prcftr), and reconcile the full snapshot from Positions periodically.
Don't confuse this with the segment/product-level realized/unrealized breakdown in Funds & Limits (rzpnl_*, uzpnl_*) — that's a margin-engine view and may not sum identically to the Positions-derived figure due to rounding and timing differences. Use one source consistently rather than cross-checking the two as if they must always agree to the paisa.
Notes
If your use case is a dashboard rather than a trading decision, recomputing this once every few seconds from Positions is usually sufficient — there's rarely a need to recompute on every single tick.
Overview
Shoonya doesn't expose a standalone "Daily MTM" API. Your day's mark-to-market is derived by summing
rpnl(realized P&L) andurmtom(unrealized mark-to-market) across every row returned by Positions. This page documents that derivation so it doesn't have to be rediscovered per integration.Derivation
Best practices
urmtomfrom tick LTPs directly (netqty × (ltp − netavgprc) × prcftr), and reconcile the full snapshot from Positions periodically.rzpnl_*,uzpnl_*) — that's a margin-engine view and may not sum identically to the Positions-derived figure due to rounding and timing differences. Use one source consistently rather than cross-checking the two as if they must always agree to the paisa.Notes
If your use case is a dashboard rather than a trading decision, recomputing this once every few seconds from Positions is usually sufficient — there's rarely a need to recompute on every single tick.