Commit b2f1ee9a authored by Ahmad Nemati's avatar Ahmad Nemati

init

parent 60ff553c
...@@ -20,7 +20,7 @@ run() ...@@ -20,7 +20,7 @@ run()
async function run() async function run()
{ {
let obj={sort:'profitPerMonthDrawDown',alocatedReserve:3,alocatedReserveCompound:3,risk:0} let obj={sort:'profitPerMonthDrawDown',alocatedReserve:3,alocatedReserveCompound:3,risk:0,start:1000}
let all=[] let all=[]
for (let i=0;i<arr.length;i++) for (let i=0;i<arr.length;i++)
all.push(add(arr[i])) all.push(add(arr[i]))
......
...@@ -19,7 +19,7 @@ async function run() { ...@@ -19,7 +19,7 @@ async function run() {
for (let i = 0; i < files.length; i++) for (let i = 0; i < files.length; i++)
if (files[i].includes('.csv')) { if (files[i].includes('.csv')) {
csvFile = files[i] csvFile = files[i]
arr.push(csv.parse(directory, files[i], configs.data,configs.risk)) arr.push(csv.parse(directory, files[i], configs.data, configs.risk))
} }
arr = await Promise.all(arr) arr = await Promise.all(arr)
...@@ -29,7 +29,8 @@ async function run() { ...@@ -29,7 +29,8 @@ async function run() {
for (let i = 0; i < arr.length; i++) { for (let i = 0; i < arr.length; i++) {
let inline = arr[i] let inline = arr[i]
for (let j = 0; j < inline.length; j++) { for (let j = 0; j < inline.length; j++) {
arr2.push(inline[j]) if (inline[j].maxAllocatedMoney < configs.start)
arr2.push(inline[j])
} }
...@@ -57,21 +58,19 @@ async function run() { ...@@ -57,21 +58,19 @@ async function run() {
} }
for (let i = 0; i < arrCompound.length; i++) { for (let i = 0; i < arrCompound.length; i++) {
if (arrCompound[i].allocatedReserve < 3) if (arrCompound[i].allocatedReserve < 3)
arrReservCompound.push(arrCompound[i]) arrReservCompound.push(arrCompound[i])
} }
let arr20MaxNew=[] let arr20MaxNew = []
let arrReservCompoundNew=[] let arrReservCompoundNew = []
for (let i=0;i<1000;i++) for (let i = 0; i < 1000; i++) {
{ if (i < arr20Max.length)
if (i<arr20Max.length)
arr20MaxNew.push(arr20Max[i]) arr20MaxNew.push(arr20Max[i])
if (i<arrReservCompound.length) if (i < arrReservCompound.length)
arrReservCompoundNew.push(arrReservCompound[i]) arrReservCompoundNew.push(arrReservCompound[i])
} }
...@@ -85,33 +84,32 @@ async function run() { ...@@ -85,33 +84,32 @@ async function run() {
} }
await fs.unlinkSync(directory + '/' + csvFile) await fs.unlinkSync(directory + '/' + csvFile)
// createfileADV('allDataSortedByProfit', JSON.stringify(arr2, null, 2)) // createfileADV('allDataSortedByProfit', JSON.stringify(arr2, null, 2))
createfileADV('profitPerMonth1000', JSON.stringify(arr3, null, 2)) createfileADV('profitPerMonth1000', JSON.stringify(arr3, null, 2))
// createfileADV('percentage1000', JSON.stringify(arrResrv200, null, 2)) // createfileADV('percentage1000', JSON.stringify(arrResrv200, null, 2))
createfileADV('compound1000', JSON.stringify(arr1000Compound, null, 2)) createfileADV('compound1000', JSON.stringify(arr1000Compound, null, 2))
// createfileADV('allocatedReservePerMonthUnder3', JSON.stringify(arr20MaxNew, null, 2)) // createfileADV('allocatedReservePerMonthUnder3', JSON.stringify(arr20MaxNew, null, 2))
// createfileADV('allocatedReserveCompoundUnder3' , JSON.stringify(arrReservCompoundNew, null, 2)) // createfileADV('allocatedReserveCompoundUnder3' , JSON.stringify(arrReservCompoundNew, null, 2))
arr20Max=[] arr20Max = []
for (let i = 0; i < arr2.length; i++) { for (let i = 0; i < arr2.length; i++) {
if (arr2[i].allocatedReserve < 2) if (arr2[i].allocatedReserve < 2)
arr20Max.push(arr2[i]) arr20Max.push(arr2[i])
} }
arrCompound=[] arrCompound = []
for (let i = 0; i < arrCompound.length; i++) { for (let i = 0; i < arrCompound.length; i++) {
if (arrCompound[i].allocatedReserve < 2) if (arrCompound[i].allocatedReserve < 2)
arrReservCompound.push(arrCompound[i]) arrReservCompound.push(arrCompound[i])
} }
arr20MaxNew=[] arr20MaxNew = []
arrReservCompoundNew=[] arrReservCompoundNew = []
for (let i=0;i<1000;i++) for (let i = 0; i < 1000; i++) {
{ if (i < arr20Max.length)
if (i<arr20Max.length)
arr20MaxNew.push(arr20Max[i]) arr20MaxNew.push(arr20Max[i])
if (i<arrReservCompound.length) if (i < arrReservCompound.length)
arrReservCompoundNew.push(arrReservCompound[i]) arrReservCompoundNew.push(arrReservCompound[i])
} }
...@@ -119,9 +117,6 @@ async function run() { ...@@ -119,9 +117,6 @@ async function run() {
// createfileADV('allocatedReserveCompoundUnder2' , JSON.stringify(arrReservCompoundNew, null, 2)) // createfileADV('allocatedReserveCompoundUnder2' , JSON.stringify(arrReservCompoundNew, null, 2))
console.log('Done') console.log('Done')
await makeStatus(directory, '0') await makeStatus(directory, '0')
// process.exit(0) // process.exit(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