/orders/{orderId}Редактирует ожидающий ордер: триггерную цену, зарезервированный amount, допуск проскальзывания или базовый размер. Движок делает это путём замены ордера, поэтому
ответ содержит новый ордер с новым идентификатором, а предыдущий в итоге становится canceled_by_update.
Проверено вне схемы:
- Ордер должен существовать и всё ещё быть
active, а его счёт должен принадлежать вызывающему и находиться в торговом статусе. - Ордера
marketиliquidationвообще нельзя редактировать, как и ордерstop/take, созданный без триггерной цены (order_not_updatable); установленную триггерную цену нельзя сбросить в0(trigger_price_reset_forbidden). - Увеличение резерва ордера на увеличение требует разницу в качестве свободного баланса и отклоняется, пока счёт заблокирован лимитом управляемого капитала.
- Ордер, созданный с
sizeMode: base, требует новогоamountвсякий раз, когда изменяетсяbaseSize(base_size_requires_amount). - Рынок должен быть открыт, и полученный ордер перепроверяется точно так же, как при создании — те же коды формы полей, триггерной цены и номинала, перечисленные в
POST /orders, применяются здесь, кромеinvalid_leverage: кредитное плечо нельзя редактировать.
Запрос, который не задаёт ни одного из полей, ничего не меняет и возвращает ордер в текущем состоянии.
https://api.upscale.tradeПараметры
orderIdstring · uuidобязательноИдентификатор ордера, который нужно редактировать.
00000000-0000-4000-8000-000000000000Тело запроса · обязательно
Необязательные поля: 4
triggerPricestring · int32необязательно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)$
65000000000000amountstring · int32необязательно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)$
100000000000expectedAmountstring · int32необязательноNew slippage tolerance, fp9 raw. See the same field on order creation.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000baseSizestring · int32необязательноNew size in base asset units, fp9 raw. Only for orders created with sizeMode: base.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000{}Примеры
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)Ответы
Неавторизовано
Ордер больше не активен. Аккаунт принадлежит другому пользователю (account_access_denied), или запрос аутентифицирован с помощью API-ключа, пока api_trading отключён на аккаунте (api_trading_not_enabled). Торговля на аккаунте завершена в его текущем статусе (challenge_closed), или аккаунт заблокирован лимитом управляемого капитала (funded_limit_trading_locked). Рынок приостановлен (market_paused) или принимает только ордера на закрытие (market_close_only).
Нет ордера с этим идентификатором.
Превышен лимит частоты запросов API-ключа (api_key_rate_limit_exceeded). Retry-After указывает, когда вернуться; тело содержит бакет (read / write), окно, которое сработало, его лимит и retryAt.
defaultОтветapplication/json
idstring · uuidобязательно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})$
00000000-0000-4000-8000-000000000000txIdstringобязательноOrder identifier. Kept for backward compatibility, always equal to id.
stringtraderstring · uuidобязательно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})$
00000000-0000-4000-8000-000000000000marketstring · uuidобязательно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})$
00000000-0000-4000-8000-000000000000statusstring · enumобязательно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.
"active" "canceled" "canceled_by_update" "canceled_by_error" "canceled_by_position" "executed"activetypestring · enumобязательноOrder type. liquidation marks an order the engine raised itself.
"market" "limit" "stop" "trailing_stop" "take" "stop_limit" "stop_market" "liquidation"marketdirectionstring · enumобязательноOrder direction.
"long" "short"longtriggerPricestring · int32обязательноPrice at which the order fires, fp9 raw. 0 when the order carries no trigger.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000requestedTriggerPricestring · int32 · nullableобязательно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)$
1000000000stopPricestring · int32обязательноTrigger price of a stop_market / stop_limit order, fp9 raw; 0 for every other type.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000limitPricestring · int32обязательно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)$
1000000000stopTriggerPricestring · int32обязательноStop-loss attached to the order, fp9 raw. 0 when none is attached.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000takeTriggerPricestring · int32обязательноTake-profit attached to the order, fp9 raw. 0 when none is attached.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000trailingStopActivationPricestring · int32обязательноPrice at which a trailing stop starts trailing, fp9 raw. 0 when it trails from creation.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000trailingStopOffsetstring · int32обязательноTrailing distance as an absolute quote amount, fp9 raw. 0 when the distance is set as a percent.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000trailingStopOffsetPercentstring · int32обязательноTrailing distance as a fraction of price, fp9 raw. 0 when the distance is absolute.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000leveragestring · int32 · nullableобязательноLeverage of the order, fp9 raw. Null on close orders, which inherit the leverage of the position.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000indexstringобязательноOrder identifier. Kept for backward compatibility, always equal to id.
stringpositionIdstring[]обязательноPosition a close order is attached to. Null for orders that open or grow a position.
Элементы массива · string
string
Посмотреть пример
[
"string"
]parentOrderIdstring[]обязательно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.
Элементы массива · string
string
Посмотреть пример
[
"string"
]expirationstring · date-time · nullableобязательноAlways null. Kept for backward compatibility — orders do not expire on their own.
2026-05-01T12:30:00.000Zamountstring · int32обязательно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)$
1000000000indexPricestring · int32 · nullableобязательноIndex price the order executed at, fp9 raw. Null while the order has not executed.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000settlementOraclePricestring · int32обязательноAlways 1000000000 (1.0). Kept for backward compatibility.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000createdAtstring · date-timeобязательноWhen the order was accepted.
2026-05-01T12:30:00.000Zerrorstring[]обязательноAlways null. Kept for backward compatibility — use errorCode.
Элементы массива · string
string
Посмотреть пример
[
"string"
]realizedPnlstring · int32 · nullableобязательно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)$
1000000000rawRealizedPnlstring · int32 · nullableобязательноRealised pnl before the 60-second adjustment, fp9 raw. Differs from realizedPnl only when the adjustment fired.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000profitAdjustmentAppliedbooleanобязательно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.
trueexecutedAfterPausebooleanобязательноWhether the order executed after a market pause. Not set by the current engine — always false.
truesizeModestring · enumобязательноHow the size was expressed on creation: quote sizes the order by amount, base sizes it by baseSize.
"quote" "base"quotebaseSizestring · int32 · nullableобязательноOrder size in base asset units, fp9 raw. Null for quote-sized orders.
- pattern
- ^(?:-?[1-9][0-9]*|0)$
1000000000reservedAmountstring · int32 · nullableобязательно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)$
1000000000errorCodestring[]обязательно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.
Элементы массива · string
string
Посмотреть пример
[
"string"
]reasonstring · enum · nullableобязательноWhy 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"
}