Placing Your First Order
This guide shows you the minimum required code to build, sign, and submit a transaction to place an order on Decibel.Prerequisites
Before you begin, make sure you have:- Generated an API key from https://app.decibel.trade/api
- Your private key (keep this secure!)
- APT in your account for gas fees (or set up Geomi Gas Station to sponsor gas)
Configuration Variables
Before placing an order, you’ll need to set these configuration variables:Minimum Required Code
Here’s the minimal code needed to place an order:What This Code Does
- Imports: Imports the necessary classes from
@aptos-labs/ts-sdk(TypeScript) oraptos-sdk(Python) - Account Setup: Creates an account from your private key
- Client Initialization: Initializes the Aptos client with the network configuration
- Transaction Building: Builds a transaction calling
place_order_to_subaccountwith your order parameters - Signing: Signs the transaction with your private key
- Submission: Submits the signed transaction to the blockchain
- Confirmation: Waits for the transaction to be confirmed
Next Steps
For more detailed information, see:- Place Order Transaction - Complete documentation for placing orders
- Formatting Prices and Sizes - Learn how to format prices and sizes correctly
- Optimized Transaction Building - Learn how to build transactions synchronously for better performance
- Authenticated Requests - Overview of authenticated requests
Note: This example uses mock addresses for
subaccountAddr and
marketAddr. In a real application, you’ll need to: - Get your Trading Account
address (see Create Trading
Account) - Get the
market address from the v1/markets API endpoint - Format prices and sizes
correctly using market configuration (see Formatting Prices and
Sizes)
