{
    "addPairs": {
        "pairs": {
            "exclude": "USDT-BTC,UP,DOWN",
            "include": "USDT-",
            "maxPairs": " (function maxPairs(data){const maxPairCount=4;if(Object.keys(data.config.pairs.binance).length<=4&&(Object.keys(data.config.pairs.binance)[0]?.override?.STATUS==='inactive'||Object.keys(data.config.pairs.binance)[1]?.override?.STATUS==='inactive'||Object.keys(data.config.pairs.binance)[2]?.override?.STATUS==='inactive')){return 15;}else if(Object.keys(data.config.pairs.binance).length>=maxPairCount){return maxPairCount;}else{return 15;}})(this)",
            "noCrossOver": true,
            "exchange": "binance"
        },
        "filters": {
            "alphabet": {
                "type": "custom",
                "target": " (function feedPairs(data){const currentMinute=new Date(Date.now()).getMinutes();const currentHour=new Date(Date.now()).getHours();const firstCharacter=data.pairName.split('-')[1].toLowerCase().charAt(0);const ranges=[['a','b','c','d'],['e','f','g','h'],['i','j','k'],['l','m','n'],['o','p','q'],['r','s','t'],['u','v','w'],['x','y','z','0','1','2','3','4','5','6','7','8','9']];if(currentMinute==0||currentMinute==1||currentMinute==35||currentMinute==36){if(currentHour%2!=0){if(ranges[0].indexOf(firstCharacter)>-1){return true;}}else{if(ranges[1].indexOf(firstCharacter)>-1){return true;}}}else if(currentMinute==15||currentMinute==16||currentMinute==50||currentMinute==51){if(currentHour%2!=0){if(ranges[2].indexOf(firstCharacter)>-1){return true;}}else{if(ranges[3].indexOf(firstCharacter)>-1){return true;}}}else if(currentMinute===30||currentMinute===31||currentMinute==20||currentMinute==21){if(currentHour%2!=0){if(ranges[4].indexOf(firstCharacter)>-1){return true;}}else{if(ranges[5].indexOf(firstCharacter)>-1){return true;}}}else if(currentMinute===45||currentMinute===46||currentMinute==5||currentMinute==6){if(currentHour%2!=0){if(ranges[6].indexOf(firstCharacter)>-1){return true;}}else{if(ranges[7].indexOf(firstCharacter)>-1){return true;}}}else{return false;}})(this)"
            },
            "stdv": {
                "type": "minStandardDevPctInterval",
                "target": "0.3"
            },
            "spread": {
                "type": "maxSpreadPct",
                "max": 0.15 
            }
        },
        "overrides": {
            "LOW_TL_RATIO": 32,
            "HIGH_TL_RATIO": 6,
            "BASE_RESERVE_PCT": 0,
            "TRADING_LIMIT": 0.00011,
            "STATUS": "new",
            "STOP_AFTER_SELL": false,
            "BUY_ENABLED": false,
            "RANKING_RATIO": -1,
            "RANKING_RESULT": -1,
            "RANKING_TRADE_COUNT": -1,
            "RANKING_PNL": -1,
            "REMOVE": false,
            "MIN_VOLUME_TO_SELL": 10,
            "MAX_PAIR_PER_BASE": 4,
            "BAG_SIZE": "none",
            "MAX_BUY_COUNT": 999,
            "ALLOW_HIGH_TL": true
        },
        "schedule": "*/5 * * * *",
        "type": "addPairs",
        "strategy": "stepGrid",
        "snapshots": "12",
        "setITB": false,
        "resume": true,
        "debug": false,
        "muteTG": true,
        "enabled": true
    },
    "manageOverrides": {
        "pairs": {
            "exclude": "USDT-BTC,UP,DOWN",
            "include": "USDT-",
            "exchange": "binance"
        },
        "filters": {
            "Sanity checks": {
                "type": "custom",
                "target": " (function CheckDataExists(data){if(typeof data.pair.whatstrat==='undefined'){return false;} if(typeof data.pair.ABP==='undefined'){return false;} if(typeof data.pair.candlesclose==='undefined'){return false;} if(typeof data.pair.candlesopen==='undefined'){return false;} if(typeof data.pair.atr==='undefined'){return false;} if(typeof data.pair.ema2==='undefined'){return false;} if(typeof data.pair.ema1==='undefined'){return false;} if(typeof data.pair.quoteBalance==='undefined'){return false;}else{return true;}})(this)"
            }
        },
        "setPairVariable": {
            "newOverrides": " (function handleOverrides(data){const base=data.pairName.split('-')[0];let overrides={TRADING_LIMIT:data.pair.whatstrat.TRADING_LIMIT,STOP_AFTER_SELL:data.pair.whatstrat.STOP_AFTER_SELL,BUY_ENABLED:data.pair.whatstrat.BUY_ENABLED,BAG_SIZE:data.pair.whatstrat.BAG_SIZE,BAG_VALUE:data.pair.whatstrat.BAG_VALUE||'none',RANKING_RATIO:data.pair.whatstrat.RANKING_RATIO||-1,RANKING_RESULT:data.pair.whatstrat.RANKING_RESULT||-1,RANKING_TRADE_COUNT:data.pair.whatstrat.RANKING_TRADE_COUNT||-1,RANKING_PNL:data.pair.whatstrat.RANKING_PNL||-1,REMOVE:data.pair.whatstrat.REMOVE,STATUS:data.pair.whatstrat.STATUS||'new',MIN_VOLUME_TO_SELL:base==='USDT'||base==='BUSD'||base==='USDC'||base==='USD'||base==='EUR'?10:base==='BTC'?0.0002:base==='ETH'?0.005:base==='BNB'?0.05:0.0002};const bid=data.pair.Bid;const quoteBalance=data.pair.quoteBalance;const mvts=parseFloat(overrides.MIN_VOLUME_TO_SELL);const ABP=parseFloat(data.pair.ABP);const keepQuote=parseFloat(data.pair.whatstrat.KEEP_QUOTE);const notEnoughCandles=typeof data.pair.candlesclose==='undefined'?true:data.pair.candlesclose.length<150;const maxSameBase=parseFloat(data.pair.whatstrat.MAX_PAIR_PER_BASE);const totalBaseValue=parseFloat(data.pair.whatstrat.TOTAL_BASE_VALUE);const rankingRatio=parseFloat(overrides.RANKING_RATIO);const rankingResult=parseFloat(overrides.RANKING_RESULT);const status=overrides.STATUS;const minRankingRatio=0.4;function setWickToBodyRatio(){const candlesOpen=data.pair.candlesopen;const candlesClose=data.pair.candlesclose;const candlesHigh=data.pair.candleshigh;const candlesLow=data.pair.candleslow;let sumBody=0;let sumWick=0;candlesOpen.forEach((item,index)=>{const body=Math.max(candlesOpen[index],candlesClose[index])-Math.min(candlesOpen[index],candlesClose[index]);const total=Math.max(candlesHigh[index],candlesLow[index])-Math.min(candlesHigh[index],candlesLow[index]);const wick=total-body;sumBody=sumBody+body;sumWick=sumWick+wick;});overrides.RANKING_RATIO=sumWick/sumBody;} function setStatus(){let sameBasePairs=0;let activePairs=0;Object.keys(data.config.pairs.binance).forEach((pair=>{if(pair.split('-')[0]===base){sameBasePairs++;} if(data.config.pairs.binance[pair].override.STATUS==='active'){activePairs++;}}));const freeSlots=maxSameBase-activePairs;if(status==='new'&&rankingResult>0){if(rankingResult<=freeSlots&&rankingRatio>=minRankingRatio){overrides.STATUS='active';return true;} else if(rankingResult>-1){overrides.STATUS='inactive';overrides.REMOVE=true;}} if(status==='active'&&overrides.BAG_SIZE==='none'&&overrides.STOP_AFTER_SELL){overrides.STATUS='inactive';overrides.REMOVE=true;}} function setBagSize(){if((quoteBalance-keepQuote)*bid<mvts){overrides.BAG_SIZE='none';}else{if((quoteBalance-keepQuote)*ABP>0){overrides.BAG_SIZE=(quoteBalance-keepQuote)*ABP;overrides.BAG_VALUE=(quoteBalance-keepQuote)*bid;}else{overrides.BAG_SIZE='none';}}} function setActivePairStats(){const orders=data.pair.orders;const timeLimit=Date.now()-43200000;if(orders.length<1){return;} if(data.config.pairs.binance[data.pairName].override.timestamp*1000>timeLimit){overrides.RANKING_TRADE_COUNT=-1;overrides.RANKING_PNL=-1;return;} let sellOrderCount=0;let sumPnl=0;let lastSellTime=0;for(var i=1;i<10000;i++){if(!orders[i]){break;} if(orders[i].time<timeLimit){break;} if(orders[i].type==='sell'){if(lastSellTime!==orders[i].time){lastSellTime=orders[i].time;sellOrderCount++;sumPnl=sumPnl+orders[i].pnl;} else{sumPnl=sumPnl+orders[i].pnl;}}} const rankingTradeCount=sellOrderCount;overrides.RANKING_TRADE_COUNT=rankingTradeCount;overrides.RANKING_PNL=sumPnl;} function setTradingLimit(){const tl=(totalBaseValue/maxSameBase)/40;if(tl>mvts){overrides.TRADING_LIMIT=tl.toPrecision(5);overrides.BUY_ENABLED=true;}else{overrides.TRADING_LIMIT=mvts*1.1;overrides.BUY_ENABLED=true;}} setBagSize();if(rankingRatio===-1){setWickToBodyRatio();} if(Object.is(totalBaseValue,NaN)||totalBaseValue===0||notEnoughCandles){return overrides;} setActivePairStats();if(setStatus()===true){setTradingLimit();} if(overrides.BAG_SIZE==='none'&&overrides.STATUS==='active'&&!overrides.STOP_AFTER_SELL){setTradingLimit()} return overrides;})(this)"
        },
        "overrides": {
            "TRADING_LIMIT": " this.pairVariables.binance[this.pairName].newOverrides.TRADING_LIMIT",
            "BUY_ENABLED": " this.pairVariables.binance[this.pairName].newOverrides.BUY_ENABLED",
            "MIN_VOLUME_TO_SELL": " this.pairVariables.binance[this.pairName].newOverrides.MIN_VOLUME_TO_SELL",
            "STOP_AFTER_SELL": " (function deactivateWorstPair(data){const base=data.pairName.split('-')[0];let configPairCount=0;let sameBasePairs=[];let maxSameBase=0;Object.keys(data.config.pairs.binance).forEach((pair=>{if(pair.split('-')[0]===base){configPairCount++;sameBasePairs.push(pair)} if(maxSameBase===0){maxSameBase=parseFloat(data.config.pairs.binance[pair].override.MAX_PAIR_PER_BASE)}}));let positions=[];let activePairCount=0;let worstPairStats=0;let worstPairName='';sameBasePairs.forEach((pair=>{if(Object.keys(data.pairVariables.binance).indexOf(pair)>-1){if(parseFloat(data.pairVariables.binance[pair].newOverrides.BAG_SIZE)>0){positions.push(parseFloat(data.pairVariables.binance[pair].newOverrides.BAG_SIZE));} else if(data.pairVariables.binance[pair].newOverrides.BAG_SIZE==='none'){positions.push(0);} if(data.pairVariables.binance[pair].newOverrides.STATUS==='active'){activePairCount++;if(parseFloat(data.pairVariables.binance[pair].newOverrides.RANKING_TRADE_COUNT)>-1&&parseFloat(data.pairVariables.binance[pair].newOverrides.RANKING_PNL)>-1){const pairStats=parseFloat(data.pairVariables.binance[pair].newOverrides.RANKING_TRADE_COUNT)+(Math.max(parseFloat(data.pairVariables.binance[pair].newOverrides.RANKING_PNL),0)/Math.max(parseFloat(data.pairVariables.binance[pair].newOverrides.RANKING_TRADE_COUNT),0));if(pairStats===0){worstPairName=pair;worstPairStats=pairStats;} else if(pairStats<worstPairStats){worstPairName=pair;worstPairStats=pairStats;}}}}}));if(positions.length===configPairCount&&activePairCount===maxSameBase&&data.pairName===worstPairName){return true;} else{return false;}})(this)",
            "BAG_SIZE": " this.pairVariables.binance[this.pairName].newOverrides.BAG_SIZE",
            "BAG_VALUE": " this.pairVariables.binance[this.pairName].newOverrides.BAG_VALUE",
            "BAG_BIGGEST": " this.pairVariables.binance[this.pairName].newOverrides.BAG_BIGGEST",
            "RANKING_RESULT": " (function rankNewPairs(data){const base=data.pairName.split('-')[0];let configPairCount=0;let sameBasePairs=[];Object.keys(data.config.pairs.binance).forEach((pair=>{if(pair.split('-')[0]===base){configPairCount++;sameBasePairs.push(pair)}}));let positions=[];let ratiosToRank=[];let newPairCount=[];sameBasePairs.forEach((pair=>{if(Object.keys(data.pairVariables.binance).indexOf(pair)>-1){if(parseFloat(data.pairVariables.binance[pair].newOverrides.BAG_SIZE)>0){positions.push(parseFloat(data.pairVariables.binance[pair].newOverrides.BAG_SIZE));}else if(data.pairVariables.binance[pair].newOverrides.BAG_SIZE==='none'){positions.push(0);} if(data.pairVariables.binance[pair].newOverrides.STATUS==='new'){newPairCount.push(pair);if(parseFloat(data.pairVariables.binance[pair].newOverrides.RANKING_RATIO)>-1){ratiosToRank.push(parseFloat(data.pairVariables.binance[pair].newOverrides.RANKING_RATIO));}}}}));const rankedRatios=ratiosToRank.sort(function(a,b){return b-a;});if(positions.length===configPairCount&&newPairCount.length===ratiosToRank.length&&newPairCount.length>0){const rank=rankedRatios.indexOf(parseFloat(data.pairVariables.binance[data.pairName].newOverrides.RANKING_RATIO))+1;return rank;}else{return-1;}})(this)",
            "TOTAL_BASE_VALUE": " (function totalBaseBalance(data){const baseBalance=data.pair.baseBalance;const base=data.pairName.split('-')[0];let configPairCount=0;let sameBasePairs=[];Object.keys(data.config.pairs.binance).forEach((pair=>{if(pair.split('-')[0]===base){configPairCount++;sameBasePairs.push(pair)}}));let positions=[];let combinedBaseValue=0;sameBasePairs.forEach((pair=>{if(Object.keys(data.pairVariables.binance).indexOf(pair)>-1){if(parseFloat(data.pairVariables.binance[pair].newOverrides.BAG_SIZE)>0){positions.push(parseFloat(data.pairVariables.binance[pair].newOverrides.BAG_SIZE))}else if(data.pairVariables.binance[pair].newOverrides.BAG_SIZE==='none'){positions.push(0)}}else if(data.config.pairs.binance[pair].override.BAG_SIZE==='none'){positions.push(0);}}));if(positions.length===configPairCount){combinedBaseValue=positions.reduce((function(a,b){return a+b}),0)+baseBalance;return combinedBaseValue}else{return 0}})(this)",
            "REMOVE": " (function dontLetLastPairBeRemoved(data){const configPairCount=Object.keys(data.config.pairs.binance).length;const isLastPair=data.pairName===Object.keys(data.config.pairs.binance)[configPairCount-1];const mainFunctionReturn=data.pairVariables.binance[data.pairName].newOverrides.REMOVE;let havePairVarsForEachPair=false;let otherPairRemoveCount=0;let allOtherPairsWillStop=false;Object.keys(data.config.pairs.binance).forEach(pair=>{if(Object.keys(data.pairVariables.binance).indexOf(pair)>-1){havePairVarsForEachPair=true;}else{havePairVarsForEachPair=false;}if(typeof data.pairVariables?.binance?.[pair]==='undefined'){}else if(data.pairVariables?.binance?.[pair]?.newOverrides?.REMOVE&&pair!==Object.keys(data.config.pairs.binance)[configPairCount-1]){otherPairRemoveCount++;}});if(otherPairRemoveCount>=configPairCount-1){allOtherPairsWillStop=true;} if(!havePairVarsForEachPair){return mainFunctionReturn;}else if(isLastPair&&allOtherPairsWillStop){return false;}else{return mainFunctionReturn}})(this)",
            "RANKING_RATIO": " this.pairVariables.binance[this.pairName].newOverrides.RANKING_RATIO",
            "RANKING_TRADE_COUNT": " this.pairVariables.binance[this.pairName].newOverrides.RANKING_TRADE_COUNT",
            "RANKING_PNL": " this.pairVariables.binance[this.pairName].newOverrides.RANKING_PNL",
            "STATUS": " this.pairVariables.binance[this.pairName].newOverrides.STATUS",
            "SELL_METHOD": " this.pairVariables.binance[this.pairName].newOverrides.SELL_METHOD",
            "BUY_METHOD": " this.pairVariables.binance[this.pairName].newOverrides.BUY_METHOD",
            "PANIC_SELL": " this.pairVariables.binance[this.pairName].newOverrides.PANIC_SELL",
            "MAX_BUY_COUNT": " this.pairVariables.binance[this.pairName].newOverrides.MAX_BUY_COUNT",
            "VERY_BULLISH": " this.pairVariables.binance[this.pairName].newOverrides.VERY_BULLISH",
            "ALLOW_HIGH_TL": " this.pairVariables.binance[this.pairName].newOverrides.ALLOW_HIGH_TL"
        },
        "clearOverrides": false,
        "schedule": "21,31,41,51 * * * * *",
        "type": "manageOverrides",
        "debug": false,
        "enabled": true
    },
    "removePairs": {
        "pairs": {
            "exclude": "USDT-BTC,UP,DOWN",
            "noBag": true,
            "removeDisabled": false,
            "notRemoveBefore": 3,
            "exchange": "binance",
            "include": "USDT-"
        },
        "filters": {
            "status": {
                "type": "custom",
                "target": " this.pair.whatstrat.STATUS === 'inactive'"
            },
            "noBag": {
                "type": "custom",
                "target": " this.pair.whatstrat.BAG_SIZE === 'none'"
            },
            "remove": {
                "type": "custom",
                "target": " this.pair.whatstrat.REMOVE === true"
            }
        },
        "schedule": "* * * * *",
        "type": "removePairs2",
        "debug": false,
        "muteTG": true,
        "enabled": true
    }
}