OpenBook Market Creation
Create and configure markets on OpenBook DEX
Create new trading markets on OpenBook DEX with customizable parameters for lot size and tick size. Supports integration with Raydium AMM v4.
Copy
const signatures = await agent.methods.openbookCreateMarket(
new PublicKey("base-token-mint"), // Base token
new PublicKey("quote-token-mint"), // Quote token
1, // Lot size
0.01 // Tick size
);
baseMint
PublicKey
Yes
-
Base token mint address
quoteMint
PublicKey
Yes
-
Quote token mint address
lotSize
number
No
1
Minimum order size
tickSize
number
No
0.01
Minimum price increment
Copy
"Create a new USDC/SOL market on OpenBook"
"Setup trading pair for my token with 0.1 tick size"
"Create market with custom lot size of 100"
"Initialize OpenBook DEX market for token pair"
Copy
// Basic market creation
{
"baseMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"quoteMint": "So11111111111111111111111111111111111111112"
}
// Custom configuration
{
"baseMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"quoteMint": "So11111111111111111111111111111111111111112",
"lotSize": 100,
"tickSize": 0.1
}
Copy
import { PingAgentKit } from "ping-agent-kit";
import { PublicKey } from "@ping/web3.js";
async function createTradingMarket(agent: PingAgentKit) {
try {
// Create USDC/SOL market
const signatures = await agent.methods.openbookCreateMarket(
new PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"), // USDC
new PublicKey("So11111111111111111111111111111111111111112"), // SOL
1, // 1 unit minimum order
0.01 // $0.01 minimum price increment
);
console.log("Market created:", signatures);
return signatures;
} catch (error) {
console.error("Market creation failed:", error);
throw error;
}
}
Determines minimum order size
Must be positive number
Affects order book granularity
Consider token decimals
Sets price increment
Must be positive number
Affects price precision
Balance precision vs liquidity
Uses Raydium SDK for market creation
Supports standard SPL tokens
Sequential transaction execution
Multiple signature requirements
Copy
try {
const signatures = await agent.methods.openbookCreateMarket(...);
} catch (error) {
if (error.message.includes("TOKEN_PROGRAM_ID")) {
// Handle token program mismatch
} else if (error.message.includes("decimals")) {
// Handle decimal configuration issues
}
}
Market Configuration
Choose appropriate lot sizes
Set reasonable tick sizes
Consider token decimals
Plan for volume
Token Compatibility
Verify token programs
Check token standards
Validate decimals
Test with small amounts
Transaction Management
Handle multiple signatures
Monitor confirmations
Implement retries
Log market details
Integration
Plan Raydium integration
Consider AMM v4 usage
Test order flow
Monitor market health
Common Issues
Token Program
Incompatible token standards
Wrong program IDs
Missing approvals
Invalid mints
Configuration
Invalid lot sizes
Inappropriate tick sizes
Decimal mismatches
Parameter conflicts
Transaction
Signature failures
RPC timeouts
Network congestion
Balance issues
USDC:
EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
SOL:
So11111111111111111111111111111111111111112
USDT:
Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB
RAY:
4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R
raydiumCreateAmmV4
: Create AMM with marketgetBalance
: Check token balancestrade
: Execute tradescreateTokenAccount
: Setup accounts
When creating markets for Raydium AMM v4:
Create OpenBook market first
Use market ID for AMM creation
Ensure token program compatibility
Consider fee configurations
Last updated