Upscale
Menu
On this page

Cambiar el precio de activación de la orden

Probar ↓
PATCH/orders/{orderId}
Cambiar el precio de activación de la ordenTrading

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 market y liquidation no se pueden editar en absoluto, ni tampoco una orden stop / take que se creó sin un precio de activación (order_not_updatable); un precio de activación que está establecido no se puede restablecer a 0 (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: base necesita un amount nuevo siempre que baseSize cambie (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 /orders se aplican aquí, excepto invalid_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á.

URL base https://api.upscale.trade

Autorización

bearerhttp · bearerobligatorio

Clave de API personal, con el prefijo usk_.

Parámetros

Ruta
orderIdstring · uuidobligatorio

Identificador de la orden que se va a editar.

Ejemplo: 00000000-0000-4000-8000-000000000000

Cuerpo de la solicitud · obligatorio

Campos opcionales: 4
triggerPricestring · int32opcional

New 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)$
Ejemplo: 65000000000000
amountstring · int32opcional

New 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)$
Ejemplo: 100000000000
expectedAmountstring · int32opcional

New slippage tolerance, fp9 raw. See the same field on order creation.

pattern
^(?:-?[1-9][0-9]*|0)$
Ejemplo: 1000000000
baseSizestring · int32opcional

New size in base asset units, fp9 raw. Only for orders created with sizeMode: base.

pattern
^(?:-?[1-9][0-9]*|0)$
Ejemplo: 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 '{}'

Respuestas

401

No autorizado

403

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).

404

No hay ninguna orden con este identificador.

429

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 · uuidobligatorio

Order 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})$
Ejemplo: 00000000-0000-4000-8000-000000000000
txIdstringobligatorio

Order identifier. Kept for backward compatibility, always equal to id.

Ejemplo: string
traderstring · uuidobligatorio

Trader 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})$
Ejemplo: 00000000-0000-4000-8000-000000000000
marketstring · uuidobligatorio

Market 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})$
Ejemplo: 00000000-0000-4000-8000-000000000000
statusstring · enumobligatorio

Lifecycle 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.

Permitido: "active" "canceled" "canceled_by_update" "canceled_by_error" "canceled_by_position" "executed"
Ejemplo: active
typestring · enumobligatorio

Order type. liquidation marks an order the engine raised itself.

Permitido: "market" "limit" "stop" "trailing_stop" "take" "stop_limit" "stop_market" "liquidation"
Ejemplo: market
directionstring · enumobligatorio

Order direction.

Permitido: "long" "short"
Ejemplo: long
triggerPricestring · int32obligatorio

Price at which the order fires, fp9 raw. 0 when the order carries no trigger.

pattern
^(?:-?[1-9][0-9]*|0)$
Ejemplo: 1000000000
requestedTriggerPricestring · int32 · nullableobligatorio

Trigger 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)$
Ejemplo: 1000000000
stopPricestring · int32obligatorio

Trigger price of a stop_market / stop_limit order, fp9 raw; 0 for every other type.

pattern
^(?:-?[1-9][0-9]*|0)$
Ejemplo: 1000000000
limitPricestring · int32obligatorio

Price 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)$
Ejemplo: 1000000000
stopTriggerPricestring · int32obligatorio

Stop-loss attached to the order, fp9 raw. 0 when none is attached.

pattern
^(?:-?[1-9][0-9]*|0)$
Ejemplo: 1000000000
takeTriggerPricestring · int32obligatorio

Take-profit attached to the order, fp9 raw. 0 when none is attached.

pattern
^(?:-?[1-9][0-9]*|0)$
Ejemplo: 1000000000
trailingStopActivationPricestring · int32obligatorio

Price at which a trailing stop starts trailing, fp9 raw. 0 when it trails from creation.

pattern
^(?:-?[1-9][0-9]*|0)$
Ejemplo: 1000000000
trailingStopOffsetstring · int32obligatorio

Trailing distance as an absolute quote amount, fp9 raw. 0 when the distance is set as a percent.

pattern
^(?:-?[1-9][0-9]*|0)$
Ejemplo: 1000000000
trailingStopOffsetPercentstring · int32obligatorio

Trailing distance as a fraction of price, fp9 raw. 0 when the distance is absolute.

pattern
^(?:-?[1-9][0-9]*|0)$
Ejemplo: 1000000000
leveragestring · int32 · nullableobligatorio

Leverage of the order, fp9 raw. Null on close orders, which inherit the leverage of the position.

pattern
^(?:-?[1-9][0-9]*|0)$
Ejemplo: 1000000000
indexstringobligatorio

Order identifier. Kept for backward compatibility, always equal to id.

Ejemplo: string
positionIdstring[]obligatorio

Position a close order is attached to. Null for orders that open or grow a position.

Elementos del array · string

string

Ver ejemplo
[
  "string"
]
parentOrderIdstring[]obligatorio

Order 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 · nullableobligatorio

Always null. Kept for backward compatibility — orders do not expire on their own.

Ejemplo: 2026-05-01T12:30:00.000Z
amountstring · int32obligatorio

Size 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)$
Ejemplo: 1000000000
indexPricestring · int32 · nullableobligatorio

Index price the order executed at, fp9 raw. Null while the order has not executed.

pattern
^(?:-?[1-9][0-9]*|0)$
Ejemplo: 1000000000
settlementOraclePricestring · int32obligatorio

Always 1000000000 (1.0). Kept for backward compatibility.

pattern
^(?:-?[1-9][0-9]*|0)$
Ejemplo: 1000000000
createdAtstring · date-timeobligatorio

When the order was accepted.

Ejemplo: 2026-05-01T12:30:00.000Z
errorstring[]obligatorio

Always null. Kept for backward compatibility — use errorCode.

Elementos del array · string

string

Ver ejemplo
[
  "string"
]
realizedPnlstring · int32 · nullableobligatorio

Pnl 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)$
Ejemplo: 1000000000
rawRealizedPnlstring · int32 · nullableobligatorio

Realised pnl before the 60-second adjustment, fp9 raw. Differs from realizedPnl only when the adjustment fired.

pattern
^(?:-?[1-9][0-9]*|0)$
Ejemplo: 1000000000
profitAdjustmentAppliedbooleanobligatorio

Whether 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.

Ejemplo: true
executedAfterPausebooleanobligatorio

Whether the order executed after a market pause. Not set by the current engine — always false.

Ejemplo: true
sizeModestring · enumobligatorio

How the size was expressed on creation: quote sizes the order by amount, base sizes it by baseSize.

Permitido: "quote" "base"
Ejemplo: quote
baseSizestring · int32 · nullableobligatorio

Order size in base asset units, fp9 raw. Null for quote-sized orders.

pattern
^(?:-?[1-9][0-9]*|0)$
Ejemplo: 1000000000
reservedAmountstring · int32 · nullableobligatorio

Quote 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)$
Ejemplo: 1000000000
errorCodestring[]obligatorio

Why 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 · nullableobligatorio

Why the platform cancelled the order itself, for example force_close or weekly_session_risk_close. Null for trader-driven cancellations.

Permitido: "force_close" "stop_accounts_fail" "stop_accounts_freeze" "stop_accounts_promote" "stop_accounts_manual" "weekly_session_risk_close" null
Ejemplo: force_close