Commit 2b6bad13 authored by Ahmad Nemati's avatar Ahmad Nemati

init

parent 250ed15f
...@@ -35,12 +35,14 @@ async function format(name) { ...@@ -35,12 +35,14 @@ async function format(name) {
let list=[] let list=[]
let pluser=0 let pluser=0
let allProfit=0
for (let i = 1; i <(res.length-1); i ++) { for (let i = 1; i <(res.length-1); i ++) {
let d=res[i].split(',') let d=res[i].split(',')
try { try {
let profit=parseFloat(d[7]) let profit=parseFloat(d[7])
if (profit<0) if (profit<0)
{ {
allProfit=allProfit+profit
pluser++ pluser++
} }
else else
...@@ -60,6 +62,7 @@ let d=res[i].split(',') ...@@ -60,6 +62,7 @@ let d=res[i].split(',')
let arr2=_.uniq(list) let arr2=_.uniq(list)
arr2=_.orderBy(arr2) arr2=_.orderBy(arr2)
let arr=[] let arr=[]
for (let i=0;i<arr2.length;i++) for (let i=0;i<arr2.length;i++)
{ {
let counter=0 let counter=0
...@@ -69,6 +72,7 @@ let d=res[i].split(',') ...@@ -69,6 +72,7 @@ let d=res[i].split(',')
arr.push({number:arr2[i],count:counter}) arr.push({number:arr2[i],count:counter})
} }
console.log('Avg Profit:'+(allProfit/list.length))
console.log(arr) console.log(arr)
// arr= await Promise.all(arr) // arr= await Promise.all(arr)
// //console.log(arr) // //console.log(arr)
......
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