askmike / gekko

A bitcoin trading bot written in node - https://gekko.wizb.it/
MIT License
10.08k stars 3.93k forks source link

error live trading #2392

Closed Kwings closed 6 years ago

Kwings commented 6 years ago

Hi.

What causes this error?

/Users/macbookpro/gekko/exchange/portfolioManager.js:72 throw new errors.ExchangeError(err); ^ Error at Object. (/Users/macbookpro/gekko/exchange/exchangeErrors.js:9:27) at Module._compile (module.js:652:30) at Object.Module._extensions..js (module.js:663:10) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12) at Function.Module._load (module.js:497:3) at Module.require (module.js:596:17) at require (internal/module.js:11:18) at Object. (/Users/macbookpro/gekko/exchange/exchangeChecker.js:4:16) at Module._compile (module.js:652:30)

askmike commented 6 years ago

Can be caused by a number of reasons.

To debug you need to tell us more:

Kwings commented 6 years ago

i use Binance with USDT/BTC and it happens every strartup with live trade.

2018-07-25 11:02:44 (INFO): Setting up Gekko in realtime mode 2018-07-25 11:02:44 (INFO):
2018-07-25 11:02:44 (INFO): Setting up: 2018-07-25 11:02:44 (INFO): Candle writer 2018-07-25 11:02:44 (INFO): Store candles in a database 2018-07-25 11:02:44 (INFO):

2018-07-25 11:02:44 (INFO): Setting up: 2018-07-25 11:02:44 (INFO): Trading Advisor 2018-07-25 11:02:44 (INFO): Calculate trading advice 2018-07-25 11:02:44 (INFO): Using the strategy: RSI_BULL_BEAR_ADX 2018-07-25 11:02:44 (INFO): ==================================== 2018-07-25 11:02:44 (INFO): Running RSI Bull and Bear + ADX 2018-07-25 11:02:44 (INFO): ==================================== 2018-07-25 11:02:44 (INFO): Make sure your warmup period matches SMA_long and that Gekko downloads data if needed 2018-07-25 11:02:44 (INFO): The trading method requests 60000 minutes of historic data. Checking availablity.. 2018-07-25 11:02:44 (INFO):

2018-07-25 11:02:44 (DEBUG): Available local data: 2018-07-25 11:02:44 (DEBUG): from: 60000 minutes ago 2018-07-25 11:02:44 (DEBUG): to: 9 minutes ago 2018-07-25 11:02:44 (INFO): Usable local data available, trying to match with exchange data.. 2018-07-25 11:02:44 (DEBUG): Fetching exchange data since 24 minutes ago 2018-07-25 11:02:45 (DEBUG): Available exchange data: 2018-07-25 11:02:45 (DEBUG): from: 24 minutes ago 2018-07-25 11:02:45 (DEBUG): to: 0 minutes ago 2018-07-25 11:02:45 (DEBUG): Stitching datasets 2018-07-25 11:02:45 (INFO): Full history locally available. Seeding the trading method with all required historical candles. 2018-07-25 11:02:45 (DEBUG): Seeding with: 2018-07-25 11:02:45 (DEBUG): from: 60000 minutes ago 2018-07-25 11:02:45 (DEBUG): to: 25 minutes ago 2018-07-25 11:02:47 (INFO): Setting up: 2018-07-25 11:02:47 (INFO): Trader 2018-07-25 11:02:47 (INFO): Follows the advice and create real orders. 2018-07-25 11:02:47 (DEBUG): syncing private data 2018-07-25 11:02:47 (INFO):

/Users/macbookpro/gekko/exchange/portfolioManager.js:72 throw new errors.ExchangeError(err); ^ Error at Object. (/Users/macbookpro/gekko/exchange/exchangeErrors.js:9:27) at Module._compile (module.js:652:30) at Object.Module._extensions..js (module.js:663:10) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12) at Function.Module._load (module.js:497:3) at Module.require (module.js:596:17) at require (internal/module.js:11:18) at Object. (/Users/macbookpro/gekko/exchange/exchangeChecker.js:4:16) at Module._compile (module.js:652:30)

