Commit 5fe53353 authored by Ahmad Nemati's avatar Ahmad Nemati

init

parent b2f1ee9a
......@@ -36,9 +36,9 @@ async function work() {
run('profitPerMonth1000', arr, timestamp)
run('percentage1000', arr, timestamp)
run('compound1000', arr, timestamp)
run('allocatedReservePerMonthUnder3', arr, timestamp)
run('allocatedReserveCompoundUnder3', arr, timestamp)
run('allocatedReservePerMonthUnder2', arr, timestamp)
// run('allocatedReservePerMonthUnder3', arr, timestamp)
// run('allocatedReserveCompoundUnder3', arr, timestamp)
// run('allocatedReservePerMonthUnder2', arr, timestamp)
await run('allocatedReserveCompoundUnder2', arr, timestamp)
}
......
......@@ -116,13 +116,84 @@ async function run() {
// createfileADV('allocatedReservePerMonthUnder2', JSON.stringify(arr20MaxNew, null, 2))
// createfileADV('allocatedReserveCompoundUnder2' , JSON.stringify(arrReservCompoundNew, null, 2))
startAgain(arr,configs.start)
console.log('Done')
await makeStatus(directory, '0')
// process.exit(0)
// console.log(d)
}
async function startAgain(arr,start){
let count = 0
let arr2 = []
let arr3 = []
for (let i = 0; i < arr.length; i++) {
let inline = arr[i]
for (let j = 0; j < inline.length; j++) {
if (inline[j].maxAllocatedMoney < start)
arr2.push(inline[j])
}
}
// console.log(arr2)
arr2 = _.orderBy(arr2, ['profitPerMonthDrawDown'], ['desc']);
let arr20Max = []
let arr1000Compound = []
let arrReserv = _.orderBy(arr2, ['percentage'], ['asc']);
let arrCompound = _.orderBy(arr2, ['CompoundPerMonthDrawDown'], ['desc']);
let arrResrv200 = []
let arrReservCompound = []
for (let i = 0; i < 1000; i++) {
arr3.push(arr2[i])
arrResrv200.push(arrReserv[i])
arr1000Compound.push(arrCompound[i])
}
for (let i = 0; i < arr2.length; i++) {
if (arr2[i].allocatedReserve < 3)
arr20Max.push(arr2[i])
}
for (let i = 0; i < arrCompound.length; i++) {
if (arrCompound[i].allocatedReserve < 3)
arrReservCompound.push(arrCompound[i])
}
let arr20MaxNew = []
let arrReservCompoundNew = []
for (let i = 0; i < 1000; i++) {
if (i < arr20Max.length)
arr20MaxNew.push(arr20Max[i])
if (i < arrReservCompound.length)
arrReservCompoundNew.push(arrReservCompound[i])
}
// await fs.unlinkSync(directory + '/' + csvFile)
// createfileADV('allDataSortedByProfit', JSON.stringify(arr2, null, 2))
createfileADV('profitPerMonth1000Start', JSON.stringify(arr3, null, 2))
// createfileADV('percentage1000', JSON.stringify(arrResrv200, null, 2))
createfileADV('compound1000Start', JSON.stringify(arr1000Compound, null, 2))
// createfileADV('allocatedReservePerMonthUnder3', JSON.stringify(arr20MaxNew, null, 2))
// createfileADV('allocatedReserveCompoundUnder3' , JSON.stringify(arrReservCompoundNew, null, 2))
}
function createfile(data) {
return new Promise(function (resolve, reject) {
fs.writeFile(directory + '/result.json', data, 'utf8', function (err) {
......
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