Commit b8b1b5ed authored by Ahmad Nemati's avatar Ahmad Nemati

git pull

parent 8278d1b8
...@@ -1055,7 +1055,7 @@ let ff=dur/7 ...@@ -1055,7 +1055,7 @@ let ff=dur/7
if (ff > opt.allDone) if (ff > opt.allDone)
return null return null
if (opt.newAllDonePer < 12) if (opt.newAllDonePer < 10)
return null return null
// if (opt.allDone <60) // if (opt.allDone <60)
......
This diff is collapsed.
...@@ -125,7 +125,7 @@ async function run(root, name, directory, timestamp) { ...@@ -125,7 +125,7 @@ async function run(root, name, directory, timestamp) {
let las = [] let las = []
for (let i = 0; i < last.length; i++) { for (let i = 0; i < last.length; i++) {
if (i < last.length) if (i < last.length)
if (last[i].total < 1 && last[i].maxLevel === 0 && last[i].newAllDonePer >12) { if (last[i].total < 1 && last[i].maxLevel === 0 && last[i].newAllDonePer >10) {
delete last[i].durDetailText delete last[i].durDetailText
delete last[i].metaDetailText delete last[i].metaDetailText
let needContinue = false let needContinue = false
......
...@@ -123,13 +123,20 @@ async function run(root,name, directory, timestamp) { ...@@ -123,13 +123,20 @@ async function run(root,name, directory, timestamp) {
let las = [] let las = []
for (let i = 0; i < 200000; i++) { for (let i = 0; i < last.length; i++) {
if (i < last.length && last[i].newAllDonePer >12) if (i < last.length && last[i].newAllDonePer >12)
las.push(last[i]) las.push(last[i])
} }
let newLast=[]
for (let i=0;i<las.length;i++)
{
let f={platform:las[i].platform,type:las[i].type,closeDate:las[i].closeDate,profitLossString:las[i].profitLossString,sideString:las[i].sideString}
newLast.push(f)
}
createfileADV(root,timestamp, name, JSON.stringify(las, null, 2)) createfileADV(root,timestamp, name, JSON.stringify(newLast, null, 2))
last = [] last = []
} }
......
let _ = require('lodash') let _ = require('lodash')
let fs=require('fs') let fs = require('fs')
// //
// 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,3crm_bUseTpPr,3crm_dTpSlRewardToRiskRatio,3crm_dRrToStartTrailSl,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 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,3crm_bUseTpPr,3crm_dTpSlRewardToRiskRatio,3crm_dRrToStartTrailSl,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'
// //
...@@ -39,20 +39,34 @@ let fs=require('fs') ...@@ -39,20 +39,34 @@ let fs=require('fs')
// p=p[0].split(pair)[0] // p=p[0].split(pair)[0]
// console.log(p) // console.log(p)
//
// let t={bad:2}
// //console.log()
//
// createfileADV(JSON.stringify(t))
// function createfileADV(data) {
// // console.log(data)
// return new Promise(function (resolve, reject) {
// fs.writeFile('bad.txt', data, 'utf8', function (err) {
// if (err) reject(err);
// else resolve(data);
// });
// });
// }
let year = ['2017', '2018', '2019', '2020', '2021', '2022']
let month = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']
let t={bad:2}
//console.log()
createfileADV(JSON.stringify(t)) let dates = []
function createfileADV(data) { for (let i = 0; i < year.length; i++) {
// console.log(data) for (let j = 0; j < month.length; j++) {
return new Promise(function (resolve, reject) { let t = year[i] + '-' + month[j]
fs.writeFile('bad.txt', data, 'utf8', function (err) { if (!(t === '2017-01' || t === '2017-02' || t === '2017-03' || t === '2017-04' || t === '2017-05' || t === '2017-06' || t === '2017-07' || t === '2022-05' ||t === '2022-06' || t === '2022-07' || t === '2022-08' || t === '2022-09' || t === '2022-10' || t === '2022-11' || t === '2022-12'))
if (err) reject(err); dates.push(t)
else resolve(data); }
});
});
} }
console.log(arr)
// //
......
const fs = require('fs')
let moment = require('moment-timezone')
let _ = require('lodash')
const uuid = require('uniqid')
let pair = 'BNB'
let res
let arr = []
let lastBalance=5000
let size=50
let balance =lastBalance
init()
let base=1
let com
let year = ['2017', '2018', '2019', '2020', '2021', '2022']
let month = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']
let dates = []
for (let i = 0; i < year.length; i++) {
for (let j = 0; j < month.length; j++) {
let t = year[i] + '-' + month[j]
if (!(t === '2017-01' || t === '2017-02' || t === '2017-03' || t === '2017-04' || t === '2017-05' || t === '2017-06' || t === '2017-07' || t === '2022-05' ||t === '2022-06' || t === '2022-07' || t === '2022-08' || t === '2022-09' || t === '2022-10' || t === '2022-11' || t === '2022-12'))
dates.push({date: t, profit: 0,count:0,longCount:0,shortCount:0,longProfit:0,shortProfit:0})
}
}
//profitLossString
//drawDownString
async function init() {
try {
await fs.mkdirSync('torob')
}
catch (e)
{
}
com = await fs.readFileSync('t.json', 'utf8');
let bad = await fs.readFileSync('bad.txt', 'utf8');
bad=JSON.parse(bad)
base=parseFloat(bad.bad)
// console.log(bad)
com = JSON.parse(com)
run()
}
async function lastCheck(param1,param2,param3,arr5) {
let bad = await fs.readFileSync('bad.txt', 'utf8');
bad=JSON.parse(bad)
base=parseFloat(bad.bad)
if (param3<base)
{
let z={maxReserve:param1,profit:param2,bad:param3}
await createfileADV(JSON.stringify(z))
await createfileTorob(param3.toString(),JSON.stringify(arr5, null, 2))
}
}
async function sleep(millis) {
return new Promise(resolve => setTimeout(resolve, millis));
}
async function run()
{
com=_.shuffle(com)
balance=lastBalance
arr=[]
for (let i = 0; i < size; i++) {
let closeDate = com[i].closeDate.split('_')
let profits = com[i].profitLossString.split('_')
let side = com[i].sideString.split('_')
for (let j = 0; j < closeDate.length - 1; j++)
add(closeDate[j], parseFloat(profits[j])-0.1,side[j])
}
arr=_.orderBy(arr,['date'])
for (let i=0;i<arr.length;i++)
{
balance=balance+arr[i].profit
arr[i].balance=balance
}
let arrNew=[]
for (let i = 0; i < arr.length; i++) {
let sums = 0
for (let j = i + 1; j < arr.length ; j++) {
sums = sums + parseFloat(arr[j].profit)
if (arrNew.length ===0)
arrNew.push({sum: sums, index: i,startDate:arr[i+1].date,date:arr[j].date})
else if (arrNew[arrNew.length-1].sum > sums)
arrNew.push({sum: sums, index: i,startDate:arr[i+1].date,date:arr[j].date})
}
}
arrNew = _.orderBy(arrNew, ['sum'])
// console.log(arr)
for (let i=0;i<arr.length;i++)
addDate(arr[i])
// dates=_.orderBy(dates,['profit'])
let arrDate=[]
for (let i = 0; i < dates.length; i++) {
let sums = 0
for (let j = i + 1; j < dates.length ; j++) {
sums = sums + parseFloat(dates[j].profit)
if (arrDate.length ===0)
arrDate.push({sum: sums, index: i,startDate:dates[i+1].date,date:dates[j].date})
else if (arrDate[arrDate.length-1].sum > sums)
arrDate.push({sum: sums, index: i,startDate:dates[i+1].date,date:dates[j].date})
}
}
arrDate = _.orderBy(arrDate, ['sum'])
console.log(arrDate)
// console.log('Balance ->',balance)
// console.log('Worth ->',arrNew[0])
let start=false
let arr2=[]
for (let i=0;i<arr.length;i++)
{
if (arr[i].date ===arrNew[0].startDate)
{
start=true
arr2.push(arr[i])
}
// else if (arr[i].date === arrNew[0].date )
// {
// arr2.push(arr[i])
// break
// }
else if (start)
arr2.push(arr[i])
}
balance=lastBalance
for (let i=0;i<arr2.length;i++)
{
balance=balance+arr2[i].profit
arr2[i].balance=balance
}
createfileADV(JSON.stringify(arr2, null, 2))
let index=arrNew[0].index
arrNew=[]
for (let i = index; i < index+1; i++) {
let sums = 0
for (let j = i + 1; j < arr.length ; j++) {
sums = sums + parseFloat(arr[j].profit)
// if (arrNew.length ===0)
// arrNew.push({sum: sums, index: i,date:arr[j].date})
// else if (arrNew[arrNew.length-1].sum > sums)
arrNew.push({sum: sums, index: i,date:arr[j].date})
}
}
// return run()
}
function add(date, profit,side) {
for (let i = 0; i < arr.length; i++)
if (arr[i].date === date) {
arr[i].profit = arr[i].profit + profit
arr[i].count++
if ( side ==='LONG') {
arr[i].longCount++
arr[i].longProfit= arr[i].longProfit+profit
}
else {
arr[i].shortCount++
arr[i].shortProfit= arr[i].shortProfit+profit
}
return
}
if ( side ==='LONG')
arr.push({date: date, profit: profit,count:1,longCount:1,shortCount:0,longProfit:profit,shortProfit:0})
else
arr.push({date: date, profit: profit,count:1,longCount:1,shortCount:1,longProfit:0,shortProfit:profit})
}
function addDate(data) {
for (let i = 0; i < dates.length; i++)
if (data.date.includes(dates[i].date)) {
dates[i].profit = dates[i].profit + data.profit
dates[i].count=dates[i].count+data.count
dates[i].longCount=dates[i].longCount+data.longCount
dates[i].longProfit= dates[i].longProfit+data.longProfit
dates[i].shortCount=dates[i].shortCount+data.shortCount
dates[i].shortProfit= dates[i].shortProfit+data.shortProfit
return
}
}
function get(date) {
for (let i = 0; i < arr.length; i++)
if (arr[i].date === date) {
return arr[i]
}
}
function createfileADV(data) {
// console.log(data)
return new Promise(function (resolve, reject) {
fs.writeFile('bad.txt', data, 'utf8', function (err) {
if (err) reject(err);
else resolve(data);
});
});
}
function createfileTorob(name,data) {
// console.log(data)
return new Promise(function (resolve, reject) {
fs.writeFile('torob/'+name+'.json', data, 'utf8', function (err) {
if (err) reject(err);
else resolve(data);
});
});
}
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