/positions/{positionId}/historyWhat happened to one position, newest first: increases, partial and full closes, liquidation, force close, margin changes.
- Funding payments are left out of this feed.
- A force close carries the market event behind it, which is where the reason for it lives.
https://api.upscale.tradeParameters
positionIdstring · uuidrequiredPosition identifier. Its account must belong to the caller.
00000000-0000-4000-8000-000000000000Examples
curl --request GET 'https://api.upscale.trade/positions/{positionId}/history' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY'const response = await fetch("https://api.upscale.trade/positions/{positionId}/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/{positionId}/history",
headers={"Accept":"application/json","Authorization":"Bearer YOUR_API_KEY"},
timeout=30,
)
print(response.status_code, response.text)Responses
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 position 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.
defaultResponseapplication/json
Array of PositionEventResponse
idxstring[]requiredPosition identifier. Same value as txId.
Array items · string
string
View example
[
"string"
]txIdstring[]requiredPosition identifier. Kept for backward compatibility, always equal to idx.
Array items · string
string
View example
[
"string"
]versionnumberrequiredRevision of the position: incremented by every event applied to it.
0openedAtstring · date-timerequiredWhen the position was opened.
2026-05-01T12:30:00.000ZlastUpdatedAtstring · date-timerequiredWhen the last event was applied to the position.
2026-05-01T12:30:00.000ZclosedAtstring · date-time · nullablerequiredWhen the position was closed; null while it is still open.
2026-05-01T12:30:00.000Ztypestring · enumrequiredDirection of the position. Same value as direction.
"long" "short"longstatusstring · enumrequiredWhether the position is still open, closed by the trader, or liquidated.
"opened" "closed" "liquidated"openedmarketstring · uuidrequiredMarket 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 · uuidrequiredTrader 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 · int32requiredPosition size in base asset units, fp9 raw.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000notionalstring · int32requiredOpen notional of the position in quote currency, fp9 raw — size at entry price.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000fractionstring · int32requiredAlways 0. Kept for backward compatibility.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000marginstring · int32requiredMargin currently backing the position, fp9 raw. Moves with pnl, funding and manual margin changes.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000pnlstring · int32 · nullablerequiredRealised pnl accumulated over every event of the position, fp9 raw.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000fundingstring · int32 · nullablerequiredFunding paid (negative) or received (positive) over the life of the position, fp9 raw.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000rolloverFeestring · int32requiredAlways 0. Kept for backward compatibility.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000settlementOraclePricestring · int32requiredAlways 1000000000 (1.0). Kept for backward compatibility.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000feestring · int32requiredTrading fees charged over the life of the position, fp9 raw.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000feeRatestring · int32requiredFee rate applied to the position, fp9 raw fraction (1000000 = 0.1%).
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000exchangedQuotestring · int32requiredQuote amount exchanged by the most recent event, fp9 raw.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000exchangedBasestring · int32requiredBase amount exchanged by the most recent event, fp9 raw.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000directionstring · enumrequiredDirection of the position.
"long" "short"longeventNamestring · enumrequiredType of the most recent event applied to the position.
"addMargin" "removeMargin" "closePosition" "increasePosition" "liquidate" "forceClose" "payFunding"addMarginpnlInEventstring · int32requiredRealised pnl of the most recent event, fp9 raw.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000rawPnlInEventstring · int32requiredRealised 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)$
1000000000profitAdjustmentAppliedbooleanrequiredWhether 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[]requiredHow 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.
Array items · string
string
View example
[
"string"
]feeInEventstring · int32requiredFee charged by the most recent event, fp9 raw.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000fundingInEventstring · int32requiredFunding settled by the most recent event, fp9 raw.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000rolloverFeeInEventstring · int32requiredAlways 0. Kept for backward compatibility.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000executionFeeRatestring · int32requiredAlways 0. Kept for backward compatibility.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000executionFeeInEventstring · int32requiredAlways 0. Kept for backward compatibility.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000executionFeestring · int32requiredAlways 0. Kept for backward compatibility.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000timestampstring · date-timerequiredTimestamp of the most recent event. Same value as lastUpdatedAt.
2026-05-01T12:30:00.000ZisOnchainbooleanrequiredAlways true. Kept for backward compatibility.
trueroestring · int32requiredReturn on equity of the position — realised pnl over the margin put up, fp9 raw fraction.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000scalpingCoefficientstring · int32requiredDynamic 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[]requiredWhy the platform closed the position (for example weekly_session_risk_close). Null for positions closed by the trader and for open ones.
Array items · string
string
View example
[
"string"
]orderobject · nullablerequiredOrder that produced this event; null for events the platform raised on its own, such as funding or a force close.
Object · 35 fields
idstring · uuidrequiredOrder identifier.
- 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-000000000000txIdstringrequiredOrder identifier. Kept for backward compatibility, always equal to id.
stringtraderstring · uuidrequiredTrader account the order 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-000000000000marketstring · uuidrequiredMarket the order is placed 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-000000000000statusstring · enumrequiredLifecycle state: active while it waits, executed once filled, canceled when cancelled by the trader or the platform, canceled_by_update when replaced by an edit, canceled_by_position when the position it was attached to went away, canceled_by_error when execution failed — see errorCode.
"active" "canceled" "canceled_by_update" "canceled_by_error" "canceled_by_position" "executed"activetypestring · enumrequiredOrder type. liquidation marks an order the engine raised itself.
"market" "limit" "stop" "trailing_stop" "take" "stop_limit" "stop_market" "liquidation"marketdirectionstring · enumrequiredOrder direction.
"long" "short"longtriggerPricestring · int32requiredPrice at which the order fires, fp9 raw. 0 when the order carries no trigger.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000requestedTriggerPricestring · int32 · nullablerequiredTrigger price as requested, before the engine pushed it out to the minimum stop distance, fp9 raw. Null when the requested price was kept as is.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000stopPricestring · int32requiredTrigger price of a stop_market / stop_limit order, fp9 raw; 0 for every other type.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000limitPricestring · int32requiredPrice the order is placed at once triggered, fp9 raw: the stop-limit price, falling back to the trigger price.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000stopTriggerPricestring · int32requiredStop-loss attached to the order, fp9 raw. 0 when none is attached.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000takeTriggerPricestring · int32requiredTake-profit attached to the order, fp9 raw. 0 when none is attached.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000trailingStopActivationPricestring · int32requiredPrice at which a trailing stop starts trailing, fp9 raw. 0 when it trails from creation.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000trailingStopOffsetstring · int32requiredTrailing distance as an absolute quote amount, fp9 raw. 0 when the distance is set as a percent.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000trailingStopOffsetPercentstring · int32requiredTrailing distance as a fraction of price, fp9 raw. 0 when the distance is absolute.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000leveragestring · int32 · nullablerequiredLeverage of the order, fp9 raw. Null on close orders, which inherit the leverage of the position.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000indexstringrequiredOrder identifier. Kept for backward compatibility, always equal to id.
stringpositionIdstring · nullablerequiredPosition a close order is attached to. Null for orders that open or grow a position.
stringparentOrderIdstring · nullablerequiredOrder this one was spawned from: a stop or take created out of stopTriggerPrice / takeTriggerPrice, or the limit order a stop_limit turned into. Null when the order was submitted directly.
stringexpirationstring · date-time · nullablerequiredAlways null. Kept for backward compatibility — orders do not expire on their own.
2026-05-01T12:30:00.000Zamountstring · int32requiredSize of the order, fp9 raw, in the unit its class uses: on an increase order a quote amount — the reserve while it waits, and what it actually spent once executed; on a close order (stop, take, trailing_stop) the base asset size it closes, as requested at creation.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000indexPricestring · int32 · nullablerequiredIndex price the order executed at, fp9 raw. Null while the order has not executed.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000settlementOraclePricestring · int32requiredAlways 1000000000 (1.0). Kept for backward compatibility.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000createdAtstring · date-timerequiredWhen the order was accepted.
2026-05-01T12:30:00.000Zerrorstring · nullablerequiredAlways null. Kept for backward compatibility — use errorCode.
stringrealizedPnlstring · int32 · nullablerequiredPnl realised by this order, fp9 raw. Set only on an executed close order; null while pending and on orders that open or grow a position.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000rawRealizedPnlstring · int32 · nullablerequiredRealised pnl before the 60-second adjustment, fp9 raw. Differs from realizedPnl only when the adjustment fired.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000profitAdjustmentAppliedbooleanrequiredWhether the 60-second adjustment capped the profit of this order — inside a minute of an open or increase the position pnl cannot grow above what it was at that moment.
trueexecutedAfterPausebooleanrequiredWhether the order executed after a market pause. Not set by the current engine — always false.
truesizeModestring · enumrequiredHow the size was expressed on creation: quote sizes the order by amount, base sizes it by baseSize.
"quote" "base"quotebaseSizestring · int32 · nullablerequiredOrder size in base asset units, fp9 raw. Null for quote-sized orders.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000reservedAmountstring · int32 · nullablerequiredQuote amount reserved when the order with sizeMode=base was created, fp9 raw. Stays at the original reserve after execution, while amount is rewritten to what was spent. Null for quote-sized orders, where amount is the reserve.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000errorCodestring · nullablerequiredWhy execution failed, set together with status canceled_by_error — for example insufficient_reserve_at_execution, order_below_min_notional, order_exceeds_market_depth or slippage_tolerance. Null otherwise.
stringreasonstring · enum · nullablerequiredWhy the platform cancelled the order itself, for example force_close or weekly_session_risk_close. Null for trader-driven cancellations.
"force_close" "stop_accounts_fail" "stop_accounts_freeze" "stop_accounts_promote" "stop_accounts_manual" "weekly_session_risk_close" nullforce_closeView example
{
"id": "00000000-0000-4000-8000-000000000000",
"txId": "string",
"trader": "00000000-0000-4000-8000-000000000000",
"market": "00000000-0000-4000-8000-000000000000",
"status": "active",
"type": "market",
"direction": "long",
"triggerPrice": "1000000000",
"requestedTriggerPrice": "1000000000",
"stopPrice": "1000000000",
"limitPrice": "1000000000",
"stopTriggerPrice": "1000000000",
"takeTriggerPrice": "1000000000",
"trailingStopActivationPrice": "1000000000",
"trailingStopOffset": "1000000000",
"trailingStopOffsetPercent": "1000000000",
"leverage": "1000000000",
"index": "string",
"positionId": "string",
"parentOrderId": "string",
"expiration": "2026-05-01T12:30:00.000Z",
"amount": "1000000000",
"indexPrice": "1000000000",
"settlementOraclePrice": "1000000000",
"createdAt": "2026-05-01T12:30:00.000Z",
"error": "string",
"realizedPnl": "1000000000",
"rawRealizedPnl": "1000000000",
"profitAdjustmentApplied": true,
"executedAfterPause": true,
"sizeMode": "quote",
"baseSize": "1000000000",
"reservedAmount": "1000000000",
"errorCode": "string",
"reason": "force_close"
}[
{
"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"
],
"order": {
"id": "00000000-0000-4000-8000-000000000000",
"txId": "string",
"trader": "00000000-0000-4000-8000-000000000000",
"market": "00000000-0000-4000-8000-000000000000",
"status": "active",
"type": "market",
"direction": "long",
"triggerPrice": "1000000000",
"requestedTriggerPrice": "1000000000",
"stopPrice": "1000000000",
"limitPrice": "1000000000",
"stopTriggerPrice": "1000000000",
"takeTriggerPrice": "1000000000",
"trailingStopActivationPrice": "1000000000",
"trailingStopOffset": "1000000000",
"trailingStopOffsetPercent": "1000000000",
"leverage": "1000000000",
"index": "string",
"positionId": "string",
"parentOrderId": "string",
"expiration": "2026-05-01T12:30:00.000Z",
"amount": "1000000000",
"indexPrice": "1000000000",
"settlementOraclePrice": "1000000000",
"createdAt": "2026-05-01T12:30:00.000Z",
"error": "string",
"realizedPnl": "1000000000",
"rawRealizedPnl": "1000000000",
"profitAdjustmentApplied": true,
"executedAfterPause": true,
"sizeMode": "quote",
"baseSize": "1000000000",
"reservedAmount": "1000000000",
"errorCode": "string",
"reason": "force_close"
}
}
]