Commit 4eced287 authored by Ahmad Nemati's avatar Ahmad Nemati

git pu

parent 25c75559
...@@ -27,6 +27,7 @@ async function run() { ...@@ -27,6 +27,7 @@ async function run() {
for (let j = 0; j < config.length; j++) { for (let j = 0; j < config.length; j++) {
total.push(config[j].total) total.push(config[j].total)
let dateString = config[j].dateString.split('_') let dateString = config[j].dateString.split('_')
let runUpString = config[j].runupString.split('_')
let arrDate = [] let arrDate = []
for (let z = 0; z < dateString.length - 1; z++) for (let z = 0; z < dateString.length - 1; z++)
...@@ -39,11 +40,14 @@ async function run() { ...@@ -39,11 +40,14 @@ async function run() {
countOfLong++ countOfLong++
else else
countOfshort++ countOfshort++
for (let z = 0; z < runUpString.length - 1; z++)
arrRunup.push(runUpString[z])
add(config[j].total, arrDate, config[j].type.split('targetPercentage:false')[1]) add(config[j].total, arrDate, config[j].type.split('targetPercentage:false')[1])
addShortLong(config[j].total, countOfshort, countOfLong) addShortLong(config[j].total, countOfshort, countOfLong)
addPoftrade(config[j].total,config[j].pftrade) addPoftrade(config[j].total, config[j].pftrade)
addRunup(config[j].total,arrRunup)
} }
...@@ -58,6 +62,12 @@ async function run() { ...@@ -58,6 +62,12 @@ async function run() {
} }
} }
for (let i = 0; i < adder.length; i++) {
for (let z = i + 1; z < adder.length; z++) {
addRunup(adder[i].total, adder[z].runUp)
}
}
for (let i = 0; i < adder.length; i++) { for (let i = 0; i < adder.length; i++) {
let countOfShort = adder[i].short let countOfShort = adder[i].short
let countOfLong = adder[i].long let countOfLong = adder[i].long
...@@ -65,7 +75,7 @@ async function run() { ...@@ -65,7 +75,7 @@ async function run() {
countOfShort = countOfShort + adder[z].short countOfShort = countOfShort + adder[z].short
countOfLong = countOfLong + adder[z].long countOfLong = countOfLong + adder[z].long
} }
addShortLong(adder[i].total,countOfShort,countOfLong) addShortLong(adder[i].total, countOfShort, countOfLong)
} }
var startTime = performance.now() var startTime = performance.now()
...@@ -101,8 +111,8 @@ async function run() { ...@@ -101,8 +111,8 @@ async function run() {
adder[i].type = _.orderBy(adder[i].type) adder[i].type = _.orderBy(adder[i].type)
adder[i].pfTrade = _.orderBy(adder[i].pfTrade) adder[i].pfTrade = _.orderBy(adder[i].pfTrade)
adder[i].runUp = _.orderBy(adder[i].runUp)
} }
for (let i = 0; i < adder.length; i++) { for (let i = 0; i < adder.length; i++) {
...@@ -161,7 +171,7 @@ function add(total, dates, type) { ...@@ -161,7 +171,7 @@ function add(total, dates, type) {
if (found) if (found)
return return
adder.push({total: total, dates: dates, countDay: dates.length, type: [type],pfTrade:[]}) adder.push({total: total, dates: dates, countDay: dates.length, type: [type], pfTrade: [],runUp:[]})
} }
...@@ -184,6 +194,17 @@ function addPoftrade(total, pfTrade) { ...@@ -184,6 +194,17 @@ function addPoftrade(total, pfTrade) {
} }
} }
function addRunup(total, runUp) {
for (let i = 0; i < adder.length; i++)
if (adder[i].total === total) {
for (let z = 0; z < runUp.length; z++) {
adder[i].runUp.push(runUp[z])
}
}
}
function getDaysDiff(start, closed) { function getDaysDiff(start, closed) {
//2019-05-25T05:34:27+04:30 //2019-05-25T05:34:27+04:30
var now = moment(moment(closed, 'YYYY-MM-DD').format()); var now = moment(moment(closed, 'YYYY-MM-DD').format());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment