-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck-markets.js
More file actions
74 lines (56 loc) · 2.75 KB
/
Copy pathcheck-markets.js
File metadata and controls
74 lines (56 loc) · 2.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/**
* 查询市场列表,确认各币种的 marketIndex
*/
import { BumpinAPI } from './bumpin-api.js';
import fs from 'fs';
async function checkMarkets() {
try {
// 从 grid-config.json 读取 API 密钥
const config = JSON.parse(fs.readFileSync('./grid-config.json', 'utf8'));
const strategy = config.strategies.btc_conservative;
const api = new BumpinAPI(strategy.apiKey, strategy.secretKey);
console.log('🔍 查询市场列表...\n');
// 获取市场列表
const markets = await api.getMarketList();
if (markets.code === 200 || markets.success === true) {
const marketList = markets.data;
console.log('='.repeat(80));
console.log('📊 所有市场列表');
console.log('='.repeat(80));
console.log('索引 | 交易对 | 最大杠杆 | 状态');
console.log('-'.repeat(80));
marketList.forEach((market, index) => {
const idx = String(index).padStart(4);
const symbol = market.symbol.padEnd(12);
const leverage = String(market.maxLeverage || 'N/A').padStart(8);
const status = market.marketStatus || 'N/A';
console.log(`${idx} | ${symbol} | ${leverage} | ${status}`);
});
console.log('='.repeat(80));
console.log('');
// 查找常见币种
console.log('🎯 常见币种的 marketIndex:\n');
const commonSymbols = ['BTCUSD', 'ETHUSD', 'BNBUSD', 'SOLUSD', 'ADAUSD', 'DOGEUSD', 'XRPUSD'];
commonSymbols.forEach(symbol => {
const index = marketList.findIndex(m => m.symbol === symbol);
if (index !== -1) {
const market = marketList[index];
console.log(`✅ ${symbol.padEnd(10)} → marketIndex: ${index} (最大杠杆: ${market.maxLeverage || 'N/A'}x)`);
} else {
console.log(`❌ ${symbol.padEnd(10)} → 未找到`);
}
});
console.log('');
console.log('='.repeat(80));
console.log('💡 使用方法:');
console.log(' 在 grid-config.json 中设置对应的 marketIndex');
console.log(' 例如:BNBUSD 的 marketIndex 应设置为上面显示的索引值');
console.log('='.repeat(80));
} else {
console.error('❌ 获取市场列表失败:', markets.msg || markets.message);
}
} catch (error) {
console.error('❌ 错误:', error.message);
}
}
checkMarkets();