Commit 29bcf0ac authored by Ahmad Nemati's avatar Ahmad Nemati

git pull

parent 4a1a14df
const fs = require('fs')
let moment = require('moment-timezone')
let _ = require('lodash')
const uuid=require('uniqid')
let pair='BNB'
const uuid = require('uniqid')
let pair = 'BNB'
let res
let arr=[]
let arr = []
init()
async function 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]))
for (let i = 0; i < 100; 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]))
}
......@@ -24,15 +22,13 @@ let closeDate=com[i].closeDate.split('_')
}
function add(date,profit)
{
for (let i=0;i<arr.length;i++)
if (arr[i].date ===date) {
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})
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