What is counted
- Every order of yours that Bullionwale has closed and recorded a
realized_pnlfor. Open, pending, rejected and deleted orders are not counted, and neither is a closed order whose metal was later delivered (it readsstatusclosed,status_detaildelivered). These are the same rules as the profit and loss in the Bullionwale web and mobile apps, so the figures match. - Each order counts on the India Standard Time (IST) calendar day it closed (its
closed_at). An old order without a closing time counts on the day it was created. - An order’s
realized_pnlis the same value as onGET /orders/{order_id}, so the figures here are sums you can reproduce. - Amounts are rupees as decimal strings with 2 decimals. A negative amount is a loss.
Query parameters
GET /pnl: either may be left out. Withoutfromthe range starts at your first closed order; withouttoit runs to now. Without both, it is all time.GET /pnl/daily:todefaults to today (IST) andfromto 29 days beforeto, so the default is the last 30 days. The range may cover at most 366 days.fromafterto, a range longer than 366 days on/pnl/daily, or a date that is notYYYY-MM-DDis refused with422 invalid_request.
The P&L object
GET /pnl returns:
GET /pnl/daily returns:
realized_pnl on both calls equals the sum of its parts: of by_metal, of symbols, and of days.
Read your P&L
200 OK
200 OK
Read it per day
200 OK
200 OK
"0.00", so the series is ready to chart without filling gaps.
A range that is too long:
422 Unprocessable Entity
Test and production
Test is always zero. Test orders are simulated fills that are never closed, so they never realize a profit or loss. The test calls return zero in the production shape, with every day listed on/pnl/daily, so your code can be written and run against them. The same parameters are checked, so a 422 on test is a 422 on production.
Errors
Every code is in the Error reference.