/accounts/{accountId}/statsAggregates 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.
https://api.upscale.tradeParameters
accountIdstring · uuidrequiredTrader account identifier. Must belong to the caller.
00000000-0000-4000-8000-000000000000Examples
curl --request GET 'https://api.upscale.trade/accounts/{accountId}/stats' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY'const response = await fetch("https://api.upscale.trade/accounts/{accountId}/stats", {
method: "GET",
headers: {
"Accept": "application/json",
"Authorization": "Bearer YOUR_API_KEY"
},
});
console.log(response.status, await response.text());import requests
response = requests.request(
"GET",
"https://api.upscale.trade/accounts/{accountId}/stats",
headers={"Accept":"application/json","Authorization":"Bearer YOUR_API_KEY"},
timeout=30,
)
print(response.status_code, response.text)Responses
200Responseapplication/json
sumPnlstring · fp9requiredRealised pnl summed over every closed position, fp9 raw, before fees and funding.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000sumFeestring · fp9requiredTrading fees paid over every closed position, fp9 raw.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000sumFundingstring · fp9requiredFunding settled over every closed position, fp9 raw. Positive when the account received more than it paid.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000profitstring · fp9requiredNet 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)$
1000000000positionsCountnumberrequiredNumber of closed positions the statistics are built from.
0profitablePositionsCountnumberrequiredClosed positions that ended at or above break-even.
0unprofitablePositionsCountnumberrequiredClosed positions that ended below break-even.
0winratePercentnumberrequiredShare of closed positions that ended at or above break-even, in percent with two decimals.
62.5minProfitstring · fp9 · nullablerequiredSmallest win among profitable positions, fp9 raw. Null when there is none.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000minLossstring · fp9 · nullablerequiredSmallest loss among losing positions, fp9 raw (negative, closest to zero). Null when there is none.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000maxProfitstring · fp9 · nullablerequiredLargest win, fp9 raw. Null when no position ended in profit.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000maxLossstring · fp9 · nullablerequiredLargest loss, fp9 raw (the most negative value). Null when no position ended in loss.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000avgProfitstring · fp9 · nullablerequiredAverage win across profitable positions, fp9 raw. Null when there is none.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000avgLossstring · fp9 · nullablerequiredAverage loss across losing positions, fp9 raw (negative). Null when there is none.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000riskRewardRationumber · nullablerequiredAverage win over the absolute average loss. Null while no losing position exists to divide by.
1.8maxDrawdownPercentnumber · nullablerequiredDeepest equity drawdown of the account across all its phases, in percent with two decimals.
12.34avgLongPositionHoldTimenumber · nullablerequiredAverage holding time of long positions, in seconds.
0avgShortPositionHoldTimenumber · nullablerequiredAverage holding time of short positions, in seconds.
0avgPositionHoldTimenumber · nullablerequiredAverage holding time across all closed positions, in seconds.
0medianPositionHoldTimenumber · nullablerequiredMedian holding time across all closed positions, in seconds.
0maxProfitablePositionHoldTimenumber · nullablerequiredLongest a profitable position was held, in seconds.
0maxUnprofitablePositionHoldTimenumber · nullablerequiredLongest a losing position was held, in seconds.
0medianProfitablePositionHoldTimenumber · nullablerequiredMedian holding time of profitable positions, in seconds.
0medianUnprofitablePositionHoldTimenumber · nullablerequiredMedian holding time of losing positions, in seconds.
0avgLeverageProfitablePositionnumber · nullablerequiredAverage leverage of profitable positions — notional over margin, as a plain multiple.
12avgLeverageUnprofitablePositionnumber · nullablerequiredAverage leverage of losing positions — notional over margin, as a plain multiple.
20topMarketstring · nullablerequiredBase asset ticker of the most traded market, by number of closed positions. Null when nothing has been closed.
BTCtopMarketPercentnumber · nullablerequiredShare of closed positions that were on topMarket, in percent with two decimals.
41.67{
"sumPnl": "1000000000",
"sumFee": "1000000000",
"sumFunding": "1000000000",
"profit": "1000000000",
"positionsCount": 0,
"profitablePositionsCount": 0,
"unprofitablePositionsCount": 0,
"winratePercent": 62.5,
"minProfit": "1000000000",
"minLoss": "1000000000",
"maxProfit": "1000000000",
"maxLoss": "1000000000",
"avgProfit": "1000000000",
"avgLoss": "1000000000",
"riskRewardRatio": 1.8,
"maxDrawdownPercent": 12.34,
"avgLongPositionHoldTime": 0,
"avgShortPositionHoldTime": 0,
"avgPositionHoldTime": 0,
"medianPositionHoldTime": 0,
"maxProfitablePositionHoldTime": 0,
"maxUnprofitablePositionHoldTime": 0,
"medianProfitablePositionHoldTime": 0,
"medianUnprofitablePositionHoldTime": 0,
"avgLeverageProfitablePosition": 12,
"avgLeverageUnprofitablePosition": 20,
"topMarket": "BTC",
"topMarketPercent": 41.67
}Unauthorized
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).
No account with this identifier.
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.