/positions/{accountId}/{asset}/historyEl historial de posiciones de la cuenta acotado a un mercado, del más reciente al más antiguo y paginado. La misma regla de fase que el historial de toda la cartera.
https://api.upscale.tradeParámetros
accountIdstring · uuidobligatorioIdentificador de la cuenta del trader. Debe pertenecer al solicitante.
- pattern
- ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
00000000-0000-4000-8000-000000000000assetstringobligatorioTicker del activo base del mercado, tal como lo devuelve GET /v2/markets.
- minLength
- 1
BTClimitintegeropcionalTamaño de página: cuántos registros devolver.
Predeterminado: 20
- minimum
- 1
- maximum
- 100
20offsetintegeropcionalCuántos registros omitir antes de la página.
Predeterminado: 0
- minimum
- 0
- maximum
- 9007199254740991
0Ejemplos
curl --request GET 'https://api.upscale.trade/positions/{accountId}/{asset}/history' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY'const response = await fetch("https://api.upscale.trade/positions/{accountId}/{asset}/history", {
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/positions/{accountId}/{asset}/history",
headers={"Accept":"application/json","Authorization":"Bearer YOUR_API_KEY"},
timeout=30,
)
print(response.status_code, response.text)Respuestas
No autorizado
La cuenta pertenece a otro usuario (account_access_denied), o la solicitud se autentica con una clave de API mientras api_trading está deshabilitado en la cuenta (api_trading_not_enabled).
No hay ninguna cuenta con este identificador, o no hay ningún mercado para este ticker.
Se superó el límite de velocidad de la clave de API (api_key_rate_limit_exceeded). Retry-After indica cuándo volver; el cuerpo incluye el bucket (read / write), la ventana que se activó, su límite y retryAt.
defaultRespuestaapplication/json
dataobject[]obligatorioRequested page of positions, newest first.
Elementos del array · object
idxstring · nullableobligatorioPosition identifier. Same value as txId.
stringtxIdstring · nullableobligatorioPosition identifier. Kept for backward compatibility, always equal to idx.
stringversionnumberobligatorioRevision of the position: incremented by every event applied to it.
0openedAtstring · date-timeobligatorioWhen the position was opened.
2026-05-01T12:30:00.000ZlastUpdatedAtstring · date-timeobligatorioWhen the last event was applied to the position.
2026-05-01T12:30:00.000ZclosedAtstring · date-time · nullableobligatorioWhen the position was closed; null while it is still open.
2026-05-01T12:30:00.000Ztypestring · enumobligatorioDirection of the position. Same value as direction.
"long" "short"longstatusstring · enumobligatorioWhether the position is still open, closed by the trader, or liquidated.
"opened" "closed" "liquidated"openedmarketstring · uuidobligatorioMarket the position is held on.
- pattern
- ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
00000000-0000-4000-8000-000000000000traderstring · uuidobligatorioTrader account the position belongs to.
- pattern
- ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
00000000-0000-4000-8000-000000000000sizestring · int32obligatorioPosition size in base asset units, fp9 raw.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000notionalstring · int32obligatorioOpen notional of the position in quote currency, fp9 raw — size at entry price.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000fractionstring · int32obligatorioAlways 0. Kept for backward compatibility.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000marginstring · int32obligatorioMargin currently backing the position, fp9 raw. Moves with pnl, funding and manual margin changes.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000pnlstring · int32 · nullableobligatorioRealised pnl accumulated over every event of the position, fp9 raw.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000fundingstring · int32 · nullableobligatorioFunding paid (negative) or received (positive) over the life of the position, fp9 raw.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000rolloverFeestring · int32obligatorioAlways 0. Kept for backward compatibility.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000settlementOraclePricestring · int32obligatorioAlways 1000000000 (1.0). Kept for backward compatibility.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000feestring · int32obligatorioTrading fees charged over the life of the position, fp9 raw.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000feeRatestring · int32obligatorioFee rate applied to the position, fp9 raw fraction (1000000 = 0.1%).
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000exchangedQuotestring · int32obligatorioQuote amount exchanged by the most recent event, fp9 raw.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000exchangedBasestring · int32obligatorioBase amount exchanged by the most recent event, fp9 raw.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000directionstring · enumobligatorioDirection of the position.
"long" "short"longeventNamestring · enumobligatorioType of the most recent event applied to the position.
"addMargin" "removeMargin" "closePosition" "increasePosition" "liquidate" "forceClose" "payFunding"addMarginpnlInEventstring · int32obligatorioRealised pnl of the most recent event, fp9 raw.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000rawPnlInEventstring · int32obligatorioRealised pnl of the most recent event before the 60-second adjustment, fp9 raw. Differs from pnlInEvent only when the adjustment fired.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000profitAdjustmentAppliedbooleanobligatorioWhether the 60-second adjustment capped the profit of the most recent event — inside a minute of an open or increase the position pnl cannot grow above what it was at that moment.
trueholdingTimeMsstring · nullableobligatorioHow long the position was held before the most recent close, in milliseconds, counted from the open or the last increase. Null on events that are not closes.
stringfeeInEventstring · int32obligatorioFee charged by the most recent event, fp9 raw.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000fundingInEventstring · int32obligatorioFunding settled by the most recent event, fp9 raw.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000rolloverFeeInEventstring · int32obligatorioAlways 0. Kept for backward compatibility.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000executionFeeRatestring · int32obligatorioAlways 0. Kept for backward compatibility.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000executionFeeInEventstring · int32obligatorioAlways 0. Kept for backward compatibility.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000executionFeestring · int32obligatorioAlways 0. Kept for backward compatibility.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000timestampstring · date-timeobligatorioTimestamp of the most recent event. Same value as lastUpdatedAt.
2026-05-01T12:30:00.000ZisOnchainbooleanobligatorioAlways true. Kept for backward compatibility.
trueroestring · int32obligatorioReturn on equity of the position — realised pnl over the margin put up, fp9 raw fraction.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000scalpingCoefficientstring · int32obligatorioDynamic spread multiplier the position was charged, fp9 raw (1000000000 = 1.0). Above 1 when the trade fell inside the market scalping window.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000closeReasonstring · nullableobligatorioWhy the platform closed the position (for example weekly_session_risk_close). Null for positions closed by the trader and for open ones.
stringVer ejemplo
[
{
"idx": "string",
"txId": "string",
"version": 0,
"openedAt": "2026-05-01T12:30:00.000Z",
"lastUpdatedAt": "2026-05-01T12:30:00.000Z",
"closedAt": "2026-05-01T12:30:00.000Z",
"type": "long",
"status": "opened",
"market": "00000000-0000-4000-8000-000000000000",
"trader": "00000000-0000-4000-8000-000000000000",
"size": "1000000000",
"notional": "1000000000",
"fraction": "1000000000",
"margin": "1000000000",
"pnl": "1000000000",
"funding": "1000000000",
"rolloverFee": "1000000000",
"settlementOraclePrice": "1000000000",
"fee": "1000000000",
"feeRate": "1000000000",
"exchangedQuote": "1000000000",
"exchangedBase": "1000000000",
"direction": "long",
"eventName": "addMargin",
"pnlInEvent": "1000000000",
"rawPnlInEvent": "1000000000",
"profitAdjustmentApplied": true,
"holdingTimeMs": "string",
"feeInEvent": "1000000000",
"fundingInEvent": "1000000000",
"rolloverFeeInEvent": "1000000000",
"executionFeeRate": "1000000000",
"executionFeeInEvent": "1000000000",
"executionFee": "1000000000",
"timestamp": "2026-05-01T12:30:00.000Z",
"isOnchain": true,
"roe": "1000000000",
"scalpingCoefficient": "1000000000",
"closeReason": "string"
}
]totalCountnumberobligatorioTotal number of positions matching the request, across all pages.
0{
"data": [
{
"idx": "string",
"txId": "string",
"version": 0,
"openedAt": "2026-05-01T12:30:00.000Z",
"lastUpdatedAt": "2026-05-01T12:30:00.000Z",
"closedAt": "2026-05-01T12:30:00.000Z",
"type": "long",
"status": "opened",
"market": "00000000-0000-4000-8000-000000000000",
"trader": "00000000-0000-4000-8000-000000000000",
"size": "1000000000",
"notional": "1000000000",
"fraction": "1000000000",
"margin": "1000000000",
"pnl": "1000000000",
"funding": "1000000000",
"rolloverFee": "1000000000",
"settlementOraclePrice": "1000000000",
"fee": "1000000000",
"feeRate": "1000000000",
"exchangedQuote": "1000000000",
"exchangedBase": "1000000000",
"direction": "long",
"eventName": "addMargin",
"pnlInEvent": "1000000000",
"rawPnlInEvent": "1000000000",
"profitAdjustmentApplied": true,
"holdingTimeMs": "string",
"feeInEvent": "1000000000",
"fundingInEvent": "1000000000",
"rolloverFeeInEvent": "1000000000",
"executionFeeRate": "1000000000",
"executionFeeInEvent": "1000000000",
"executionFee": "1000000000",
"timestamp": "2026-05-01T12:30:00.000Z",
"isOnchain": true,
"roe": "1000000000",
"scalpingCoefficient": "1000000000",
"closeReason": "string"
}
],
"totalCount": 0
}