LogoLogo
Join DiscordFollow on XBridge FundsLong $BERA
  • Doc Bros v1
    • Overview
    • Key Features
      • Speed & Liquidity is Key
      • Bropetual Markets
      • A Hub for Berachain DeFi
    • Proof-of-Liquidity
      • Reward Vault
    • Power of Points
    • Partners & Integrations
    • Campaigns
      • bro.trade Em Up
  • bullish bros
    • SuperBros NFT
  • Technicals
    • What is Proof-of-Liquidity?
    • One-Click Trading
    • Funding Rates
  • Liquidations & Insurance Fund
  • Vertex Edge Sequencer
  • Fees
  • PnL Settlements
  • Withdrawals
  • Pricing (Oracles)
  • links & resources
    • bro.trade Links
      • Website
      • Trade Bropetuals
      • Discord
      • X (Twitter)
      • Medium
      • Swap on OogaBooga
    • Berachain Links
      • Berachain.com
      • Official Bridge
      • BeraHub
      • Berascan
      • Bera Discord
      • Berachain X (Twitter)
      • Berachain Docs
    • FAQ
  • developer bros
    • API
      • Gateway
        • Executes
          • Place Order
          • Cancel Order
          • Cancel and Place
          • Cancel Product Order
          • Withdraw Colleteral
          • Transfer Quote
          • Liquidate Subaccount
          • Mint LP
          • Burn LP
          • Link Signer
        • Queries
          • All Products
          • Contracts
          • Fee Rates
          • Health Groups
          • Insurance
          • Linked Signer
          • Market Liquidity
          • Market Prices
          • Max Lp Mintable
          • Max Order Size
          • Max Withdrawable
          • Min Deposit Rates
          • Nonces
          • Order
          • Orders
          • Status
          • Subaccount Info
          • Symbols
        • Signing
          • Examples
          • Q A
      • Subscriptions
        • Authentication
        • Streams
        • Events
        • Rate Limits
      • Archive (indexer)
        • Candlesticks
        • Events
        • Funding Rate
        • Interest Funding Payments
        • Linked Signer Rate Limit
        • Liquidation Feed
        • Maker Statistics
        • Market Snapshots
        • Matches
        • Merkle Proofs
        • Oracle Price
        • Orders
        • Perp Prices
        • Product Snapshots
        • Rewards
        • Signatures
        • Subaccounts
        • Summary
        • HONEY Price
      • Trigger
        • Executes
          • Place Order
          • Cancel Orders
          • Cancel Product Orders
        • Queries
          • List Trigger Orders
      • V2
        • Apr
        • Assets
        • Contracts
        • Orderbook
        • Pairs
        • Tickers
        • Trades
      • Rate limits
      • Errors
      • Symbols
      • Depositing
      • Withdrawing (on-chain)
      • Integrate via Smart Contracts
      • Definitions / Formulas
    • On-Chain Contracts
Powered by GitBook
On this page
  • ​Rate limits
  • ​Request
  • ​Request Parameters
  • ​Signing
  • ​Response
  1. developer bros
  2. API
  3. Gateway
  4. Executes

Cancel Product Order

PreviousCancel and PlaceNextWithdraw Colleteral

Last updated 2 months ago

Rate limits

  • When no productIds are provided**:** 12 cancellations/min or 2 cancellations/sec per wallet. (weight=50)

  • When productIds are provided: 600 / (5 * total productIds) cancellations per minute per wallet. (weight=5*total productIds)

See more details in .

Request

Connect

WEBSOCKET [GATEWAY_WEBSOCKET_ENDPOINT]

Message

{
  "cancel_product_orders": {
    "tx": {
      "sender": "0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c43746573743000000000000000",
      "productIds": [2],
      "nonce": "1"
    },
    "signature": "0x",
    "digest": null
  }
}

POST [GATEWAY_REST_ENDPOINT]/execute

Body

{
  "cancel_product_orders": {
    "tx": {
      "sender": "0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c43746573743000000000000000",
      "productIds": [0],
      "nonce": "1"
    },
    "signature": "0x",
    "digest": "0x"
  }
}
Parameter
Type
Required
Description

tx

object

Yes

tx.sender

string

Yes

Hex string representing the subaccount’s 32 bytes (address + subaccount name) of the tx sender.

tx.productIds

number[]

Yes

A list of product IDs to cancel orders for.

tx.nonce

string

Yes

signature

string

Yes

digest

string

No

Hex string representing a hash of the CancellationProducts object.

The solidity typed data struct that needs to be signed is:

struct CancellationProducts {
    bytes32 sender;
    uint32[] productIds;
    uint64 nonce;
}

sender: a bytes32 sent as a hex string; includes the address and the subaccount identifier

productIds: a list of product Ids for which to cancel all subaccount orders. When left empty, orders from all products will be cancelled.

nonce: used to differentiate between the same cancellation multiple times, and a user trying to place a cancellation with the same parameters twice. Sent as a string. Encodes two bit of information:

  • Most significant 44 bits encoding the recv_time in milliseconds after which the cancellation should be ignored by the matching engine; the engine will accept cancellations where current_time < recv_time <= current_time + 100000

  • Least significant 20 bits are a random integer used to avoid hash collisions

    For example, to place a cancellation with a random integer of 1000, and a discard time 50 ms from now, we would send a nonce of (timestamp_ms() + 50) << 20 + 1000

Note: for signing you should always use the data type specified in the solidity struct which might be different from the type sent in the request e.g: nonce should be an uint64 for Signing but should be sent as a string in the final payload.

{
  "status": "success",
  "signature": {signature},
  "data": {
    "cancelled_orders": [
      {
        "product_id": 2,
        "sender": "0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c43746573743000000000000000",
        "price_x18": "20000000000000000000000",
        "amount": "-100000000000000000",
        "expiration": "1686332748",
        "order_type": "post_only",
        "nonce": "1768248100142339392",
        "unfilled_amount": "-100000000000000000",
        "digest": "0x3195a7929feb8307edecf9c045j5ced68925108f0aa305f0ee5773854159377c",
        "placed_at": 1686332708
      },
      ...
    ]
  },
  "request_type": "execute_cancel_product_orders"
}
{
  "status": "failure",
  "signature": {signature},
  "error": "{error_msg}",
  "error_code": {error_code},
  "request_type": "execute_cancel_product_orders"
}

Request Parameters

Cancel product orders transaction object. See section for details on transaction fields.

Used to differentiate between the same cancellation multiple times. See section for more details.

Signed transaction. See section for more details.

Signing

See more details and examples in our page.

Response

Success

Failure

​
API Rate limits
​
​
​
signing
​
​
​
Signing
Signing
Signing