trading-execution
2
总安装量
2
周安装量
#75086
全站排名
安装命令
npx skills add https://github.com/ben-alph-ai/crypto-trading-api --skill trading-execution
Agent 安装分布
trae
2
antigravity
2
claude-code
2
github-copilot
2
codex
2
kiro-cli
2
Skill 文档
Trading Execution (Solana)
Execute Solana token trades including market orders, limit/pending orders, copy trading, and order management.
Overview
This skill helps you:
- Place market buy/sell orders on Solana DEXs
- Create and manage limit/pending orders
- Set up copy trading (follow smart wallets)
- Query order history and statistics
- Configure buy/sell order settings
Authentication Required
All trading operations require dex_cookie authentication. See auth-helper skill for setup.
# Set your cookie (get from browser after login at www.alph.ai)
export ALPH_DEX_COOKIE="your_dex_cookie_value_here"
# Use in requests as Cookie header:
Cookie: dex_cookie=${ALPH_DEX_COOKIE}
API Base URL
https://b.alph.ai
Important Notes
- Solana Only: This platform supports Solana chain only. Chain parameter is always
sol. - All trading endpoints require authentication.
- Always confirm with user before executing trades.
Quick Reference
Market Order Endpoints
| Endpoint | Method | Purpose |
|---|---|---|
/smart-web-gateway/order/pre-check |
GET | Pre-trade validation |
/smart-web-gateway/order/create |
POST | Place market order |
/smart-web-gateway/order/batchCreate |
POST | Batch create orders |
/smart-web-gateway/order/query/page |
POST | Query orders (paginated) |
/smart-web-gateway/order/query |
POST | Batch query orders |
/smart-web-gateway/order/statistic |
POST | Order statistics |
/smart-web-gateway/order/tradeType |
GET | Get base currencies |
/order/orderFee |
POST | Query order fees |
Pending/Limit Order Endpoints
| Endpoint | Method | Purpose |
|---|---|---|
/smart-web-gateway/pending/order/create |
POST | Create limit order |
/smart-web-gateway/pending/order/update |
POST | Update limit order |
/smart-web-gateway/pending/order/cancel |
POST | Cancel limit order |
/smart-web-gateway/pending/order/cancelAll |
POST | Cancel all limit orders |
/smart-web-gateway/pending/order/batchCreate |
POST | Batch create orders + limit orders |
/smart-web-gateway/pending/order/query/page |
POST | Query limit orders (paginated) |
/smart-web-gateway/pending/order/query |
POST | Query specific limit order |
Copy Trading Endpoints
| Endpoint | Method | Purpose |
|---|---|---|
/smart-web-gateway/follow/order/create |
POST | Create copy trade |
/smart-web-gateway/follow/order/update |
POST | Update copy trade |
/smart-web-gateway/follow/order/stop |
POST | Stop copy trade |
/smart-web-gateway/follow/order/pause |
POST | Pause copy trade |
/smart-web-gateway/follow/order/resume |
POST | Resume copy trade |
/smart-web-gateway/follow/order/query/page |
POST | Query copy trades |
/smart-web-gateway/follow/order/profit |
POST | Copy trade profit |
/smart-web-gateway/follow/order/statistic |
POST | Copy trade stats |
/smart-web-gateway/follow/order/default |
POST | Default copy trade params |
Order Configuration Endpoints
| Endpoint | Method | Purpose |
|---|---|---|
/smart-web-gateway/user-buy-set/query |
GET | Get buy order settings |
/smart-web-gateway/user-buy-set/v2/query |
GET | Get buy settings v2 |
/smart-web-gateway/user-sell-set/query |
GET | Get sell order settings |
/smart-web-gateway/user-sell-set/v2/query |
GET | Get sell settings v2 |
/smart-web-gateway/user-sell-set/update |
POST | Update sell settings |
/smart-web-gateway/userTradeSet/query |
GET | Advanced trade settings |
/smart-web-gateway/userTradeSet/queryTopSettings |
GET | Top trade settings |
/smart-web-gateway/userTradeSet/getSlippageConfig |
GET | Auto slippage config |
/smart-web-gateway/userSet/getAutoFee |
GET | Auto fee settings |
Trading Workflow
Step 1: Pre-Trade Check
curl -s "https://b.alph.ai/smart-web-gateway/order/pre-check?chain=sol&token={token_address}" \
-H "Cookie: dex_cookie=${ALPH_DEX_COOKIE}"
Response:
{
"code": "200",
"data": {
"check": true
}
}
Step 2: Confirm Trade with User
Use AskUserQuestion to confirm:
{
"questions": [{
"question": "Confirm trade details?",
"header": "Trade",
"multiSelect": false,
"options": [
{
"label": "Confirm",
"description": "Buy 1 SOL worth of BONK at market price"
},
{
"label": "Cancel",
"description": "Cancel this trade"
},
{
"label": "Modify",
"description": "Change trade parameters"
}
]
}]
}
Step 3: Place Market Order
curl -s -X POST "https://b.alph.ai/smart-web-gateway/order/create" \
-H "Content-Type: application/json" \
-H "Cookie: dex_cookie=${ALPH_DEX_COOKIE}" \
-d '{
"chain": "sol",
"token": "DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",
"type": "buy",
"amount": "1"
}'
Response (success):
{
"code": "200",
"msg": "success",
"data": {}
}
Step 4: Query Order Status
curl -s -X POST "https://b.alph.ai/smart-web-gateway/order/query/page" \
-H "Content-Type: application/json" \
-H "Cookie: dex_cookie=${ALPH_DEX_COOKIE}" \
-d '{
"chain": "sol",
"page": 1,
"pageSize": 10
}'
Response includes orders with: id, clientOrderId, chain, buyCoin, tokenCoin, status, amounts, etc.
Limit/Pending Orders
Create Limit Order
curl -s -X POST "https://b.alph.ai/smart-web-gateway/pending/order/create" \
-H "Content-Type: application/json" \
-H "Cookie: dex_cookie=${ALPH_DEX_COOKIE}" \
-d '{
"chain": "sol",
"token": "DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",
"type": "buy",
"amount": "1",
"price": "0.00000005"
}'
Response:
{
"code": 200,
"msg": "success",
"orderVo": {
"id": 12345,
"chain": "sol",
"clientOrderId": "...",
"buyCoin": "SOL",
"tokenCoin": "BONK"
}
}
Cancel Limit Order
curl -s -X POST "https://b.alph.ai/smart-web-gateway/pending/order/cancel" \
-H "Content-Type: application/json" \
-H "Cookie: dex_cookie=${ALPH_DEX_COOKIE}" \
-d '{
"orderId": 12345
}'
Cancel All Limit Orders
curl -s -X POST "https://b.alph.ai/smart-web-gateway/pending/order/cancelAll" \
-H "Content-Type: application/json" \
-H "Cookie: dex_cookie=${ALPH_DEX_COOKIE}" \
-d '{
"chain": "sol"
}'
Query Limit Orders
curl -s -X POST "https://b.alph.ai/smart-web-gateway/pending/order/query/page" \
-H "Content-Type: application/json" \
-H "Cookie: dex_cookie=${ALPH_DEX_COOKIE}" \
-d '{
"chain": "sol",
"page": 1,
"pageSize": 10
}'
Copy Trading (Follow Wallet)
Create Copy Trade
Follow a smart wallet to automatically copy their trades:
curl -s -X POST "https://b.alph.ai/smart-web-gateway/follow/order/create" \
-H "Content-Type: application/json" \
-H "Cookie: dex_cookie=${ALPH_DEX_COOKIE}" \
-d '{
"chain": "sol",
"wallet": "2jJfuPMN3R3Se5c8y7BdeiQDJMKv9wms1z1wG14xJH4H"
}'
Manage Copy Trade
# Pause
curl -s -X POST "https://b.alph.ai/smart-web-gateway/follow/order/pause" \
-H "Content-Type: application/json" \
-H "Cookie: dex_cookie=${ALPH_DEX_COOKIE}" \
-d '{"orderId": 12345}'
# Resume
curl -s -X POST "https://b.alph.ai/smart-web-gateway/follow/order/resume" \
-H "Content-Type: application/json" \
-H "Cookie: dex_cookie=${ALPH_DEX_COOKIE}" \
-d '{"orderId": 12345}'
# Stop
curl -s -X POST "https://b.alph.ai/smart-web-gateway/follow/order/stop" \
-H "Content-Type: application/json" \
-H "Cookie: dex_cookie=${ALPH_DEX_COOKIE}" \
-d '{"orderId": 12345}'
Query Copy Trade Stats
# Query copy trades
curl -s -X POST "https://b.alph.ai/smart-web-gateway/follow/order/query/page" \
-H "Content-Type: application/json" \
-H "Cookie: dex_cookie=${ALPH_DEX_COOKIE}" \
-d '{"page": 1, "pageSize": 10}'
# Get profit
curl -s -X POST "https://b.alph.ai/smart-web-gateway/follow/order/profit" \
-H "Content-Type: application/json" \
-H "Cookie: dex_cookie=${ALPH_DEX_COOKIE}" \
-d '{}'
# Get statistics
curl -s -X POST "https://b.alph.ai/smart-web-gateway/follow/order/statistic" \
-H "Content-Type: application/json" \
-H "Cookie: dex_cookie=${ALPH_DEX_COOKIE}" \
-d '{}'
Order Fee Query
curl -s -X POST "https://b.alph.ai/order/orderFee" \
-H "Content-Type: application/json" \
-H "Cookie: dex_cookie=${ALPH_DEX_COOKIE}" \
-d '{"chain": "sol", "token": "..."}'
Response includes: platformFeeRate, maxPriorityFee, maxSlippage, minUsdt, antiMev.
Safety Guidelines
Pre-Trade Checks
ALWAYS perform these checks before executing:
- Verify token address (use market-data skill to check holders/whale data first)
- Check current price via market-data skill
- Run pre-check API
- Get explicit user confirmation via AskUserQuestion
- Start with small amounts
Risk Warnings
Display these warnings for:
- New Tokens (< 7 days): “New unverified token – high risk of rug pull”
- Low Liquidity: “Low liquidity – high slippage risk”
- High Whale Concentration: “Top 10 holders own >50% – manipulation risk”
- Large Orders: “Large order relative to liquidity – significant price impact”
Example Confirmation Flow
User: "Buy 1 SOL worth of BONK"
Agent steps:
1. Get BONK price from market-data (currentPrice endpoint)
2. Check holder stats for red flags
3. Run order/pre-check
4. Show confirmation with AskUserQuestion:
"Confirm trade:
- Buy: ~13.4B BONK (~1 SOL)
- Price: 0.0000000747 SOL per BONK
- Platform: Raydium (Solana)
- Fee: Check with orderFee API
Proceed?"
5. If confirmed, call order/create
6. Query order status
7. Display result
Error Handling
Common Errors
| Code | Message | Solution |
|---|---|---|
| 200 | success | Normal response |
| 400 | Bad request | Check parameters |
| 401 | Unauthorized | Token expired, re-authenticate |
| 403 | Insufficient balance | User needs more SOL |
| 500 | sys error | Server issue, retry |
Error Response Format
{
"code": "403",
"msg": "Insufficient balance",
"errorDetail": {
"key": "value"
}
}
Use Cases
Use Case 1: Market Buy
User: "Buy 1 SOL worth of BONK"
Steps:
1. Get BONK address and current price
2. Run pre-check
3. Show confirmation
4. Execute order/create
5. Query status
6. Display results
Use Case 2: Limit Buy
User: "Buy BONK when price drops to 0.00000005 SOL"
Steps:
1. Create pending order with target price
2. Confirm order placed
3. Explain: "Order will execute when BONK hits target price"
Use Case 3: Copy Trade
User: "Follow this smart wallet: 2jJfuPMN3R..."
Steps:
1. Look up wallet via smart/wallet endpoint (market-data skill)
2. Show wallet stats (PnL, win rate)
3. Confirm with user
4. Create follow order
5. Explain copy trade settings
Use Case 4: Cancel Orders
User: "Cancel all my pending orders"
Steps:
1. Query pending orders first
2. Show list to user
3. Confirm cancellation
4. Call cancelAll
5. Confirm result
Tips
- Always Confirm: Never execute trades without explicit user confirmation
- Check First: Use market-data skill to research tokens before trading
- Small Amounts: Recommend starting with small amounts for new tokens
- Copy Trading: Research the wallet’s track record before following
- Error Recovery: Provide clear next steps on failures
Related Skills
- market-data: Get prices, holder stats, smart wallet data before trading
- auth-helper: Setup authentication (required for all trading)