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
25c75559
Commit
25c75559
authored
Apr 14, 2022
by
Ahmad Nemati
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
git pu
parent
fb3b3a22
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
4 deletions
+41
-4
test_json.js
test_json.js
+3
-3
uniq2.js
uniq2.js
+38
-1
No files found.
test_json.js
View file @
25c75559
let
t
=
'
dynamic param:48.0 base:200 target:1 targetPercentage:true fft 1
'
let
_
=
require
(
'
lodash
'
)
let
arr
=
[
2
,
3
,
5
,
1
,
2
,
2
]
console
.
log
(
_
.
orderBy
(
arr
))
console
.
log
(
t
.
split
(
'
targetPercentage:true
'
))
\ No newline at end of file
\ No newline at end of file
uniq2.js
View file @
25c75559
...
@@ -43,6 +43,7 @@ async function run() {
...
@@ -43,6 +43,7 @@ async function run() {
add
(
config
[
j
].
total
,
arrDate
,
config
[
j
].
type
.
split
(
'
targetPercentage:false
'
)[
1
])
add
(
config
[
j
].
total
,
arrDate
,
config
[
j
].
type
.
split
(
'
targetPercentage:false
'
)[
1
])
addShortLong
(
config
[
j
].
total
,
countOfshort
,
countOfLong
)
addShortLong
(
config
[
j
].
total
,
countOfshort
,
countOfLong
)
addPoftrade
(
config
[
j
].
total
,
config
[
j
].
pftrade
)
}
}
...
@@ -77,6 +78,15 @@ async function run() {
...
@@ -77,6 +78,15 @@ async function run() {
}
}
}
}
for
(
let
i
=
0
;
i
<
adder
.
length
;
i
++
)
{
for
(
let
z
=
i
+
1
;
z
<
adder
.
length
;
z
++
)
{
let
pfTrade
=
adder
[
z
].
pfTrade
for
(
let
l
=
0
;
l
<
pfTrade
.
length
;
l
++
)
addPoftrade
(
adder
[
i
].
total
,
pfTrade
[
l
])
}
}
var
endTime
=
performance
.
now
()
var
endTime
=
performance
.
now
()
console
.
log
(
`Call to doSomething took
${
endTime
-
startTime
}
milliseconds`
)
console
.
log
(
`Call to doSomething took
${
endTime
-
startTime
}
milliseconds`
)
...
@@ -89,6 +99,24 @@ async function run() {
...
@@ -89,6 +99,24 @@ async function run() {
for
(
let
i
=
0
;
i
<
adder
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
adder
.
length
;
i
++
)
{
adder
[
i
].
type
=
_
.
uniq
(
adder
[
i
].
type
)
adder
[
i
].
type
=
_
.
uniq
(
adder
[
i
].
type
)
adder
[
i
].
type
=
_
.
orderBy
(
adder
[
i
].
type
)
adder
[
i
].
type
=
_
.
orderBy
(
adder
[
i
].
type
)
adder
[
i
].
pfTrade
=
_
.
orderBy
(
adder
[
i
].
pfTrade
)
}
for
(
let
i
=
0
;
i
<
adder
.
length
;
i
++
)
{
let
dates
=
adder
[
i
].
dates
let
maxDiff
=
0
for
(
let
z
=
0
;
z
<
dates
.
length
-
1
;
z
++
)
{
let
diff
=
getDaysDiff
(
dates
[
z
],
dates
[
z
+
1
])
if
(
diff
>
maxDiff
)
maxDiff
=
diff
}
adder
[
i
].
diffDay
=
maxDiff
}
}
for
(
let
i
=
0
;
i
<
adder
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
adder
.
length
;
i
++
)
{
...
@@ -133,7 +161,7 @@ function add(total, dates, type) {
...
@@ -133,7 +161,7 @@ function add(total, dates, type) {
if
(
found
)
if
(
found
)
return
return
adder
.
push
({
total
:
total
,
dates
:
dates
,
countDay
:
dates
.
length
,
type
:
[
type
]})
adder
.
push
({
total
:
total
,
dates
:
dates
,
countDay
:
dates
.
length
,
type
:
[
type
]
,
pfTrade
:[]
})
}
}
...
@@ -147,6 +175,15 @@ function addShortLong(total, short, long) {
...
@@ -147,6 +175,15 @@ function addShortLong(total, short, long) {
}
}
}
}
function
addPoftrade
(
total
,
pfTrade
)
{
for
(
let
i
=
0
;
i
<
adder
.
length
;
i
++
)
if
(
adder
[
i
].
total
===
total
)
{
adder
[
i
].
pfTrade
.
push
(
pfTrade
)
}
}
function
getDaysDiff
(
start
,
closed
)
{
function
getDaysDiff
(
start
,
closed
)
{
//2019-05-25T05:34:27+04:30
//2019-05-25T05:34:27+04:30
var
now
=
moment
(
moment
(
closed
,
'
YYYY-MM-DD
'
).
format
());
var
now
=
moment
(
moment
(
closed
,
'
YYYY-MM-DD
'
).
format
());
...
...
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