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
  • Response
  1. developer bros
  2. API
  3. Trigger
  4. Executes

Place Order

PreviousExecutesNextCancel Orders

Last updated 2 months ago

Rate limits

  • A max of 100 pending trigger orders per subaccount

See more details in .

Request

POST [TRIGGER_ENDPOINT]/execute

Body

{
  "place_order": {
    "product_id": 1,
    "order": {
      "sender": "0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c43746573743000000000000000",
      "priceX18": "9900000000000000000000",
      "amount": "1000000000000000000",
      "expiration": "4294967295",
      "nonce": "1757062078359666688"
    },
    "trigger": {
      "price_below": "9900000000000000000000"
    }
    "signature": "0x",
    "id": 100
  }
}

Request Parameters

Parameter
Type
Required
Description

product_id

number

Yes

order

object

Yes

signature

string

Yes

trigger

object

Yes

Trigger criteria could be any of: {"price_above":"{PRICE}"}, {"price_below":"{PRICE}"}, {"last_price_above":"{PRICE}"},{"last_price_below":"{PRICE}"}

digest

string

No

Hex string representing a hash of the order.

spot_leverage

boolean

No

Indicates whether leverage should be used; when set to false , placing the order fails if the transaction causes a borrow on the subaccount. Defaults to true.

id

number

No

An optional id that when provided is returned as part of Fill and OrderUpdate stream events when the order is triggered / executed

Note: - price_above: Order is triggered if the indicated price is above the oracle price. - price_below: Order is triggered if the indicated price is below the oracle price. - last_price_above: Order is triggered if the indicated price is above the last trade price. - last_price_below: Order is triggered if the indicated price is below the last trade price.

Order Nonce

To compute a nonce for a trigger order with a random integer of 1000, and a discard time 50 ms from now, we can do the following:

import time
unix_epoch_ms = int(time.time()) * 1000
nonce = ((unix_epoch_ms + 50) << 20) + 1000 | (1 << 63)

Response

Success

{
  "status": "success",
  "signature": {signature},
  "data": { 
    "digest": {order digest} 
  },
  "request_type": "execute_place_order"
  "id": 100
}

Failure

{
  "status": "failure",
  "signature": {signature}
  "error": "{error_msg}"
  "error_code": {error_code},
  "request_type": "execute_place_order"
}

Id of spot / perp product for which to place order. Use query to retrieve all valid product ids.

Order object, see section for details on each order field.

Hex string representing hash of the signed order. See section for more details.

Note: The first most significant bit must be set, this is used to identify a trigger order from a regular one. See for more details.

API Rate limits
All products
Signing
Signing
order nonce