Upscale
Menu
On this page

Get trading stats of the trader account

Try it out ↓
GET/accounts/{accountId}/stats
Get trading stats of the trader accountAccounts

Aggregates over the closed positions of the account: win rate, average profit and loss, risk-reward ratio, max drawdown and average holding times.

  • Responds with an empty body while the account has no closed positions yet.
  • Covers every phase the account has been through, not only the current one.
Base URL https://api.upscale.trade

Authorization

bearerhttp · bearerrequired

Personal API key, prefixed with usk_.

Parameters

Path
accountIdstring · uuidrequired

Trader account identifier. Must belong to the caller.

Example: 00000000-0000-4000-8000-000000000000

Examples

curl --request GET 'https://api.upscale.trade/accounts/{accountId}/stats' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer YOUR_API_KEY'

Responses

200Responseapplication/json
sumPnlstring · fp9required

Realised pnl summed over every closed position, fp9 raw, before fees and funding.

pattern
^(?:-?[1-9][0-9]*|0)$
Example: 1000000000
sumFeestring · fp9required

Trading fees paid over every closed position, fp9 raw.

pattern
^(?:-?[1-9][0-9]*|0)$
Example: 1000000000
sumFundingstring · fp9required

Funding settled over every closed position, fp9 raw. Positive when the account received more than it paid.

pattern
^(?:-?[1-9][0-9]*|0)$
Example: 1000000000
profitstring · fp9required

Net result of the closed positions, fp9 raw: pnl minus fees plus funding. This is what the win rate splits on.

pattern
^(?:-?[1-9][0-9]*|0)$
Example: 1000000000
positionsCountnumberrequired

Number of closed positions the statistics are built from.

Example: 0
profitablePositionsCountnumberrequired

Closed positions that ended at or above break-even.

Example: 0
unprofitablePositionsCountnumberrequired

Closed positions that ended below break-even.

Example: 0
winratePercentnumberrequired

Share of closed positions that ended at or above break-even, in percent with two decimals.

Example: 62.5
minProfitstring · fp9 · nullablerequired

Smallest win among profitable positions, fp9 raw. Null when there is none.

pattern
^(?:-?[1-9][0-9]*|0)$
Example: 1000000000
minLossstring · fp9 · nullablerequired

Smallest loss among losing positions, fp9 raw (negative, closest to zero). Null when there is none.

pattern
^(?:-?[1-9][0-9]*|0)$
Example: 1000000000
maxProfitstring · fp9 · nullablerequired

Largest win, fp9 raw. Null when no position ended in profit.

pattern
^(?:-?[1-9][0-9]*|0)$
Example: 1000000000
maxLossstring · fp9 · nullablerequired

Largest loss, fp9 raw (the most negative value). Null when no position ended in loss.

pattern
^(?:-?[1-9][0-9]*|0)$
Example: 1000000000
avgProfitstring · fp9 · nullablerequired

Average win across profitable positions, fp9 raw. Null when there is none.

pattern
^(?:-?[1-9][0-9]*|0)$
Example: 1000000000
avgLossstring · fp9 · nullablerequired

Average loss across losing positions, fp9 raw (negative). Null when there is none.

pattern
^(?:-?[1-9][0-9]*|0)$
Example: 1000000000
riskRewardRationumber · nullablerequired

Average win over the absolute average loss. Null while no losing position exists to divide by.

Example: 1.8
maxDrawdownPercentnumber · nullablerequired

Deepest equity drawdown of the account across all its phases, in percent with two decimals.

Example: 12.34
avgLongPositionHoldTimenumber · nullablerequired

Average holding time of long positions, in seconds.

Example: 0
avgShortPositionHoldTimenumber · nullablerequired

Average holding time of short positions, in seconds.

Example: 0
avgPositionHoldTimenumber · nullablerequired

Average holding time across all closed positions, in seconds.

Example: 0
medianPositionHoldTimenumber · nullablerequired

Median holding time across all closed positions, in seconds.

Example: 0
maxProfitablePositionHoldTimenumber · nullablerequired

Longest a profitable position was held, in seconds.

Example: 0
maxUnprofitablePositionHoldTimenumber · nullablerequired

Longest a losing position was held, in seconds.

Example: 0
medianProfitablePositionHoldTimenumber · nullablerequired

Median holding time of profitable positions, in seconds.

Example: 0
medianUnprofitablePositionHoldTimenumber · nullablerequired

Median holding time of losing positions, in seconds.

Example: 0
avgLeverageProfitablePositionnumber · nullablerequired

Average leverage of profitable positions — notional over margin, as a plain multiple.

Example: 12
avgLeverageUnprofitablePositionnumber · nullablerequired

Average leverage of losing positions — notional over margin, as a plain multiple.

Example: 20
topMarketstring · nullablerequired

Base asset ticker of the most traded market, by number of closed positions. Null when nothing has been closed.

Example: BTC
topMarketPercentnumber · nullablerequired

Share of closed positions that were on topMarket, in percent with two decimals.

Example: 41.67
401

Unauthorized

403

The account belongs to another user (account_access_denied), or the request is authenticated with an API key while api_trading is disabled on the account (api_trading_not_enabled).

404

No account with this identifier.

429

Rate limit of the API key exceeded (api_key_rate_limit_exceeded). Retry-After says when to come back; the body carries the bucket (read / write), the window that tripped, its limit and retryAt.