Commit bfff4989 authored by Ahmad Nemati's avatar Ahmad Nemati

git pull

parent 95f60096
...@@ -87,18 +87,23 @@ function add(date, profit,side) { ...@@ -87,18 +87,23 @@ function add(date, profit,side) {
for (let i = 0; i < arr.length; i++) for (let i = 0; i < arr.length; i++)
if (arr[i].date === date) { if (arr[i].date === date) {
arr[i].profit = arr[i].profit + profit arr[i].profit = arr[i].profit + profit
arr[i].count++ arr[i].count++
if ( side ==='LONG') if ( side ==='LONG') {
arr[i].longCount++ arr[i].longCount++
else arr[i].longProfit= arr[i].longProfit+profit
}
else {
arr[i].shortCount++ arr[i].shortCount++
arr[i].shortProfit= arr[i].shortProfit+profit
}
return return
} }
if ( side ==='LONG') if ( side ==='LONG')
arr.push({date: date, profit: profit,count:1,longCount:1,shortCount:0}) arr.push({date: date, profit: profit,count:1,longCount:1,shortCount:0,longProfit:profit,shortProfit:0})
else else
arr.push({date: date, profit: profit,count:1,longCount:1,shortCount:1}) arr.push({date: date, profit: profit,count:1,longCount:1,shortCount:1,longProfit:0,shortProfit: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