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

git pull

parent e269ab2b
const fs = require('fs')
let moment = require('moment-timezone')
let _ = require('lodash')
const uuid=require('uniqid')
let pair='BNB'
let res
let arr=[]
init()
async function init()
{
let com = await fs.readFileSync('t.json', 'utf8');
com = JSON.parse(com)
for (let i=0;i<1000;i++)
{
let closeDate=com[i].closeDate.split('_')
let profits=com[i].profitLossString.split('_')
for (let j=0;j<closeDate.length-1;j++)
add(closeDate[j],parseFloat(profits[j]))
}
console.log(arr)
}
function add(date,profit)
{
for (let i=0;i<arr.length;i++)
if (arr[i].date ===date) {
arr[i].profit = arr[i].profit + profit
return
}
arr.push({date:date,profit:profit})
}
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