Commit e9884e2b authored by Ahmad Nemati's avatar Ahmad Nemati

init

parent 90fae3e0
...@@ -72,16 +72,21 @@ async function run() { ...@@ -72,16 +72,21 @@ async function run() {
let timestamp = Date.now() let timestamp = Date.now()
try { try {
await fs.mkdirSync('result/' + csvFile) await fs.mkdirSync('result/' + csvFile)
await fs.mkdirSync('result/' + csvFile+'/default')
await fs.mkdirSync('result/' + csvFile+'/drawDown30')
await fs.mkdirSync('result/' + csvFile+'/drawdown40')
await fs.mkdirSync('result/' + csvFile+'/drawdown50')
} catch (e) { } catch (e) {
} }
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('default','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('default','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))
...@@ -168,8 +173,8 @@ async function generateBaseDrawDown(arrLast) ...@@ -168,8 +173,8 @@ async function generateBaseDrawDown(arrLast)
createfileADV('profitPerMonth1000DrawDown'+drawDown[z], JSON.stringify(arr3, null, 2)) createfileADV('drawDown'+drawDown[z],'profitPerMonth1000DrawDown'+drawDown[z], JSON.stringify(arr3, null, 2))
createfileADV('compound1000DrawDown'+drawDown[z], JSON.stringify(arr1000Compound, null, 2)) createfileADV('drawDown'+drawDown[z],'compound1000DrawDown'+drawDown[z], JSON.stringify(arr1000Compound, null, 2))
} }
...@@ -238,9 +243,9 @@ async function startAgain(arr, start) { ...@@ -238,9 +243,9 @@ async function startAgain(arr, start) {
// 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('profitPerMonth1000Start', JSON.stringify(arr3, null, 2)) createfileADV('default','profitPerMonth1000Start', JSON.stringify(arr3, null, 2))
// createfileADV('percentage1000', JSON.stringify(arrResrv200, null, 2)) // createfileADV('percentage1000', JSON.stringify(arrResrv200, null, 2))
createfileADV('compound1000Start', JSON.stringify(arr1000Compound, null, 2)) createfileADV('default','compound1000Start', 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))
...@@ -256,9 +261,9 @@ function createfile(data) { ...@@ -256,9 +261,9 @@ function createfile(data) {
}); });
} }
function createfileADV(filename, data) { function createfileADV(type,filename, data) {
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
fs.writeFile('result/' + csvFile + '/' + filename + '.json', data, 'utf8', function (err) { fs.writeFile('result/' + csvFile + '/'+type+ '/' + filename + '.json', data, 'utf8', function (err) {
if (err) reject(err); if (err) reject(err);
else resolve(data); else resolve(data);
}); });
......
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