Build Your First Trading Bot
This quickstart guide will walk you through connecting to the LFG DEX, querying market data, and placing your first order.1
Install the SDK
Install the SDK package in your project:
Make sure you have Node.js 18+ installed
2
Create a Wallet
Generate a new wallet or import an existing one:
wallet-setup.ts
3
Connect to the Network
Initialize the CompositeClient with network configuration:
connect.ts
4
Query Market Data
Fetch available markets and their current prices:
market-data.ts
5
Check Your Balance
Query your subaccount balance before trading:
check-balance.ts
You need USDC deposited in your subaccount to trade. See the Transfers guide for details.
6
Place Your First Order
Place a limit order on the ETH-USD market:
place-order.ts
Your order is now on the orderbook! Track it using the client ID.
Complete Example
Here’s the complete code combining all steps:complete-example.ts