Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
ai
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
ai
Commits
96003452
Commit
96003452
authored
Dec 20, 2021
by
Ahmad Nemati
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parent
5e482336
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
161 additions
and
0 deletions
+161
-0
end.bat
end.bat
+1
-0
end.js
end.js
+160
-0
No files found.
end.bat
0 → 100644
View file @
96003452
node --max-old-space-size=9999999999 end.js
\ No newline at end of file
end.js
0 → 100644
View file @
96003452
let
fs
=
require
(
'
fs
'
)
let
_
=
require
(
'
lodash
'
)
let
drawDown
=
[
30
,
40
,
50
]
let
sort
=
'
profitPerMonth
'
let
alocatedReserve
=
3
let
alocatedReserveCompound
=
3
let
dir
work
()
async
function
work
()
{
let
arr
=
[]
try
{
await
fs
.
mkdirSync
(
'
end
'
)
}
catch
(
e
)
{
}
let
configs
=
await
fs
.
readdirSync
(
'
last1000/
'
)
for
(
let
z
=
0
;
z
<
configs
.
length
;
z
++
)
{
let
directory
=
await
fs
.
readdirSync
(
'
last1000/
'
+
configs
[
z
])
for
(
let
i
=
0
;
i
<
directory
.
length
;
i
=
i
+
1000
)
{
// console.log('hi')
for
(
let
j
=
0
;
j
<
1000
;
j
++
)
{
try
{
if
((
j
+
i
)
<
directory
.
length
)
arr
.
push
(
configs
[
z
]
+
'
/
'
+
directory
[
j
+
i
])
}
catch
(
e
)
{
}
}
}
}
if
(
arr
.
length
!==
0
)
{
let
timestamp
=
Date
.
now
()
try
{
await
fs
.
mkdirSync
(
'
end
'
+
'
/
'
+
timestamp
)
await
fs
.
mkdirSync
(
'
end
'
+
'
/
'
+
timestamp
+
'
/default
'
)
// for (let z=0;z<drawDown.length;z++)
// await fs.mkdirSync('final1000/' + timestamp+'/drawDown'+drawDown[z])
}
catch
(
e
)
{
}
run
(
'
default
'
,
'
compound1000
'
,
arr
,
timestamp
)
run
(
'
default
'
,
'
compound1000Start
'
,
arr
,
timestamp
)
run
(
'
default
'
,
'
profitPerMonth1000
'
,
arr
,
timestamp
)
// generateByDrawDown(timestamp,arr)
await
run
(
'
default
'
,
'
profitPerMonth1000Start
'
,
arr
,
timestamp
)
}
}
async
function
run
(
root
,
name
,
directory
,
timestamp
)
{
// let directory = await fs.readdirSync('last1000')
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
(
root
,
name
,
directory
[
f
]))
}
arrFinal
=
await
Promise
.
all
(
arrFinal
)
for
(
let
i
=
0
;
i
<
arrFinal
.
length
;
i
++
)
{
let
inline
=
arrFinal
[
i
]
// console.log(inline)
for
(
let
z
=
0
;
z
<
inline
.
length
;
z
++
)
arr2
.
push
(
inline
[
z
])
}
// console.log(arr2)
let
t
=
name
.
toLowerCase
()
if
(
t
.
includes
(
'
per
'
)
||
name
===
'
profitPerMonth1000
'
||
name
===
'
allocatedReservePerMonthUnder3
'
||
name
===
'
allocatedReservePerMonthUnder2
'
||
name
===
'
profitPerMonth1000Start
'
)
last
=
_
.
orderBy
(
arr2
,
[
'
profitPerMonthDrawDown
'
],
[
'
desc
'
]);
// if (name === 'percentage1000')
// last = _.orderBy(arr2, ['percentage'], ['asc']);
if
(
t
.
includes
(
'
compound
'
)
||
name
===
'
compound1000
'
||
name
===
'
allocatedReserveCompoundUnder3
'
||
name
===
'
allocatedReserveCompoundUnder2
'
||
name
===
'
compound1000Start
'
)
last
=
_
.
orderBy
(
arr2
,
[
'
CompoundPerMonthDrawDown
'
],
[
'
desc
'
]);
let
las
=
[]
for
(
let
i
=
0
;
i
<
1000
;
i
++
)
{
if
(
i
<
last
.
length
)
las
.
push
(
last
[
i
])
}
createfileADV
(
root
,
timestamp
,
name
,
JSON
.
stringify
(
las
,
null
,
2
))
last
=
[]
}
async
function
readFile
(
root
,
name
,
directory
,
conf
)
{
let
sortByProfit
=
[]
let
file
=
await
fs
.
readFileSync
(
'
./last1000/
'
+
directory
+
'
/
'
+
root
+
'
/
'
+
name
+
'
.json
'
,
'
utf8
'
)
file
=
JSON
.
parse
(
file
)
// file = _.orderBy(file, sort, ['desc']);
for
(
let
j
=
0
;
j
<
file
.
length
;
j
++
)
{
sortByProfit
.
push
(
file
[
j
])
}
return
file
}
function
createfileADV
(
root
,
timestamp
,
filename
,
data
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
fs
.
writeFile
(
'
end
'
+
'
/
'
+
timestamp
+
'
/
'
+
root
+
'
/
'
+
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