Commit f252580a authored by Ahmad Nemati's avatar Ahmad Nemati

init

parent e9884e2b
......@@ -117,6 +117,7 @@ async function run() {
startAgain(arr, configs.start)
generateBaseDrawDown(arr2)
generateDrawDownBaseStart(arr2,configs.start)
console.log('Done')
await makeStatus(directory, '0')
// process.exit(0)
......@@ -180,6 +181,77 @@ async function generateBaseDrawDown(arrLast)
}
}
async function generateDrawDownBaseStart(arrLast,start)
{
for (let z=0;z<drawDown.length;z++)
{
let arr2 = []
let newArr=[]
let arr3 = []
for (let i=0;i<arr2.length;i++) {
// console.log(arr2[i].drawDown)
if (arr2[i].drawDown >= drawDown[z] && arr2[i].maxAllocatedMoney < start)
newArr.push(arr2[i])
}
// console.log(arr2)
arr2=newArr
arr2 = _.without(arr2, undefined, null);
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++) {
if (typeof arr2[i] !== "undefined")
arr3.push(arr2[i])
if (typeof arrReserv[i] !== "undefined")
arrResrv200.push(arrReserv[i])
if (typeof arrCompound[i] !== "undefined")
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 (typeof arr20Max !== "undefined")
if (i < arr20Max.length)
arr20MaxNew.push(arr20Max[i])
if (typeof arrReservCompound !== "undefined")
if (i < arrReservCompound.length)
arrReservCompoundNew.push(arrReservCompound[i])
}
// await fs.unlinkSync(directory + '/' + csvFile)
// createfileADV('allDataSortedByProfit', JSON.stringify(arr2, null, 2))
createfileADV('drawDown'+drawDown[z],'profitPerMonth1000StartDrawDown'+drawDown[z], JSON.stringify(arr3, null, 2))
// createfileADV('percentage1000', JSON.stringify(arrResrv200, null, 2))
createfileADV('drawDown'+drawDown[z],'compound1000StartDrawDown'+drawDown[z], JSON.stringify(arr1000Compound, null, 2))
// createfileADV('allocatedReservePerMonthUnder3', JSON.stringify(arr20MaxNew, null, 2))
// createfileADV('allocatedReserveCompoundUnder3' , JSON.stringify(arrReservCompoundNew, null, 2))
}
}
async function startAgain(arr, start) {
let count = 0
......
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