| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- #!/usr/bin/env tsx
- import { Config, SmartAccountDiscovery } from './src/config/simpleEnv.js'
- import { PacificaProxyClient } from './src/exchanges/pacifica/PacificaProxyClient.js'
- async function simpleOrderTest() {
- console.log('🧪 简单下单测试')
- try {
- const accounts = SmartAccountDiscovery.discoverPacifica()
- if (accounts.length === 0) {
- console.log('❌ 未发现Pacifica账户')
- return
- }
- const account = accounts[0]
- console.log(`使用账户: ${account.account.substring(0, 8)}...`)
- const client = new PacificaProxyClient({
- account: account.account,
- privateKey: account.privateKey,
- })
- // 测试最小的市价单
- console.log('发送市价单...')
- console.log('参数: BTC, 0.01, bid, reduce_only=false')
- const result = await client.createMarketOrder({
- account: account.account,
- symbol: 'BTCUSDT', // 试试完整的符号格式
- amount: '0.01',
- side: 'bid',
- reduceOnly: false,
- slippagePercent: '2.0',
- })
- console.log('✅ 下单成功!')
- console.log(JSON.stringify(result, null, 2))
- } catch (error: any) {
- console.log('❌ 下单失败:', error.message)
- if (error.stack) {
- console.log('堆栈:', error.stack)
- }
- }
- }
- simpleOrderTest()
|