diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..e7215b3 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,17 @@ +{ + "env": { + "browser": true, + "es6": true + }, + "extends": "eslint:recommended", + "globals": { + "Atomics": "readonly", + "SharedArrayBuffer": "readonly" + }, + "parserOptions": { + "ecmaVersion": 2018, + "sourceType": "module" + }, + "rules": { + } +} \ No newline at end of file diff --git a/config.json b/config.json deleted file mode 100644 index b28c9e4..0000000 --- a/config.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "API_KEY": "", - "SECRET_KEY": "", - "CURRENCY": "PAX", - "MARKET" : "USDT", - "SPREAD_SELL" : 0.00150, - "SPREAD_BUY" : 0.00150, - "BUY_MAX" : 0.9993, - "SELL_MIN" : 1.0000, - "ORDER_EXPIRE" : 24, - "AUTO_SPREAD" : 1, - "BUY_VALUE" : 11, - "SPREAD_MIN" : 0.00150, - "LOOP_TIME": 15, - "BOT_TOKEN": "", - "BOT_CHAT": "", - "INITIAL_INVESTMENT": 2925.67, - "LISTEN_PORT" : 82, - "LISTEN_REPORT" : 3000 -} diff --git a/test.js b/dev/test.js similarity index 100% rename from test.js rename to dev/test.js diff --git a/main.js b/main.js deleted file mode 100644 index 4ae1fd9..0000000 --- a/main.js +++ /dev/null @@ -1,497 +0,0 @@ -var config = require('./config.json'); -var cron = require('node-cron'); -var app = require('express')(); -var coins = ['TUSD', 'USDT', 'USDC', 'USDC', 'PAX', 'USDS', 'USDSB', ]; - -const Binance = require('binance-api-node').default; -const client = Binance({ - apiKey: config.API_KEY, - apiSecret: config.SECRET_KEY, -}); - - -if(config.BOT_TOKEN == "" && config.BOT_CHAT == "") { - bot_enabled = 0; -} else { - const TelegramBot = require('node-telegram-bot-api'); - const TOKEN = config.BOT_TOKEN; - var bot = new TelegramBot(TOKEN, {polling: true}); - bot.sendMessage(config.BOT_CHAT, '\u{1F916} stablecoins-infinity-profit-bot iniciando'); - bot_enabled = 1; -} - -client.openOrders({ - symbol: config.CURRENCY + config.MARKET, -}).then((result) => { - for (let index = 0; index < result.length; index++) { - if(result[index].side == "BUY") { - if(bot_enabled == 1) { - bot.sendMessage(config.BOT_CHAT, '\u{1F5E3} Order de compra encontrada: '+ result[index].orderId +' No total de: '+ result[index].origQty +' no valor de: '+ result[index].price +''); - } - console.log('Order de compra encontrada: '+ result[index].orderId +' No total de: '+ result[index].origQty +' no valor de: '+ result[index].price +''); - filledBuyOrder = false; - OrderBuyID = result[index].orderId; - buyAmount = result[index].origQty; - buyPriceTemp = result[index].price; - } - if(result[index].side == "SELL") { - if(bot_enabled == 1) { - bot.sendMessage(config.BOT_CHAT, '\u{1F5E3} Order de venda encontrada: '+ result[index].orderId +' No total de: '+ result[index].origQty +' no valor de: '+ result[index].price +''); - } - console.log("Order de venda encontrada: "+ result[index].orderId +" No total de: "+ result[index].origQty +" no valor de: "+ result[index].price +""); - filledSellOrder = false; - OrderSellID = result[index].orderId; - sellAmount = result[index].origQty; - sellPriceTemp = result[index].price; - } - } -}); - -var task = cron.schedule('*/' + config.LOOP_TIME + ' * * * * *', () => { - client.dailyStats({ symbol: config.CURRENCY + config.MARKET }).then((result) => { - changePrice = parseFloat(result.priceChangePercent); - avgPrice = parseFloat(result.lastPrice); - minDay = parseFloat(result.lowPrice); - maxDay = parseFloat(result.highPrice); - spreadDay = parseFloat(maxDay - minDay).toFixed(4); - spreadOpera = parseFloat(spreadDay / 4); - otherStables = 0; - client.accountInfo({ useServerTime: true }).then((result) => { - for (let index = 0; index < result.balances.length; index++) { - if (result.balances[index].asset == "BNB") { - balanceBNB = (parseFloat(result.balances[index].locked) + parseFloat(result.balances[index].free)); - } - if (result.balances[index].asset == "TUSD") { - saldo_TUSD = (parseFloat(result.balances[index].locked) + parseFloat(result.balances[index].free)).toFixed(8); - } - if (result.balances[index].asset == "USDT") { - saldo_USDT = (parseFloat(result.balances[index].locked) + parseFloat(result.balances[index].free)).toFixed(8); - } - if (result.balances[index].asset == "USDC") { - saldo_USDC = (parseFloat(result.balances[index].locked) + parseFloat(result.balances[index].free)).toFixed(8); - } - if (result.balances[index].asset == "PAX") { - saldo_PAX = (parseFloat(result.balances[index].locked) + parseFloat(result.balances[index].free)).toFixed(8); - } - if (result.balances[index].asset == "USDS") { - saldo_USDS = (parseFloat(result.balances[index].locked) + parseFloat(result.balances[index].free)).toFixed(8); - } - if (result.balances[index].asset == "USDSB") { - saldo_USDSB = (parseFloat(result.balances[index].locked) + parseFloat(result.balances[index].free)).toFixed(8); - } - - if (result.balances[index].asset == config.MARKET) { - marketBalanceLocked = parseFloat(result.balances[index].locked); - marketBalanceFree = parseFloat(result.balances[index].free); - } else if (result.balances[index].asset == config.CURRENCY) { - currencyBalanceLocked = parseFloat(result.balances[index].locked); - currencyBalanceFree = parseFloat(result.balances[index].free); - } - - if (coins.indexOf(result.balances[index].asset) > -1) { - if((result.balances[index].asset != config.MARKET) && (result.balances[index].asset != config.CURRENCY)) { - let otherCoinsLocked = parseFloat(result.balances[index].locked); - let otherCoinsFree = parseFloat(result.balances[index].free); - otherStables = (otherStables + (otherCoinsLocked + otherCoinsFree)); - } - } - - } - - total = (marketBalanceLocked + marketBalanceFree + currencyBalanceLocked + currencyBalanceFree + otherStables).toFixed(8); - - if((marketBalanceLocked + marketBalanceFree) < (total / 2)) { - buyAmount = (((total/2) * config.BUY_VALUE) / 100 ).toFixed(2); - sellAmount = (((total/2) * config.BUY_VALUE) / 100 ).toFixed(2); - } else { - if((currencyBalanceLocked + currencyBalanceFree) < (total / 2)) { - buyAmount = (((total/2) * config.BUY_VALUE) / 100 ).toFixed(2); - sellAmount = (((total/2) * config.BUY_VALUE) / 100 ).toFixed(2); - } else { - if (setAmount == 0) { - buyAmount = (((marketBalanceLocked + marketBalanceFree) * config.BUY_VALUE) / 100).toFixed(2); - sellAmount = ((( currencyBalanceLocked + currencyBalanceFree) * config.BUY_VALUE) / 100).toFixed(2); - setAmount = 1; - } - } - } - - if(config.AUTO_SPREAD == 1) { - status_spread = "ATIVADO"; - } else { - status_spread = "DESATIVADO"; - } - - console.clear(); - console.log("==========================================="); - console.log("SALDO "+ config.MARKET +"...:", marketBalanceLocked + marketBalanceFree); - console.log("SALDO "+ config.CURRENCY +"...:", currencyBalanceLocked + currencyBalanceFree); - console.log("OUTRAS STALBE:", otherStables.toFixed(8)); - console.log("SALDO BNB....:", balanceBNB); - console.log("SALDO TOTAL..:", total, "USD"); - console.log("AUTO SPREAD..:", status_spread); - console.log("MINIMA DO DIA:", minDay); - console.log("MAXIMA DO DIA:", maxDay); - console.log(config.CURRENCY + config.MARKET +".....:", avgPrice); - console.log("VARIACAO 24H.:", changePrice +" %"); - console.log("SPREAD 24H...:", spreadDay); - console.log("SPREAD OPERA.:", spreadOpera); - console.log("SALDO INICIAL:", config.INITIAL_INVESTMENT, "USD"); - console.log("LUCRO........:", (total - config.INITIAL_INVESTMENT).toFixed(4), "USD"); - console.log(" ", ((total - config.INITIAL_INVESTMENT) * 100 / config.INITIAL_INVESTMENT).toFixed(2), "%"); - console.log("==========================================="); - console.log("UPTIME.......:", ((Math.floor(+new Date() / 1000) - startTime) / 3600).toFixed(2) , "horas"); - console.log("ORDENS.......:", "VENDAS: [", totalVendas, "] COMPRAS: [", totalCompras, "]"); - simpleStrategy(); - }).catch((err) => { - throw err; - }); - }).catch((err) => { - console.log(err); - }); -}, { scheduled: false }); - -function simpleStrategy() { - if(OrderBuyID != 0 && (hasFundsBuy == 1)) { - client.getOrder({ - symbol: config.CURRENCY + config.MARKET, - orderId: OrderBuyID, - }).then((result) => { - dateOrderBuy = result.time; - if(result.status == 'FILLED') { - filledBuyOrder = true; - if(bot_enabled == 1) { - bot.sendMessage(config.BOT_CHAT, '\u{1f911} Ordem de compra executada com sucesso. Saldo atual: '+ config.MARKET + ': '+ (marketBalanceLocked + marketBalanceFree).toFixed(4) +' '+ config.CURRENCY +' '+ (currencyBalanceLocked + currencyBalanceFree).toFixed(4) +' Lucro atual: '+ (total - config.INITIAL_INVESTMENT).toFixed(4) + " USD" +' \u{1F4B0} '+ ((total - config.INITIAL_INVESTMENT) * 100 / config.INITIAL_INVESTMENT).toFixed(2) +'%'); - } - client.cancelOrder({ - symbol: config.CURRENCY + config.MARKET, - orderId: OrderSellID,}).catch((err) => { - console.log(err); - }); - } - - if(result.status == 'CANCELED') { - filledBuyOrder = true; - if(bot_enabled == 1) { - bot.sendMessage(config.BOT_CHAT, '\u{1f6a8} Ordem de compra '+ OrderBuyID +' cancelada na exchange, gerando uma nova ordem.'); - } - } - }).catch((err) => { - throw err; - }); - } - - if(OrderSellID != 0 && (hasFundsSell == 1)) { - client.getOrder({ - symbol: config.CURRENCY + config.MARKET, - orderId: OrderSellID, - }).then((result) => { - dateOrderSell = result.time; - if(result.status == 'FILLED') { - filledSellOrder = true; - if(bot_enabled == 1) { - bot.sendMessage(config.BOT_CHAT, '\u{1f911} Ordem de venda executada com sucesso. Saldo atual: '+ config.MARKET + ': '+ (marketBalanceLocked + marketBalanceFree).toFixed(4) +' '+ config.CURRENCY +' '+ (currencyBalanceLocked + currencyBalanceFree).toFixed(4) +' Lucro atual: '+ (total - config.INITIAL_INVESTMENT).toFixed(4) + " USD" +' \u{1F4B0} '+ ((total - config.INITIAL_INVESTMENT) * 100 / config.INITIAL_INVESTMENT).toFixed(2) +'%'); - } - client.cancelOrder({ - symbol: config.CURRENCY + config.MARKET, - orderId: OrderBuyID,}).catch((err) => { - console.log(err); - }); - } - - if(result.status == 'CANCELED') { - filledSellOrder = true; - if(bot_enabled == 1) { - bot.sendMessage(config.BOT_CHAT, '\u{1f6a8} Ordem de venda '+ OrderSellID +' cancelada na exchange, gerando uma nova ordem.'); - } - } - }).catch((err) => { - throw err; - }); - } - - if(config.ORDER_EXPIRE != 0) { - date = new Date(dateOrderBuy); - dateOrderBuyExpire = date.setHours(date.getHours() + config.ORDER_EXPIRE); - if((dateOrderBuyExpire > 1546300800) && (Date.now() > dateOrderBuyExpire) && (OrderBuyID != 0) && (buyPriceTemp != 0) && (countExpireBuy > 2)) { - if(bot_enabled == 1) { - bot.sendMessage(config.BOT_CHAT, '\u{231b} A ordem de compra expirou em '+ new Date(dateOrderSellExpire) +' sem execução do mercado. Timeout em '+ config.ORDER_EXPIRE +' horas. Será gerada uma nova ordem de compra para operação.'); - } - client.cancelOrder({ - symbol: config.CURRENCY + config.MARKET, - orderId: OrderBuyID,}).catch((err) => { - console.log(err); - }); - countExpireBuy = 0; - } else { - countExpireBuy++; - } - - date = new Date(dateOrderSell); - dateOrderSellExpire = date.setHours(date.getHours() + config.ORDER_EXPIRE); - if((dateOrderSellExpire > 1546300800) && (Date.now() > dateOrderSellExpire) && (OrderSellID != 0) && (sellPriceTemp != 0) && (countExpireSell > 2)) { - if(bot_enabled == 1) { - bot.sendMessage(config.BOT_CHAT, '\u{231b} A ordem de venda expirou em '+ new Date(dateOrderSellExpire) +' sem execução do mercado. Timeout em '+ config.ORDER_EXPIRE +' horas. Será gerada uma nova ordem de venda para operação.'); - } - client.cancelOrder({ - symbol: config.CURRENCY + config.MARKET, - orderId: OrderSellID,}).catch((err) => { - console.log(err); - }); - countExpireSell = 0; - } else { - countExpireSell++; - } - - } - - if ((config.AUTO_SPREAD == 1) && (SpreadTemp != 0) && (SpreadTemp != spreadOpera) && (spreadOpera >= config.SPREAD_MIN)) { - if(bot_enabled == 1) { - bot.sendMessage(config.BOT_CHAT, '\u{1f6a7} Ajuste no spread de mercado de '+ SpreadTemp +' para '+ spreadOpera +' para variação de '+ changePrice + ' %. As próximas ordens vão utilizar esta margem.'); - } - } - SpreadTemp = spreadOpera; - changePriceTemp = changePrice; - - if(config.AUTO_SPREAD == 1) { - if((OrderSellID == 0 && OrderBuyID == 0) || (spreadOpera <= config.SPREAD_MIN)) { - spreadOpera = config.SPREAD_MIN; - buyPrice = (avgPrice * (1 - spreadOpera)).toFixed(4); - sellPrice = (avgPrice * (1 + spreadOpera)).toFixed(4); - } else { - buyPrice = (avgPrice - (spreadOpera)).toFixed(4); - sellPrice = (avgPrice + (spreadOpera)).toFixed(4); - } - } else { - buyPrice = (avgPrice * (1 - config.SPREAD_BUY)).toFixed(4); - sellPrice = (avgPrice * (1 + config.SPREAD_SELL)).toFixed(4); - } - - - client.myTrades({ - symbol: config.CURRENCY + config.MARKET, - }).then((result) => { - if(filledSellOrder == true) { - for (let index = (result.length -1); index > 1; index--) { - if((result[index].isBuyer == true) && (filledSellOrder == true) && (currencyBalanceFree >= 20)) { - if(sellPrice - parseFloat(result[index].price).toFixed(4) < spreadOpera) { - let sellPriceTemp = (parseFloat(result[index].price).toFixed(4) * (1 + spreadOpera)).toFixed(4); - if((sellPriceTemp > avgPrice) && ((sellPriceTemp - avgPrice) >= spreadOpera) && notifySellMin == 0) { - sellPrice = sellPriceTemp; - if(bot_enabled == 1) { - bot.sendMessage(config.BOT_CHAT, '\u{2716} ALERTA: A ordem de venda está em um valor abaixo da diferença de spread '+ spreadOpera +' da última ordem de compra no valor de '+ parseFloat(result[index].price).toFixed(4) +' comparado ao preço atual de mercado em '+ avgPrice +'. Ela teve seu valor reajustado para: '+ sellPrice +'.'); - } - } else { - if(bot_enabled == 1 && notifySellMin == 0) { - bot.sendMessage(config.BOT_CHAT, '\u{2714} AVISO: A ordem de venda está dentro da diferença de spread '+ spreadOpera +' da última ordem de compra no valor de '+ parseFloat(result[index].price).toFixed(4) +''); - } - } - } else { - if(bot_enabled == 1 && notifySellMin == 0) { - bot.sendMessage(config.BOT_CHAT, '\u{2714} AVISO: A ordem de venda está dentro da diferença de spread '+ spreadOpera +' da última ordem de compra no valor de '+ parseFloat(result[index].price).toFixed(4) +''); - } - } - index = 0; - } - } - } - - if(filledBuyOrder == true) { - for (let index = (result.length - 1); index > 1; index--) { - if((result[index].isBuyer == false) && (filledBuyOrder == true) && (marketBalanceFree >= 20)) { - if(buyPrice - parseFloat(result[index].price).toFixed(4) < spreadOpera) { - let buyPriceTemp = (parseFloat(result[index].price).toFixed(4) * (1 - spreadOpera)).toFixed(4); - if ((buyPriceTemp < avgPrice) && ((avgPrice - buyPriceTemp) >= spreadOpera) && notifyBuyMax == 0) { - buyPrice = buyPriceTemp; - if(bot_enabled == 1) { - bot.sendMessage(config.BOT_CHAT, '\u{2716} ALERTA: A ordem de compra está em um valor abaixo da diferença de spread '+ spreadOpera +' da última ordem de venda no valor de '+ parseFloat(result[index].price).toFixed(4) +' comparado ao preço atual de mercado em '+ avgPrice +'. Ela teve seu valor reajustado para: '+ buyPrice +'.'); - } - } else { - if(bot_enabled == 1 && notifyBuyMax == 0) { - bot.sendMessage(config.BOT_CHAT, '\u{2714} AVISO: A ordem de compra está dentro da diferença de spread '+ spreadOpera +' da última ordem de venda no valor de '+ parseFloat(result[index].price).toFixed(4) +''); - } - } - } else { - if(bot_enabled == 1 && notifyBuyMax == 0) { - bot.sendMessage(config.BOT_CHAT, '\u{2714} AVISO: A ordem de compra está dentro da diferença de spread '+ spreadOpera +' da última ordem de venda no valor de '+ parseFloat(result[index].price).toFixed(4) +''); - } - } - index = 0; - } - } - } - }); - - - client.dailyStats({ symbol: "BTC" + config.MARKET }).then((result) => { - console.log("DEFINIDOS....: Compra " + buyPrice + " e Venda " + sellPrice); - console.log("TIMEOUT ORDEM:"+ " "+config.ORDER_EXPIRE+" horas"); - console.log("HORA AGORA...:"+ " "+new Date()); - console.log("============== DADOS DE COMPRA ============"); - console.log("VALOR COMPRA.:", buyAmount); - console.log("PRECO COMPRA.:", parseFloat(buyPriceTemp).toFixed(4)); - console.log("ID ORDEM BUY.:", OrderBuyID); - console.log("EXPIRA EM....:", new Date(dateOrderBuyExpire)); - console.log("============== DADOS DE VENDA ============="); - console.log("VALOR VENDA..:", sellAmount); - console.log("PRECO VENDA..:", parseFloat(sellPriceTemp).toFixed(4)); - console.log("ID ORDEM SELL:", OrderSellID); - console.log("EXPIRA EM....:", new Date(dateOrderSellExpire)); - console.log("==========================================="); - client.openOrders({ - symbol: config.CURRENCY + config.MARKET, - }).then((result) => { - if (filledBuyOrder == true) { - if ((marketBalanceFree > 20 || marketBalanceFree >= buyAmount) && buyPrice < config.BUY_MAX) { - if((marketBalanceFree > 20) && (marketBalanceFree <= buyAmount)) { - buyAmount = parseFloat(marketBalanceFree).toFixed(2); - } - client.order({ - symbol: config.CURRENCY + config.MARKET, - side: 'BUY', - quantity: buyAmount, - price: buyPrice, - useServerTime: true - }).then((result) => { - totalCompras++; - OrderBuyID = result.orderId; - filledBuyOrder = false; - }).catch((err) => { - totalCompras--; - throw err; - }); - notifyBuyMax = 0; - hasFundsBuy = 1; - buyPriceTemp = buyPrice; - if(bot_enabled == 1) { - bot.sendMessage(config.BOT_CHAT, '\u{1F4C9} Order de compra criada com sucesso: Quantidade comprada: \u{1f4b5} '+ buyAmount +', valor de compra: \u{1f3f7} '+ buyPrice +' utilizando spread em '+ spreadOpera +'.'); - } - } else { - if(bot_enabled == 1 && notifyBuyMax == 0 && marketBalanceFree >= buyAmount) { - bot.sendMessage(config.BOT_CHAT, '\u{274C} O valor de compra do mercado esta acima do definido em '+ config.BUY_MAX+'. O bot vai aguardar o preço reduzir até o valor definido para evitar prejuízos.'); - notifyBuyMax = 1; - } - if(bot_enabled == 1 && hasFundsBuy == 1 && notifyBuyMax == 0) { - bot.sendMessage(config.BOT_CHAT, '\u{1F6AB} O bot está sem saldo para compras em '+ config.MARKET +'. Seu saldo atual é: '+marketBalanceFree+'. O bot vai aguardar até que uma compra seja executada para liberar saldo.'); - notifyBuyMax = 1; - } - OrderBuyID = 0; - hasFundsBuy = 0; - } - } - - if (filledSellOrder == true) { - if ((currencyBalanceFree > 20 || currencyBalanceFree >= sellAmount) && sellPrice > config.SELL_MIN) { - if((currencyBalanceFree > 20) && (currencyBalanceFree <= sellAmount)) { - sellAmount = parseFloat(currencyBalanceFree).toFixed(2); - } - client.order({ - symbol: config.CURRENCY + config.MARKET, - side: 'SELL', - quantity: sellAmount, - price: sellPrice, - useServerTime: true - }).then((result) => { - totalVendas++; - OrderSellID = result.orderId; - filledSellOrder = false; - }).catch((err) => { - totalVendas--; - throw err; - }); - notifySellMin = 0; - hasFundsSell = 1; - sellPriceTemp = sellPrice; - if(bot_enabled == 1) { - bot.sendMessage(config.BOT_CHAT, '\u{1F4C8} Order de venda criada com sucesso: Quantidade vendida: \u{1f4b5} '+ sellAmount +', valor de venda: \u{1f3f7} '+ sellPrice +' utilizando spread em '+ spreadOpera +'.'); - } - } else { - if(bot_enabled == 1 && notifySellMin == 0 && currencyBalanceFree >= sellAmount) { - bot.sendMessage(config.BOT_CHAT, '\u{274C} O valor de venda do mercado esta abaixo do definido em '+ config.SELL_MIN+'. O bot vai aguardar o preço aumentar até o valor definido para evitar prejuízos.'); - notifySellMin = 1; - } - if(bot_enabled == 1 && hasFundsSell == 1 && notifySellMin == 0) { - bot.sendMessage(config.BOT_CHAT, '\u{1F6AB} O bot está sem saldo para vendas em '+ config.CURRENCY +'. Seu saldo atual é: '+currencyBalanceFree+'. O bot vai aguardar até que uma compra seja executada para liberar saldo.'); - notifySellMin = 1; - } - OrderSellID = 0; - hasFundsSell = 0; - } - } - }).catch((err) => { - throw err; - }); - }).catch((err) => { - throw err; - }); -} - -// limpa o console -console.clear(); -// define as variaveis -notifyBuyMax = 0 -notifySellMin = 0; -otherStables = 0; -hasFundsBuy = 1; -hasFundsSell = 1; -countExpireBuy = 0; -countExpireSell = 0 -dateOrderBuy = 0 -dateOrderBuyExpire = 0; -dateOrderSell = 0; -dateOrderSellExpire = 0; -buyPriceTemp = 0; -sellPriceTemp = 0; -changePriceTemp = 0; -startTime = Math.floor(+new Date() / 1000); -avgPrice = 0; -OrderBuyID = 0; -filledBuyOrder = true; -filledSellOrder = true; -OrderSellID = 0; -SpreadTemp = 0; -totalCompras = 0; -totalVendas = 0; -marketBalanceLocked = 0; -marketBalanceFree = 0; -currencyBalanceLocked = 0; -currencyBalanceFree = 0; -total = 0; -setAmount = 0; -setBuyOrder = 0; -saldo_TUSD = 0; -saldo_USDT = 0; -saldo_USDC = 0; -saldo_PAX = 0; -saldo_USDS = 0; -saldo_USDSB = 0; -total_stable = 0; - -console.log("Iniciando..."); - -task.start(); - -app.get('/', (req, res) => { - let total_investiment = (total - config.INITIAL_INVESTMENT).toFixed(8); - res.json( - { - initialInvestment: config.INITIAL_INVESTMENT, - market: config.MARKET, - currency: config.CURRENCY, - balances: { - usdt: parseFloat(saldo_USDT), - tusd: parseFloat(saldo_TUSD), - pax: parseFloat(saldo_PAX), - usdc: parseFloat(saldo_USDC), - usds: parseFloat(saldo_USDS), - usdsb: parseFloat(saldo_USDSB) - }, - profit: { - USD: parseFloat(total_investiment), - percent: parseFloat(((total - config.INITIAL_INVESTMENT) * 100 / config.INITIAL_INVESTMENT).toFixed(2)) - } - } - ); -}); - -app.listen(config.LISTEN_PORT); diff --git a/package-lock.json b/package-lock.json index 0ace019..557ad44 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,6 +4,32 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "@babel/code-frame": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.8.3.tgz", + "integrity": "sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g==", + "dev": true, + "requires": { + "@babel/highlight": "^7.8.3" + } + }, + "@babel/highlight": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.8.3.tgz", + "integrity": "sha512-PX4y5xQUvy0fnEVHrYOarRPXVWafSjTW9T0Hab8gVIawpl2Sj0ORyrygANq+KjcNlSSTw0YCLSNA8OyZ1I4yEg==", + "dev": true, + "requires": { + "chalk": "^2.0.0", + "esutils": "^2.0.2", + "js-tokens": "^4.0.0" + } + }, + "@types/color-name": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", + "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==", + "dev": true + }, "accepts": { "version": "1.3.7", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", @@ -13,16 +39,85 @@ "negotiator": "0.6.2" } }, + "acorn": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.1.tgz", + "integrity": "sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg==", + "dev": true + }, + "acorn-jsx": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.2.0.tgz", + "integrity": "sha512-HiUX/+K2YpkpJ+SzBffkM/AQ2YE03S0U1kjTLVpoJdhZMOWy8qvXVN9JdLqv2QsaQ6MPYQIuNmwD8zOiYUofLQ==", + "dev": true + }, + "ajv": { + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.0.tgz", + "integrity": "sha512-D6gFiFA0RRLyUbvijN74DWAjXSFxWKaWP7mldxkVhyhAV3+SWA9HEJPHQ2c9soIeTFJqcSdFDGFgdqs1iUU2Hw==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ansi-escapes": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.0.tgz", + "integrity": "sha512-EiYhwo0v255HUL6eDyuLrXEkTi7WwVCLAw+SeOQ7M7qdun1z1pum4DEm/nuqIVbPvi9RPPc9k9LbyBv6H0DwVg==", + "dev": true, + "requires": { + "type-fest": "^0.8.1" + } + }, + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, "array-flatten": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" }, + "astral-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz", + "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==", + "dev": true + }, "async-limiter": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==" }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, "binance-api-node": { "version": "0.9.2", "resolved": "https://registry.npmjs.org/binance-api-node/-/binance-api-node-0.9.2.tgz", @@ -51,11 +146,80 @@ "type-is": "~1.6.17" } }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, "bytes": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==" }, + "callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "chardet": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", + "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", + "dev": true + }, + "cli-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", + "dev": true, + "requires": { + "restore-cursor": "^3.1.0" + } + }, + "cli-width": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", + "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", + "dev": true + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, "content-disposition": { "version": "0.5.3", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz", @@ -79,6 +243,27 @@ "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" }, + "cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "dev": true, + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } + } + }, "debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", @@ -87,6 +272,12 @@ "ms": "2.0.0" } }, + "deep-is": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "dev": true + }, "depd": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", @@ -97,11 +288,26 @@ "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" }, + "doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "requires": { + "esutils": "^2.0.2" + } + }, "ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, "encodeurl": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", @@ -120,6 +326,151 @@ "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "eslint": { + "version": "6.8.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-6.8.0.tgz", + "integrity": "sha512-K+Iayyo2LtyYhDSYwz5D5QdWw0hCacNzyq1Y821Xna2xSJj7cijoLLYmLxTQgcgZ9mC61nryMy9S7GRbYpI5Ig==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "ajv": "^6.10.0", + "chalk": "^2.1.0", + "cross-spawn": "^6.0.5", + "debug": "^4.0.1", + "doctrine": "^3.0.0", + "eslint-scope": "^5.0.0", + "eslint-utils": "^1.4.3", + "eslint-visitor-keys": "^1.1.0", + "espree": "^6.1.2", + "esquery": "^1.0.1", + "esutils": "^2.0.2", + "file-entry-cache": "^5.0.1", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^5.0.0", + "globals": "^12.1.0", + "ignore": "^4.0.6", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "inquirer": "^7.0.0", + "is-glob": "^4.0.0", + "js-yaml": "^3.13.1", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.3.0", + "lodash": "^4.17.14", + "minimatch": "^3.0.4", + "mkdirp": "^0.5.1", + "natural-compare": "^1.4.0", + "optionator": "^0.8.3", + "progress": "^2.0.0", + "regexpp": "^2.0.1", + "semver": "^6.1.2", + "strip-ansi": "^5.2.0", + "strip-json-comments": "^3.0.1", + "table": "^5.2.3", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } + } + }, + "eslint-scope": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.0.0.tgz", + "integrity": "sha512-oYrhJW7S0bxAFDvWqzvMPRm6pcgcnWc4QnofCAqRTRfQC0JcwenzGglTtsLyIuuWFfkqDG9vz67cnttSd53djw==", + "dev": true, + "requires": { + "esrecurse": "^4.1.0", + "estraverse": "^4.1.1" + } + }, + "eslint-utils": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.4.3.tgz", + "integrity": "sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^1.1.0" + } + }, + "eslint-visitor-keys": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz", + "integrity": "sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A==", + "dev": true + }, + "esm": { + "version": "3.2.25", + "resolved": "https://registry.npmjs.org/esm/-/esm-3.2.25.tgz", + "integrity": "sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==" + }, + "espree": { + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/espree/-/espree-6.1.2.tgz", + "integrity": "sha512-2iUPuuPP+yW1PZaMSDM9eyVf8D5P0Hi8h83YtZ5bPc/zHYjII5khoixIUTMO794NOY8F/ThF1Bo8ncZILarUTA==", + "dev": true, + "requires": { + "acorn": "^7.1.0", + "acorn-jsx": "^5.1.0", + "eslint-visitor-keys": "^1.1.0" + } + }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + }, + "esquery": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.1.0.tgz", + "integrity": "sha512-MxYW9xKmROWF672KqjO75sszsA8Mxhw06YFeS5VHlB98KDHbOSurm3ArsjO60Eaf3QmGMCP1yn+0JQkNLo/97Q==", + "dev": true, + "requires": { + "estraverse": "^4.0.0" + } + }, + "esrecurse": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz", + "integrity": "sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==", + "dev": true, + "requires": { + "estraverse": "^4.1.0" + } + }, + "estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true + }, + "esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true + }, "etag": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", @@ -162,6 +513,53 @@ "vary": "~1.1.2" } }, + "external-editor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", + "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", + "dev": true, + "requires": { + "chardet": "^0.7.0", + "iconv-lite": "^0.4.24", + "tmp": "^0.0.33" + } + }, + "fast-deep-equal": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz", + "integrity": "sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==", + "dev": true + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "dev": true + }, + "figures": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", + "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.5" + } + }, + "file-entry-cache": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz", + "integrity": "sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g==", + "dev": true, + "requires": { + "flat-cache": "^2.0.1" + } + }, "finalhandler": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", @@ -176,6 +574,23 @@ "unpipe": "~1.0.0" } }, + "flat-cache": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz", + "integrity": "sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA==", + "dev": true, + "requires": { + "flatted": "^2.0.0", + "rimraf": "2.6.3", + "write": "1.0.3" + } + }, + "flatted": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.1.tgz", + "integrity": "sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg==", + "dev": true + }, "forwarded": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", @@ -186,6 +601,56 @@ "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", + "dev": true + }, + "glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "glob-parent": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.0.tgz", + "integrity": "sha512-qjtRgnIVmOfnKUE3NJAQEdk+lKrxfw8t5ke7SXtfMTHcjsBfOfWXCQfdb30zfDoZQ2IRSIiidmjtbHZPZ++Ihw==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, + "globals": { + "version": "12.3.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-12.3.0.tgz", + "integrity": "sha512-wAfjdLgFsPZsklLJvOBUBmzYE8/CwhEqSBEMRXA3qxIiNtyqvjYurAtIfDh6chlEPUfmTY3MnZh5Hfh4q0UlIw==", + "dev": true, + "requires": { + "type-fest": "^0.8.1" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, "html5-websocket": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/html5-websocket/-/html5-websocket-2.0.4.tgz", @@ -226,21 +691,168 @@ "safer-buffer": ">= 2.1.2 < 3" } }, + "ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true + }, + "import-fresh": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.1.tgz", + "integrity": "sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ==", + "dev": true, + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + } + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, "inherits": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" }, + "inquirer": { + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.0.5.tgz", + "integrity": "sha512-6Z5cP+LAO0rzNE7xWjWtT84jxKa5ScLEGLgegPXeO3dGeU8lNe5Ii7SlXH6KVtLGlDuaEhsvsFjrjWjw8j5lFg==", + "dev": true, + "requires": { + "ansi-escapes": "^4.2.1", + "chalk": "^3.0.0", + "cli-cursor": "^3.1.0", + "cli-width": "^2.0.0", + "external-editor": "^3.0.3", + "figures": "^3.0.0", + "lodash": "^4.17.15", + "mute-stream": "0.0.8", + "run-async": "^2.4.0", + "rxjs": "^6.5.3", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0", + "through": "^2.3.6" + }, + "dependencies": { + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.0" + } + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, "ipaddr.js": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.0.tgz", "integrity": "sha512-M4Sjn6N/+O6/IXSJseKqHoFc+5FdGJ22sXqnjTpdZweHK64MzEPAyQZyEU3R/KRv2GLoa7nNtg/C2Ev6m7z+eA==" }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "is-glob": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", + "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-promise": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", + "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=", + "dev": true + }, "is-stream": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=" }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, "isomorphic-fetch": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz", @@ -250,6 +862,50 @@ "whatwg-fetch": ">=0.10.0" } }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "js-yaml": { + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", + "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", + "dev": true + }, + "levn": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", + "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", + "dev": true, + "requires": { + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2" + } + }, + "lodash": { + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", + "dev": true + }, "lodash.zipobject": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/lodash.zipobject/-/lodash.zipobject-4.1.3.tgz", @@ -288,16 +944,64 @@ "mime-db": "1.40.0" } }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, + "requires": { + "minimist": "0.0.8" + } + }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, + "mute-stream": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", + "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", + "dev": true + }, + "natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "dev": true + }, "negotiator": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==" }, + "nice-try": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", + "dev": true + }, "node-cron": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/node-cron/-/node-cron-2.0.3.tgz", @@ -324,21 +1028,92 @@ "ee-first": "1.1.1" } }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "onetime": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.0.tgz", + "integrity": "sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q==", + "dev": true, + "requires": { + "mimic-fn": "^2.1.0" + } + }, "opencollective-postinstall": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/opencollective-postinstall/-/opencollective-postinstall-2.0.2.tgz", "integrity": "sha512-pVOEP16TrAO2/fjej1IdOyupJY8KDUM1CvsaScRbw6oddvpQoOfGk4ywha0HKKVAD6RkW4x6Q+tNBwhf3Bgpuw==" }, + "optionator": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", + "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", + "dev": true, + "requires": { + "deep-is": "~0.1.3", + "fast-levenshtein": "~2.0.6", + "levn": "~0.3.0", + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2", + "word-wrap": "~1.2.3" + } + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "dev": true + }, + "parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "requires": { + "callsites": "^3.0.0" + } + }, "parseurl": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==" }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true + }, "path-to-regexp": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" }, + "prelude-ls": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", + "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", + "dev": true + }, + "progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true + }, "proxy-addr": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.5.tgz", @@ -348,6 +1123,12 @@ "ipaddr.js": "1.9.0" } }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true + }, "qs": { "version": "6.7.0", "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", @@ -374,6 +1155,55 @@ "resolved": "https://registry.npmjs.org/reconnecting-websocket/-/reconnecting-websocket-3.2.2.tgz", "integrity": "sha512-SWSfoXiaHVOqXuPWFgGWeUxKnb5HIY7I/Fh5C/hy4wUOgeOh7YIMXEiv5/eHBlNs4tNzCrO5YDR9AH62NWle0Q==" }, + "regexpp": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz", + "integrity": "sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==", + "dev": true + }, + "resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true + }, + "restore-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", + "dev": true, + "requires": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + } + }, + "rimraf": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", + "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "run-async": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.0.tgz", + "integrity": "sha512-xJTbh/d7Lm7SBhc1tNvTpeCHaEzoyxPrqNlvSdMfBTYwaY++UJFyXUOxAtsRUXjlqOfj8luNaR9vjCh4KeV+pg==", + "dev": true, + "requires": { + "is-promise": "^2.1.0" + } + }, + "rxjs": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.4.tgz", + "integrity": "sha512-naMQXcgEo3csAEGvw/NydRA0fuS2nDZJiw1YUWFKU7aPPAPGZEsD4Iimit96qwCieH6y614MCLYwdkrWx7z/7Q==", + "dev": true, + "requires": { + "tslib": "^1.9.0" + } + }, "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", @@ -384,6 +1214,12 @@ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + }, "send": { "version": "0.17.1", "resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz", @@ -427,16 +1263,195 @@ "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==" }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true + }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "dev": true + }, + "slice-ansi": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-2.1.0.tgz", + "integrity": "sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.0", + "astral-regex": "^1.0.0", + "is-fullwidth-code-point": "^2.0.0" + }, + "dependencies": { + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + } + } + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, "statuses": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" }, + "string-width": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", + "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + }, + "dependencies": { + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.0" + } + } + } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + } + } + }, + "strip-json-comments": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.0.1.tgz", + "integrity": "sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, + "table": { + "version": "5.4.6", + "resolved": "https://registry.npmjs.org/table/-/table-5.4.6.tgz", + "integrity": "sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug==", + "dev": true, + "requires": { + "ajv": "^6.10.2", + "lodash": "^4.17.14", + "slice-ansi": "^2.1.0", + "string-width": "^3.0.0" + }, + "dependencies": { + "emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + } + } + }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true + }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", + "dev": true + }, + "tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "dev": true, + "requires": { + "os-tmpdir": "~1.0.2" + } + }, "toidentifier": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==" }, + "tslib": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.11.1.tgz", + "integrity": "sha512-aZW88SY8kQbU7gpV19lN24LtXh/yD4ZZg6qieAJDDg+YBsJcSmLGK9QpnUjAKVG/xefmvJGd1WUmfpT/g6AJGA==", + "dev": true + }, + "type-check": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", + "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", + "dev": true, + "requires": { + "prelude-ls": "~1.1.2" + } + }, + "type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "dev": true + }, "type-is": { "version": "1.6.18", "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", @@ -461,11 +1476,26 @@ "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" }, + "uri-js": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", + "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "dev": true, + "requires": { + "punycode": "^2.1.0" + } + }, "utils-merge": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" }, + "v8-compile-cache": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz", + "integrity": "sha512-usZBT3PW+LOjM25wbqIlZwPeJV+3OSz3M1k1Ws8snlW39dZyYL9lOGC5FgPVHfk0jKmjiDV8Z0mIbVQPiwFs7g==", + "dev": true + }, "vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", @@ -475,6 +1505,36 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.0.0.tgz", "integrity": "sha512-9GSJUgz1D4MfyKU7KRqwOjXCXTqWdFNvEr7eUBYchQiVc744mqK/MzXPNR2WsPkmkOa4ywfg8C2n8h+13Bey1Q==" + }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "dev": true + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "write": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/write/-/write-1.0.3.tgz", + "integrity": "sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig==", + "dev": true, + "requires": { + "mkdirp": "^0.5.1" + } } } } diff --git a/package.json b/package.json index c93b68c..b229a2c 100644 --- a/package.json +++ b/package.json @@ -2,10 +2,10 @@ "name": "stablecoins-infinity-profit-bot", "version": "1.0.0", "description": "Make infinity money with stablecoins", - "main": "main.js", + "main": "index.js", "repository": "github:itxtoledo/Stablecoins-Infinity-Profit-Bot", "scripts": { - "start": "node main.js" + "start": "node -r esm ./src/index.js" }, "author": { "name": "Gustavo Toledo", @@ -16,12 +16,14 @@ "dependencies": { "binance-api-node": "^0.9.2", "dateformat": "^3.0.3", + "esm": "^3.2.25", "express": "^4.17.1", "get-json": "^1.0.1", "http": "0.0.0", "lowdb": "^1.0.0", "node-cron": "^2.0.3", - "node-telegram-bot-api": "^0.29.0" + "node-telegram-bot-api": "^0.29.0", + "telegraf": "^3.36.0" }, "keywords": [ "javascript", @@ -31,5 +33,7 @@ "tusd", "usdt" ], - "devDependencies": {} + "devDependencies": { + "eslint": "^6.8.0" + } } diff --git a/src/botMemory.js b/src/botMemory.js new file mode 100644 index 0000000..79680ac --- /dev/null +++ b/src/botMemory.js @@ -0,0 +1,42 @@ +export default { + notifyBuyMax: false, + notifySellMin: false, + otherStables: 0, + hasFundsBuy: true, + hasFundsSell: true, + countExpireBuy: 0, + countExpireSell: 0, + dateOrderBuy: 0, + dateOrderBuyExpire: 0, + dateOrderSell: 0, + dateOrderSellExpire: 0, + buyPriceTemp: 0, + sellPriceTemp: 0, + changePriceTemp: 0, + startTime: Date.now(), + avgPrice: 0, + OrderBuyID: 0, + filledBuyOrder: true, + filledSellOrder: true, + OrderSellID: 0, + SpreadTemp: 0, + totalBuys: 0, + totalSells: 0, + marketBalanceLocked: 0, + marketBalanceFree: 0, + currencyBalanceLocked: 0, + currencyBalanceFree: 0, + total: 0, + settedAmount: false, + balance_BNB: 0, + balance_TUSD: 0, + balance_USDT: 0, + balance_USDC: 0, + balance_PAX: 0, + balance_USDS: 0, + balance_USDSB: 0, + total_stable: 0, + sellAmount: 0, + buyAmount: 0, + telegram: false +}; diff --git a/src/config.js b/src/config.js new file mode 100644 index 0000000..d12d20d --- /dev/null +++ b/src/config.js @@ -0,0 +1,21 @@ +export default { + API_KEY: "", + SECRET_KEY: "", + CURRENCY: "PAX", + MARKET: "USDT", + COINS: ["TUSD", "USDT", "USDC", "USDC", "PAX", "USDS", "USDSB"], + SPREAD_SELL: 0.0015, + SPREAD_BUY: 0.0015, + BUY_MAX: 0.9993, + SELL_MIN: 1.0, + ORDER_EXPIRE: 24, + AUTO_SPREAD: true, + BUY_VALUE: 100, + SPREAD_MIN: 0.0015, + LOOP_TIME: 15, + TELEGRAM_TOKEN: "", + TELEGRAM_CHAT: "", + INITIAL_INVESTMENT: 2925.67, + LISTEN_PORT: 82, + LISTEN_REPORT: 3000 +}; diff --git a/src/index.js b/src/index.js new file mode 100644 index 0000000..f42f786 --- /dev/null +++ b/src/index.js @@ -0,0 +1,826 @@ +import config from "./config.js"; +import cron from "node-cron"; +import express from "express"; +import Binance from "binance-api-node"; +import Telegraf from "telegraf"; +import botMemory from "./botMemory.js"; + +const app = express(); + +let tgBot = null; + +const client = Binance({ + apiKey: config.API_KEY, + apiSecret: config.SECRET_KEY +}); + +if (config.BOT_TOKEN != "" && config.BOT_CHAT != "") { + tgBot = new Telegraf(config.BOT_TOKEN); + tgBot.telegram.sendMessage( + config.BOT_CHAT, + "\u{1F916} stablecoins-infinity-profit-bot iniciando" + ); + botMemory.telegram = true; +} + +function showMessage(message) { + if (botMemory.telegram) tgBot.telegram.sendMessage(config.BOT_CHAT, message); + console.log(message); +} + +client + .openOrders({ + symbol: config.CURRENCY + config.MARKET + }) + .then(result => { + for (let i = 0; i < result.length; i++) { + if (result[i].side == "BUY") { + botMemory.filledBuyOrder = false; + botMemory.OrderBuyID = result[i].orderId; + botMemory.buyAmount = result[i].origQty; + botMemory.buyPriceTemp = result[i].price; + } else { + botMemory.filledSellOrder = false; + botMemory.OrderSellID = result[i].orderId; + botMemory.sellAmount = result[i].origQty; + botMemory.sellPriceTemp = result[i].price; + } + showMessage( + `Order de ${ + result[i].side === "BUY" ? "compra" : "venda" + } encontrada: ${result[i].orderId} No total de: ${ + result[i].origQty + } no valor de: ${result[i].price}` + ); + } + }); + +const task = cron.schedule( + `*/${config.LOOP_TIME} * * * * *`, + () => { + client + .dailyStats({ symbol: config.CURRENCY + config.MARKET }) + .then(result => { + botMemory.changePrice = parseFloat(result.priceChangePercent); + botMemory.avgPrice = parseFloat(result.lastPrice); + botMemory.minDay = parseFloat(result.lowPrice); + botMemory.maxDay = parseFloat(result.highPrice); + botMemory.spreadDay = parseFloat( + botMemory.maxDay - botMemory.minDay + ).toFixed(4); + botMemory.spreadOpera = parseFloat(botMemory.spreadDay / 4); + botMemory.otherStables = 0; + client + .accountInfo({ useServerTime: true }) + .then(result => { + for (let i = 0; i < result.balances.length; i++) { + if (result.balances[i].asset == "BNB") { + botMemory.balance_BNB = + parseFloat(result.balances[i].locked) + + parseFloat(result.balances[i].free); + } else if (result.balances[i].asset == "TUSD") { + botMemory.balance_TUSD = ( + parseFloat(result.balances[i].locked) + + parseFloat(result.balances[i].free) + ).toFixed(8); + } else if (result.balances[i].asset == "USDT") { + botMemory.balance_USDT = ( + parseFloat(result.balances[i].locked) + + parseFloat(result.balances[i].free) + ).toFixed(8); + } else if (result.balances[i].asset == "USDC") { + botMemory.balance_USDC = ( + parseFloat(result.balances[i].locked) + + parseFloat(result.balances[i].free) + ).toFixed(8); + } else if (result.balances[i].asset == "PAX") { + botMemory.balance_PAX = ( + parseFloat(result.balances[i].locked) + + parseFloat(result.balances[i].free) + ).toFixed(8); + } else if (result.balances[i].asset == "USDS") { + botMemory.balance_USDS = ( + parseFloat(result.balances[i].locked) + + parseFloat(result.balances[i].free) + ).toFixed(8); + } else if (result.balances[i].asset == "USDSB") { + botMemory.balance_USDSB = ( + parseFloat(result.balances[i].locked) + + parseFloat(result.balances[i].free) + ).toFixed(8); + } else if (result.balances[i].asset == config.MARKET) { + botMemory.marketBalanceLocked = parseFloat( + result.balances[i].locked + ); + botMemory.marketBalanceFree = parseFloat( + result.balances[i].free + ); + } else if (result.balances[i].asset == config.CURRENCY) { + botMemory.currencyBalanceLocked = parseFloat( + result.balances[i].locked + ); + botMemory.currencyBalanceFree = parseFloat( + result.balances[i].free + ); + } else if (config.COINS.includes(result.balances[i].asset)) { + if ( + result.balances[i].asset != config.MARKET && + result.balances[i].asset != config.CURRENCY + ) { + botMemory.botMemory.otherStables = + botMemory.otherStables + + (parseFloat(result.balances[i].locked) + + parseFloat(result.balances[i].free)); + } + } + } + + botMemory.total = ( + botMemory.marketBalanceLocked + + botMemory.marketBalanceFree + + botMemory.currencyBalanceLocked + + botMemory.currencyBalanceFree + + botMemory.botMemory.otherStables + ).toFixed(8); + + if ( + botMemory.marketBalanceLocked + botMemory.marketBalanceFree < + botMemory.total / 2 + ) { + botMemory.buyAmount = ( + ((botMemory.total / 2) * config.BUY_VALUE) / + 100 + ).toFixed(2); + botMemory.sellAmount = ( + ((botMemory.total / 2) * config.BUY_VALUE) / + 100 + ).toFixed(2); + } else { + if ( + botMemory.currencyBalanceLocked + + botMemory.currencyBalanceFree < + botMemory.total / 2 + ) { + botMemory.buyAmount = ( + ((botMemory.total / 2) * config.BUY_VALUE) / + 100 + ).toFixed(2); + botMemory.sellAmount = ( + ((botMemory.total / 2) * config.BUY_VALUE) / + 100 + ).toFixed(2); + } else { + if (!botMemory.settedAmount) { + botMemory.buyAmount = ( + ((botMemory.marketBalanceLocked + + botMemory.marketBalanceFree) * + config.BUY_VALUE) / + 100 + ).toFixed(2); + botMemory.sellAmount = ( + ((botMemory.currencyBalanceLocked + + botMemory.currencyBalanceFree) * + config.BUY_VALUE) / + 100 + ).toFixed(2); + botMemory.settedAmount = true; + } + } + } + + if (config.AUTO_SPREAD) { + botMemory.status_spread = "ATIVADO"; + } else { + botMemory.status_spread = "DESATIVADO"; + } + + console.clear(); + console.log(` + =========================================== + SALDO ${config.MARKET}...: ${botMemory.marketBalanceLocked + + botMemory.marketBalanceFree}\n + SALDO ${config.CURRENCY}...: ${botMemory.currencyBalanceLocked + + botMemory.currencyBalanceFree}\n + OUTRAS STABLE: ${botMemory.otherStables.toFixed(8)}\n + SALDO BNB....: ${botMemory.balanceBNB}\n + SALDO TOTAL..: ${botMemory.total} USD\n + AUTO SPREAD..: ${botMemory.status_spread}\n + MINIMA DO DIA: ${botMemory.minDay}\n + MAXIMA DO DIA: ${botMemory.maxDay}\n + ${config.CURRENCY + config.MARKET}.....: ${botMemory.avgPrice}\n + VARIACAO 24H.: ${botMemory.changePrice} %\n + SPREAD 24H...: ${botMemory.spreadDay}\n + SPREAD OPERA.: ${botMemory.spreadOpera}\n + SALDO INICIAL: ${config.INITIAL_INVESTMENT} USD\n + LUCRO........: ${( + botMemory.total - config.INITIAL_INVESTMENT + ).toFixed(4)} USD\n + ${( + ((botMemory.total - config.INITIAL_INVESTMENT) * + 100) / + config.INITIAL_INVESTMENT + ).toFixed(2)} %\n + =========================================== + UPTIME.......: ${( + (Math.floor(+new Date() / 1000) - botMemory.startTime) / + 3600 + ).toFixed(2)} horas + ORDENS.......: VENDAS: [${botMemory.totalSells}] COMPRAS: [${ + botMemory.totalBuys + }]`); + + simpleStrategy(); + }) + .catch(err => { + throw err; + }); + }) + .catch(err => { + console.error(err); + }); + }, + { scheduled: false } +); + +function simpleStrategy() { + if (botMemory.OrderBuyID != 0 && botMemory.hasFundsBuy) { + client + .getOrder({ + symbol: config.CURRENCY + config.MARKET, + orderId: botMemory.OrderBuyID + }) + .then(result => { + botMemory.dateOrderBuy = result.time; + if (result.status == "FILLED") { + botMemory.filledBuyOrder = true; + if (botMemory.telegram) { + tgBot.telegram.sendMessage( + config.BOT_CHAT, + `\u{1f911} Ordem de compra executada com sucesso. Saldo atual: ${ + config.MARKET + } : ${( + botMemory.marketBalanceLocked + botMemory.marketBalanceFree + ).toFixed(4)} ${config.CURRENCY}${( + botMemory.currencyBalanceLocked + botMemory.currencyBalanceFree + ).toFixed(4)} Lucro atual: ${( + botMemory.total - config.INITIAL_INVESTMENT + ).toFixed(4)} USD \u{1F4B0} ${( + ((botMemory.total - config.INITIAL_INVESTMENT) * 100) / + config.INITIAL_INVESTMENT + ).toFixed(2)}%` + ); + } + client + .cancelOrder({ + symbol: config.CURRENCY + config.MARKET, + orderId: botMemory.OrderSellID + }) + .catch(err => { + console.error(err); + }); + } + + if (result.status == "CANCELED") { + botMemory.filledBuyOrder = true; + if (botMemory.telegram) { + tgBot.telegram.sendMessage( + config.BOT_CHAT, + `\u{1f6a8} Ordem de compra ${botMemory.OrderBuyID} cancelada na exchange, gerando uma nova ordem.` + ); + } + } + }) + .catch(err => { + throw err; + }); + } + + if (botMemory.OrderSellID != 0 && botMemory.hasFundsSell) { + client + .getOrder({ + symbol: config.CURRENCY + config.MARKET, + orderId: botMemory.OrderSellID + }) + .then(result => { + botMemory.dateOrderSell = result.time; + if (result.status == "FILLED") { + botMemory.filledSellOrder = true; + if (botMemory.telegram) { + tgBot.telegram.sendMessage( + config.BOT_CHAT, + "\u{1f911} Ordem de venda executada com sucesso. Saldo atual: " + + config.MARKET + + ": " + + ( + botMemory.marketBalanceLocked + botMemory.marketBalanceFree + ).toFixed(4) + + " " + + config.CURRENCY + + " " + + ( + botMemory.currencyBalanceLocked + + botMemory.currencyBalanceFree + ).toFixed(4) + + " Lucro atual: " + + (botMemory.total - config.INITIAL_INVESTMENT).toFixed(4) + + " USD" + + " \u{1F4B0} " + + ( + ((botMemory.total - config.INITIAL_INVESTMENT) * 100) / + config.INITIAL_INVESTMENT + ).toFixed(2) + + "%" + ); + } + client + .cancelOrder({ + symbol: config.CURRENCY + config.MARKET, + orderId: botMemory.OrderBuyID + }) + .catch(err => { + console.error(err); + }); + } + + if (result.status == "CANCELED") { + botMemory.filledSellOrder = true; + if (botMemory.telegram) { + tgBot.telegram.sendMessage( + config.BOT_CHAT, + "\u{1f6a8} Ordem de venda " + + botMemory.OrderSellID + + " cancelada na exchange, gerando uma nova ordem." + ); + } + } + }) + .catch(err => { + throw err; + }); + } + + if (config.ORDER_EXPIRE != 0) { + botMemory.date = new Date(botMemory.dateOrderBuy); + botMemory.dateOrderBuyExpire = botMemory.date.setHours( + botMemory.date.getHours() + config.ORDER_EXPIRE + ); + if ( + botMemory.dateOrderBuyExpire > 1546300800 && + Date.now() > botMemory.dateOrderBuyExpire && + botMemory.OrderBuyID != 0 && + botMemory.buyPriceTemp != 0 && + botMemory.countExpireBuy > 2 + ) { + if (botMemory.telegram) { + tgBot.telegram.sendMessage( + config.BOT_CHAT, + "\u{231b} A ordem de compra expirou em " + + new Date(botMemory.dateOrderSellExpire) + + " sem execução do mercado. Timeout em " + + config.ORDER_EXPIRE + + " horas. Será gerada uma nova ordem de compra para operação." + ); + } + client + .cancelOrder({ + symbol: config.CURRENCY + config.MARKET, + orderId: botMemory.OrderBuyID + }) + .catch(err => { + console.error(err); + }); + botMemory.countExpireBuy = 0; + } else { + botMemory.countExpireBuy++; + } + + botMemory.date = new Date(botMemory.dateOrderSell); + botMemory.dateOrderSellExpire = botMemory.date.setHours( + botMemory.date.getHours() + config.ORDER_EXPIRE + ); + if ( + botMemory.dateOrderSellExpire > 1546300800 && + Date.now() > botMemory.dateOrderSellExpire && + botMemory.OrderSellID != 0 && + botMemory.sellPriceTemp != 0 && + botMemory.countExpireSell > 2 + ) { + if (botMemory.telegram) { + tgBot.telegram.sendMessage( + config.BOT_CHAT, + "\u{231b} A ordem de venda expirou em " + + new Date(botMemory.dateOrderSellExpire) + + " sem execução do mercado. Timeout em " + + config.ORDER_EXPIRE + + " horas. Será gerada uma nova ordem de venda para operação." + ); + } + client + .cancelOrder({ + symbol: config.CURRENCY + config.MARKET, + orderId: botMemory.OrderSellID + }) + .catch(err => { + console.error(err); + }); + botMemory.countExpireSell = 0; + } else { + botMemory.countExpireSell++; + } + } + + if ( + config.AUTO_SPREAD && + botMemory.SpreadTemp != 0 && + botMemory.SpreadTemp != botMemory.spreadOpera && + botMemory.spreadOpera >= config.SPREAD_MIN + ) { + if (botMemory.telegram) { + tgBot.telegram.sendMessage( + config.BOT_CHAT, + "\u{1f6a7} Ajuste no spread de mercado de " + + botMemory.SpreadTemp + + " para " + + botMemory.spreadOpera + + " para variação de " + + botMemory.changePrice + + " %. As próximas ordens vão utilizar esta margem." + ); + } + } + botMemory.SpreadTemp = botMemory.spreadOpera; + botMemory.changePriceTemp = botMemory.changePrice; + + if (config.AUTO_SPREAD) { + if ( + (botMemory.OrderSellID == 0 && botMemory.OrderBuyID == 0) || + botMemory.spreadOpera <= config.SPREAD_MIN + ) { + botMemory.spreadOpera = config.SPREAD_MIN; + botMemory.buyPrice = ( + botMemory.avgPrice * + (1 - botMemory.spreadOpera) + ).toFixed(4); + botMemory.sellPrice = ( + botMemory.avgPrice * + (1 + botMemory.spreadOpera) + ).toFixed(4); + } else { + botMemory.buyPrice = (botMemory.avgPrice - botMemory.spreadOpera).toFixed( + 4 + ); + botMemory.sellPrice = ( + botMemory.avgPrice + botMemory.spreadOpera + ).toFixed(4); + } + } else { + botMemory.buyPrice = (botMemory.avgPrice * (1 - config.SPREAD_BUY)).toFixed( + 4 + ); + botMemory.sellPrice = ( + botMemory.avgPrice * + (1 + config.SPREAD_SELL) + ).toFixed(4); + } + + client + .myTrades({ + symbol: config.CURRENCY + config.MARKET + }) + .then(result => { + if (botMemory.filledSellOrder) { + for (let i = result.length - 1; i > 1; i--) { + if ( + result[i].isBuyer && + botMemory.filledSellOrder && + botMemory.currencyBalanceFree >= 20 + ) { + if ( + botMemory.sellPrice - parseFloat(result[i].price).toFixed(4) < + botMemory.spreadOpera + ) { + let sellPriceTemp = ( + parseFloat(result[i].price).toFixed(4) * + (1 + botMemory.spreadOpera) + ).toFixed(4); + if ( + sellPriceTemp > botMemory.avgPrice && + sellPriceTemp - botMemory.avgPrice >= botMemory.spreadOpera && + !botMemory.notifySellMin + ) { + botMemory.sellPrice = sellPriceTemp; + if (botMemory.telegram) { + tgBot.telegram.sendMessage( + config.BOT_CHAT, + "\u{2716} ALERTA: A ordem de venda está em um valor abaixo da diferença de spread " + + botMemory.spreadOpera + + " da última ordem de compra no valor de " + + parseFloat(result[i].price).toFixed(4) + + " comparado ao preço atual de mercado em " + + botMemory.avgPrice + + ". Ela teve seu valor reajustado para: " + + botMemory.sellPrice + + "." + ); + } + } else { + if (botMemory.telegram && !botMemory.notifySellMin) { + tgBot.telegram.sendMessage( + config.BOT_CHAT, + "\u{2714} AVISO: A ordem de venda está dentro da diferença de spread " + + botMemory.spreadOpera + + " da última ordem de compra no valor de " + + parseFloat(result[i].price).toFixed(4) + + "" + ); + } + } + } else { + if (botMemory.telegram && !botMemory.notifySellMin) { + tgBot.telegram.sendMessage( + config.BOT_CHAT, + "\u{2714} AVISO: A ordem de venda está dentro da diferença de spread " + + botMemory.spreadOpera + + " da última ordem de compra no valor de " + + parseFloat(result[i].price).toFixed(4) + + "" + ); + } + } + i = 0; + } + } + } + + if (botMemory.filledBuyOrder) { + for (let i = result.length - 1; i > 1; i--) { + if ( + !result[i].isBuyer && + botMemory.filledBuyOrder && + botMemory.marketBalanceFree >= 20 + ) { + if ( + botMemory.buyPrice - parseFloat(result[i].price).toFixed(4) < + botMemory.spreadOpera + ) { + let buyPriceTemp = ( + parseFloat(result[i].price).toFixed(4) * + (1 - botMemory.spreadOpera) + ).toFixed(4); + if ( + buyPriceTemp < botMemory.avgPrice && + botMemory.avgPrice - buyPriceTemp >= botMemory.spreadOpera && + botMemory.notifyBuyMax == 0 + ) { + botMemory.buyPrice = buyPriceTemp; + if (botMemory.telegram) { + tgBot.telegram.sendMessage( + config.BOT_CHAT, + `\u{2716} ALERTA: A ordem de compra está em um valor abaixo da diferença de spread ${ + botMemory.spreadOpera + } da última ordem de venda no valor de ${parseFloat( + result[i].price + ).toFixed(4)} comparado ao preço atual de mercado em ${ + botMemory.avgPrice + }. Ela teve seu valor reajustado para: ${ + botMemory.buyPrice + }.` + ); + } + } else { + if (botMemory.telegram && !botMemory.notifyBuyMax) { + tgBot.telegram.sendMessage( + config.BOT_CHAT, + "\u{2714} AVISO: A ordem de compra está dentro da diferença de spread " + + botMemory.spreadOpera + + " da última ordem de venda no valor de " + + parseFloat(result[i].price).toFixed(4) + + "" + ); + } + } + } else { + if (botMemory.telegram && !botMemory.notifyBuyMax) { + tgBot.telegram.sendMessage( + config.BOT_CHAT, + "\u{2714} AVISO: A ordem de compra está dentro da diferença de spread " + + botMemory.spreadOpera + + " da última ordem de venda no valor de " + + parseFloat(result[i].price).toFixed(4) + + "" + ); + } + } + i = 0; + } + } + } + }); + + console.log(` + DEFINIDOS....: Compra ${botMemory.buyPrice} e Venda ${botMemory.sellPrice} + TIMEOUT ORDERM: ${config.ORDER_EXPIRE} horas \n + HORA ATUAL....: ${new Date()}\n + ============== DADOS DE COMPRA ============\n + VALOR COMPRA..: ${botMemory.buyAmount}\n + PRECO COMPRA..: ${parseFloat(botMemory.buyPriceTemp).toFixed(4)}\n + ID ORDEM BUY..: ${botMemory.OrderBuyID}\n + EXPIRA EM.....: ${new Date(botMemory.dateOrderBuyExpire)}\n + "============== DADOS DE VENDA =============\n + VALOR VENDA...: ${botMemory.sellAmount}\n + PRECO VENDA...: ${parseFloat(botMemory.sellPriceTemp).toFixed(4)}\n + ID ORDEM SELL.: ${botMemory.OrderSellID}\n + EXPIRA EM.....: ${new Date(botMemory.dateOrderSellExpire)} + ===========================================`); + + if (botMemory.filledBuyOrder) { + if ( + (botMemory.marketBalanceFree > 20 || + botMemory.marketBalanceFree >= botMemory.buyAmount) && + botMemory.buyPrice < config.BUY_MAX + ) { + if ( + botMemory.marketBalanceFree > 20 && + botMemory.marketBalanceFree <= botMemory.buyAmount + ) { + botMemory.buyAmount = parseFloat(botMemory.marketBalanceFree).toFixed( + 2 + ); + } + client + .order({ + symbol: config.CURRENCY + config.MARKET, + side: "BUY", + quantity: botMemory.buyAmount, + price: botMemory.buyPrice, + useServerTime: true + }) + .then(result => { + botMemory.totalBuys++; + botMemory.OrderBuyID = result.orderId; + botMemory.filledBuyOrder = false; + }) + .catch(err => { + botMemory.totalBuys--; + throw err; + }); + botMemory.notifyBuyMax = false; + botMemory.hasFundsBuy = true; + botMemory.buyPriceTemp = botMemory.buyPrice; + if (botMemory.telegram) { + tgBot.telegram.sendMessage( + config.BOT_CHAT, + "\u{1F4C9} Order de compra criada com sucesso: Quantidade comprada: \u{1f4b5} " + + botMemory.buyAmount + + ", valor de compra: \u{1f3f7} " + + botMemory.buyPrice + + " utilizando spread em " + + botMemory.spreadOpera + + "." + ); + } + } else { + if ( + botMemory.telegram && + botMemory.notifyBuyMax == 0 && + botMemory.marketBalanceFree >= botMemory.buyAmount + ) { + tgBot.telegram.sendMessage( + config.BOT_CHAT, + "\u{274C} O valor de compra do mercado esta acima do definido em " + + config.BUY_MAX + + ". O bot vai aguardar o preço reduzir até o valor definido para evitar prejuízos." + ); + botMemory.notifyBuyMax = true; + } + if ( + botMemory.telegram && + botMemory.hasFundsBuy && + botMemory.notifyBuyMax == 0 + ) { + tgBot.telegram.sendMessage( + config.BOT_CHAT, + "\u{1F6AB} O bot está sem saldo para compras em " + + config.MARKET + + ". Seu saldo atual é: " + + botMemory.marketBalanceFree + + ". O bot vai aguardar até que uma compra seja executada para liberar saldo." + ); + botMemory.notifyBuyMax = true; + } + botMemory.OrderBuyID = 0; + botMemory.hasFundsBuy = false; + } + } + + if (botMemory.filledSellOrder) { + if ( + (botMemory.currencyBalanceFree > 20 || + botMemory.currencyBalanceFree >= botMemory.sellAmount) && + botMemory.sellPrice > config.SELL_MIN + ) { + if ( + botMemory.currencyBalanceFree > 20 && + botMemory.currencyBalanceFree <= botMemory.sellAmount + ) { + botMemory.sellAmount = parseFloat( + botMemory.currencyBalanceFree + ).toFixed(2); + } + client + .order({ + symbol: config.CURRENCY + config.MARKET, + side: "SELL", + quantity: botMemory.sellAmount, + price: botMemory.sellPrice, + useServerTime: true + }) + .then(result => { + botMemory.totalSells++; + botMemory.OrderSellID = result.orderId; + botMemory.filledSellOrder = false; + }) + .catch(err => { + botMemory.totalSells--; + throw err; + }); + botMemory.notifySellMin = false; + botMemory.hasFundsSell = true; + botMemory.sellPriceTemp = botMemory.sellPrice; + if (botMemory.telegram) { + tgBot.telegram.sendMessage( + config.BOT_CHAT, + "\u{1F4C8} Order de venda criada com sucesso: Quantidade vendida: \u{1f4b5} " + + botMemory.sellAmount + + ", valor de venda: \u{1f3f7} " + + botMemory.sellPrice + + " utilizando spread em " + + botMemory.spreadOpera + + "." + ); + } + } else { + if ( + botMemory.telegram && + !botMemory.notifySellMin && + botMemory.currencyBalanceFree >= botMemory.sellAmount + ) { + tgBot.telegram.sendMessage( + config.BOT_CHAT, + "\u{274C} O valor de venda do mercado esta abaixo do definido em " + + config.SELL_MIN + + ". O bot vai aguardar o preço aumentar até o valor definido para evitar prejuízos." + ); + botMemory.notifySellMin = true; + } + if ( + botMemory.telegram && + botMemory.hasFundsSell && + !botMemory.notifySellMin + ) { + tgBot.telegram.sendMessage( + config.BOT_CHAT, + `\u{1F6AB} O bot está sem saldo para vendas em ${config.CURRENCY}. Seu saldo atual é: ${botMemory.currencyBalanceFree}. O bot vai aguardar até que uma compra seja executada para liberar saldo.` + ); + botMemory.notifySellMin = true; + } + botMemory.OrderSellID = 0; + botMemory.hasFundsSell = 0; + } + } +} + +console.clear(); +console.log("Iniciando..."); + +task.start(); + +app.get("/*", (req, res) => { + let total_investiment = (botMemory.total - config.INITIAL_INVESTMENT).toFixed( + 8 + ); + res.json({ + initialInvestment: config.INITIAL_INVESTMENT, + market: config.MARKET, + currency: config.CURRENCY, + balances: { + usdt: parseFloat(botMemory.balance_USDT), + tusd: parseFloat(botMemory.balance_TUSD), + pax: parseFloat(botMemory.balance_PAX), + usdc: parseFloat(botMemory.balance_USDC), + usds: parseFloat(botMemory.balance_USDS), + usdsb: parseFloat(botMemory.balance_USDSB) + }, + profit: { + USD: parseFloat(total_investiment), + percent: parseFloat( + ( + ((botMemory.total - config.INITIAL_INVESTMENT) * 100) / + config.INITIAL_INVESTMENT + ).toFixed(2) + ) + } + }); +}); + +app.listen(config.LISTEN_PORT); diff --git a/report.js b/src/report.js similarity index 69% rename from report.js rename to src/report.js index f0c80cf..6c760e5 100644 --- a/report.js +++ b/src/report.js @@ -3,8 +3,7 @@ const adapter = new FileSync('db.json'); const low = require('lowdb'); const db = low(adapter); - -var config = require('./config.json'); +var config = require('./config.js/index.js'); var http = require('http'); var ip = '0.0.0.0'; var port = config.LISTEN_REPORT; @@ -12,12 +11,12 @@ var getJSON = require('get-json'); var dateFormat = require('dateformat'); var cron = require('node-cron'); -saldo_TUSD = 0; -saldo_USDT = 0; -saldo_USDC = 0; -saldo_PAX = 0; -saldo_USDS = 0; -saldo_USDSB = 0; +balance_TUSD = 0; +balance_USDT = 0; +balance_USDC = 0; +balance_PAX = 0; +balance_USDS = 0; +balance_USDSB = 0; total_stable = 0; date = 0; @@ -26,7 +25,7 @@ profit_day_percentage = 0; total_profit = 0; total_profit_percentage = 0; -db.defaults({ reports: [], date: {}, saldo_USDT: {}, saldo_TUSD: {}, saldo_USDC: {}, saldo_PAX: {}, saldo_USDS: {}, saldo_USDSB: {}, profit_day: {}, profit_day_percentage: {}, total_profit: {}, total_profit_percentage: {}, id: 0 }).write(); +db.defaults({ reports: [], date: {}, balance_USDT: {}, balance_TUSD: {}, balance_USDC: {}, balance_PAX: {}, balance_USDS: {}, balance_USDSB: {}, profit_day: {}, profit_day_percentage: {}, total_profit: {}, total_profit_percentage: {}, id: 0 }).write(); total_report = db.get('reports').size().value(); if(total_report == 0) { profit_day = total_profit; @@ -34,17 +33,17 @@ if(total_report == 0) { getJSON('http://localhost', function(error, response){ total_profit = parseFloat(response.profit['USD'], 8); date = dateFormat(new Date(), "dd/mm/yyyy"); - saldo_USDT = parseFloat(response.balances['usdt'], 8); - saldo_TUSD = parseFloat(response.balances['tusd'], 8); - saldo_USDC = parseFloat(response.balances['usdc'], 8); - saldo_PAX = parseFloat(response.balances['pax'], 8); - saldo_USDS = parseFloat(response.balances['usds'], 8); - saldo_USDSB = parseFloat(response.balances['usdsb'], 8); + balance_USDT = parseFloat(response.balances['usdt'], 8); + balance_TUSD = parseFloat(response.balances['tusd'], 8); + balance_USDC = parseFloat(response.balances['usdc'], 8); + balance_PAX = parseFloat(response.balances['pax'], 8); + balance_USDS = parseFloat(response.balances['usds'], 8); + balance_USDSB = parseFloat(response.balances['usdsb'], 8); total_profit_percentage = response.profit['percent'].toFixed(2); total_profit_percentage = parseFloat(total_profit_percentage); profit_day = total_profit; profit_day_percentage = total_profit_percentage; - db.get('reports').push({ date: date, saldo_USDT: saldo_USDT, saldo_TUSD: saldo_TUSD, saldo_USDC: saldo_USDC, saldo_PAX: saldo_PAX, saldo_USDS: saldo_USDS, saldo_USDSB: saldo_USDSB, profit_day: profit_day, profit_day_percentage: profit_day_percentage, total_profit: total_profit, total_profit_percentage: total_profit_percentage, id: total_report}).write(); + db.get('reports').push({ date: date, balance_USDT: balance_USDT, balance_TUSD: balance_TUSD, balance_USDC: balance_USDC, balance_PAX: balance_PAX, balance_USDS: balance_USDS, balance_USDSB: balance_USDSB, profit_day: profit_day, profit_day_percentage: profit_day_percentage, total_profit: total_profit, total_profit_percentage: total_profit_percentage, id: total_report}).write(); db.update('id', n => n + 1).write(); }); } @@ -55,12 +54,12 @@ var task = cron.schedule('0 0 * * *', () => { total_profit = parseFloat(response.profit['USD'], 8); date = dateFormat(new Date(), "dd/mm/yyyy"); - saldo_USDT = parseFloat(response.balances['usdt'], 8); - saldo_TUSD = parseFloat(response.balances['tusd'], 8); - saldo_USDC = parseFloat(response.balances['usdc'], 8); - saldo_PAX = parseFloat(response.balances['pax'], 8); - saldo_USDS = parseFloat(response.balances['usds'], 8); - saldo_USDSB = parseFloat(response.balances['usdsb'], 8); + balance_USDT = parseFloat(response.balances['usdt'], 8); + balance_TUSD = parseFloat(response.balances['tusd'], 8); + balance_USDC = parseFloat(response.balances['usdc'], 8); + balance_PAX = parseFloat(response.balances['pax'], 8); + balance_USDS = parseFloat(response.balances['usds'], 8); + balance_USDSB = parseFloat(response.balances['usdsb'], 8); total_profit_percentage = response.profit['percent'].toFixed(2); total_profit_percentage = parseFloat(total_profit_percentage); @@ -75,7 +74,7 @@ var task = cron.schedule('0 0 * * *', () => { profit_day_percentage = Math.abs(profit_day_percentage); profit_day_percentage = parseFloat(profit_day_percentage); - db.get('reports').push({ date: date, saldo_USDT: saldo_USDT, saldo_TUSD: saldo_TUSD, saldo_USDC: saldo_USDC, saldo_PAX: saldo_PAX, saldo_USDS: saldo_USDS, saldo_USDSB: saldo_USDSB, profit_day: profit_day, profit_day_percentage: profit_day_percentage, total_profit: total_profit, total_profit_percentage: total_profit_percentage, id: total_report}).write(); + db.get('reports').push({ date: date, balance_USDT: balance_USDT, balance_TUSD: balance_TUSD, balance_USDC: balance_USDC, balance_PAX: balance_PAX, balance_USDS: balance_USDS, balance_USDSB: balance_USDSB, profit_day: profit_day, profit_day_percentage: profit_day_percentage, total_profit: total_profit, total_profit_percentage: total_profit_percentage, id: total_report}).write(); db.update('id', n => n + 1).write(); }); }); @@ -92,14 +91,14 @@ var server=http.createServer((function(request,response) response.write('
| Balances | |
| USDT | '+result_report.saldo_USDT+' |
| PAX | '+result_report.saldo_PAX+' |
| TUSD | '+result_report.saldo_TUSD+' |
| USDC | '+result_report.saldo_USDC+' |
| USDS | '+result_report.saldo_USDS+' |
| USDSB | '+result_report.saldo_USDSB+' |
| USDT | '+result_report.balance_USDT+' |
| PAX | '+result_report.balance_PAX+' |
| TUSD | '+result_report.balance_TUSD+' |
| USDC | '+result_report.balance_USDC+' |
| USDS | '+result_report.balance_USDS+' |
| USDSB | '+result_report.balance_USDSB+' |
| Initial Invest |  '+config.INITIAL_INVESTMENT+' | '); - response.write('
| Total: | '+(result_report.saldo_USDT + result_report.saldo_PAX + result_report.saldo_TUSD + result_report.saldo_USDC + result_report.saldo_USDS + result_report.saldo_USDSB) +' |
| Date | Profit Today USD | % Today | Total Profit | Total % |