| 123456789101112131415161718192021222324252627282930313233 |
- const axios = require('axios');
- const { SocksProxyAgent } = require('socks-proxy-agent');
- const logger = require('./utils/logger')
- const BASE_REST = 'https://api.binance.com'
- const QUOTE_ASSET = 'USDT'
- const socksProxy = 'socks://127.0.0.1:7890';
- const agent = new SocksProxyAgent(socksProxy);
- async function HttpQuery(url) {
- let rst = await axios.get(url, {
- httpAgent: agent,
- httpsAgent: agent
- })
- return rst.data
- }
- async function main() {
- const exchangeInfo = await HttpQuery(`${BASE_REST}/api/v3/exchangeInfo?permissions=SPOT`)
- const symbolsInfo = exchangeInfo.symbols.filter((item) => {
- return item.quoteAsset === QUOTE_ASSET && item.symbol.endsWith(QUOTE_ASSET) && item.status === 'TRADING'
- })
- const symbols = symbolsInfo.map((item) => item.symbol.replace(QUOTE_ASSET, `_${QUOTE_ASSET}`))
- logger.info(symbols)
- }
- main().catch((error) => {
- logger.error(error.stack);
- process.exitCode = 1;
- })
|