Kwings commented 6 years ago

This is the live-config.js file:

// Everything is explained here: // @link https://gekko.wizb.it/docs/commandline/plugins.html

var config = {};

// ~~~~~~~~~~~~~~~~ // GENERAL SETTINGS // ~~~~~~~~~~~~~~~~

config.debug = true; // for additional logging / debugging config.silent = false

// ~~~~~~~~~~~~~~~~ // WATCHING A MARKET // ~~~~~~~~~~~~~~~~

config.watch = {

// see https://gekko.wizb.it/docs/introduction/supported_exchanges.html exchange: 'binance', currency: 'USDT', asset: 'BTC',

// You can set your own tickrate (refresh rate). // If you don't set it, the defaults are 2 sec for // okcoin and 20 sec for all other exchanges. // tickrate: 20 }

// ~~~~~~~~~~~~~~~~ // CONFIGURING TRADING ADVICE // ~~~~~~~~~~~~~~~~

config.tradingAdvisor = { enabled: true, method: 'RSI_BULL_BEAR_ADX', candleSize: 60, historySize: 1000, }

// Exponential Moving Averages settings: config.DEMA = { // EMA weight (α) // the higher the weight, the more smooth (and delayed) the line weight: 21, // amount of candles to remember and base initial EMAs on // the difference between the EMAs (to act as triggers) thresholds: { down: -0.025, up: 0.025 } };

// MACD settings: config.MACD = { // EMA weight (α) // the higher the weight, the more smooth (and delayed) the line short: 10, long: 21, signal: 9, // the difference between the EMAs (to act as triggers) thresholds: { down: -0.025, up: 0.025, // How many candle intervals should a trend persist // before we consider it real? persistence: 1 } };

// PPO settings: config.PPO = { // EMA weight (α) // the higher the weight, the more smooth (and delayed) the line short: 12, long: 26, signal: 9, // the difference between the EMAs (to act as triggers) thresholds: { down: -0.025, up: 0.025, // How many candle intervals should a trend persist // before we consider it real? persistence: 2 } };

// Uses one of the momentum indicators but adjusts the thresholds when PPO is bullish or bearish // Uses settings from the ppo and momentum indicator config block config.varPPO = { momentum: 'TSI', // RSI, TSI or UO thresholds: { // new threshold is default threshold + PPOhist * PPOweight weightLow: 120, weightHigh: -120, // How many candle intervals should a trend persist // before we consider it real? persistence: 0 } };

// RSI settings: config.RSI = { interval: 14, thresholds: { low: 30, high: 70, // How many candle intervals should a trend persist // before we consider it real? persistence: 1 } };

// TSI settings: config.TSI = { short: 13, long: 25, thresholds: { low: -25, high: 25, // How many candle intervals should a trend persist // before we consider it real? persistence: 1 } };

// Ultimate Oscillator Settings config.UO = { first: {weight: 4, period: 7}, second: {weight: 2, period: 14}, third: {weight: 1, period: 28}, thresholds: { low: 30, high: 70, // How many candle intervals should a trend persist // before we consider it real? persistence: 1 } };

// CCI Settings config.CCI = { constant: 0.015, // constant multiplier. 0.015 gets to around 70% fit history: 90, // history size, make same or smaller than history thresholds: { up: 100, // fixed values for overbuy upward trajectory down: -100, // fixed value for downward trajectory persistence: 0 // filter spikes by adding extra filters candles } };

// StochRSI settings config.StochRSI = { interval: 3, thresholds: { low: 20, high: 80, // How many candle intervals should a trend persist // before we consider it real? persistence: 3 } };

// RSI Bull Bear ADX settings config.RSI_BULL_BEAR_ADX = { SMA: { long: 1000, short: 50 }, BULL: { rsi: 10, high: 80, low: 60, mod_high: 5, mod_low: -5 }, BEAR: { rsi: 15, high: 50, low: 20, mod_high: 15, mod_low: -5 }, ADX: { adx: 3, high: 70, low: 50 } };

// custom settings: config.custom = { my_custom_setting: 10, }

config['talib-macd'] = { parameters: { optInFastPeriod: 10, optInSlowPeriod: 21, optInSignalPeriod: 9 }, thresholds: { down: -0.025, up: 0.025, } }

// ~~~~~~~~~~~~~~~~ // CONFIGURING PLUGINS // ~~~~~~~~~~~~~~~~

// do you want Gekko to simulate the profit of the strategy's own advice? config.paperTrader = { enabled: false, // report the profit in the currency or the asset? reportInCurrency: true, // start balance, on what the current balance is compared with simulationBalance: { // these are in the unit types configured in the watcher. asset: 0.0045, currency: 100, }, // how much fee in % does each trade cost? feeMaker: 0.075, feeTaker: 0.075, feeUsing: 'maker', // how much slippage/spread should Gekko assume per trade? slippage: 0.05, }

config.performanceAnalyzer = { enabled: true, riskFreeReturn: 5 }

// Want Gekko to perform real trades on buy or sell advice? // Enabling this will activate trades for the market being // watched by config.watch. config.trader = { enabled: true, key: 'XXXXXXXXXXXXXXXXXX', secret: 'XXXXXXXXXXXXXXXXXX', username: '', // your username, only required for specific exchanges. passphrase: '', // GDAX, requires a passphrase. }

config.eventLogger = { enabled: false, // optionally pass a whitelist of events to log, if not past // the eventLogger will log all events. // whitelist: ['portfolioChange', 'portfolioValueChange'] }

config.pushover = { enabled: false, sendPushoverOnStart: false, muteSoft: true, // disable advice printout if it's soft tag: '[GEKKO]', key: '', user: '' }

// want Gekko to send a mail on buy or sell advice? config.mailer = { enabled: false, // Send Emails if true, false to turn off sendMailOnStart: true, // Send 'Gekko starting' message if true, not if false

email: '', // Your Gmail address muteSoft: true, // disable advice printout if it's soft

// You don't have to set your password here, if you leave it blank we will ask it // when Gekko's starts. // // NOTE: Gekko is an open source project < https://github.com/askmike/gekko >, // make sure you looked at the code or trust the maintainer of this bot when you // fill in your email and password. // // WARNING: If you have NOT downloaded Gekko from the github page above we CANNOT // guarantuee that your email address & password are safe!

password: '', // Your Gmail Password - if not supplied Gekko will prompt on startup.

tag: '[GEKKO] ', // Prefix all email subject lines with this

        //       ADVANCED MAIL SETTINGS
        // you can leave those as is if you
        // just want to use Gmail

server: 'smtp.gmail.com', // The name of YOUR outbound (SMTP) mail server. smtpauth: true, // Does SMTP server require authentication (true for Gmail) // The following 3 values default to the Email (above) if left blank user: '', // Your Email server user name - usually your full Email address 'me@mydomain.com' from: '', // 'me@mydomain.com' to: '', // 'me@somedomain.com, me@someotherdomain.com' ssl: true, // Use SSL (true for Gmail) port: '', // Set if you don't want to use the default port }

config.pushbullet = { // sends pushbullets if true enabled: false, // Send 'Gekko starting' message if true sendMessageOnStart: true, // disable advice printout if it's soft muteSoft: true, // your pushbullet API key key: 'xxx', // your email, change it unless you are Azor Ahai email: 'jon_snow@westeros.org', // will make Gekko messages start mit [GEKKO] tag: '[GEKKO]' };

config.kodi = { // if you have a username & pass, add it like below // http://user:pass@ip-or-hostname:8080/jsonrpc host: 'http://ip-or-hostname:8080/jsonrpc', enabled: false, sendMessageOnStart: true, }

config.ircbot = { enabled: false, emitUpdates: false, muteSoft: true, channel: '#your-channel', server: 'irc.freenode.net', botName: 'gekkobot' }

config.telegrambot = { enabled: false, token: 'YOUR_TELEGRAM_BOT_TOKEN', };

config.twitter = { // sends pushbullets if true enabled: false, // Send 'Gekko starting' message if true sendMessageOnStart: false, // disable advice printout if it's soft muteSoft: false, tag: '[GEKKO]', // twitter consumer key consumer_key: '', // twitter consumer secret consumer_secret: '', // twitter access token key access_token_key: '', // twitter access token secret access_token_secret: '' };

config.xmppbot = { enabled: false, emitUpdates: false, client_id: 'jabber_id', client_pwd: 'jabber_pw', client_host: 'jabber_server', client_port: 5222, status_msg: 'I\'m online', receiver: 'jabber_id_for_updates' }

config.campfire = { enabled: false, emitUpdates: false, nickname: 'Gordon', roomId: null, apiKey: '', account: '' }

config.redisBeacon = { enabled: false, port: 6379, // redis default host: '127.0.0.1', // localhost // On default Gekko broadcasts // events in the channel with // the name of the event, set // an optional prefix to the // channel name. channelPrefix: '', broadcast: [ 'candle' ] }

config.slack = { enabled: false, token: '', sendMessageOnStart: true, muteSoft: true, channel: '' // #tradebot }

config.ifttt = { enabled: false, eventName: 'gekko', makerKey: '', muteSoft: true, sendMessageOnStart: true }

config.candleWriter = { enabled: true }

config.adviceWriter = { enabled: false, muteSoft: true, }

config.backtestResultExporter = { enabled: false, writeToDisk: false, data: { stratUpdates: false, roundtrips: true, stratCandles: true, trades: true } }

// ~~~~~~~~~~~~~~~~ // CONFIGURING ADAPTER // ~~~~~~~~~~~~~~~~

config.adapter = 'sqlite';

config.sqlite = { path: 'plugins/sqlite',

dataDirectory: 'history', version: 0.1,

journalMode: require('./web/isWindows.js') ? 'DELETE' : 'WAL',

dependencies: [] }

// Postgres adapter example config (please note: requires postgres >= 9.5): config.postgresql = { path: 'plugins/postgresql', version: 0.1, connectionString: 'postgres://user:pass@localhost:5432', // if default port database: null, // if set, we'll put all tables into a single database. schema: 'public', dependencies: [{ module: 'pg', version: '7.4.3' }] }

// Mongodb adapter, requires mongodb >= 3.3 (no version earlier tested) config.mongodb = { path: 'plugins/mongodb', version: 0.1, connectionString: 'mongodb://localhost/gekko', // connection to mongodb server dependencies: [{ module: 'mongojs', version: '2.4.0' }] }

// ~~~~~~~~~~~~~~~~ // CONFIGURING BACKTESTING // ~~~~~~~~~~~~~~~~

// Note that these settings are only used in backtesting mode, see here: // @link: https://gekko.wizb.it/docs/commandline/backtesting.html

config.backtest = { daterange: { from: "2018-06-22 00:00:00", to: "2018-07-23 23:40:00" }, batchSize: 1000 }

// ~~~~~~~~~~~~~~~~ // CONFIGURING IMPORTING // ~~~~~~~~~~~~~~~~

config.importer = { daterange: { // NOTE: these dates are in UTC from: "2018-07-24 11:49:00", } }

// set this to true if you understand that Gekko will // invest according to how you configured the indicators. // None of the advice in the output is Gekko telling you // to take a certain position. Instead it is the result // of running the indicators you configured automatically. // // In other words: Gekko automates your trading strategies, // it doesn't advice on itself, only set to true if you truly // understand this. // // Not sure? Read this first: https://github.com/askmike/gekko/issues/201 config['I understand that Gekko only automates MY OWN trading strategies'] = true;

module.exports = config;

askmike commented 6 years ago

Most likely a problem with your API keys. I will update Gekko to provide more logging about the exact reason. Meanwhile please generate new ones and try these.

PS. Please put your logs and configs in code blocks or gists.

On Wed, Aug 1, 2018 at 4:40 PM, Kwings notifications@github.com wrote:

i use Binance with USDT/BTC and it happens every strartup with live trade.

2018-07-25 11:02:44 (INFO): Setting up Gekko in realtime mode 2018-07-25 11:02:44 (INFO): 2018-07-25 11:02:44 (INFO): Setting up: 2018-07-25 11:02:44 (INFO): Candle writer 2018-07-25 11:02:44 (INFO): Store candles in a database 2018-07-25 11:02:44 (INFO):

2018-07-25 11:02:44 (INFO): Setting up: 2018-07-25 11:02:44 (INFO): Trading Advisor 2018-07-25 11:02:44 (INFO): Calculate trading advice 2018-07-25 11:02:44 (INFO): Using the strategy: RSI_BULL_BEAR_ADX 2018-07-25 11:02:44 (INFO): ==================================== 2018-07-25 11:02:44 (INFO): Running RSI Bull and Bear + ADX 2018-07-25 11:02:44 (INFO): ==================================== 2018-07-25 11:02:44 (INFO): Make sure your warmup period matches SMA_long and that Gekko downloads data if needed 2018-07-25 11:02:44 (INFO): The trading method requests 60000 minutes of historic data. Checking availablity.. 2018-07-25 11:02:44 (INFO):

2018-07-25 11:02:44 (DEBUG): Available local data: 2018-07-25 11:02:44 (DEBUG): from: 60000 minutes ago 2018-07-25 11:02:44 (DEBUG): to: 9 minutes ago 2018-07-25 11:02:44 (INFO): Usable local data available, trying to match with exchange data.. 2018-07-25 11:02:44 (DEBUG): Fetching exchange data since 24 minutes ago 2018-07-25 11:02:45 (DEBUG): Available exchange data: 2018-07-25 11:02:45 (DEBUG): from: 24 minutes ago 2018-07-25 11:02:45 (DEBUG): to: 0 minutes ago 2018-07-25 11:02:45 (DEBUG): Stitching datasets 2018-07-25 11:02:45 (INFO): Full history locally available. Seeding the trading method with all required historical candles. 2018-07-25 11:02:45 (DEBUG): Seeding with: 2018-07-25 11:02:45 (DEBUG): from: 60000 minutes ago 2018-07-25 11:02:45 (DEBUG): to: 25 minutes ago 2018-07-25 11:02:47 (INFO): Setting up: 2018-07-25 11:02:47 (INFO): Trader 2018-07-25 11:02:47 (INFO): Follows the advice and create real orders. 2018-07-25 11:02:47 (DEBUG): syncing private data 2018-07-25 11:02:47 (INFO):

/Users/macbookpro/gekko/exchange/portfolioManager.js:72 throw new errors.ExchangeError(err); ^ Error at Object. (/Users/macbookpro/gekko/exchange/exchangeErrors.js:9:27) at Module._compile (module.js:652:30) at Object.Module._extensions..js (module.js:663:10) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12) at Function.Module._load (module.js:497:3) at Module.require (module.js:596:17) at require (internal/module.js:11:18) at Object. (/Users/macbookpro/gekko/exchange/exchangeChecker.js:4:16) at Module._compile (module.js:652:30)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/askmike/gekko/issues/2392#issuecomment-409498213, or mute the thread https://github.com/notifications/unsubscribe-auth/AA7MD8HEFR6Jp4kKRv5nZd8mr00Aiwx8ks5uMWmVgaJpZM4VqBIx .

-- PGP key at keybase.io/mikevanrossum https://keybase.io/mikevanrossum/key.asc

Kwings commented 6 years ago

Ok i try to generte new API, Thank You

Kwings commented 6 years ago

It looks like new API fixed the problem. i allso added login info, but dont know if that was necessary or not.

askmike commented 6 years ago

:+1: