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
4c341555
Commit
4c341555
authored
Nov 03, 2021
by
Ahmad Nemati
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parent
c0a7b5d2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
162 additions
and
0 deletions
+162
-0
final1000.bat
final1000.bat
+1
-0
final1000.js
final1000.js
+161
-0
No files found.
final1000.bat
0 → 100644
View file @
4c341555
node --max-old-space-size=9999999999 final1000.js
\ No newline at end of file
final1000.js
0 → 100644
View file @
4c341555
let
fs
=
require
(
'
fs
'
)
let
_
=
require
(
'
lodash
'
)
let
sort
=
'
profitPerMonth
'
let
alocatedReserve
=
3
let
alocatedReserveCompound
=
3
work
()
async
function
work
()
{
let
directory
=
await
fs
.
readdirSync
(
'
final1000
'
)
for
(
let
i
=
0
;
i
<
directory
.
length
;
i
=
i
+
1000
)
{
// console.log('hi')
let
arr
=
[]
for
(
let
j
=
0
;
j
<
1000
;
j
++
)
{
try
{
if
((
j
+
i
)
<
directory
.
length
)
arr
.
push
(
directory
[
j
+
i
])
}
catch
(
e
)
{
}
}
if
(
arr
.
length
!==
0
)
{
let
timestamp
=
Date
.
now
()
try
{
await
fs
.
mkdirSync
(
'
last1000/
'
+
timestamp
)
}
catch
(
e
)
{
}
run
(
'
profitPerMonth1000
'
,
arr
,
timestamp
)
run
(
'
percentage1000
'
,
arr
,
timestamp
)
run
(
'
compound1000
'
,
arr
,
timestamp
)
run
(
'
allocatedReservePerMonthUnder3
'
,
arr
,
timestamp
)
run
(
'
allocatedReserveCompoundUnder3
'
,
arr
,
timestamp
)
run
(
'
allocatedReservePerMonthUnder2
'
,
arr
,
timestamp
)
await
run
(
'
allocatedReserveCompoundUnder2
'
,
arr
,
timestamp
)
}
}
}
async
function
run
(
name
,
directory
,
timestamp
)
{
// let directory = await fs.readdirSync('result')
let
arr2
=
[]
let
arrFinal
=
[]
let
last
=
[]
console
.
log
(
directory
)
for
(
let
f
=
0
;
f
<
directory
.
length
;
f
++
)
{
if
(
typeof
directory
[
f
]
===
"
undefined
"
)
continue
console
.
log
(
directory
[
f
])
arrFinal
.
push
(
readFile
(
name
,
directory
[
f
]))
}
arrFinal
=
await
Promise
.
all
(
arrFinal
)
for
(
let
i
=
0
;
i
<
arrFinal
.
length
;
i
++
)
{
let
inline
=
arrFinal
[
i
]
for
(
let
z
=
0
;
z
<
inline
.
length
;
z
++
)
arr2
.
push
(
inline
[
z
])
}
if
(
name
===
'
profitPerMonth1000
'
||
name
===
'
allocatedReservePerMonthUnder3
'
||
name
===
'
allocatedReservePerMonthUnder2
'
)
last
=
_
.
orderBy
(
arr2
,
[
'
profitPerMonth
'
],
[
'
desc
'
]);
if
(
name
===
'
percentage1000
'
)
last
=
_
.
orderBy
(
arr2
,
[
'
percentage
'
],
[
'
asc
'
]);
if
(
name
===
'
compound1000
'
||
name
===
'
allocatedReserveCompoundUnder3
'
||
name
===
'
allocatedReserveCompoundUnder2
'
)
last
=
_
.
orderBy
(
arr2
,
[
'
compoundPerMonth
'
],
[
'
desc
'
]);
if
(
name
===
'
allocatedReservePerMonthUnder2
'
||
name
===
'
allocatedReservePerMonthUnder3
'
)
{
let
arr20Max
=
[]
for
(
let
i
=
0
;
i
<
last
.
length
;
i
++
)
{
if
(
name
===
'
allocatedReservePerMonthUnder2
'
)
alocatedReserve
=
2
else
alocatedReserve
=
3
if
(
last
[
i
].
allocatedReserve
<
alocatedReserve
)
arr20Max
.
push
(
last
[
i
])
}
last
=
arr20Max
}
if
(
name
===
'
allocatedReserveCompoundUnder2
'
||
name
===
'
allocatedReserveCompoundUnder3
'
)
{
let
arr20Max
=
[]
for
(
let
i
=
0
;
i
<
last
.
length
;
i
++
)
{
if
(
name
===
'
allocatedReserveCompoundUnder2
'
)
alocatedReserve
=
2
else
alocatedReserve
=
3
if
(
last
[
i
].
allocatedReserve
<
alocatedReserve
)
arr20Max
.
push
(
last
[
i
])
}
last
=
arr20Max
}
let
las
=
[]
for
(
let
i
=
0
;
i
<
1000
;
i
++
)
{
if
(
i
<
last
.
length
)
las
.
push
(
last
[
i
])
}
createfileADV
(
timestamp
,
name
,
JSON
.
stringify
(
las
,
null
,
2
))
last
=
[]
}
async
function
readFile
(
name
,
directory
)
{
let
sortByProfit
=
[]
let
file
=
await
fs
.
readFileSync
(
'
./final1000/
'
+
directory
+
'
/
'
+
name
+
'
.json
'
,
'
utf8
'
)
file
=
JSON
.
parse
(
file
)
// file = _.orderBy(file, sort, ['desc']);
for
(
let
j
=
0
;
j
<
file
.
length
;
j
++
)
{
sortByProfit
.
push
(
file
[
j
])
}
// let sortByPercentage = []
// file = _.orderBy(file, ['percentage'], ['asc']);
// for (let j = 0; j < file.length; j++) {
//
// sortByPercentage.push(file[j])
// }
//
// let sortByCompound = []
// file =_.orderBy(file, ['compoundPerMonth'], ['desc']);
// for (let j = 0; j < file.length; j++) {
//
// sortByCompound.push(file[j])
// }
return
file
}
function
createfileADV
(
timestamp
,
filename
,
data
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
fs
.
writeFile
(
'
last1000/
'
+
timestamp
+
'
/
'
+
filename
+
'
.json
'
,
data
,
'
utf8
'
,
function
(
err
)
{
if
(
err
)
reject
(
err
);
else
resolve
(
data
);
});
});
}
\ No newline at end of file
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