Skip to content

API Reference / Profit

Get aggregate profit for a workspace

Returns the workspace's aggregate profit, including total buy cost, sell revenue, realised and unrealised figures, and item counts. Optionally scoped to one contract and a time range.

POST/contracts.v1.Contracts/GetPnLSummary

Request body

application/jsonRequired

Request for the caller's workspace profit, optionally for one contract and for sales completed within a time range.

accountNames?array<string>

Optional filter: only items held on, or sold or lost from, one of these Steam accounts. Narrows every component. At most 200.

buyingContractIds?array<string>

Optional filter: only items one of these contracts bought, unlike contract_id, which also credits a contract's sales of items another contract bought. Narrows every component. At most 200.

contractId?string

Optional filter: scope the summary to one contract's realised and unrealised figures instead of the whole workspace.

Format"byte" base64

endTime?string

Optional end of the time range that filters the realised components on sale completion time. The unrealised and lifetime buy components ignore this range.

Format"date-time"

marketHashNames?array<string>

Optional filter: only items with one of these exact names. Narrows every component. At most 200.

query?string

Optional filter: only items whose name contains this text, ignoring case. Narrows every component.

sellingContractIds?array<string>

Optional filter: only items whose selling contract is one of these. Narrows every component. At most 200.

sellingMarketplaces?array<string>

Optional filter: only items sold or lost on one of these markets, so the unrealised components are zero under it. At most 20.

startTime?string

Optional start of the time range that filters the realised components (sell revenue, realised profit, and sold-item counts) on sale completion time. The unrealised and lifetime buy components ignore this range.

Format"date-time"

Response body

application/json

Success

summary?PnLSummary

The requested aggregate profit summary.

Show attributes
averageHoldingDuration?string

Average time from acquiring an item to selling it, over the items sold in the period. Unset when no item sold in the period has an acquired time.

itemsInInventory?string

Number of items in scope that are still held and not yet sold.

Format"int64"

itemsLost?string

Items lost in scope: they left the account and no money came for them. Never counted in items_sold.

Format"int64"

itemsSold?string

Number of items in scope that have sold.

Format"int64"

lossItemCount?string

Number of items sold in the period for less than they cost.

Format"int64"

lostCostCents?string

The buy cost of the items lost in scope, in cents. Realized_pnl_cents already subtracts it.

Format"int64"

lostCostMicros?string

lost_cost_cents in millionths of a dollar, from the exact buy prices.

Format"int64"

realizedPnlCents?string

Realised profit in scope, in cents: total_sell_revenue_cents minus the buy cost of those same sold items, minus the cost of the items lost (lost_cost_cents).

Format"int64"

realizedPnlMicros?string

realized_pnl_cents in millionths of a dollar: total_sell_revenue_cents times 10,000 minus the exact buy cost of those sold items and of the items lost. Exact to the millionth of a dollar, so a purchase charged a fraction of a cent counts at what it cost. The _cents figure beside it sums prices rounded up to a cent and is kept for limits.

Format"int64"

totalBuyCostCents?string

Lifetime buy cost in scope, in cents: the sum of listing_price_cents over every purchase, held and sold alike, for the workspace or for the one contract the request scoped to.

Format"int64"

totalBuyCostMicros?string

total_buy_cost_cents in millionths of a dollar, summed from the exact buy prices. Exact to the millionth of a dollar, so a purchase charged a fraction of a cent counts at what it cost. The _cents figure beside it sums prices rounded up to a cent and is kept for limits.

Format"int64"

totalPurchases?string

Lifetime count of purchases in scope, held and sold alike.

Format"int64"

totalSellRevenueCents?string

Realised sell revenue in scope, in cents: the sum of sell_price_cents over every sold item counted in this summary.

Format"int64"

unrealizedCostCents?string

Unrealised cost in scope, in cents: the buy cost basis of items still held and not yet sold.

Format"int64"

unrealizedCostMicros?string

unrealized_cost_cents in millionths of a dollar, summed from the exact buy prices. Exact to the millionth of a dollar, so a purchase charged a fraction of a cent counts at what it cost. The _cents figure beside it sums prices rounded up to a cent and is kept for limits.

Format"int64"

curl -X POST "https://api.goldmine.to/contracts.v1.Contracts/GetPnLSummary" \
  -H "Authorization: Bearer $CSTRADER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "startTime": "2026-01-01T00:00:00Z",
    "endTime": "2026-06-30T23:59:59Z"
  }'
{
  "summary": {
    "totalBuyCostCents": "1250000",
    "totalSellRevenueCents": "1480000",
    "realizedPnlCents": "230000",
    "unrealizedCostCents": "420000",
    "totalPurchases": "312",
    "itemsInInventory": "95",
    "itemsSold": "217"
  }
}