pull_klines.js 933 B

123456789101112131415161718192021222324252627282930313233
  1. const axios = require('axios');
  2. const { SocksProxyAgent } = require('socks-proxy-agent');
  3. const logger = require('./utils/logger')
  4. const BASE_REST = 'https://api.binance.com'
  5. const QUOTE_ASSET = 'USDT'
  6. const socksProxy = 'socks://127.0.0.1:7890';
  7. const agent = new SocksProxyAgent(socksProxy);
  8. async function HttpQuery(url) {
  9. let rst = await axios.get(url, {
  10. httpAgent: agent,
  11. httpsAgent: agent
  12. })
  13. return rst.data
  14. }
  15. async function main() {
  16. const exchangeInfo = await HttpQuery(`${BASE_REST}/api/v3/exchangeInfo?permissions=SPOT`)
  17. const symbolsInfo = exchangeInfo.symbols.filter((item) => {
  18. return item.quoteAsset === QUOTE_ASSET && item.symbol.endsWith(QUOTE_ASSET) && item.status === 'TRADING'
  19. })
  20. const symbols = symbolsInfo.map((item) => item.symbol.replace(QUOTE_ASSET, `_${QUOTE_ASSET}`))
  21. logger.info(symbols)
  22. }
  23. main().catch((error) => {
  24. logger.error(error.stack);
  25. process.exitCode = 1;
  26. })