Browse Source

拉取最近365天的数据。

skyffire 1 year ago
parent
commit
e11b9b5a21
1 changed files with 3 additions and 1 deletions
  1. 3 1
      pull_k_lines.js

+ 3 - 1
pull_k_lines.js

@@ -1,3 +1,4 @@
+const TimeKit = require('./utils/time-kit')
 const axios = require('axios');
 const fs = require('fs');
 
@@ -6,7 +7,7 @@ const logger = require('./utils/logger')
 
 const BASE_REST = 'https://api.binance.com'
 const QUOTE_ASSET = 'USDT'                                    // 拉取什么交易对的
-const NUMBER_OF_DAYS_TO_PULL = 30                           // 一共拉取多少天的数据
+const NUMBER_OF_DAYS_TO_PULL = 365                          // 一共拉取多少天的数据
 
 const socksProxy = 'socks://127.0.0.1:7890';
 const agent = new SocksProxyAgent(socksProxy);
@@ -75,6 +76,7 @@ async function main() {
 
     // length - 1是最新一天的
     logger.info(`${symbol}拉取完毕,拉取到${kLinesMap[symbol].length}条(${i+1}/${symbols.length})。`)
+    await TimeKit.sleep(1000)
   }
 
   fs.writeFile('./data/k_lines.json', JSON.stringify(kLinesMap, null, 2), 'utf8', (err) => {