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
c59d3def
Commit
c59d3def
authored
May 21, 2022
by
Ahmad Nemati
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
git pu
parent
eca92d64
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
123 additions
and
10 deletions
+123
-10
grab.js
grab.js
+85
-0
package.json
package.json
+1
-0
test_bybit.js
test_bybit.js
+33
-0
test_json.js
test_json.js
+4
-10
No files found.
grab.js
0 → 100644
View file @
c59d3def
const
fs
=
require
(
'
fs
'
)
let
moment
=
require
(
'
moment-timezone
'
)
let
_
=
require
(
'
lodash
'
)
let
res
init
()
async
function
init
()
{
let
res
=
await
fs
.
readFileSync
(
'
run.csv
'
,
'
utf8
'
);
res
=
res
.
split
(
'
\n
'
)
}
async
function
found
(
pair
,
lp
)
{
for
(
let
i
=
0
;
i
<
res
.
length
;
i
++
)
{
if
(
!
res
.
includes
(
lp
+
'
_
'
))
continue
let
d
=
res
.
split
(
'
,
'
)
let
timeframe
=
d
[
13
]
let
pvt
=
d
[
14
]
let
factor
=
d
[
15
]
let
period
=
d
[
103
]
period
=
period
.
split
(
pair
)
period
=
period
[
period
.
length
-
1
]
return
{
timeframe
,
pvt
,
factor
,
period
}
}
}
function
getDataFromFileAndConfig
(
all
,
file
,
config
)
{
for
(
let
i
=
0
;
i
<
all
.
length
;
i
++
)
{
// console.log(all[i].name)
if
(
all
[
i
].
name
===
file
)
{
let
inline
=
all
[
i
].
data
for
(
let
j
=
0
;
j
<
inline
.
length
;
j
++
)
{
if
(
inline
[
j
].
includes
(
config
))
return
inline
[
j
]
}
}
}
}
async
function
format
(
name
)
{
let
res
=
await
fs
.
readFileSync
(
'
./RunRes/
'
+
name
,
'
utf8
'
);
res
=
res
.
split
(
'
\n
'
)
// console.log(res[0])
return
res
}
function
createRunResfileADV
(
data
)
{
// console.log(data)
return
new
Promise
(
function
(
resolve
,
reject
)
{
fs
.
writeFile
(
'
runres.json
'
,
data
,
'
utf8
'
,
function
(
err
)
{
if
(
err
)
reject
(
err
);
else
resolve
(
data
);
});
});
}
function
createFile
(
name
,
body
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
fs
.
writeFile
(
'
files/
'
+
name
,
body
,
'
utf8
'
,
function
(
err
)
{
if
(
err
)
reject
(
err
);
else
resolve
(
true
);
});
});
}
\ No newline at end of file
package.json
View file @
c59d3def
...
...
@@ -14,6 +14,7 @@
"license"
:
"
ISC
"
,
"dependencies"
:
{
"
big-json
"
:
"
^3.1.0
"
,
"
bybit-api
"
:
"
^2.1.10
"
,
"
execution-time
"
:
"
^1.4.1
"
,
"
extract-zip
"
:
"
^2.0.1
"
,
"
fast-csv
"
:
"
^4.3.6
"
,
...
...
test_bybit.js
0 → 100644
View file @
c59d3def
const
{
InverseFuturesClient
}
=
require
(
'
bybit-api
'
);
const
API_KEY
=
'
7iW1muhWWyX8PxuQWx
'
;
const
PRIVATE_KEY
=
'
5Bf4FFISdQNxVJqg5pqyn860CIrgjsXXy3pK
'
;
const
useLivenet
=
false
;
const
client
=
new
InverseFuturesClient
(
API_KEY
,
PRIVATE_KEY
,
// optional, uses testnet by default. Set to 'true' to use livenet.
useLivenet
,
// restClientOptions,
// requestLibraryOptions
);
client
.
getApiKeyInfo
()
.
then
(
result
=>
{
console
.
log
(
"
apiKey result:
"
,
result
);
})
.
catch
(
err
=>
{
console
.
error
(
"
apiKey error:
"
,
err
);
});
client
.
getOrderBook
({
symbol
:
'
BTCUSDH21
'
})
.
then
(
result
=>
{
console
.
log
(
"
getOrderBook inverse futures result:
"
,
result
);
})
.
catch
(
err
=>
{
console
.
error
(
"
getOrderBook inverse futures error:
"
,
err
);
});
test_json.js
View file @
c59d3def
let
t
=
'
1,2022.01.01 00:12:00.000,Sell,0.01,ETHUSDT,3691.45,0.00,0.00,3696.44,2022.01.01 00:22:00.000,-499,-4.99,"s1g0_B_PrfFr-5.22_To5.62_xOpp",1,000 00:10:00.000,600000,-499,-4.99,637765927200000000,637765933200000000,562,-522,3691.45,3696.44,1,9999.12.31 23:59:59.999,3155378975999999999,0.00,0.00,1,1,-0.14,5.6200,-5.2200,0.15,-0.14
'
let
t2
=
'
RowNum,Open_Time,Type,Lots,Symbol,Open_Price,SL,TP,Close_Price,Close_Time,ProfitPips,ProfitUsd,Comment,MagicNum,Age_Dhhmmssfff,AgeMsec,TotPrfPips,TotPrfUsd,Open_Time_Ticks,Close_Time_Ticks,nAgeHiPrfPips,nAgeLoPrfPips,InvOpPrice,InvClPrice,Ticket,Expiration_Time,Expiration_Time_Ticks,Commission,Swap,nOmNum,nMyMagCode1,dPrfPipWrtOpPrPc,dAgeHiPrfUsd,dAgeLoPrfUsd,dAgeHiPrfInPrPc_RunUpPc,dAgeLoPrfInPrPc_DrawDownPc
'
let
t
=
'
Num.,OpClOrds,MaxTotOpOrdNo,MaxEffOpLot,prfpDmddp,MddInPc,PrfInPc,PrfVal,InvprfpDmddp,InvMddInPc,InvPrfInPc,InvPrfVal,AnyDirPrf,PPST1_stMnBarAge,PPST1_PvtPtPeriod,PPST1_AtrFactor,PPST1_AtrPeriod,PPST2_stMnBarAge,PPST2_PvtPtPeriod,PPST2_AtrFactor,PPST2_AtrPeriod,nEntSignalCodeNum,3crm_nStopLoss_AtrPeriod,3crm_dStopLoss_AtrRiskAdjustmentCoef,3crm_nStopLoss_SwingLookbackBarNo,3crm_bUseTrailingStopLoss,3crm_enumTrailSlRef,3crm_dTrailSlAtrMultiplier,m_nToUseSym0MinSpreadPip,nInitTpPip_Sym1_Tgt1,nInitSlPip_Sym1_Tgt1,stMnRefHopAge,nAllTmMktTrEntNum,nAftLkbkTmMktTrEntNum,dToClAllSsAndRestartImd_ReqEqIncPc,SimCp1_dToClAllSsAndRestartImd_ReqEqIncPc,nByReqEgIncPcClAllSsNum,PrfPips_BestTpSl,Tp_BestTpSl,Sl_BestTpSl,InvPrfPips_BestTpSl,Tp_InvBestTpSl,Sl_InvBestTpSl, dTkSimStEquityUsd,bUpDirEntEnabled,bDnDirEntEnabled,dFixedOrdLot,dRiskPercentForLot,nMaxAnyDirOrdNo,nMaxOneDirOrdNo,nTkSimOrdExecHaltAgeMsecNo,bUseOrdExecHaltAgeForOrdClosing,bInverseEntSig,bClOppDirOrds,TotOpClLot,TotOpB_ClLot,TotOpS_ClLot,ProcTickNo,RealSsNo,PrfRealSsNo,LssRealSsNo,PotSsCnt,OpB_ClNo,OpS_ClNo,hOrds,MaxOpBuyyLots,MaxOpBuyyLots_Fr,MaxOpBuyyLots_To,MaxOpSellLots,MaxOpSellLots_Fr,MaxOpSellLots_To,MaxTotAccsEq,MaxTotAccsEq_MinusStEq,MaxTotAccsEq_Fr,MaxTotAccsEq_To,MinTotAccsEq,MinTotAccsEq_MinusStEq,MinTotAccsEq_Fr,MinTotAccsEq_To,MaxTotOpOrdNo_Fr,MaxTotOpOrdNo_To,MaxEffOpLot_Fr,MaxEffOpLot_To,MddInVal,StEq,Mdd_EqUto,Mdd_EqUto_mSt,Mdd_EqDto,Mdd_EqDto_mSt,MddTm_Fr,MddTm_To,InvMddInVal,StEq,InvMdd_EqUto,InvMdd_EqUto_mSt,InvMdd_EqDto,InvMdd_EqDto_mSt,InvMddTm_Fr,InvMddTm_To,dtTrLookBackStTime_Str,dtTrStTime_Str,dtTrEnTime_Str,SimRgAgeStr,SufxStr
'
console
.
log
(
t
.
split
(
'
,
'
))
t2
=
t2
.
split
(
'
,
'
)
console
.
log
(
t2
)
for
(
let
i
=
0
;
i
<
t2
.
length
;
i
++
)
console
.
log
(
i
,
t2
[
i
])
\ No newline at end of file
t
=
t
.
split
(
'
,
'
)
for
(
let
i
=
0
;
i
<
t
.
length
;
i
++
)
console
.
log
(
i
,
t
[
i
])
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