/accounts/{accountId}/statsАгрегирует по закрытым позициям аккаунта: доля выигрышей, средняя прибыль и убыток, соотношение риска и вознаграждения, максимальная просадка и среднее время удержания.
- Отвечает пустым телом, пока у аккаунта ещё нет закрытых позиций.
- Охватывает каждую фазу, через которую прошёл аккаунт, а не только текущую.
https://api.upscale.tradeПараметры
accountIdstring · uuidобязательноИдентификатор торгового аккаунта. Должен принадлежать вызывающей стороне.
00000000-0000-4000-8000-000000000000Примеры
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)Ответы
200Ответapplication/json
sumPnlstring · fp9обязательноRealised pnl summed over every closed position, fp9 raw, before fees and funding.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000sumFeestring · fp9обязательноTrading fees paid over every closed position, fp9 raw.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000sumFundingstring · fp9обязательноFunding settled over every closed position, fp9 raw. Positive when the account received more than it paid.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000profitstring · fp9обязательно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)$
1000000000positionsCountnumberобязательноNumber of closed positions the statistics are built from.
0profitablePositionsCountnumberобязательноClosed positions that ended at or above break-even.
0unprofitablePositionsCountnumberобязательноClosed positions that ended below break-even.
0winratePercentnumberобязательноShare of closed positions that ended at or above break-even, in percent with two decimals.
62.5minProfitstring · fp9 · nullableобязательноSmallest win among profitable positions, fp9 raw. Null when there is none.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000minLossstring · fp9 · nullableобязательноSmallest loss among losing positions, fp9 raw (negative, closest to zero). Null when there is none.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000maxProfitstring · fp9 · nullableобязательноLargest win, fp9 raw. Null when no position ended in profit.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000maxLossstring · fp9 · nullableобязательноLargest loss, fp9 raw (the most negative value). Null when no position ended in loss.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000avgProfitstring · fp9 · nullableобязательноAverage win across profitable positions, fp9 raw. Null when there is none.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000avgLossstring · fp9 · nullableобязательноAverage loss across losing positions, fp9 raw (negative). Null when there is none.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000riskRewardRationumber · nullableобязательноAverage win over the absolute average loss. Null while no losing position exists to divide by.
1.8maxDrawdownPercentnumber · nullableобязательноDeepest equity drawdown of the account across all its phases, in percent with two decimals.
12.34avgLongPositionHoldTimenumber · nullableобязательноAverage holding time of long positions, in seconds.
0avgShortPositionHoldTimenumber · nullableобязательноAverage holding time of short positions, in seconds.
0avgPositionHoldTimenumber · nullableобязательноAverage holding time across all closed positions, in seconds.
0medianPositionHoldTimenumber · nullableобязательноMedian holding time across all closed positions, in seconds.
0maxProfitablePositionHoldTimenumber · nullableобязательноLongest a profitable position was held, in seconds.
0maxUnprofitablePositionHoldTimenumber · nullableобязательноLongest a losing position was held, in seconds.
0medianProfitablePositionHoldTimenumber · nullableобязательноMedian holding time of profitable positions, in seconds.
0medianUnprofitablePositionHoldTimenumber · nullableобязательноMedian holding time of losing positions, in seconds.
0avgLeverageProfitablePositionnumber · nullableобязательноAverage leverage of profitable positions — notional over margin, as a plain multiple.
12avgLeverageUnprofitablePositionnumber · nullableобязательноAverage leverage of losing positions — notional over margin, as a plain multiple.
20topMarketstring · nullableобязательноBase asset ticker of the most traded market, by number of closed positions. Null when nothing has been closed.
BTCtopMarketPercentnumber · nullableобязательноShare 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
}Неавторизовано
Аккаунт принадлежит другому пользователю (account_access_denied), или запрос аутентифицирован с помощью API-ключа, тогда как api_trading отключён на аккаунте (api_trading_not_enabled).
Нет аккаунта с этим идентификатором.
Превышен лимит частоты запросов API-ключа (api_key_rate_limit_exceeded). Retry-After указывает, когда вернуться; тело содержит бакет (read / write), окно, которое сработало, его лимит и retryAt.