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

git pull

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