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
e94172be
Commit
e94172be
authored
Jul 25, 2022
by
Ahmad Nemati
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
git pull
parent
831d9463
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
57 deletions
+71
-57
renamer.js
renamer.js
+71
-57
No files found.
renamer.js
View file @
e94172be
...
...
@@ -4,67 +4,83 @@ let _ = require('lodash')
const
uuid
=
require
(
'
uniqid
'
)
let
pairs
=
''
let
files
=
[]
let
files
=
[]
init
()
async
function
init
()
{
let
com
=
await
fs
.
readFileSync
(
'
newCom_last.json
'
,
'
utf8
'
);
files
=
await
fs
.
readdirSync
(
'
E:
\\
YashilFinal
'
)
com
=
JSON
.
parse
(
com
)
// console.log(com)
// console.log(com)
// for (let i = 0; i < com.length; i++) {
// await renamer(com[i].config,com[i].uniq)
//
// }
let
tempFiles
=
await
fs
.
readdirSync
(
'
C:
\\
Users
\\
Administrator
\\
Desktop
\\
ai
\\
temp
\\
'
)
for
(
let
i
=
0
;
i
<
tempFiles
.
length
;
i
++
)
{
let
f
=
await
fs
.
readFileSync
(
'
C:
\\
Users
\\
Administrator
\\
Desktop
\\
ai
\\
temp
\\
'
+
tempFiles
[
i
],
'
utf8
'
);
files
=
await
fs
.
readdirSync
(
'
E:
\\
YashilFinal
'
)
let
tempFiles
=
await
fs
.
readdirSync
(
'
C:
\\
Users
\\
Administrator
\\
Desktop
\\
ai
\\
temp
\\
'
)
for
(
let
i
=
0
;
i
<
tempFiles
.
length
;
i
++
)
{
let
f
=
await
fs
.
readFileSync
(
'
C:
\\
Users
\\
Administrator
\\
Desktop
\\
ai
\\
temp
\\
'
+
tempFiles
[
i
],
'
utf8
'
);
f
=
f
.
split
(
'
\n
'
)
let
format
=
tempFiles
[
i
].
split
(
'
&
'
)
let
format
=
tempFiles
[
i
].
split
(
'
&
'
)
// console.log(format)
format
=
format
[
0
]
+
'
&
'
+
format
[
1
]
+
'
&
'
+
format
[
2
]
+
'
&
'
+
format
[
3
]
format
=
format
.
replace
(
'
Kelt
'
,
'
btc4
'
).
replace
(
'
SOTT
'
,
'
btc3
'
).
replace
(
'
Pmax
'
,
'
btc2
'
).
replace
(
'
PPST
'
,
'
btc1
'
)
await
append
(
format
,
f
)
// console.log(format)
format
=
format
[
0
]
+
'
&
'
+
format
[
1
]
+
'
&
'
+
format
[
2
]
+
'
&
'
+
format
[
3
]
format
=
format
.
replace
(
'
Kelt
'
,
'
btc4
'
).
replace
(
'
SOTT
'
,
'
btc3
'
).
replace
(
'
Pmax
'
,
'
btc2
'
).
replace
(
'
PPST
'
,
'
btc1
'
)
console
.
log
(
format
)
}
//console.log(tempFiles)
}
async
function
append
(
config
,
data
)
{
for
(
let
i
=
0
;
i
<
files
.
length
;
i
++
)
{
if
(
files
[
i
].
includes
(
config
+
'
_
'
))
{
for
(
let
j
=
0
;
j
<
data
.
length
;
j
++
)
appender
(
files
[
i
],
data
[
j
])
}
}
}
async
function
appender
(
file
,
data
)
{
fs
.
appendFile
(
'
E:
\\
YashilFinal
\\
'
+
file
,
data
+
'
\n
'
,
function
(
err
)
{
if
(
err
)
throw
err
;
});
}
async
function
renamer
(
config
,
newName
)
{
for
(
let
i
=
0
;
i
<
files
.
length
;
i
++
)
{
if
(
files
[
i
].
includes
(
config
+
'
_
'
))
{
let
file
=
await
fs
.
readFileSync
(
'
E:
\\
YashilFinal
\\
'
+
files
[
i
],
'
utf8
'
)
async
function
renamer
(
config
,
newName
)
{
for
(
let
i
=
0
;
i
<
files
.
length
;
i
++
)
{
if
(
files
[
i
].
includes
(
config
+
'
_
'
))
{
let
file
=
await
fs
.
readFileSync
(
'
E:
\\
YashilFinal
\\
'
+
files
[
i
],
'
utf8
'
)
file
=
file
.
split
(
'
\n
'
)
//console.log(file)
let
arr
=
[]
for
(
let
j
=
0
;
j
<
file
.
length
-
2
;
j
++
)
let
arr
=
[]
for
(
let
j
=
0
;
j
<
file
.
length
-
2
;
j
++
)
arr
.
push
(
file
[
j
])
// console.log(arr)
let
t
=
''
for
(
let
j
=
0
;
j
<
arr
.
length
;
j
++
)
{
// console.log(arr)
let
t
=
''
for
(
let
j
=
0
;
j
<
arr
.
length
;
j
++
)
{
t
=
t
+
arr
[
j
]
if
(
j
!==
arr
.
length
-
1
)
t
=
t
+
'
\n
'
if
(
j
!==
arr
.
length
-
1
)
t
=
t
+
'
\n
'
}
createYAshil
(
files
[
i
],
t
)
createYAshil
(
files
[
i
],
t
)
}
// if (files[i].includes('Lp1_'+config))
// await fs.renameSync('E:\\YashilFinal\\'+files[i],'E:\\YashilFinal\\'+config+'_'+newName+'.csv' )
// if (files[i].includes('Lp1_'+config))
// await fs.renameSync('E:\\YashilFinal\\'+files[i],'E:\\YashilFinal\\'+config+'_'+newName+'.csv' )
}
}
...
...
@@ -92,29 +108,28 @@ function createRunResfileADV(data) {
}
function
createYAshil
(
name
,
data
)
{
function
createYAshil
(
name
,
data
)
{
// console.log(data)
return
new
Promise
(
function
(
resolve
,
reject
)
{
fs
.
writeFile
(
'
E:
\\
YashilFinal
\\
'
+
name
,
data
,
'
utf8
'
,
function
(
err
)
{
fs
.
writeFile
(
'
E:
\\
YashilFinal
\\
'
+
name
,
data
,
'
utf8
'
,
function
(
err
)
{
if
(
err
)
reject
(
err
);
else
resolve
(
data
);
});
});
}
function
found
(
indicator
,
pair
,
lp
)
{
function
found
(
indicator
,
pair
,
lp
)
{
// console.log(indicator,lp)
let
res
=
[]
let
res
=
[]
if
(
indicator
===
2
)
res
=
res2
else
if
(
indicator
===
3
)
res
=
res3
else
if
(
indicator
===
4
)
res
=
res4
if
(
indicator
===
2
)
res
=
res2
else
if
(
indicator
===
3
)
res
=
res3
else
if
(
indicator
===
4
)
res
=
res4
if
(
res
.
length
===
0
)
if
(
res
.
length
===
0
)
return
{
timeframe
:
0
}
for
(
let
i
=
0
;
i
<
res
.
length
;
i
++
)
{
if
(
!
res
[
i
].
includes
(
lp
+
'
_
'
))
...
...
@@ -123,21 +138,20 @@ function found(indicator,pair, lp) {
let
d
=
res
[
i
].
split
(
'
,
'
)
let
timeframe
=
d
[
13
]
timeframe
=
timeframe
.
split
(
'
'
)
let
newTimeframe
=
'
0d
'
for
(
let
z
=
1
;
z
<
timeframe
.
length
;
z
++
)
{
newTimeframe
=
newTimeframe
+
timeframe
[
z
]
if
(
z
!==
timeframe
.
length
-
1
)
newTimeframe
=
newTimeframe
+
'
'
timeframe
=
timeframe
.
split
(
'
'
)
let
newTimeframe
=
'
0d
'
for
(
let
z
=
1
;
z
<
timeframe
.
length
;
z
++
)
{
newTimeframe
=
newTimeframe
+
timeframe
[
z
]
if
(
z
!==
timeframe
.
length
-
1
)
newTimeframe
=
newTimeframe
+
'
'
}
if
(
indicator
===
2
)
return
{
timeframe
:
newTimeframe
,
nAtrPeriod
:
d
[
15
],
dAtrMultiplier
:
d
[
17
]}
if
(
indicator
===
3
)
return
{
timeframe
:
newTimeframe
,
nStochPeriod
:
d
[
15
],
nStochSmoothingPeriod
:
d
[
16
],
dOttPercent
:
d
[
18
]}
if
(
indicator
===
4
)
return
{
timeframe
:
newTimeframe
,
nMidLnMaPeriod
:
d
[
14
],
dMultiplier
:
d
[
15
]}
if
(
indicator
===
2
)
return
{
timeframe
:
newTimeframe
,
nAtrPeriod
:
d
[
15
],
dAtrMultiplier
:
d
[
17
]}
if
(
indicator
===
3
)
return
{
timeframe
:
newTimeframe
,
nStochPeriod
:
d
[
15
],
nStochSmoothingPeriod
:
d
[
16
],
dOttPercent
:
d
[
18
]}
if
(
indicator
===
4
)
return
{
timeframe
:
newTimeframe
,
nMidLnMaPeriod
:
d
[
14
],
dMultiplier
:
d
[
15
]}
// timeframe=newTimeframe
// let nStochPeriod=parseFloat(d[15])
...
...
@@ -152,10 +166,10 @@ function found(indicator,pair, lp) {
}
}
function
createConfigYashilADV
(
name
,
data
)
{
function
createConfigYashilADV
(
name
,
data
)
{
// console.log(data)
return
new
Promise
(
function
(
resolve
,
reject
)
{
fs
.
writeFile
(
'
YConfig/
'
+
name
+
'
.txt
'
,
data
,
'
utf8
'
,
function
(
err
)
{
fs
.
writeFile
(
'
YConfig/
'
+
name
+
'
.txt
'
,
data
,
'
utf8
'
,
function
(
err
)
{
if
(
err
)
reject
(
err
);
else
resolve
(
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