/orders/{orderId}Edita una orden pendiente: precio de activación, amount reservado, tolerancia al deslizamiento, o tamaño base. El motor hace esto reemplazando la orden, por lo que la
respuesta contiene una nueva orden con un nuevo identificador, mientras que la anterior termina como canceled_by_update.
Verificado más allá del esquema:
- La orden debe existir y seguir estando
active, y su cuenta debe pertenecer al solicitante y estar en un estado de trading. - Las órdenes
marketyliquidationno se pueden editar en absoluto, ni tampoco una ordenstop/takeque se creó sin un precio de activación (order_not_updatable); un precio de activación que está establecido no se puede restablecer a0(trigger_price_reset_forbidden). - Aumentar la reserva de una orden de incremento requiere la diferencia como saldo libre, y se rechaza mientras la cuenta esté bloqueada por el límite de capital gestionado.
- Una orden creada con
sizeMode: basenecesita unamountnuevo siempre quebaseSizecambie (base_size_requires_amount). - El mercado debe estar abierto, y la orden resultante se vuelve a comprobar exactamente como en la creación — la misma forma de campos, precio de activación y códigos de nocional listados en
POST /ordersse aplican aquí, exceptoinvalid_leverage: el apalancamiento no se puede editar.
Una solicitud que no establece ninguno de los campos no cambia nada y devuelve la orden tal como está.
https://api.upscale.tradeParámetros
orderIdstring · uuidobligatorioIdentificador de la orden que se va a editar.
00000000-0000-4000-8000-000000000000Cuerpo de la solicitud · obligatorio
Campos opcionales: 4
triggerPricestring · int32opcionalNew trigger price, fp9 raw. Bounds are re-checked against the current market price (and, for stop / take, against the liquidation price of the position). A trigger price that is already set cannot be reset to 0.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
65000000000000amountstring · int32opcionalNew amount, fp9 raw, in the unit its order class uses — see the same field on order creation. On an increase order it is the quote reserve: growing it requires the difference to be available as free balance, and it is required together with baseSize on a base-sized order. On a close order it is the base asset size of the position to close.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
100000000000expectedAmountstring · int32opcionalNew slippage tolerance, fp9 raw. See the same field on order creation.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000baseSizestring · int32opcionalNew size in base asset units, fp9 raw. Only for orders created with sizeMode: base.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000{}Ejemplos
curl --request PATCH 'https://api.upscale.trade/orders/{orderId}' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{}'const response = await fetch("https://api.upscale.trade/orders/{orderId}", {
method: "PATCH",
headers: {
"Accept": "application/json",
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
body: "{}",
});
console.log(response.status, await response.text());import requests
response = requests.request(
"PATCH",
"https://api.upscale.trade/orders/{orderId}",
headers={"Accept":"application/json","Authorization":"Bearer YOUR_API_KEY","Content-Type":"application/json"},
data="{}",
timeout=30,
)
print(response.status_code, response.text)Respuestas
No autorizado
La orden ya no está activa. La cuenta pertenece a otro usuario (account_access_denied), o la solicitud está autenticada con una clave de API mientras api_trading está deshabilitado en la cuenta (api_trading_not_enabled). El trading en la cuenta ha terminado en su estado actual (challenge_closed), o la cuenta está bloqueada por el límite de capital gestionado (funded_limit_trading_locked). El mercado está en pausa (market_paused) o solo acepta órdenes de cierre (market_close_only).
No hay ninguna orden con este identificador.
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
idstring · uuidobligatorioOrder 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-000000000000txIdstringobligatorioOrder identifier. Kept for backward compatibility, always equal to id.
stringtraderstring · uuidobligatorioTrader 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 · uuidobligatorioMarket 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 · enumobligatorioLifecycle 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 · enumobligatorioOrder type. liquidation marks an order the engine raised itself.
"market" "limit" "stop" "trailing_stop" "take" "stop_limit" "stop_market" "liquidation"marketdirectionstring · enumobligatorioOrder direction.
"long" "short"longtriggerPricestring · int32obligatorioPrice at which the order fires, fp9 raw. 0 when the order carries no trigger.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000requestedTriggerPricestring · int32 · nullableobligatorioTrigger 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 · int32obligatorioTrigger price of a stop_market / stop_limit order, fp9 raw; 0 for every other type.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000limitPricestring · int32obligatorioPrice 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 · int32obligatorioStop-loss attached to the order, fp9 raw. 0 when none is attached.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000takeTriggerPricestring · int32obligatorioTake-profit attached to the order, fp9 raw. 0 when none is attached.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000trailingStopActivationPricestring · int32obligatorioPrice at which a trailing stop starts trailing, fp9 raw. 0 when it trails from creation.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000trailingStopOffsetstring · int32obligatorioTrailing distance as an absolute quote amount, fp9 raw. 0 when the distance is set as a percent.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000trailingStopOffsetPercentstring · int32obligatorioTrailing distance as a fraction of price, fp9 raw. 0 when the distance is absolute.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000leveragestring · int32 · nullableobligatorioLeverage of the order, fp9 raw. Null on close orders, which inherit the leverage of the position.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000indexstringobligatorioOrder identifier. Kept for backward compatibility, always equal to id.
stringpositionIdstring[]obligatorioPosition a close order is attached to. Null for orders that open or grow a position.
Elementos del array · string
string
Ver ejemplo
[
"string"
]parentOrderIdstring[]obligatorioOrder 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.
Elementos del array · string
string
Ver ejemplo
[
"string"
]expirationstring · date-time · nullableobligatorioAlways null. Kept for backward compatibility — orders do not expire on their own.
2026-05-01T12:30:00.000Zamountstring · int32obligatorioSize 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 · nullableobligatorioIndex price the order executed at, fp9 raw. Null while the order has not executed.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000settlementOraclePricestring · int32obligatorioAlways 1000000000 (1.0). Kept for backward compatibility.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000createdAtstring · date-timeobligatorioWhen the order was accepted.
2026-05-01T12:30:00.000Zerrorstring[]obligatorioAlways null. Kept for backward compatibility — use errorCode.
Elementos del array · string
string
Ver ejemplo
[
"string"
]realizedPnlstring · int32 · nullableobligatorioPnl 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 · nullableobligatorioRealised pnl before the 60-second adjustment, fp9 raw. Differs from realizedPnl only when the adjustment fired.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000profitAdjustmentAppliedbooleanobligatorioWhether 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.
trueexecutedAfterPausebooleanobligatorioWhether the order executed after a market pause. Not set by the current engine — always false.
truesizeModestring · enumobligatorioHow the size was expressed on creation: quote sizes the order by amount, base sizes it by baseSize.
"quote" "base"quotebaseSizestring · int32 · nullableobligatorioOrder size in base asset units, fp9 raw. Null for quote-sized orders.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000reservedAmountstring · int32 · nullableobligatorioQuote 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[]obligatorioWhy 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.
Elementos del array · string
string
Ver ejemplo
[
"string"
]reasonstring · enum · nullableobligatorioWhy 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_close{
"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"
}