Commit c59d3def authored by Ahmad Nemati's avatar Ahmad Nemati

git pu

parent eca92d64
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
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"big-json": "^3.1.0", "big-json": "^3.1.0",
"bybit-api": "^2.1.10",
"execution-time": "^1.4.1", "execution-time": "^1.4.1",
"extract-zip": "^2.0.1", "extract-zip": "^2.0.1",
"fast-csv": "^4.3.6", "fast-csv": "^4.3.6",
......
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);
});
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 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'
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'
t=t.split(',')
console.log(t.split(',')) for (let i=0;i<t.length;i++)
console.log(i,t[i])
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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment