diff --git a/apps/fomo-cli/package.json b/apps/fomo-cli/package.json index a255d67..587fa43 100644 --- a/apps/fomo-cli/package.json +++ b/apps/fomo-cli/package.json @@ -6,29 +6,37 @@ "fomobot": "./lib/index.js" }, "scripts": { - "start": "nodemon --watch 'src/**/*.ts' --exec ts-node src/index.ts run --strategy ta_ultosc --leverage 6", + "start": "nodemon --watch 'src/**/*.ts' --exec ts-node src/index.ts", "create": "npm run build && npm run test", "build": "tsc -p .", "test": "sudo npm i -g && pizza", "refresh": "rm -rf ./node_modules ./package-lock.json && npm install" }, "dependencies": { + "@fomobro/fomo-api": "^6.2.6", "@fomobro/fomo-sim": "^1.0.1", + "@fomobro/fomo-wallet": "0.0.1", "@fomobro/fomobot": "^1.0.21", "@fomobro/loggerdog-client": "latest", + "bcryptjs": "^2.4.3", "bitmex-realtime-api": "^0.4.3", "chalk": "^4.0.0", "clear": "^0.1.0", "commander": "^5.0.0", + "crypto-js": "^4.0.0", "cryptr": "^4.0.2", "default-logger": "0.0.2", + "describe-export": "^1.0.0", "figlet": "^1.3.0", "find-package-json": "^1.2.0", "fs-extra": "^9.0.0", + "inquirer": "^7.3.3", "light-event-bus": "^1.0.1", "loggerdog-client": "0.0.4", "monk": "^7.1.2", - "path": "^0.12.7" + "path": "^0.12.7", + "uuid": "^8.3.0", + "vorpal": "^1.12.0" }, "devDependencies": { "@types/node": "^13.11.1", diff --git a/apps/fomo-cli/src/app.ts b/apps/fomo-cli/src/app.ts new file mode 100644 index 0000000..d9ae647 --- /dev/null +++ b/apps/fomo-cli/src/app.ts @@ -0,0 +1,351 @@ +/* + Pioneer APP + */ + +const TAG = " | app | "; + +import axios from "axios"; +import { + getConfig, + getWallet, updateConfig, +} from "./modules/config"; + +let keyTools = require("@fomobro/fomo-wallet") +const Cryptr = require("cryptr"); +// const CryptoJS = require("crypto-js"); +// const bip39 = require(`bip39`); +// +// const fs = require("fs-extra"); +let fomo = require("@fomobro/fomo-api") +const bot = require("@fomobro/fomobot") +const log = require("loggerdog-client")(); +const BitMEXClient = require('bitmex-realtime-api'); +// let Table = require('cli-table'); +// const chalk = require("chalk"); +// const figlet = require("figlet"); +// const clear = require("clear"); +// const request = require('request') +const db = require('monk')('localhost/zenbot4') +const wait = require('wait-promise'); +const chalk = require('chalk'); +const tradesDB = db.get('trades') +const sleep = wait.sleep; + +let USERNAME = '' +let ACCOUNT = '' +let API_KEY = '' +let WALLET_PASSWORD:any = "" +let WALLET_SEED:string +let STRATERGY:string = 'bollinger' +let LAST_PRICE:any +//chingle +// let opts:any = {} +// var player = require('play-sound')(opts = {}) + +let strategies = [ + 'forex_analytics', + 'bollinger', + 'cci_srsi', + 'crossover_vwap', + 'dema', + 'ichimoku_score', + 'ichimoku', + 'speed', + 'wavetrend', + 'trust_distrust', + 'ta_ultosc', + 'stddev', + 'trendline', + 'renko' +] + + + + +module.exports = { + init: function (config: any, wallet: any, password:string) { + return init_wallet(config,wallet,password); + }, + setPassword: function (pw: string) { + WALLET_PASSWORD = pw; + return true; + }, + run: async function () { + onRun() + return true + }, + getInfo: async function () { + return fomo.getInfo() + }, + goBull: async function () { + return buy_signal() + }, + goBear: async function () { + return sell_signal() + }, + newUsername: async function (username:string) { + return change_username(username) + }, + getApiKeys: async function () { + return {ACCOUNT,API_KEY} + }, + signUp: async function () { + return sign_up() + }, + lastPrice: async function () { + return LAST_PRICE + }, + currentStrategy: async function () { + return STRATERGY + }, + strategys: async function () { + return strategies.toString() + }, + makePrediction: async function (coin:string,time:string,price:string) { + return make_prediction(coin,time,price) + }, + setStrategy: async function (strategy:string) { + if(strategies.indexOf(strategy) >= 0){ + STRATERGY = strategy + return strategy + } else { + return "unknown strategy "+strategies.toString() + } + }, + getConfig: function () { + return getConfig(); + }, + viewSeed: function () { + return WALLET_SEED; + } +}; + +let sell_signal = async function () { + let tag = " | sell_signal | "; + try { + //predict .001 pct loss in 10min + log.info(tag,"LAST_PRICE: ",LAST_PRICE) + let predictPrice = LAST_PRICE - (LAST_PRICE * 0.001) + let inTenMinutes = new Date().getTime() + (1000 * 60 * 10) + log.info(tag,"predictPrice: ",predictPrice) + + let result = await make_prediction("BTC",inTenMinutes.toString(),predictPrice.toString()) + + return result + } catch (e) { + log.error(tag, "Error: ", e); + throw e; + } +}; + +let buy_signal = async function () { + let tag = " | make_prediction | "; + try { + //predict .001 pct loss in 10min + log.info(tag,"LAST_PRICE: ",LAST_PRICE) + let predictPrice = LAST_PRICE + (LAST_PRICE * 0.001) + let inTenMinutes = new Date().getTime() + (1000 * 60 * 10) + log.info(tag,"predictPrice: ",predictPrice) + + let result = await make_prediction("BTC",inTenMinutes.toString(),predictPrice.toString()) + + return result + } catch (e) { + log.error(tag, "Error: ", e); + throw e; + } +}; + +let sign_up = async function () { + let tag = " | make_prediction | "; + try { + log.info(tag, "USERNAME,ACCOUNT: ",{USERNAME,ACCOUNT}); + + //create account + let signup = await fomo.create(USERNAME,ACCOUNT) + log.info("signup success! ",signup) + + return signup; + } catch (e) { + log.error(tag, "Error: ", e); + throw e; + } +}; + +let change_username = async function (username:string) { + let tag = " | make_prediction | "; + try { + log.info(tag, "username: ",username); + + let result = updateConfig({username}); + + return result; + } catch (e) { + log.error(tag, "Error: ", e); + throw e; + } +}; + + +let make_prediction = async function (coin:string,time:string,price:string) { + let tag = " | make_prediction | "; + try { + log.info(tag, "checkpoint: "); + + let prediction = { + coin, + time, + price + } + + let predictionResult = await fomo.predict(prediction) + console.log("predictionResult: ",predictionResult) + + return predictionResult; + } catch (e) { + log.error(tag, "Error: ", e); + throw e; + } +}; + + +let onRun: (this: any) => Promise; +onRun = async function (this: any) { + let tag = TAG + " | onRun | " + try { + //get strat + log.info(tag, "strategy: ", STRATERGY) + let engine = await bot.init(STRATERGY); + await sleep(4000); + + //get recent history + let allTrades = await tradesDB.find({selector: "bitmex.BTC-USD"}, {limit: 10000, sort: {time: -1}}) + log.info(tag, "total trades: ", allTrades.length) + + //Load trades to engine + chalk.blue( + " Loading trades into the Fomo engine! " + ) + bot.load(allTrades) + await sleep(6000); + + // @ts-ignore + engine.on('events', async message => { + //event triggerd + log.info("**** Signal event: **** ", message) + if (message.signal === "sell") { + sell_signal() + + } else if (message.signal === "buy") { + //goBull + buy_signal() + + } else { + log.error("Unknown Signal! message: ", message) + } + }); + const client = new BitMEXClient(); + //sub to trades + client.addStream('XBTUSD', 'trade', function (data: any, symbol: any, tableName: any) { + log.debug(tag, "Stream: ", data, symbol, tableName) + + + let clean = [] + for (let i = 0; i < data.length; i++) { + let tradeInfo = data[i] + let normalized: any = {} + normalized.trade_id = tradeInfo.trdMatchID + normalized.time = new Date(tradeInfo.timestamp).getTime() + normalized.unix = new Date(tradeInfo.timestamp).getTime() + normalized.size = tradeInfo.size + normalized.side = tradeInfo.side + normalized.price = tradeInfo.price + LAST_PRICE = tradeInfo.price + clean.push(normalized) + } + bot.load(clean) + }) + } catch (e) { + log.error(tag, e) + throw Error(e) + } +}; + +// let onBackfill = async function(){ +// let tag = TAG + " | onBackfill | " +// try{ +// //get backfill status +// +// //if not done, backfill +// +// }catch(e){ +// log.error(tag,e) +// throw Error(e) +// } +// } + + +let init_wallet = async function (config:any,wallet:any,password:string) { + let tag = " | init_wallet | "; + try { + log.info(tag, "checkpoint: "); + log.info(tag, "config username: ",config.username); + log.info(tag, "password: ",password); + log.info(tag, "wallet: ",wallet); + let output: any = []; + const cryptr = new Cryptr(password); + + let walletInfo = await getWallet() + log.debug(tag,"walletInfo: ",walletInfo) + //get seed + let seed = cryptr.decrypt(walletInfo.vault) + WALLET_SEED = seed + log.debug(tag,"seed: ",seed) + //init client + let apiKeys = await keyTools.onBuildWallet(seed); + log.debug(tag,"apiKeys: ",apiKeys) + + USERNAME = config.username + ACCOUNT = apiKeys.account + API_KEY = apiKeys.apiKey + + let urlSpec = process.env['URL_FOMO_SPEC'] || "https://fomobro.com/spec/swagger.json" + await fomo.init(urlSpec,{apiKey:apiKeys.account}) + + //health + let health = await fomo.health() + console.log("health: ",health) + + //user info + let userInfo = await fomo.getUser(config.username) + console.log("health: ",health) + + //if available + if(userInfo.isAvailable){ + //signup + //create account + let signup = await fomo.create(config.username,apiKeys.account) + log.info("signup success! ",signup) + + } else { + //verify ownership + let userInfoPrivate = await fomo.getInfo() + log.info("userInfoPrivate: ",userInfoPrivate) + + if(userInfoPrivate.account === apiKeys.account){ + log.info("Account info valid!") + } else { + log.info(tag,"userInfoPrivate.account: ",userInfoPrivate.account) + log.info(tag,"apiKeys.account: ",apiKeys.account) + //if fail/change username + log.error(tag," Account does NOT match username! ERROR! recover or make new username to continue! ") + } + } + + + return true; + } catch (e) { + log.error(tag, "Error: ", e); + throw e; + } +}; diff --git a/apps/fomo-cli/src/index.ts b/apps/fomo-cli/src/index.ts index 6a55a22..156342c 100644 --- a/apps/fomo-cli/src/index.ts +++ b/apps/fomo-cli/src/index.ts @@ -12,7 +12,10 @@ import { setConfig, updateConfig, checkConfigs, - backtestDir + backtestDir, + innitConfig, + initWallet, + getWallet } from './modules/config' import { @@ -26,28 +29,39 @@ import { //Modules const Cryptr = require('cryptr'); const inquirer = require('inquirer'); -const {BitmexAPI, BitmexSocket} = require("bitmex-node"); -const bot = require("@fomobro/fomobot") +//const {BitmexAPI, BitmexSocket} = require("bitmex-node"); + const chalk = require('chalk'); const clear = require('clear'); const figlet = require('figlet'); const path = require('path'); const program = require('commander'); const log = require("loggerdog-client")() -const BitMEXClient = require('bitmex-realtime-api'); + const wait = require('wait-promise'); const db = require('monk')('localhost/zenbot4') const { EventBus } = require('light-event-bus') +const wallet = require("@fomobro/fomo-wallet") +const shortid = require('shortid'); +const vorpal = require("vorpal")(); +const describe = require("describe-export"); +const bcrypt = require("bcryptjs"); +// @ts-ignore +import {v4 as uuidv4} from 'uuid'; + +//app +let App = require("./app"); //globals const eventBus = new EventBus() const tradesDB = db.get('trades') -const client = new BitMEXClient(); const sleep = wait.sleep; // @ts-ignore global.EXCHANGES = {}; +let urlSpec = process.env['URL_FOMO_SPEC'] || "https://fomobro.com/spec/swagger.json" + let LAST_PRICE:any let SELECTED_STRAT = "bollinger" let WALLET_PASSWORD:string @@ -124,81 +138,98 @@ if(program.new) NEW_FLAG = true let onRun: (this: any) => Promise; onRun = async function (this: any) { - let tag = TAG + " | onRun | " + let tag = TAG + " | onRun | "; try { - //get strat - log.info(tag, "strategy: ", program.strategy) - let engine = await bot.init(SELECTED_STRAT); - await sleep(4000); - - //get recent history - let allTrades = await tradesDB.find({selector: "bitmex.BTC-USD"}, {limit: 10000, sort: {time: -1}}) - log.info(tag, "total trades: ", allTrades.length) - - //Load trades to engine - chalk.blue( - " Loading trades into the Fomo engine! " - ) - bot.load(allTrades) - await sleep(6000); - - // @ts-ignore - engine.on('events', async message => { - //event triggerd - log.info("**** Signal event: **** ", message) - if (message.signal === "sell") { - - //goBear - eventBus.publish('event', {message}) - } else if (message.signal === "buy") { - //goBull - - //await buySignal(LAST_PRICE) - eventBus.publish('event', {message}) - } else { - log.error("Unknown Signal! message: ", message) - } - }); - - //sub to trades - client.addStream('XBTUSD', 'trade', function (data: any, symbol: any, tableName: any) { - log.debug(tag, "Stream: ", data, symbol, tableName) - - - let clean = [] - for (let i = 0; i < data.length; i++) { - let tradeInfo = data[i] - let normalized: any = {} - normalized.trade_id = tradeInfo.trdMatchID - normalized.time = new Date(tradeInfo.timestamp).getTime() - normalized.unix = new Date(tradeInfo.timestamp).getTime() - normalized.size = tradeInfo.size - normalized.side = tradeInfo.side - normalized.price = tradeInfo.price - LAST_PRICE = tradeInfo.price - clean.push(normalized) - } - bot.load(clean) + //init wallet + let config = getConfig() + let wallet = getWallet() + App.init(config, wallet, WALLET_PASSWORD) + + log.info(tag, " Starting Interactive Terminal "); + //globals + let prompt = "client: "; + var locked = true; + var USER = null; + + //map module + const map = describe.map(App); + //log.info("methods known: ", map); + + let help: any = { + info: "", + }; + + Object.keys(map).forEach(function (key) { + let tag = TAG + " | " + key + " | "; + let debug = false; + log.debug(tag, "key: ", key); + let expectedParams = map[key]; + + log.debug(tag, "expectedParams: ", expectedParams); + + let helpString; + if (help[key]) helpString = help[key]; + if (!helpString) + helpString = " \n \n " + key + ": expected params: " + expectedParams; + + vorpal.command(key, helpString) + .action(function (args: any, cb: any) { + let params = []; + if(key === 'makePrediction'){ + log.info(" 30 seconds ******** ", new Date().getTime() + 1000 * 30) + log.info(" 1 min ******** ", new Date().getTime() + 1000 * 60) + log.info(" 5 min ******** ", new Date().getTime() + 1000 * 60 * 5) + log.info(" 10 min ******** ", new Date().getTime() + 1000 * 60 * 10) + log.info(" 30 min ******** ", new Date().getTime() + 1000 * 60 * 30) + } + if (expectedParams.length > 0) { + for (let i = 0; i < expectedParams.length; i++) { + let param = { + type: "input", + name: expectedParams[i], + message: "input " + expectedParams[i] + ": ", + }; + params.push(param); + } + } + + // @ts-ignore + let promise = this.prompt(params, function (answers: any) { + // You can use callbacks... + }); + + promise.then(async function (answers: any) { + log.debug(tag, "answers: ", answers); + + let parameters: any = []; + Object.keys(answers).forEach(function (answer) { + parameters.push(answers[answer]); + }); + log.info(tag, "parameters: ", parameters); + try { + // @ts-ignore + const result = await App[key].apply(this, parameters); + log.info("result: ", result); + + cb() + } catch (e) { + console.error(tag, "e: ", e); + } + }); + }) }) + + vorpal + .delimiter(prompt) + //.action(app.tick()) + .show(); + } catch (e) { - log.error(tag, e) - throw Error(e) + log.error(tag, e); + throw Error(e); } }; -// let onBackfill = async function(){ -// let tag = TAG + " | onBackfill | " -// try{ -// //get backfill status -// -// //if not done, backfill -// -// }catch(e){ -// log.error(tag,e) -// throw Error(e) -// } -// } - let onSetup = async function(){ let tag = TAG + " | onBackfill | " try{ @@ -208,22 +239,72 @@ let onSetup = async function(){ const questions = [ - { type: 'input', name: 'username', message: 'Select username', default: "billy" }, - { type: 'input', name: 'seed', message: 'restore from seed? (leave empty to create new)', default: "" }, - { type: 'input', name: 'bitmexPub', message: 'Bitmex PubKey', default: "" }, - { type: 'input', name: 'bitmexPriv', message: 'Bitmex PrivKey', default: "" }, - { type: 'input', name: 'password', message: 'password', default: "" }, + { + type: "input", + name: "username", + message: "Select username", + default: "billy", + }, + { + type: "list", + name: "task", + message: "What do you want to do?", + choices: ["create a new wallet", "restore from seed"], + }, + {type: "password", name: "password", message: "password", default: ""}, + { + type: "password", + name: "password2", + message: "confirm password", + default: "", + }, ]; - inquirer - .prompt(questions) - .then(function (answers:any) { - console.log(answers); - //TODO config create + inquirer.prompt(questions).then(async function (answers: any) { + if (answers.password !== answers.password2) + throw Error("Passwords do not match! "); + //hashpw + const hash = bcrypt.hashSync(answers.password, 10); - }) + if (answers.task === "create a new wallet") { + let seed = await wallet.onGetNewSeed() + seed = seed.seed + log.info(" * SAVEME * Your Seed Phrase! seed: " + seed); + //encrypt + const cryptr = new Cryptr(answers.password); + let seed_encrypted = cryptr.encrypt(seed); + // + log.debug(tag, "seed_encrypted: ", seed_encrypted); + log.debug(tag, "hash: ", hash); + await innitConfig("english"); + + //generate query key + const queryKey = uuidv4(); + + // + log.info(tag, "queryKey: ", queryKey) + updateConfig({queryKey: queryKey}); + updateConfig({username: answers.username}); + updateConfig({password: hash}); + updateConfig({created: new Date().getTime()}); + + await initWallet(seed_encrypted, hash); + log.info("Wallet initialized! please restart cli! "); + + //register account key + + process.exit(0); + } + + if (answers.task === "restore from seed") { + log.info(tag, " restore from seed ") + //ask for seed + onRestore(answers.username, answers.password) + } + + }); }catch(e){ log.error(tag,e) @@ -231,64 +312,101 @@ let onSetup = async function(){ } } +let onRestore = async function (username: string, password: string) { + let tag = TAG + " | onSetup | "; + try { + //get backfill status -let onStart = async function(){ - let tag = TAG + " | onStart | " - try{ - log.info(tag,"onStart()") - let configStatus = checkConfigs() - let config = getConfig() - log.info(tag,"configStatus() | configStatus: ", configStatus) - log.info(tag,"loadConfig() | config: ", config) + //if not done, backfill - //if new flag - if(NEW_FLAG){ - //if config - if(config){ - // - log.info("CONFIG FOUND! please backup and remove from home dir! ") - } else { - //signup - //setup - onSetup() + const questions = [ + { + type: "input", + name: "Seed", + message: "Insert your 12 or 24 word mnemonics", + default: "alcohol woman abuse must during monitor noble actual mixed trade anger aisle", } - // move current to backup - } + ]; - //if no config setup + inquirer.prompt(questions).then(async function (answers: any) { + //TODO validate seed - // - if(!WALLET_PASSWORD){ - const questions = [ - { type: 'input', name: 'password', message: 'password', default: "" }, - ]; + //hashpw + const hash = bcrypt.hashSync(password, 10); - inquirer - .prompt(questions) - .then(function (answers:any) { - console.log(answers); - WALLET_PASSWORD = answers.password + let seed = answers.Seed; + log.debug(" Your Seed Phrase! seed: " + seed); - //TODO verify password! + //encrypt + const cryptr = new Cryptr(password); + let seed_encrypted = cryptr.encrypt(seed); + // + log.debug(tag, "seed_encrypted: ", seed_encrypted); + log.debug(tag, "hash: ", hash); + await innitConfig("english"); - }) + // + updateConfig({username: username}); + updateConfig({password: hash}); + updateConfig({created: new Date().getTime()}); - } + await initWallet(seed_encrypted, hash); + log.info("Wallet initialized! please restart cli! "); - //if no api keys setup exchange - if(config.bitMexTestPub && config.bitMexTestPub){ - //decrypt - await initBot(WALLET_PASSWORD,config,LEVERAGE) - await updatePosition() - } + //register account key + + process.exit(0); - //if configured AND command is run - log.info(tag,"args: ",process.argv) - log.info(tag,"args: ",process.argv[2]) + }); + } catch (e) { + log.error(tag, e); + throw Error(e); + } +}; - if(process.argv[2] === "run"){ - log.info(tag,"Starting Fomobot!") - onRun() +let onStart = async function(){ + let tag = TAG + " | onStart | " + try{ + log.info(tag,"onStart()") + let configStatus = checkConfigs() + let config = getConfig() + log.info(tag,"configStatus() | configStatus: ", configStatus) + log.info(tag,"loadConfig() | config: ", config) + + if(Object.keys(config).length === 0){ + //empty config, setup + onSetup() + } else { + if(!WALLET_PASSWORD){ + const questions = [ + { type: 'password', name: 'password', message: 'password', default: "" }, + ]; + + inquirer + .prompt(questions) + .then(async function (answers:any) { + console.log(answers); + WALLET_PASSWORD = answers.password + + //TODO verify password! + + //decrypt + + //if no api keys setup exchange + // if(config.bitMexTestPub && config.bitMexTestPub){ + // //decrypt + // await initBot(WALLET_PASSWORD,config,LEVERAGE) + // await updatePosition() + // } + + //if configured AND command is run + log.info(tag,"args: ",process.argv) + log.info(tag,"args: ",process.argv[2]) + log.info(tag,"Starting Fomobot!") + onRun() + }) + + } } }catch(e){ @@ -304,11 +422,11 @@ let onUpdate = async function(){ let tag = TAG + " | onUpdate | " try{ let status = getSummaryInfo() - log.info("summary lastPrice: ",status.LAST_PRICE) - log.info("summary balance Available: ",status.BALANCE_AVAILABLE) - log.info("summary balance Position: ",status.BALANCE_POSITION) - log.info("summary balance isBull: ",status.IS_BULL) - log.info("summary balance isBear: ",status.IS_BEAR) + // log.info("summary lastPrice: ",status.LAST_PRICE) + // log.info("summary balance Available: ",status.BALANCE_AVAILABLE) + // log.info("summary balance Position: ",status.BALANCE_POSITION) + // log.info("summary balance isBull: ",status.IS_BULL) + // log.info("summary balance isBear: ",status.IS_BEAR) //positions diff --git a/apps/fomo-cli/src/modules/config.ts b/apps/fomo-cli/src/modules/config.ts index 848a2f0..ddfc49c 100644 --- a/apps/fomo-cli/src/modules/config.ts +++ b/apps/fomo-cli/src/modules/config.ts @@ -46,7 +46,7 @@ export function innitConfig(languageSelected:string){ let config:any = {} config.locale = "english" config.localeSelected = true - config.version = finder.next().value.version + config.version = "1.0.1" config.isCli = true fs.writeFileSync(fomoConfig,JSON.stringify(config)) @@ -56,39 +56,38 @@ export function innitConfig(languageSelected:string){ } } - //innit Wallet -export function initWallet(encryptedSeed:any,passwordHash:any){ - let tag = TAG + " | initWallet | " - try{ +export async function initWallet(encryptedSeed: any, passwordHash: any) { + let tag = TAG + " | initWallet | "; + try { + console.log(tag, "seedDir: ", seedDir); - mkdirp(seedDir, function (err:any) { - if (err) console.error(err) - else console.log('seedDir: ',seedDir) + //make the dir + let isCreated = await mkdirp(seedDir); + //console.log("isCreated: ", isCreated); - let output:any = {} - console.log(tag,"CHECKPOINT innitConfig") - console.log(tag,"encryptedSeed: ",encryptedSeed) + let output: any = {}; + //console.log(tag, "CHECKPOINT innitConfig"); + //console.log(tag, "encryptedSeed: ", encryptedSeed); - let wallet:any = {} - wallet.hash = passwordHash - wallet.version = 1 - wallet.type = "seedwords" - wallet.vault = encryptedSeed - - let result = fs.writeFileSync(seedPath,JSON.stringify(wallet)) - console.log("result: ",result) - }); + let wallet: any = {}; + wallet.hash = passwordHash; + wallet.version = 1; + wallet.type = "seedwords"; + wallet.vault = encryptedSeed; + let result = fs.writeFileSync(seedPath, JSON.stringify(wallet)); + //console.log("result: ", result); - - }catch (e) { - console.error(tag,"e: ",e) - return {} + return true; + } catch (e) { + console.error(tag, "e: ", e); + return {}; } } + //check export function checkConfigs(){ let output:any = {} @@ -115,15 +114,20 @@ export function checkConfigs(){ return output } -export function getWallet(){ - try{ - return fs.readFileSync(seedPath) - }catch (e) { - return {} +export function getWallet() { + try { + let walletBuff = fs.readFileSync(seedPath); + let walletString = walletBuff.toString() + let wallet = JSON.parse(walletString) + + return wallet + } catch (e) { + return {}; } } + export function getConfig(){ try{ let output = JSON.parse(fs.readFileSync(configPath)) diff --git a/apps/fomo-cluster/cli/src/index.ts b/apps/fomo-cluster/cli/src/index.ts index 46afce9..605508a 100644 --- a/apps/fomo-cluster/cli/src/index.ts +++ b/apps/fomo-cluster/cli/src/index.ts @@ -150,7 +150,7 @@ let onSetup = async function(){ //create wallet await initWallet(encryptedString,hash) - //TODO test keys + //TODO __test__ keys //save to config @@ -237,11 +237,11 @@ let onUpdate = async function(){ let tag = TAG + " | onUpdate | " try{ let status = getSummaryInfo() - log.info("summary lastPrice: ",status.LAST_PRICE) - log.info("summary balance Available: ",status.BALANCE_AVAILABLE) - log.info("summary balance Position: ",status.BALANCE_POSITION) - log.info("summary balance isBull: ",status.IS_BULL) - log.info("summary balance isBear: ",status.IS_BEAR) + // log.info("summary lastPrice: ",status.LAST_PRICE) + // log.info("summary balance Available: ",status.BALANCE_AVAILABLE) + // log.info("summary balance Position: ",status.BALANCE_POSITION) + // log.info("summary balance isBull: ",status.IS_BULL) + // log.info("summary balance isBear: ",status.IS_BEAR) //positions diff --git a/apps/fomo-cluster/workers/prediction-worker/src/index.ts b/apps/fomo-cluster/workers/prediction-worker/src/index.ts index 69ed7d6..28adace 100644 --- a/apps/fomo-cluster/workers/prediction-worker/src/index.ts +++ b/apps/fomo-cluster/workers/prediction-worker/src/index.ts @@ -12,8 +12,10 @@ const sleep = wait.sleep; let fomo = require("fomo-api") let shortid = require('shortid'); -let urlSpec = "https://fomobro.com/spec/swagger.json" -console.log(urlSpec) + +let urlSpec = "http://127.0.0.1:8000/spec/swagger.json" +// let urlSpec = "https://fomobro.com/spec/swagger.json" +// console.log(urlSpec) let onStart = async function(){ try{ diff --git a/apps/fomo-core/extensions/exchanges/bitmex/exchange.js b/apps/fomo-core/extensions/exchanges/bitmex/exchange.js index 2129814..1374788 100644 --- a/apps/fomo-core/extensions/exchanges/bitmex/exchange.js +++ b/apps/fomo-core/extensions/exchanges/bitmex/exchange.js @@ -210,7 +210,7 @@ module.exports = function gdax (conf) { let toUnix = new Date(now.getTime() - 1000 * 60 * 60) let fromUnix = opts.from - //test + //__test__ // // toUnix = new Date(toUnix).getTime() // fromUnix = new Date(fromUnix).getTime() diff --git a/apps/fomo-core/extensions/strategies/trendline/strategy.js b/apps/fomo-core/extensions/strategies/trendline/strategy.js index bf1480d..9e7d20f 100644 --- a/apps/fomo-core/extensions/strategies/trendline/strategy.js +++ b/apps/fomo-core/extensions/strategies/trendline/strategy.js @@ -19,8 +19,8 @@ module.exports = { this.option('lastpoints2', 'Number of trades for short trend average', Number, 10) this.option('avgpoints2', 'Number of trades for long trend average', Number, 100) this.option('min_periods', 'Basically avgpoints + a BUNCH of more preroll periods for anything less than 5s period', Number, 15000) - this.option('markup_sell_pct', 'test-module.js', Number, 0) - this.option('markdown_buy_pct', 'test-module.js', Number, 0) + this.option('markup_sell_pct', '__test__-module.js', Number, 0) + this.option('markdown_buy_pct', '__test__-module.js', Number, 0) }, calculate: function () { diff --git a/apps/fomo-core/services/train/index.js b/apps/fomo-core/services/train/index.js index 2ff7f1d..fd2927c 100644 --- a/apps/fomo-core/services/train/index.js +++ b/apps/fomo-core/services/train/index.js @@ -285,7 +285,7 @@ require('mongodb').MongoClient.connect(connectionString, { useNewUrlParser: true if (so.days_test > 0) { var endTest = moment(so.end_training).add(so.days_test, 'days') - console.log('\nRunning simulation on test data from ' + console.log('\nRunning simulation on __test__ data from ' + moment(so.end_training).format('YYYY-MM-DD HH:mm:ss ZZ') + ' to ' + moment(endTest).format('YYYY-MM-DD HH:mm:ss ZZ') + ' (' + so.days_test + ' days).\n' ) diff --git a/apps/fomo-core/train.js b/apps/fomo-core/train.js index 3f3c96f..5485667 100644 --- a/apps/fomo-core/train.js +++ b/apps/fomo-core/train.js @@ -276,7 +276,7 @@ require('mongodb').MongoClient.connect(connectionString, { useNewUrlParser: true if (so.days_test > 0) { var endTest = moment(so.end_training).add(so.days_test, 'days') - console.log('\nRunning simulation on test data from ' + console.log('\nRunning simulation on __test__ data from ' + moment(so.end_training).format('YYYY-MM-DD HH:mm:ss ZZ') + ' to ' + moment(endTest).format('YYYY-MM-DD HH:mm:ss ZZ') + ' (' + so.days_test + ' days).\n' ) diff --git a/apps/fomo-native-legacy/src/renderer/App.vue b/apps/fomo-native-legacy/src/renderer/App.vue index 43810af..3e930cb 100644 --- a/apps/fomo-native-legacy/src/renderer/App.vue +++ b/apps/fomo-native-legacy/src/renderer/App.vue @@ -909,7 +909,7 @@ //init bot await this.$botService.init(password) - //test bitmex + //__test__ bitmex let status = await this.$botService.getSummaryInfo() //if online diff --git a/modules/default-redis/__tests__/test-module.js b/modules/default-redis/__tests__/test-module.js index a439499..c6d8e3d 100644 --- a/modules/default-redis/__tests__/test-module.js +++ b/modules/default-redis/__tests__/test-module.js @@ -67,7 +67,7 @@ const {redis,redisQueue} = require("../index") write */ -// redis.set("test","foo") +// redis.set("__test__","foo") // .then(function(resp){ // console.log("resp: ",resp) // }) @@ -77,7 +77,7 @@ write Read */ -// redis.get("test") +// redis.get("__test__") // .then(function(resp){ // console.log("resp: ",resp) // }) diff --git a/modules/fomo-api/__tests__/test-local.js b/modules/fomo-api/__tests__/test-local.js index 569ce89..82b2b58 100644 --- a/modules/fomo-api/__tests__/test-local.js +++ b/modules/fomo-api/__tests__/test-local.js @@ -34,16 +34,25 @@ let run_test = async function(){ let signup = await fomo.create(username,apiKeys.account) console.log("signup: ",signup) + //get user info + let userInfoPublic = await fomo.getUser(username) + console.log("userInfoPublic: ",userInfoPublic) + + //get user info Private + let userInfoPrivate = await fomo.getInfo(username) + console.log("userInfoPrivate: ",userInfoPrivate) + //create prediction - let inTenMinutes = new Date().getTime() + 1000 * 60 * 10 - let prediction = { - coin:"BTC", - time:inTenMinutes.toString(), - price:"10000" - } - - let predictionResult = await fomo.predict(prediction) - console.log("predictionResult: ",predictionResult) + // let inTenMinutes = new Date().getTime() + 1000 * 60 * 10 + // let inTenMinutes = new Date().getTime() + 1000 * 11 + // let prediction = { + // coin:"BTC", + // time:inTenMinutes.toString(), + // price:"10000" + // } + // + // let predictionResult = await fomo.predict(prediction) + // console.log("predictionResult: ",predictionResult) }catch(e){ console.error(e) diff --git a/modules/fomo-api/package.json b/modules/fomo-api/package.json index c4a2ec5..4676fb1 100644 --- a/modules/fomo-api/package.json +++ b/modules/fomo-api/package.json @@ -1,6 +1,6 @@ { - "name": "fomo-api", - "version": "6.2.5", + "name": "@fomobro/fomo-api", + "version": "6.2.6", "main": "./lib/index.js", "types": "./lib/main.d.ts", "scripts": { diff --git a/modules/fomo-api/src/index.ts b/modules/fomo-api/src/index.ts index ff0c670..8d55ca0 100644 --- a/modules/fomo-api/src/index.ts +++ b/modules/fomo-api/src/index.ts @@ -36,6 +36,10 @@ module.exports = { let resp = await fomoApi.instance.GetInfo() return resp.data; }, + getUser:async function (username:string) { + let resp = await fomoApi.instance.User(username) + return resp.data; + }, create:async function (username:string,account:string) { let resp = await fomoApi.instance.CreateAccount(null,{username,account}) return resp.data; diff --git a/modules/fomo-coincap/__test__/test-module.js b/modules/fomo-coincap/__test__/test-module.js new file mode 100644 index 0000000..981637b --- /dev/null +++ b/modules/fomo-coincap/__test__/test-module.js @@ -0,0 +1,29 @@ +require("dotenv").config({path:"../.env"}) +let coincap = require("../index") + +console.log(new Date().getTime() + 1000 * 20) + +// coincap.getPrice('BTC') +// .then(function(resp){ +// console.log(resp) +// }) + +// coincap.assets() +// .then(function(resp){ +// console.log(resp) +// }) + +// coincap.history('bitcoin') +// .then(function(resp){ +// console.log(resp.data.length) +// let outputPrices = [] +// let outputDates = [] +// for(let i = 0; i < resp.data.length; i++){ +// let entry = resp.data[i] +// outputPrices.push(entry.priceUsd) +// outputDates.push(entry.date) +// } +// +// console.log(outputPrices) +// console.log(outputDates) +// }) diff --git a/modules/fomo-coincap/index.js b/modules/fomo-coincap/index.js index 718e40f..344bbc0 100644 --- a/modules/fomo-coincap/index.js +++ b/modules/fomo-coincap/index.js @@ -4,9 +4,9 @@ */ -const TAG = " | fomo-coincap-api-client | " +const TAG = " | coincap-api-client | " require('dotenv').config() -const log = require('default-logger')() +const log = require('@fomobro/loggerdog-client')() const https = require('https'); const Axios = require('axios') const axios = Axios.create({ @@ -14,9 +14,32 @@ const axios = Axios.create({ rejectUnauthorized: false }) }); +const { GraphQLClient } = require('graphql-request'); +const symbolIDMap = require('./symbolIDMap'); + +const graphql = new GraphQLClient('https://graphql.coincap.io/',{ + headers: { + "x-coincap-bypass-limit": process.env['BYPASS_RATE_LIMIT_KEY'], + } +}); const URL = "https://api.coincap.io/v2/" +let ENABLE_CACHE = true +let GLOBAL_RATES + +// let onStart = async function(){ +// let tag = TAG + " | onStart | " +// try{ +// let rates = await get_assets() +// GLOBAL_RATES = rates +// }catch(e){ +// console.error(e) +// } +// } +// onStart() + + module.exports = { assets:function(){ return get_assets() @@ -24,6 +47,170 @@ module.exports = { history:function(asset,interval,start,end){ return get_asset_history(asset,interval,start,end) }, + valuePortfolio:function(portfolio,quote){ + return get_value_portfolio(portfolio,quote) + }, + getPrice:function(asset){ + return get_asset_price(asset) + }, + getPriceIn:function(asset,quote){ + return get_asset_price_in_quote(asset,quote) + }, + getValue:function(asset,amount){ + return get_asset_value(asset,amount) + }, +} + + +let get_value_portfolio = async function (portfolio,quote) { + let tag = TAG + ' | get_value_portfolio | ' + try { + // + if(!GLOBAL_RATES) GLOBAL_RATES = await get_assets() + + let coins = Object.keys(portfolio) + + let valuesUsd = {} + let totalValueUsd = 0 + for(let i = 0; i < coins.length; i++){ + let coin = coins[i] + //log.debug(tag,"coin: ",coin) + if(!GLOBAL_RATES[coin] || !GLOBAL_RATES[coin].priceUsd){ + log.error(tag," Missing rate data for "+coin) + GLOBAL_RATES[coin] = {} + GLOBAL_RATES[coin].priceUsd = 0 + } + let rateUsd = GLOBAL_RATES[coin].priceUsd + log.debug(coin," rateUsD: ",rateUsd) + valuesUsd[coin] = portfolio[coin] * parseFloat(rateUsd) + totalValueUsd += valuesUsd[coin] + + //TODO if quote !== USD + //calc conversion + } + + return {values:valuesUsd,total:totalValueUsd} + } catch (e) { + console.error(tag, 'Error: ', e) + throw e + } +} + +let get_asset_value = async function (asset,amount) { + let tag = TAG + ' | get_asset_history | ' + try { + let id = await getIDForSymbol(asset) + if(!id) throw Error("102: unknown id for asset: "+asset) + log.debug(tag,"id: ",id) + + let marketInfo = await getMarketDataForIDs([id]) + + if(!marketInfo.assets.edges[0]) throw Error("103: unknown market info for asset! asset: "+asset) + let priceUsd = marketInfo.assets.edges[0].node.priceUsd + + let value = parseFloat(amount) * parseFloat(priceUsd) + + return value + } catch (e) { + console.error(tag, 'Error: ', e) + throw e + } +} + +//lib +let get_asset_price = async function (asset) { + let tag = TAG + ' | get_asset_history | ' + try { + let id = await getIDForSymbol(asset) + log.info(tag,"id: ",id) + + let marketInfo = await getMarketDataForIDs([id]) + + return marketInfo.assets.edges[0].node + } catch (e) { + console.error(tag, 'Error: ', e) + throw e + } +} + +// +const getMarketDataForIDs = async (ids) => { + const query = /* GraphQL */ ` + { + assets(first: ${ids.length}, where: { + id_in: ${JSON.stringify(ids)} + }) { + edges { + node { + id, + symbol, + priceUsd, + changePercent24Hr + } + } + } + }`; + + return await graphql.request(query); +} + +const getIDForSymbol = async (symbol) => { + try { + const query = `{ + assets( + first: 1, + where: { + symbol_starts_with: "${symbol}" + }, + sort: rank, + direction: ASC) + { + edges { + node { + id, + } + } + } + }`; + + const ret = await graphql.request(query); + const ID = ret.assets.edges[0].node.id; + // Cache + symbolIDMap[symbol] = ID; + return ID; + + } catch (err) { + return symbol; + } +} + +const getMarketDataForSymbols = async (symbols) => { + let ids = symbols.map(symbol => { + return symbolIDMap[symbol] !== undefined ? + symbolIDMap[symbol] : + getIDForSymbol(symbol); + }); + ids = await Promise.all(ids); + const ret = await getMarketDataForIDs(ids); + const marketDatas = ret.assets.edges.map(edge => edge.node); + return marketDatas; +} + +getHistoryForSymbol = async (symbol) => { + const id = await getIDForSymbol(symbol); + + const query = /* GraphQL */ ` + { + assetHistories(assetId: "${id}" interval: h1, limit: 24) + { + priceUsd, + date, + timestamp + } + }`; + + const ret = await graphql.request(query); + return ret.assetHistories; } @@ -35,17 +222,29 @@ module.exports = { let get_assets = async function () { let tag = TAG + ' | get_order | ' try { + let output = {} - let url = URL + 'assets' - log.info(tag,"url: ",url) + let url = URL + 'assets?limit=2000' + log.debug(tag,"url: ",url) let result = await axios({ url: url, method: 'GET' }) - log.info('result: ', result.data) + //parse into keys array off ticker + let allCoinsArray = result.data.data + log.info(tag,"allCoinsArray: ",allCoinsArray.length) - return result.data + for(let i = 0; i < allCoinsArray.length; i++){ + // + let coinInfo = allCoinsArray[i] + log.debug(tag,"coinInfo: ",coinInfo) + + output[coinInfo.symbol] = coinInfo + } + log.debug('result: ', output) + + return output } catch (e) { console.error(tag, 'Error: ', e) throw e @@ -65,13 +264,13 @@ let get_asset_history = async function (asset,interval,start,end) { if(!interval) interval let url = URL + 'assets/'+asset+'/history?interval='+interval+'&start='+start+'&end='+end - log.info(tag,"url: ",url) + log.debug(tag,"url: ",url) let result = await axios({ url: url, method: 'GET' }) - log.info('result: ', result.data) + log.debug('result: ', result.data) return result.data } catch (e) { diff --git a/modules/fomo-coincap/package.json b/modules/fomo-coincap/package.json index 99fcdb6..fd5e3a3 100644 --- a/modules/fomo-coincap/package.json +++ b/modules/fomo-coincap/package.json @@ -1,6 +1,6 @@ { "name": "@fomobro/fomo-coincap", - "version": "1.0.13", + "version": "1.0.14", "description": "A coincap module", "main": "index.js", "scripts": { @@ -12,8 +12,9 @@ "author": "highlander", "license": "ISC", "dependencies": { - "axios": "^0.19.0", - "default-logger": "0.0.2", - "dotenv": "^8.0.0" + "@fomobro/loggerdog-client": "^1.0.14", + "axios": "^0.19.2", + "dotenv": "^8.2.0", + "graphql-request": "^1.8.2" } } diff --git a/modules/fomo-coincap/symbolIDMap.js b/modules/fomo-coincap/symbolIDMap.js new file mode 100644 index 0000000..4758b91 --- /dev/null +++ b/modules/fomo-coincap/symbolIDMap.js @@ -0,0 +1,49 @@ +const symbolIDMap = { + btc: 'bitcoin', + eth: 'ethereum', + xrp: 'ripple', + bch: 'bitcoin-cash', + eos: 'eos', + xlm: 'stellar', + ltc: 'litecoin', + usdt: 'tether', + ada: 'cardano', + xmr: 'monero', + trx: 'tron', + iota: 'iota', + miota: 'iota', + dash: 'dash', + bnb: 'binance-coin', + neo: 'neo', + etc: 'ethereum-classic', + xem: 'nem', + nem: 'nem', + xtz: 'tezos', + vet: 'vechain', + doge: 'dogecoin', + zec: 'zcash', + mkr: 'maker', + omg: 'omisego', + zrx: '0x', + '0x': '0x', + btg: 'bitcoin-gold', + ont: 'ontology', + dcr: 'decred', + lsk: 'lisk', + qtum: 'qtum', + dgb: 'digibyte', + sky: 'skycoin', + rvn: 'ravencoin', + fun: 'funfair', + mana: 'decentraland', + bat: 'basic-attention-token', + tusd: 'trueusd', + knc: 'kyber-network', + sc: 'siacoin', + dai: 'dai', + pax: 'paxos-standard-token', + swarm: 'swarm-fund', + zp: 'zen-protocol' +} + +module.exports = symbolIDMap; diff --git a/modules/fomo-coincap/test/test-module.js b/modules/fomo-coincap/test/test-module.js deleted file mode 100644 index 7c0ba76..0000000 --- a/modules/fomo-coincap/test/test-module.js +++ /dev/null @@ -1,23 +0,0 @@ -require("dotenv").config({path:"../.env"}) -let coincap = require("../index") - - -// fomo-coincap.assets() -// .then(function(resp){ -// console.log(resp) -// }) - -coincap.history('bitcoin') - .then(function(resp){ - console.log(resp.data.length) - let outputPrices = [] - let outputDates = [] - for(let i = 0; i < resp.data.length; i++){ - let entry = resp.data[i] - outputPrices.push(entry.priceUsd) - outputDates.push(entry.date) - } - - console.log(outputPrices) - console.log(outputDates) - }) diff --git a/modules/fomobot/__tests__/test-module.js b/modules/fomobot/__tests__/test-module.js index 1072f16..cb13555 100644 --- a/modules/fomobot/__tests__/test-module.js +++ b/modules/fomobot/__tests__/test-module.js @@ -19,7 +19,7 @@ bot.backfill() let run_test = async function(){ - let tag = " | run-test | " + let tag = " | run-__test__ | " try{ let events = await bot.init("ta_ultosc") console.log(events) diff --git a/modules/fomobot/extensions/strategies/trendline/strategy.js b/modules/fomobot/extensions/strategies/trendline/strategy.js index bf1480d..9e7d20f 100644 --- a/modules/fomobot/extensions/strategies/trendline/strategy.js +++ b/modules/fomobot/extensions/strategies/trendline/strategy.js @@ -19,8 +19,8 @@ module.exports = { this.option('lastpoints2', 'Number of trades for short trend average', Number, 10) this.option('avgpoints2', 'Number of trades for long trend average', Number, 100) this.option('min_periods', 'Basically avgpoints + a BUNCH of more preroll periods for anything less than 5s period', Number, 15000) - this.option('markup_sell_pct', 'test-module.js', Number, 0) - this.option('markdown_buy_pct', 'test-module.js', Number, 0) + this.option('markup_sell_pct', '__test__-module.js', Number, 0) + this.option('markdown_buy_pct', '__test__-module.js', Number, 0) }, calculate: function () { diff --git a/modules/forex-analytics-fomo/.gitignore b/modules/forex-analytics-fomo/.gitignore index 37b62bd..54ef9a1 100644 --- a/modules/forex-analytics-fomo/.gitignore +++ b/modules/forex-analytics-fomo/.gitignore @@ -69,7 +69,7 @@ bld/ # Uncomment if you have tasks that create the project's static files in wwwroot #wwwroot/ -# MSTest test Results +# MSTest __test__ Results [Tt]est[Rr]esult*/ [Bb]uild[Ll]og.* diff --git a/modules/forex-analytics-fomo/.travis.yml b/modules/forex-analytics-fomo/.travis.yml index 23f1546..a3534d4 100644 --- a/modules/forex-analytics-fomo/.travis.yml +++ b/modules/forex-analytics-fomo/.travis.yml @@ -13,6 +13,6 @@ env: addons: apt: sources: - - ubuntu-toolchain-r-test + - ubuntu-toolchain-r-__test__ packages: - g++-4.8 diff --git a/modules/loggerdog-client/__tests__/test-module.js b/modules/loggerdog-client/__tests__/test-module.js index d0f63e6..516b2b1 100644 --- a/modules/loggerdog-client/__tests__/test-module.js +++ b/modules/loggerdog-client/__tests__/test-module.js @@ -3,4 +3,4 @@ let log = require("../index.js")() console.log(process.env['REDIS_LOGGING']) -log.info(" | test | ","foo","bar") +log.info(" | __test__ | ","foo","bar") diff --git a/modules/redis-queue/__tests__/test-module.js b/modules/redis-queue/__tests__/test-module.js index 74f6cee..71e5deb 100644 --- a/modules/redis-queue/__tests__/test-module.js +++ b/modules/redis-queue/__tests__/test-module.js @@ -28,9 +28,9 @@ let ASSET = "BNB" let run_test = async function(){ try{ - await queue.delete('test-queue') - let resp = await queue.createWork("test-queue",{work:2}) - let resp2 = await queue.createWork("test-queue",{work:2}) + await queue.delete('__test__-queue') + let resp = await queue.createWork("__test__-queue",{work:2}) + let resp2 = await queue.createWork("__test__-queue",{work:2}) console.log(resp) console.log(resp2) @@ -39,7 +39,7 @@ let run_test = async function(){ //work = 0 //verify only one work - let work = await queue.viewWork('test-queue',10) + let work = await queue.viewWork('__test__-queue',10) console.log(work) }catch(e){ @@ -52,19 +52,19 @@ run_test() // let run_test = async function(){ // try{ // -// await queue.delete('test-queue') +// await queue.delete('__test__-queue') // // //doesnt throw on expired -// let expire = await queue.getWork('test-queue',1) +// let expire = await queue.getWork('__test__-queue',1) // console.log("expire: ",expire) // // // for(let i = 0; i < 5; i++){ -// await queue.createWork("test-queue",{work:i}) +// await queue.createWork("__test__-queue",{work:i}) // } // // //start working -// let work = await queue.getWork('test-queue') +// let work = await queue.getWork('__test__-queue') // console.log("work: ",work) // // //if lifo diff --git a/modules/views/__tests__/test-module.js b/modules/views/__tests__/test-module.js index c8ab1fa..5b5acbc 100644 --- a/modules/views/__tests__/test-module.js +++ b/modules/views/__tests__/test-module.js @@ -6,4 +6,4 @@ let view = require("../index") -view.displayStringToChannel("test: ","markets") +view.displayStringToChannel("__test__: ","markets")