mirror of
https://github.com/discountry/ritmex-bot.git
synced 2026-09-09 16:28:06 +00:00
4.6 KiB
4.6 KiB
Cancel And Place
Rate limits
- The sum of Cancel Orders + Place Order limits
{% hint style="info" %} See more details in API Rate limits. {% endhint %}
Request
{% tabs %} {% tab title="Websocket" %} Connect
WEBSOCKET [GATEWAY_WEBSOCKET_ENDPOINT]
Message
{
"cancel_and_place": {
"cancel_tx": {
"sender": "0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c43746573743000000000000000",
"productIds": [2],
"digests": ["0x"],
"nonce": "1"
},
"cancel_signature": "0x",
"place_order": {
"product_id": 1,
"order": {
"sender": "0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c43746573743000000000000000",
"priceX18": "1000000000000000000",
"amount": "1000000000000000000",
"expiration": "4294967295",
"appendix": "1537",
"nonce": "1757062078359666688"
},
"signature": "0x",
}
}
}
{% endtab %}
{% tab title="REST" %} POST [GATEWAY_REST_ENDPOINT]/execute
Body
{
"cancel_and_place": {
"cancel_tx": {
"sender": "0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c43746573743000000000000000",
"productIds": [2],
"digests": ["0x"],
"nonce": "1"
},
"cancel_signature": "0x",
"place_order": {
"product_id": 1,
"order": {
"sender": "0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c43746573743000000000000000",
"priceX18": "1000000000000000000",
"amount": "1000000000000000000",
"expiration": "4294967295",
"nonce": "1757062078359666688"
},
"signature": "0x",
}
}
}
{% endtab %} {% endtabs %}
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| cancel_tx | object | Yes | Cancel order transaction object. See Cancel order signing for details on the transaction fields. |
| cancel_tx.sender | string | Yes | Hex string representing the subaccount's 32 bytes (address + subaccount name) of the tx sender. |
| cancel_tx.productIds | number[] | Yes | A list of product IDs, corresponding to the product ids of the orders in digests |
| cancel_tx.digests | string[] | Yes | A list of order digests, represented as hex strings. |
| cancel_tx.nonce | string | Yes | Used to differentiate between the same cancellation multiple times. See Cancel order signing section for more details. |
| cancel_signature | string | Yes | Signed transaction. See SigningCancel order signing for more details. |
| place_order | object | Yes | Payload of order to be placed. See Place order request parameters for payload details. |
Signing
{% hint style="warning" %}
Note: both cancel_tx and place_order objects must be signed using the same signer, otherwise the request will be rejected.
{% endhint %}
- See Cancel orders signing for details on how to sign the order cancellation.
- See Place order signing for details on how to sign the order placement.
Response
Success
{
"status": "success",
"signature": {signature},
"data": {
"digest": {order digest}
},
"request_type": "execute_cancel_and_place"
}
Failure
{
"status": "failure",
"signature": {signature}
"error": "{error_msg}"
"error_code": {error_code}
"request_type": "execute_cancel_and_place"
}