Selaa lähdekoodia

新参数调整,今天不调了

skyffire 1 vuosi sitten
vanhempi
commit
5f037a6ff6
2 muutettua tiedostoa jossa 19 lisäystä ja 5 poistoa
  1. 1 2
      pull_k_lines.js
  2. 18 3
      十面埋伏分析.js

+ 1 - 2
pull_k_lines.js

@@ -1,4 +1,3 @@
-const TimeKit = require('./utils/time-kit')
 const axios = require('axios');
 const fs = require('fs');
 
@@ -55,7 +54,7 @@ async function main() {
   for (let i = 0; i < symbols.length; i++) {
     let symbol = symbols[i]
     const kLines = await HttpQuery(
-      `${BASE_REST}/api/v3/klines?symbol=${symbol.replace('_', '')}&interval=2h&limit=${NUMBER_OF_DAYS_TO_PULL}`)
+      `${BASE_REST}/api/v3/klines?symbol=${symbol.replace('_', '')}&interval=2h&limit=${NUMBER_OF_DAYS_TO_PULL}&startTime=1696089600000`)
 
     kLinesMap[symbol] = []
     for (let kLine of kLines) {

+ 18 - 3
十面埋伏分析.js

@@ -5,7 +5,7 @@ const ChartKit = require('./utils/chart-kit');
 const fs = require('fs').promises;
 
 async function readData() {
-  let data = await fs.readFile('./data/k_lines.json', 'utf8')
+  let data = await fs.readFile('./data/k_lines_202401_202403.json', 'utf8')
 
   return JSON.parse(data)
 }
@@ -83,6 +83,14 @@ function statisticC(kLines, btcKLines, index) {
 //   return 0
 // }
 
+function statisticE(kLines, index) {
+  let kLine = kLines[index]
+  let date = new Date(kLine.Time)
+
+  // date.getDay() * 100
+  return date.getHours()
+}
+
 // 指标过滤
 function filter(btcKLines, kLines, index) {
   // 过去N根K的累计涨幅
@@ -101,6 +109,10 @@ function filter(btcKLines, kLines, index) {
     return false
   }
 
+  // if ([4, 6, 14, 22].indexOf(statisticE(kLines, index)) === -1) {
+  //   return false
+  // }
+
   return true
 }
 
@@ -181,13 +193,14 @@ let dataLeft = []
 let dataRight = []
 let tempLeft = []
 let tempRight = []
-let dataY = [...Array(40).keys()]
+let dataY = [...Array(30).keys()]
 function dragonAnalysis(btcKLines, kLinesMap, dragonMap, dayCount) {
   for (let symbol in dragonMap) {
     let kLines = kLinesMap[symbol]
     let index = kLines.length - (dayCount + 1)
 
-    let x = statisticB(kLines, index)
+    let x = statisticE(kLines, index)
+    // dataY = [100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 200, 202, 204, 206, 208, 210, 212, 214, 216, 218, 220, 222, 300, 302, 304, 306, 308, 310, 312, 314, 316, 318, 320, 322, 400, 402, 404, 406, 408, 410, 412, 414, 416, 418, 420, 422, 500, 502, 504, 506, 508, 510, 512, 514, 516, 518, 520, 522, 600, 602, 604, 606, 608, 610, 612, 614, 616, 618, 620, 622, 700, 702, 704, 706, 708, 710, 712, 714, 716, 718, 720, 722]
     // let x = statisticE(btcKLines, kLines, index)
     let y = dragonMap[symbol].Profit
 
@@ -232,6 +245,8 @@ async function main() {
   let kLinesMap = await readData()
 
   const BUY_LIMIT_RATE = 0               // 从什么比例入场
+
+
   const FIRST_FEW_DAYS = 1               // 第几K的数据,0表示今K,1表示昨K,2表示前K,以此类推
   const BAKE_TEST_DAYS = 900              // 一共回测多少K
   // const FIRST_FEW_DAYS = 710                   // 第几K的数据,0表示今K,1表示昨K,2表示前K,以此类推