Profit and loss is realized only: it comes from orders Bullionwale has closed. Open positions are not valued, so there is no unrealized or mark-to-market figure to follow. On the test path every figure is zero, because test orders are never closed; the examples below use the production path and a live key, which can read even while production trading is switched off.
orders:read. The examples assume it is in the BULLIONWALE_API_KEY environment variable.
How a profit or loss is realized
- You buy or sell with
POST /orders(or in the app). The order isopen: it has no profit or loss yet. - Bullionwale closes the order. Its
statusbecomesclosed, andclose_price,realized_pnlandclosed_atare set (see the order object). - From then on, the order’s
realized_pnlcounts inGET /pnlon the India Standard Time (IST) day of itsclosed_at.
1. The total for a period
Ask for a range of IST days, both included:200 OK
- A negative amount is a loss: here October closed at a net loss of ₹2,620.51.
- Leave
fromout to start at your first closed order, andtoout to run to now. Leave both out for all time.
2. By metal and by symbol
The same answer carries the breakdown, so no second call is needed:by_metalalways has bothgoldandsilver,"0.00"when nothing closed.symbolslists only symbols with a closed order in the range, sorted bysymbol_code.
3. A daily series for a chart
GET /pnl/daily returns every day of the range, oldest first, with "0.00" on days when nothing closed, so it can be charted as it is:
200 OK
realized_pnl.
- Without
fromandto, you get the last 30 IST days up to today. - One request covers at most 366 days; a longer range is
422 invalid_request. For a longer history, ask for one year at a time and join thedays. - Days are IST calendar days: an order closed at 23:45 IST on 20 October counts on
2026-10-20, although it is already 21 October in some other timezones.
4. Reconcile with your closed orders
To prove the figures, or to keep your own ledger, rebuild them from the orders. Each closed order carries its ownrealized_pnl and closed_at:
- List your closed orders with
GET /orders?status=closed, 200 at a time, usingoffsetto page. - Keep the orders with a
realized_pnl, and whosestatus_detailisclosedorsell_closed. A closed order whose metal was later delivered showsstatusclosedtoo, withstatus_detaildelivered, and is not counted inGET /pnl, by design: the API applies the same P&L rules as the Bullionwale web and mobile apps. - Put each order on the IST day of its
closed_at(or ofcreated_atifclosed_atisnull, which only very old orders have). - Sum per day with decimals, and compare with
GET /pnl/daily.
since on GET /orders filters on when an order was created, not when it closed. An order created last month and closed this month still belongs to this month’s P&L, so do not narrow the order list with since when you reconcile by closing day.
Python
What test returns
The test path answers both calls in the production shape with zeros:realized_pnl "0.00", closed_orders 0, by_metal zeros, an empty symbols, and every day of the range at "0.00". The parameters are checked the same way, so a 422 on test is a 422 on production. Use test to build your parsing, paging and charting; use production reads to see real figures.
Keeping it current
- Poll gently. Realized P&L changes only when Bullionwale closes an order. Reading
GET /pnlfor today every few minutes is plenty, and well within the read budget (see Rate limits). - End of day. Read the finished day after the market closes (23:30 IST; see Market hours), and store it: a past day’s figure changes only if Bullionwale corrects an order.
- Webhooks, once they are turned on, will send
order.closedwhen an order closes, with itsrealized_pnl(see the Event catalog). Until then, poll.