Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
forex
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
forex
Commits
6e96260a
Commit
6e96260a
authored
Nov 03, 2021
by
Ahmad Nemati
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parent
f204edde
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
80 deletions
+46
-80
final.js
final.js
+46
-80
No files found.
final.js
View file @
6e96260a
...
...
@@ -5,120 +5,86 @@ let _ = require('lodash')
let
sort
=
'
profitPerMonth
'
let
alocatedReserve
=
3
let
alocatedReserveCompound
=
3
run
()
run
(
'
profitPerMonth1000
'
)
run
(
'
percentage1000
'
)
run
(
'
compound1000
'
)
run
(
'
allocatedReservePerMonthUnder
'
)
run
(
'
allocatedReserveCompoundUnder
'
)
async
function
run
()
{
async
function
run
(
name
)
{
let
directory
=
await
fs
.
readdirSync
(
'
result
'
)
let
arr2
=
[]
let
arr3
=
[]
let
arrReserv
=
[]
let
arrCompound
=
[]
for
(
let
f
=
0
;
f
<
directory
.
length
;
f
=
f
+
1000
)
{
let
arrFinal
=
[]
console
.
log
(
'
try
'
+
f
+
'
to
'
+
(
f
+
1000
)
+
'
from
'
+
directory
.
length
)
for
(
let
i
=
0
;
i
<
1000
;
i
++
)
{
try
{
if
(
(
f
+
i
)
<
directory
.
length
)
arrFinal
.
push
(
readFile
(
directory
[
f
+
i
]))
}
catch
(
e
)
{
}
arrFinal
=
await
Promise
.
all
(
arrFinal
)
}
// console.log(arrFinal)
for
(
let
i
=
0
;
i
<
arrFinal
.
length
;
i
++
)
{
let
inline
=
arrFinal
[
i
]
// console.log(inline)
let
arrFinal
=
[]
let
last
=
[]
for
(
let
f
=
0
;
f
<
directory
.
length
;
f
++
)
arrFinal
.
push
(
readFile
(
name
,
directory
[
f
]))
for
(
let
z
=
0
;
z
<
inline
.
sortByProfit
.
length
;
z
++
)
arr2
.
push
(
inline
.
sortByProfit
[
z
])
// for (let z=0;z<inline.sortByPercentage.length;z++)
// arrReserv.push(inline.sortByProfit[z])
// for (let z=0;z<inline.sortByCompound.length;z++)
// arrCompound.push(inline.sortByProfit[z])
arrFinal
=
await
Promise
.
all
(
arrFinal
)
for
(
let
i
=
0
;
i
<
arrFinal
.
length
;
i
++
)
{
let
inline
=
arrFinal
[
i
]
}
}
// console.log(arr2)
for
(
let
z
=
0
;
z
<
inline
.
length
;
z
++
)
arr2
.
push
(
inline
[
z
])
}
if
(
name
===
'
profitPerMonth1000
'
||
name
===
'
allocatedReservePerMonthUnder
'
)
last
=
_
.
orderBy
(
arr2
,
[
'
profitPerMonth
'
],
[
'
desc
'
]);
//console.log(arr2)
if
(
name
===
'
percentage1000
'
)
last
=
_
.
orderBy
(
arr2
,
[
'
percentage
'
],
[
'
asc
'
]);
if
(
name
===
'
compound1000
'
||
name
===
'
allocatedReserveCompoundUnder
'
)
last
=
_
.
orderBy
(
arr2
,
[
'
compoundPerMonth
'
],
[
'
desc
'
]);
// console.log(arr2)
if
(
name
===
'
allocatedReservePerMonthUnder
'
)
{
let
arr20Max
=
[]
for
(
let
i
=
0
;
i
<
last
.
length
;
i
++
)
{
arr2
=
_
.
orderBy
(
arr2
,
sort
,
[
'
desc
'
]);
let
arr20Max
=
[]
let
arr1000Compound
=
[]
if
(
last
[
i
].
allocatedReserve
<
alocatedReserve
)
arr20Max
.
push
(
last
[
i
])
}
arrReserv
=
_
.
orderBy
(
arr2
,
[
'
percentage
'
],
[
'
asc
'
]);
arrCompound
=
_
.
orderBy
(
arr2
,
[
'
compoundPerMonth
'
],
[
'
desc
'
]);
let
arrResrv200
=
[]
let
arrReservCompound
=
[]
for
(
let
i
=
0
;
i
<
1000
;
i
++
)
{
arr3
.
push
(
arr2
[
i
])
arrResrv200
.
push
(
arrReserv
[
i
])
arr1000Compound
.
push
(
arrCompound
[
i
])
last
=
arr20Max
}
for
(
let
i
=
0
;
i
<
arr2
.
length
;
i
++
)
{
if
(
name
===
'
allocatedReserveCompoundUnder
'
)
{
let
arr20Max
=
[]
for
(
let
i
=
0
;
i
<
last
.
length
;
i
++
)
{
if
(
arr2
[
i
].
allocatedReserve
<
alocatedReserve
)
arr20Max
.
push
(
arr2
[
i
])
}
for
(
let
i
=
0
;
i
<
arrCompound
.
length
;
i
++
)
{
if
(
last
[
i
].
allocatedReserve
<
alocatedReserve
)
arr20Max
.
push
(
last
[
i
])
}
if
(
arrCompound
[
i
].
allocatedReserve
<
alocatedReserveCompound
)
arrReservCompound
.
push
(
arrCompound
[
i
])
last
=
arr20Max
}
let
alocated100
=
[]
let
allocated1000compond
=
[]
for
(
let
i
=
0
;
i
<
1000
;
i
++
)
{
alocated100
.
push
(
arr20Max
[
i
])
allocated1000compond
.
push
(
arrReservCompound
[
i
])
}
createfileADV
(
'
profitPerMonth1000
'
,
JSON
.
stringify
(
arr3
,
null
,
2
))
createfileADV
(
'
percentage1000
'
,
JSON
.
stringify
(
arrResrv200
,
null
,
2
))
createfileADV
(
'
compound1000
'
,
JSON
.
stringify
(
arr1000Compound
,
null
,
2
))
// createfileADV('allocatedReservePerMonthUnder' + alocatedReserve, JSON.stringify(alocated100, null, 2))
// createfileADV('allocatedReserveCompoundUnder' + alocatedReserveCompound, JSON.stringify(allocated1000compond, null, 2))
createfileADV
(
'
allocatedReservePerMonthUnder
'
+
alocatedReserve
,
JSON
.
stringify
(
alocated100
,
null
,
2
))
createfileADV
(
'
allocatedReserveCompoundUnder
'
+
alocatedReserveCompound
,
JSON
.
stringify
(
allocated1000compond
,
null
,
2
))
createfileADV
(
name
,
JSON
.
stringify
(
last
,
null
,
2
))
}
async
function
readFile
(
name
)
{
let
sortByProfit
=
[]
let
file
=
await
fs
.
readFileSync
(
'
./result/
'
+
name
+
'
/allDataSortedByProfit.json
'
,
'
utf8
'
)
async
function
readFile
(
name
,
directory
)
{
let
sortByProfit
=
[]
let
file
=
await
fs
.
readFileSync
(
'
./result/
'
+
directory
+
'
/
'
+
name
+
'
.json
'
,
'
utf8
'
)
file
=
JSON
.
parse
(
file
)
// file = _.orderBy(file, sort, ['desc']);
// file = _.orderBy(file, sort, ['desc']);
for
(
let
j
=
0
;
j
<
file
.
length
;
j
++
)
{
sortByProfit
.
push
(
file
[
j
])
...
...
@@ -138,7 +104,7 @@ async function readFile(name)
// sortByCompound.push(file[j])
// }
return
{
sortByProfit
:
file
}
return
file
}
function
createfileADV
(
filename
,
data
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment