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
87ba2529
Commit
87ba2529
authored
Oct 31, 2021
by
Ahmad Nemati
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parent
94fc4423
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
15 deletions
+48
-15
ai.js
ai.js
+22
-2
generate.js
generate.js
+1
-1
run.js
run.js
+8
-4
test_cal.js
test_cal.js
+17
-8
No files found.
ai.js
View file @
87ba2529
...
@@ -87,10 +87,20 @@ function run(data, config) {
...
@@ -87,10 +87,20 @@ function run(data, config) {
// percentage2 = maxAllocatedMoney / percentage2
// percentage2 = maxAllocatedMoney / percentage2
// let minus2 = 0
// let minus2 = 0
// if (percentage2 < 0) {
// if (percentage2 < 0) {
// minus2 = percentage2
//
minus2 = percentage2
// percentage2 = null
// percentage2 = null
// }
// }
let
perp
=
(
config
.
target
*
100
)
/
Math
.
abs
(
maxReserve
)
perp
=
perp
/
100
let
sum
=
Math
.
abs
(
maxReserve
)
for
(
let
i
=
0
;
i
<
total
;
i
++
)
sum
=
sum
+
(
sum
*
perp
)
let
newCompund
=
sum
/
dur
let
compoundPerMonth
=
(
newCompund
*
30
*
100
)
/
maxReserve
let
opt
=
{
let
opt
=
{
platform
:
data
[
0
].
signal
,
platform
:
data
[
0
].
signal
,
type
:
config
.
type
+
'
param:
'
+
config
.
param
+
'
base:
'
+
config
.
base
+
'
target:
'
+
config
.
target
,
type
:
config
.
type
+
'
param:
'
+
config
.
param
+
'
base:
'
+
config
.
base
+
'
target:
'
+
config
.
target
,
...
@@ -99,8 +109,9 @@ function run(data, config) {
...
@@ -99,8 +109,9 @@ function run(data, config) {
maxLevel
:
maxLevel
,
maxLevel
:
maxLevel
,
dur
:
dur
,
dur
:
dur
,
totalFinal
:
totalFinal
,
totalFinal
:
totalFinal
,
totalCompound
:
sum
,
profitPerMonth
:
Math
.
abs
(
profitPerMonth
),
profitPerMonth
:
Math
.
abs
(
profitPerMonth
),
compoundPerMonth
:
compoundPerMonth
,
maxAllocatedMoney
:
maxAllocatedMoney
,
maxAllocatedMoney
:
maxAllocatedMoney
,
avgAllocatedMoney
:
maxAllocatedMoney
/
total
,
avgAllocatedMoney
:
maxAllocatedMoney
/
total
,
...
@@ -122,6 +133,15 @@ function run(data, config) {
...
@@ -122,6 +133,15 @@ function run(data, config) {
// console.log(data)
// console.log(data)
}
}
function
percentage2
(
base
,
per
)
{
base
=
parseFloat
(
base
)
per
=
parseFloat
(
per
)
let
percentager
=
per
/
100
let
temp
=
base
*
percentager
return
base
+
temp
}
function
inlineCheck
(
money
,
com
,
data
,
profit
,
lastCom
,
tar
)
{
function
inlineCheck
(
money
,
com
,
data
,
profit
,
lastCom
,
tar
)
{
// console.log(profit)
// console.log(profit)
...
...
generate.js
View file @
87ba2529
...
@@ -20,7 +20,7 @@ run()
...
@@ -20,7 +20,7 @@ run()
async
function
run
()
async
function
run
()
{
{
let
obj
=
{
sort
:
'
profitPerMonth
'
,
alocatedReserve
:
2
0
}
let
obj
=
{
sort
:
'
profitPerMonth
'
,
alocatedReserve
:
1
0
}
let
all
=
[]
let
all
=
[]
for
(
let
i
=
0
;
i
<
arr
.
length
;
i
++
)
for
(
let
i
=
0
;
i
<
arr
.
length
;
i
++
)
all
.
push
(
add
(
arr
[
i
]))
all
.
push
(
add
(
arr
[
i
]))
...
...
run.js
View file @
87ba2529
...
@@ -33,11 +33,14 @@ async function run() {
...
@@ -33,11 +33,14 @@ async function run() {
arr2
=
_
.
orderBy
(
arr2
,
[
configs
.
sort
],
[
'
desc
'
]);
arr2
=
_
.
orderBy
(
arr2
,
[
configs
.
sort
],
[
'
desc
'
]);
let
arr20Max
=
[]
let
arr20Max
=
[]
let
arr1000Compound
=
[]
let
arrReserv
=
_
.
orderBy
(
arr2
,
[
'
percentage
'
],
[
'
asc
'
]);
let
arrReserv
=
_
.
orderBy
(
arr2
,
[
'
percentage
'
],
[
'
asc
'
]);
let
arrCompound
=
_
.
orderBy
(
arr2
,
[
'
compoundPerMonth
'
],
[
'
asc
'
]);
let
arrResrv200
=
[]
let
arrResrv200
=
[]
for
(
let
i
=
0
;
i
<
2
00
;
i
++
)
{
for
(
let
i
=
0
;
i
<
10
00
;
i
++
)
{
arr3
.
push
(
arr2
[
i
])
arr3
.
push
(
arr2
[
i
])
arrResrv200
.
push
(
arrReserv
[
i
])
arrResrv200
.
push
(
arrReserv
[
i
])
arr1000Compound
.
push
(
arrCompound
[
i
])
}
}
for
(
let
i
=
0
;
i
<
arrReserv
.
length
;
i
++
)
for
(
let
i
=
0
;
i
<
arrReserv
.
length
;
i
++
)
...
@@ -53,8 +56,9 @@ async function run() {
...
@@ -53,8 +56,9 @@ async function run() {
// createfile(JSON.stringify(arr2, null, 2))
// createfile(JSON.stringify(arr2, null, 2))
createfile2
(
JSON
.
stringify
(
arr3
,
null
,
2
))
createfile2
(
JSON
.
stringify
(
arr3
,
null
,
2
))
// createfileADV('percentage',JSON.stringify(arrReserv, null, 2))
// createfileADV('percentage',JSON.stringify(arrReserv, null, 2))
createfileADV
(
'
percentage200
'
,
JSON
.
stringify
(
arrResrv200
,
null
,
2
))
createfileADV
(
'
percentage1000
'
,
JSON
.
stringify
(
arrResrv200
,
null
,
2
))
// createfileADV('allocatedReserve',JSON.stringify(arr20Max, null, 2))
createfileADV
(
'
compound1000
'
,
JSON
.
stringify
(
arr1000Compound
,
null
,
2
))
createfileADV
(
'
allocatedReserve
'
,
JSON
.
stringify
(
arr20Max
,
null
,
2
))
// console.log(perf.stop())
// console.log(perf.stop())
console
.
log
(
'
Done
'
)
console
.
log
(
'
Done
'
)
// process.exit(0)
// process.exit(0)
...
@@ -82,7 +86,7 @@ function createfileADV(filename,data) {
...
@@ -82,7 +86,7 @@ function createfileADV(filename,data) {
function
createfile2
(
data
)
{
function
createfile2
(
data
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
fs
.
writeFile
(
'
work/
result2
.json
'
,
data
,
'
utf8
'
,
function
(
err
)
{
fs
.
writeFile
(
'
work/
profitPerMonth1000
.json
'
,
data
,
'
utf8
'
,
function
(
err
)
{
if
(
err
)
reject
(
err
);
if
(
err
)
reject
(
err
);
else
resolve
(
data
);
else
resolve
(
data
);
});
});
...
...
test_cal.js
View file @
87ba2529
let
arr
=
[
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
]
let
target
=
20
let
arr2
=
[
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
]
let
maxReserve
=
300
let
total
=
2
let
t
=
0
let
perp
=
(
target
*
100
)
/
Math
.
abs
(
maxReserve
)
perp
=
perp
/
100
for
(
let
i
=
0
;
i
<
arr
.
length
;
i
++
)
let
sum
=
Math
.
abs
(
maxReserve
)
for
(
let
j
=
0
;
j
<
arr2
.
length
;
j
++
)
for
(
let
z
=
0
;
z
<
arr2
.
length
;
z
++
)
t
++
for
(
let
i
=
0
;
i
<
total
;
i
++
)
sum
=
sum
+
(
sum
*
perp
)
console
.
log
(
sum
)
console
.
log
(
t
)
function
percentage2
(
base
,
per
)
{
\ No newline at end of file
base
=
parseFloat
(
base
)
per
=
parseFloat
(
per
)
let
percentager
=
per
/
100
let
temp
=
base
*
percentager
return
base
+
temp
}
\ 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