Skip to main content
Profit and loss here is realized only: the profit or loss Bullionwale recorded on each of your orders when it closed the order. Open positions are not valued, so there is no unrealized or mark-to-market figure anywhere in the API. For a walkthrough with reconciliation, see Following your profit and loss.

What is counted

  • Every order of yours that Bullionwale has closed and recorded a realized_pnl for. Open, pending, rejected and deleted orders are not counted, and neither is a closed order whose metal was later delivered (it reads status closed, status_detail delivered). 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_pnl is the same value as on GET /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. Without from the range starts at your first closed order; without to it runs to now. Without both, it is all time.
  • GET /pnl/daily: to defaults to today (IST) and from to 29 days before to, so the default is the last 30 days. The range may cover at most 366 days.
  • from after to, a range longer than 366 days on /pnl/daily, or a date that is not YYYY-MM-DD is refused with 422 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

On test it is always zero, in the production shape:
200 OK
On production, with three closed orders in the range:
200 OK
379.50 + 999.99 = 1,379.49: the total is the sum of the metals, and of the symbols.

Read it per day

200 OK
On production:
200 OK
Days with nothing closed are listed with "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.