|
|
@ -496,7 +496,7 @@ export default { |
|
|
|
for (let i = 0; i < data.length; i++) { |
|
|
|
if (i == 0) continue; |
|
|
|
let subArray = []; |
|
|
|
let postObj = { N: null }; |
|
|
|
let postObj = { N: [] }; |
|
|
|
for (let j = 0; j < data[i].length; j++) { |
|
|
|
if (j == 0) { |
|
|
|
if ( |
|
|
@ -550,7 +550,7 @@ export default { |
|
|
|
data[i][j] != "NaN" && |
|
|
|
data[i][j] != NaN |
|
|
|
) |
|
|
|
postObj.N = 10; |
|
|
|
postObj.N.push(10); |
|
|
|
} else if (j == 9) { |
|
|
|
if ( |
|
|
|
data[i][j] != 0 && |
|
|
@ -558,15 +558,15 @@ export default { |
|
|
|
data[i][j] != "NaN" && |
|
|
|
data[i][j] != NaN |
|
|
|
) |
|
|
|
postObj.N = 11; |
|
|
|
postObj.N.push(11); |
|
|
|
} else if (j == 10) { |
|
|
|
if (data[i][j] != 0) postObj.N = 2; |
|
|
|
if (data[i][j] != 0) postObj.N.push(2); |
|
|
|
} else if (j == 12) { |
|
|
|
if (data[i][j] != 0) postObj.N = 3; |
|
|
|
if (data[i][j] != 0) postObj.N.push(3); |
|
|
|
} else if (j == 15) { |
|
|
|
subArray[6] = {}; |
|
|
|
if (data[i][j] != 0) { |
|
|
|
postObj.N = 1; |
|
|
|
postObj.N.push(1); |
|
|
|
subArray[6] = { |
|
|
|
name: "卖出Point", |
|
|
|
symbol: "diamond", |
|
|
@ -587,7 +587,7 @@ export default { |
|
|
|
} else if (j == 14) { |
|
|
|
subArray[5] = {}; |
|
|
|
if (data[i][j] != 0) { |
|
|
|
postObj.N = 0; |
|
|
|
postObj.N.push(0); |
|
|
|
subArray[5] = { |
|
|
|
name: "买入Point", |
|
|
|
coord: [ |
|
|
@ -612,105 +612,105 @@ export default { |
|
|
|
}, |
|
|
|
|
|
|
|
//订底回测数据处理 |
|
|
|
topMutateData(data) { |
|
|
|
let result = []; |
|
|
|
let postResult = []; |
|
|
|
if (data.length > 1) { |
|
|
|
for (let i = 0; i < data.length; i++) { |
|
|
|
if (i == 0) continue; |
|
|
|
let subArray = []; |
|
|
|
let postObj = { N: null }; |
|
|
|
for (let j = 0; j < data[i].length; j++) { |
|
|
|
if (j == 0) { |
|
|
|
if ( |
|
|
|
this.startTime && |
|
|
|
this.endTime && |
|
|
|
!moment(data[i][j] * 1000).isBetween( |
|
|
|
this.startTime.startOf("day"), |
|
|
|
this.endTime.endOf("day") |
|
|
|
) |
|
|
|
) { |
|
|
|
break; |
|
|
|
} else if ( |
|
|
|
this.startTime && |
|
|
|
!moment(data[i][j] * 1000).isAfter( |
|
|
|
this.startTime.startOf("day") |
|
|
|
) |
|
|
|
) { |
|
|
|
break; |
|
|
|
} |
|
|
|
// topMutateData(data) { |
|
|
|
// let result = []; |
|
|
|
// let postResult = []; |
|
|
|
// if (data.length > 1) { |
|
|
|
// for (let i = 0; i < data.length; i++) { |
|
|
|
// if (i == 0) continue; |
|
|
|
// let subArray = []; |
|
|
|
// let postObj = { N: null }; |
|
|
|
// for (let j = 0; j < data[i].length; j++) { |
|
|
|
// if (j == 0) { |
|
|
|
// if ( |
|
|
|
// this.startTime && |
|
|
|
// this.endTime && |
|
|
|
// !moment(data[i][j] * 1000).isBetween( |
|
|
|
// this.startTime.startOf("day"), |
|
|
|
// this.endTime.endOf("day") |
|
|
|
// ) |
|
|
|
// ) { |
|
|
|
// break; |
|
|
|
// } else if ( |
|
|
|
// this.startTime && |
|
|
|
// !moment(data[i][j] * 1000).isAfter( |
|
|
|
// this.startTime.startOf("day") |
|
|
|
// ) |
|
|
|
// ) { |
|
|
|
// break; |
|
|
|
// } |
|
|
|
|
|
|
|
subArray[0] = moment(data[i][j] * 1000).format( |
|
|
|
"YYYY-MM-DD HH:mm:ss" |
|
|
|
); |
|
|
|
postObj.T = data[i][j]; |
|
|
|
} else if (j == 1) { |
|
|
|
//open |
|
|
|
subArray[1] = data[i][j]; |
|
|
|
postObj.OpenPrice = data[i][j]; |
|
|
|
} else if (j == 2) { |
|
|
|
//highest |
|
|
|
subArray[4] = data[i][j]; |
|
|
|
postObj.H = data[i][j]; |
|
|
|
} else if (j == 3) { |
|
|
|
//lowest |
|
|
|
subArray[3] = data[i][j]; |
|
|
|
postObj.L = data[i][j]; |
|
|
|
} else if (j == 4) { |
|
|
|
//close |
|
|
|
subArray[2] = data[i][j]; |
|
|
|
postObj.C = data[i][j]; |
|
|
|
} else if (j == 5) { |
|
|
|
postObj.TP = data[i][j]; |
|
|
|
} else if (j == 6) { |
|
|
|
if (data[i][j] != 0) postObj.N = 3; |
|
|
|
} else if (j == 7) { |
|
|
|
subArray[5] = {}; |
|
|
|
if (data[i][j] && data[i][j] != 0) { |
|
|
|
postObj.N = 1; |
|
|
|
subArray[5] = { |
|
|
|
name: "买入Point", |
|
|
|
coord: [ |
|
|
|
`${moment(data[i][0] * 1000).format( |
|
|
|
"YYYY-MM-DD HH:mm:ss" |
|
|
|
)}`, |
|
|
|
data[i][3] |
|
|
|
], |
|
|
|
value: data[i][j], |
|
|
|
itemStyle: { |
|
|
|
color: "rgb(23,160,93)" |
|
|
|
} |
|
|
|
}; |
|
|
|
} |
|
|
|
} else if (j == 8) { |
|
|
|
subArray[6] = {}; |
|
|
|
if (data[i][j] && data[i][j] != 0) { |
|
|
|
postObj.N = 0; |
|
|
|
subArray[6] = { |
|
|
|
name: "卖出Point", |
|
|
|
symbol: "diamond", |
|
|
|
symbolSize: [15, 25], |
|
|
|
symbolOffset: [0, 25], |
|
|
|
coord: [ |
|
|
|
`${moment(data[i][0] * 1000).format( |
|
|
|
"YYYY-MM-DD HH:mm:ss" |
|
|
|
)}`, |
|
|
|
data[i][2] |
|
|
|
], |
|
|
|
value: data[i][j], |
|
|
|
itemStyle: { |
|
|
|
color: "rgb(221,82,70)" |
|
|
|
} |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (subArray.length > 0) result.push(subArray); |
|
|
|
if (postObj.T != null) postResult.push(postObj); |
|
|
|
} |
|
|
|
} |
|
|
|
return { kLineData: result, postData: postResult }; |
|
|
|
}, |
|
|
|
// subArray[0] = moment(data[i][j] * 1000).format( |
|
|
|
// "YYYY-MM-DD HH:mm:ss" |
|
|
|
// ); |
|
|
|
// postObj.T = data[i][j]; |
|
|
|
// } else if (j == 1) { |
|
|
|
// //open |
|
|
|
// subArray[1] = data[i][j]; |
|
|
|
// postObj.OpenPrice = data[i][j]; |
|
|
|
// } else if (j == 2) { |
|
|
|
// //highest |
|
|
|
// subArray[4] = data[i][j]; |
|
|
|
// postObj.H = data[i][j]; |
|
|
|
// } else if (j == 3) { |
|
|
|
// //lowest |
|
|
|
// subArray[3] = data[i][j]; |
|
|
|
// postObj.L = data[i][j]; |
|
|
|
// } else if (j == 4) { |
|
|
|
// //close |
|
|
|
// subArray[2] = data[i][j]; |
|
|
|
// postObj.C = data[i][j]; |
|
|
|
// } else if (j == 5) { |
|
|
|
// postObj.TP = data[i][j]; |
|
|
|
// } else if (j == 6) { |
|
|
|
// if (data[i][j] != 0) postObj.N = 3; |
|
|
|
// } else if (j == 7) { |
|
|
|
// subArray[5] = {}; |
|
|
|
// if (data[i][j] && data[i][j] != 0) { |
|
|
|
// postObj.N = 1; |
|
|
|
// subArray[5] = { |
|
|
|
// name: "买入Point", |
|
|
|
// coord: [ |
|
|
|
// `${moment(data[i][0] * 1000).format( |
|
|
|
// "YYYY-MM-DD HH:mm:ss" |
|
|
|
// )}`, |
|
|
|
// data[i][3] |
|
|
|
// ], |
|
|
|
// value: data[i][j], |
|
|
|
// itemStyle: { |
|
|
|
// color: "rgb(23,160,93)" |
|
|
|
// } |
|
|
|
// }; |
|
|
|
// } |
|
|
|
// } else if (j == 8) { |
|
|
|
// subArray[6] = {}; |
|
|
|
// if (data[i][j] && data[i][j] != 0) { |
|
|
|
// postObj.N = 0; |
|
|
|
// subArray[6] = { |
|
|
|
// name: "卖出Point", |
|
|
|
// symbol: "diamond", |
|
|
|
// symbolSize: [15, 25], |
|
|
|
// symbolOffset: [0, 25], |
|
|
|
// coord: [ |
|
|
|
// `${moment(data[i][0] * 1000).format( |
|
|
|
// "YYYY-MM-DD HH:mm:ss" |
|
|
|
// )}`, |
|
|
|
// data[i][2] |
|
|
|
// ], |
|
|
|
// value: data[i][j], |
|
|
|
// itemStyle: { |
|
|
|
// color: "rgb(221,82,70)" |
|
|
|
// } |
|
|
|
// }; |
|
|
|
// } |
|
|
|
// } |
|
|
|
// } |
|
|
|
// if (subArray.length > 0) result.push(subArray); |
|
|
|
// if (postObj.T != null) postResult.push(postObj); |
|
|
|
// } |
|
|
|
// } |
|
|
|
// return { kLineData: result, postData: postResult }; |
|
|
|
// }, |
|
|
|
|
|
|
|
test() { |
|
|
|
if (this.policyMode == 0) this.executeTest(); |
|
|
|