diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 000000000..6a5577e4d --- /dev/null +++ b/.prettierrc @@ -0,0 +1,4 @@ +{ + "trailingComma": "es5", + "singleQuote": true +} \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index b7ae263da..b92f2c940 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,3 @@ language: node_js node_js: - - "6.6.0" \ No newline at end of file + - "8.0.0" \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 9fca6f795..e4f79e9f9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:6.3 +FROM node:8 ENV HOST localhost ENV PORT 3000 @@ -7,12 +7,15 @@ ENV PORT 3000 RUN mkdir -p /usr/src/app WORKDIR /usr/src/app +# Install GYP dependencies globally, will be used to code build other dependencies +RUN npm install -g --production node-gyp && \ + npm cache clean --force + # Install app dependencies -COPY package.json /usr/src/app/ -RUN npm install -g node-gyp -RUN cd $(npm root -g)/npm && npm install fs-extra && sed -i -e s/graceful-fs/fs-extra/ -e s/fs.rename/fs.move/ ./lib/utils/rename.js -RUN npm install --production -RUN npm install redis@0.10.0 talib@1.0.2 pg@6.1.0 +COPY package.json /usr/src/app +RUN npm install --production && \ + npm install --production redis@0.10.0 talib@1.0.2 tulind@0.8.7 pg && \ + npm cache clean --force # Bundle app source COPY . /usr/src/app @@ -22,4 +25,4 @@ RUN chmod +x /usr/src/app/docker-entrypoint.sh ENTRYPOINT ["/usr/src/app/docker-entrypoint.sh"] -CMD [ "npm", "start" ] +CMD [ "npm", "start" ] \ No newline at end of file diff --git a/README.md b/README.md index bd62bfbbe..d9138abad 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ -Gordon Gekko -Gekko is a Bitcoin TA trading and backtesting platform that connects to popular Bitcoin exchanges. It is written in javascript and runs on [nodejs](http://nodejs.org). +Gekko is a Bitcoin TA trading and backtesting platform that connects to popular Bitcoin exchanges. It is written in JavaScript and runs on [Node.js](http://nodejs.org). *Use Gekko at your own risk.* diff --git a/config/strategies/tulip-multi-strat.toml b/config/strategies/tulip-multi-strat.toml new file mode 100644 index 000000000..3e8b549be --- /dev/null +++ b/config/strategies/tulip-multi-strat.toml @@ -0,0 +1,12 @@ +optInTimePeriod = 2 +optInFastPeriod = 4 +optInSlowPeriod = 7 +optInSignalPeriod = 23.707189677282354 + +candleSize = 1 +historySize = 4 + +up = 24.52 +down = 55.74 +macd_up = 14.498233170768081 +macd_down = -9.65220944122072 diff --git a/core/error.js b/core/error.js new file mode 100644 index 000000000..aafdec49c --- /dev/null +++ b/core/error.js @@ -0,0 +1,25 @@ +const _ = require('lodash'); + +let RetryError = function(message) { + _.bindAll(this); + + this.name = "RetryError"; + this.message = message; +} + +RetryError.prototype = new Error(); + +let AbortError = function(message) { + _.bindAll(this); + + this.name = "AbortError"; + this.message = message; +} + +AbortError.prototype = new Error(); + +module.exports = { + 'RetryError': RetryError, + 'AbortError': AbortError +}; + diff --git a/core/gekkoStream.js b/core/gekkoStream.js index 1ee77609d..e37e2483b 100644 --- a/core/gekkoStream.js +++ b/core/gekkoStream.js @@ -3,6 +3,7 @@ var Writable = require('stream').Writable; var _ = require('lodash'); +var async = require('async'); var util = require('./util'); var env = util.gekkoEnv(); @@ -39,13 +40,18 @@ Gekko.prototype.finalize = function() { } Gekko.prototype.shutdown = function() { - _.each(this.candleConsumers, function(c) { - if(c.finalize) - c.finalize(); - }); - - if(env === 'child-process') - process.exit(0); -} + async.eachSeries( + this.candleConsumers, + function(c, callback) { + if (c.finalize) c.finalize(callback); + else callback(); + }, + function() { + // If we are a child process, we signal to the parent to kill the child once it is done + // so that is has time to process all remaining events (and send report data) + if (env === 'child-process') process.send('done'); + } + ); +}; module.exports = Gekko; \ No newline at end of file diff --git a/core/markets/importer.js b/core/markets/importer.js index e9dd4b679..14df16ad1 100644 --- a/core/markets/importer.js +++ b/core/markets/importer.js @@ -100,7 +100,8 @@ Market.prototype.processTrades = function(trades) { if(this.done) { log.info('Done importing!'); - process.exit(0); + this.emit('end'); + return; } if(_.size(trades)) { diff --git a/core/stats.js b/core/stats.js index da633f942..5c314922d 100644 --- a/core/stats.js +++ b/core/stats.js @@ -11,7 +11,7 @@ const lodash = require('lodash'); // @param rfreturn (number - risk free return) // stats.sharpe = (returns, rfreturn) => { - return stats.mean(returns) - rfreturn / stats.stdev(returns); + return (stats.mean(returns) - rfreturn) / stats.stdev(returns); } -module.exports = stats; \ No newline at end of file +module.exports = stats; diff --git a/core/talib.js b/core/talib.js index a3d7b31cc..fdad18459 100644 --- a/core/talib.js +++ b/core/talib.js @@ -1,7 +1,15 @@ -var talib = require("talib"); var semver = require("semver"); var _ = require('lodash'); +// validate that talib is installed, if not we'll throw an excepion which will +// prevent further loading or out outside this module +try { + var talib = require("talib"); +} catch (e) { + module.exports = null; + return; +} + var talibError = 'Gekko was unable to configure talib indicator:\n\t'; var talibGTEv103 = semver.gte(talib.version, '1.0.3'); diff --git a/core/tulind.js b/core/tulind.js index dfdfa7718..a26e8d013 100644 --- a/core/tulind.js +++ b/core/tulind.js @@ -1,7 +1,15 @@ -var tulind = require("tulind"); var semver = require("semver"); var _ = require('lodash'); +// validate that talib is installed, if not we'll throw an excepion which will +// prevent further loading or out outside this module +try { + var tulind = require("tulind"); +} catch (e) { + module.exports = null; + return; +} + var tulindError = 'Gekko was unable to configure Tulip Indicators:\n\t'; // Wrapper that executes a tulip indicator @@ -137,7 +145,7 @@ methods.aroon = { methods.aroonosc = { requires: ['optInTimePeriod'], create: (params) => { - verifyParams('arronosc', params); + verifyParams('aroonosc', params); return (data, callback) => execute(callback, { indicator: tulind.indicators.aroonosc, diff --git a/core/util.js b/core/util.js index b34ae2505..0c92ae1ac 100644 --- a/core/util.js +++ b/core/util.js @@ -5,6 +5,7 @@ var fs = require('fs'); var semver = require('semver'); var program = require('commander'); var retry = require('retry'); +var Errors = require('./error'); var startTime = moment(); @@ -16,6 +17,19 @@ var _gekkoEnv = false; var _args = false; +var retryHelper = function(fn, options, callback) { + var operation = retry.operation(options); + operation.attempt(function(currentAttempt) { + fn(function(err, result) { + if (!(err instanceof Errors.AbortError) && operation.retry(err)) { + return; + } + + callback(err ? err.message : null, result); + }); + }); +} + // helper functions var util = { getConfig: function() { @@ -163,23 +177,18 @@ var util = { return startTime; }, retry: function(fn, callback) { - var operation = retry.operation({ + var operation = { retries: 5, factor: 1.2, minTimeout: 1 * 1000, maxTimeout: 3 * 1000 - }); + }; - operation.attempt(function(currentAttempt) { - fn(function(err, result) { - if (operation.retry(err)) { - return; - } - - callback(err ? operation.mainError() : null, result); - }); - }); - } + retryHelper(fn, options, callback); + }, + retryCustom: function(options, fn, callback) { + retryHelper(fn, options, callback); + }, } // NOTE: those options are only used diff --git a/core/workers/pipeline/child.js b/core/workers/pipeline/child.js index 049d75571..2eb12bf6c 100644 --- a/core/workers/pipeline/child.js +++ b/core/workers/pipeline/child.js @@ -44,4 +44,12 @@ process.send('ready'); process.on('message', function(m) { if(m.what === 'start') start(m.mode, m.config); -}); \ No newline at end of file + + if(m.what === 'exit') + process.exit(0); +}); + +process.on('disconnect', function() { + console.log("disconnect"); + process.exit(-1); +}) \ No newline at end of file diff --git a/core/workers/pipeline/parent.js b/core/workers/pipeline/parent.js index 9ca72d316..fd5cd2d79 100644 --- a/core/workers/pipeline/parent.js +++ b/core/workers/pipeline/parent.js @@ -18,6 +18,9 @@ module.exports = (mode, config, callback) => { if(m === 'ready') return child.send(message); + if(m === 'done') + return child.send({what: 'exit'}); + handle.message(m); }); diff --git a/docs/installation/installing_gekko_on_windows_with_bash_on_windows_10.md b/docs/installation/installing_gekko_on_windows_with_bash_on_windows_10.md index 15a5193f5..dafbee0c5 100644 --- a/docs/installation/installing_gekko_on_windows_with_bash_on_windows_10.md +++ b/docs/installation/installing_gekko_on_windows_with_bash_on_windows_10.md @@ -68,23 +68,6 @@ cd gekko npm install --only=production ``` -## Edit the handle.js file (taken from [here](https://github.com/askmike/gekko/issues/708#issuecomment-296329300)) - -Navigate to gekko/plugins/sqlite: - -`cd ~/gekko/plugins/sqlite` - -Change line 53 in handle.js from - -`db.run("PRAGMA journal_mode = WAL"); ` - -to - -`db.run("PRAGMA journal_mode = DEL"); ` - -(I use nano for this --> `nano handle.js`) - - ## Restart Bash and install the correct version of TA-lib (taken from [here](https://github.com/askmike/gekko/issues/908#issuecomment-319657408)) Restart Bash by closing it and reopening it. Then: diff --git a/docs/introduction/about_gekko.md b/docs/introduction/about_gekko.md index dbe5ea6c0..d2dda2cdb 100644 --- a/docs/introduction/about_gekko.md +++ b/docs/introduction/about_gekko.md @@ -12,7 +12,7 @@ Gekko is a tool that makes it very easy to automate your own trading stragies. ![gist of gekko](https://gekko.wizb.it/_static/gekko-gist.png) -You can either create your own trading strategy or start with the build in example strategies. Once you have a strategy you can use Gekko to automatically run it in a few different ways: +You can either create your own trading strategy or start with the built-in example strategies. Once you have a strategy you can use Gekko to automatically run it in a few different ways: - **Backtest**: You can start a simulation of the strategy over a historical data period and Gekko will tell you what would have happened (which trades would have been performed as well as overall performance and risk metrics). - **Paper trader**: You can run the strategy in realtime simulate trading (trade with fake money) to see in realtime how profitable your strategy would have been. diff --git a/docs/introduction/supported_exchanges.md b/docs/introduction/supported_exchanges.md index 7d52565f6..f4586d279 100644 --- a/docs/introduction/supported_exchanges.md +++ b/docs/introduction/supported_exchanges.md @@ -27,7 +27,9 @@ Gekko is able to directly communicate with the APIs of a number of exchanges. Ho | [zaif][17] | ✓ | ✕ | ✕ | | | [lakeBTC][18] | ✓ | ✕ | ✕ | | | [bx.in.th][19] | ✓ | ✕ | ✕ | | -| [bitcoin.co.id][22] | ✓ | ✓ | ✕ | | | +| [bitcoin.co.id][22] | ✓ | ✓ | ✕ | | +| [Quadriga CX][23] | ✓ | ✓ | ✕ | | +| [Binance][24] | ✓ | ✓ | ✓ | | | [1]: ../features/backtesting.md [2]: https://poloniex.com @@ -51,4 +53,6 @@ Gekko is able to directly communicate with the APIs of a number of exchanges. Ho [20]: https://github.com/askmike/gekko/pull/352 [21]: https://github.com/askmike/gekko/issues/288#issuecomment-223810974 [22]: https://vip.bitcoin.co.id/ +[23]: https://quadrigacx.com/ +[24]: https://binance.com/ diff --git a/exchanges/binance.js b/exchanges/binance.js new file mode 100644 index 000000000..73c4dd3f6 --- /dev/null +++ b/exchanges/binance.js @@ -0,0 +1,569 @@ +const moment = require('moment'); +const util = require('../core/util'); +const _ = require('lodash'); +const log = require('../core/log'); + +const Binance = require('binance'); + +var Trader = function(config) { + _.bindAll(this); + + if (_.isObject(config)) { + this.key = config.key; + this.secret = config.secret; + this.currency = config.currency.toUpperCase(); + this.asset = config.asset.toUpperCase(); + } + + this.pair = this.asset + this.currency; + this.name = 'binance'; + + this.binance = new Binance.BinanceRest({ + key: this.key, + secret: this.secret, + timeout: 15000, + recvWindow: 60000, // suggested by binance + disableBeautification: false, // better field names + }); +}; + +var recoverableErrors = new RegExp( + /(SOCKETTIMEDOUT|TIMEDOUT|CONNRESET|CONNREFUSED|NOTFOUND|API:Invalid nonce|between Cloudflare and the origin web server)/ +); + +Trader.prototype.retry = function(method, args, error) { + if (!error || !error.message.match(recoverableErrors)) { + log.error('[binance.js] ', this.name, 'returned an irrecoverable error'); + return; + } + + var wait = +moment.duration(5, 'seconds'); + log.debug( + '[binance.js] (retry) ', + this.name, + 'returned an error, retrying..' + ); + + var self = this; + + // make sure the callback (and any other fn) + // is bound to Trader + _.each(args, function(arg, i) { + if (_.isFunction(arg)) args[i] = _.bind(arg, self); + }); + + // run the failed method again with the same + // arguments after wait + setTimeout(function() { + method.apply(self, args); + }, wait); +}; + +Trader.prototype.getTrades = function(since, callback, descending) { + var args = _.toArray(arguments); + + var process = function(err, data) { + if (!err && !_.isEmpty(data.msg)) err = new Error(data.msg); + + if (err) { + log.error('[binance.js] error getting trades', err); + return this.retry(this.getTrades, args, err); + } + + var parsedTrades = []; + _.each( + data, + function(trade) { + parsedTrades.push({ + tid: trade.aggTradeId, + date: moment(trade.timestamp).unix(), + price: parseFloat(trade.price), + amount: parseFloat(trade.quantity), + }); + }, + this + ); + + if (descending) callback(null, parsedTrades.reverse()); + else callback(null, parsedTrades); + }; + + var reqData = { + symbol: this.pair, + }; + + if (since) { + var endTs = moment(since) + .add(1, 'd') + .valueOf(); + var nowTs = moment().valueOf(); + + reqData.startTime = moment(since).valueOf(); + reqData.endTime = endTs > nowTs ? nowTs : endTs; + } + + this.binance.aggTrades(reqData, _.bind(process, this)); +}; + +Trader.prototype.getPortfolio = function(callback) { + var args = _.toArray(arguments); + var setBalance = function(err, data) { + log.debug( + '[binance.js] entering "setBalance" callback after api call, err:', + err, + ' data:', + data + ); + + if (!err && !_.isEmpty(data.msg)) err = new Error(data.msg); + + if (err) { + log.error('[binance.js] ', err); + return this.retry(this.getPortfolio, args, err); + } + + var findAsset = function(item) { + return item.asset === this.asset; + } + var assetAmount = parseFloat(_.find(data.balances, _.bind(findAsset, this)).free); + + var findCurrency = function(item) { + return item.asset === this.currency; + } + var currencyAmount = parseFloat(_.find(data.balances, _.bind(findCurrency, this)).free); + + if (!_.isNumber(assetAmount) || _.isNaN(assetAmount)) { + log.error( + `Binance did not return portfolio for ${this.asset}, assuming 0.` + ); + assetAmount = 0; + } + + if (!_.isNumber(currencyAmount) || _.isNaN(currencyAmount)) { + log.error( + `Binance did not return portfolio for ${this.currency}, assuming 0.` + ); + currencyAmount = 0; + } + + var portfolio = [ + { name: this.asset, amount: assetAmount }, + { name: this.currency, amount: currencyAmount }, + ]; + + return callback(err.message, portfolio); + }; + + this.binance.account({}, _.bind(setBalance, this)); +}; + +// This uses the base maker fee (0.1%), and does not account for BNB discounts +Trader.prototype.getFee = function(callback) { + var makerFee = 0.1; + callback(false, makerFee / 100); +}; + +Trader.prototype.getTicker = function(callback) { + var setTicker = function(err, data) { + log.debug( + '[binance.js] entering "getTicker" callback after api call, err:', + err, + ' data:', + data + ); + + if (!err && !_.isEmpty(data.msg)) err = new Error(data.msg); + + if (err) + return log.error( + '[binance.js] unable to get ticker', + JSON.stringify(err) + ); + + var findSymbol = function(ticker) { + return ticker.symbol === this.pair; + } + var result = _.find(data, _.bind(findSymbol, this)); + + var ticker = { + ask: parseFloat(result.askPrice), + bid: parseFloat(result.bidPrice), + }; + + callback(err.message, ticker); + }; + + // Not exposed by the API yet, have to do it the hard way + this.binance._makeRequest( + {}, + _.bind(setTicker, this), + 'ticker/allBookTickers' + ); +}; + +// Effectively counts the number of decimal places, so 0.001 or 0.234 results in 3 +Trader.prototype.getPrecision = function(tickSize) { + if (!isFinite(tickSize)) return 0; + var e = 1, p = 0; + while (Math.round(tickSize * e) / e !== tickSize) { e *= 10; p++; } + return p; +}; + +Trader.prototype.roundAmount = function(amount, tickSize) { + var precision = 100000000; + var t = this.getPrecision(tickSize); + + if(Number.isInteger(t)) + precision = Math.pow(10, t); + + amount *= precision; + amount = Math.floor(amount); + amount /= precision; + return amount; +}; + +Trader.prototype.addOrder = function(tradeType, amount, price, callback) { + var args = _.toArray(arguments); + + var findMarket = function(market) { + return market.pair[0] === this.currency && market.pair[1] === this.asset + } + var market = _.find(Trader.getCapabilities().markets, _.bind(findMarket, this)); + amount = Math.max(this.roundAmount(amount, market.minimalOrder.amount), market.minimalOrder.amount); + price = Math.max(this.roundAmount(price, market.precision), market.precision); + + log.debug( + '[binance.js] (addOrder)', + tradeType.toUpperCase(), + amount, + this.asset, + '@', + price, + this.currency + ); + + var setOrder = function(err, data) { + log.debug( + '[binance.js] entering "setOrder" callback after api call, err:', + err, + ' data:', + data + ); + + if (!err && !_.isEmpty(data.msg)) err = new Error(data.msg); + + if (err) { + log.error('[binance.js] unable to ' + tradeType.toLowerCase(), err); + return this.retry(this.addOrder, args, err); + } + + var txid = data.orderId; + log.debug('added order with txid:', txid); + + callback(undefined, txid); + }; + + this.binance.newOrder( + { + symbol: this.pair, + side: tradeType.toUpperCase(), + type: 'LIMIT', + timeInForce: 'GTC', // Good to cancel (I think, not really covered in docs, but is default) + quantity: amount, + price: price, + timestamp: new Date().getTime() + }, + _.bind(setOrder, this) + ); +}; + +Trader.prototype.getOrder = function(order, callback) { + var get = function(err, data) { + log.debug( + '[binance.js] entering "getOrder" callback after api call, err:', + err, + ' data:', + data + ); + + if (!err && !_.isEmpty(data.msg)) err = new Error(data.msg); + + if (err) + return log.error( + '[binance.js] unable to get order', + order, + JSON.stringify(err) + ); + + var price = parseFloat(data.price); + var amount = parseFloat(data.executedQty); + var date = moment.unix(data.time); + + callback(undefined, { price, amount, date }); + }.bind(this); + + this.binance.queryOrder( + { + symbol: this.pair, + orderId: order, + }, + get + ); +}; + +Trader.prototype.buy = function(amount, price, callback) { + this.addOrder('buy', amount, price, callback); +}; + +Trader.prototype.sell = function(amount, price, callback) { + this.addOrder('sell', amount, price, callback); +}; + +Trader.prototype.checkOrder = function(order, callback) { + var check = function(err, data) { + log.debug( + '[binance.js] entering "checkOrder" callback after api call, err:', + err, + ' data:', + data + ); + + if (!err && !_.isEmpty(data.msg)) err = new Error(data.msg); + + if (err) + return log.error( + '[binance.js] Unable to check order', + order, + JSON.stringify(err) + ); + + var stillThere = + data.status === 'NEW' || data.status === 'PARTIALLY_FILLED'; + callback(err.message, !stillThere); + }; + + this.binance.queryOrder( + { + symbol: this.pair, + orderId: order, + }, + _.bind(check, this) + ); +}; + +Trader.prototype.cancelOrder = function(order, callback) { + var args = _.toArray(arguments); + var cancel = function(err, data) { + log.debug( + '[binance.js] entering "cancelOrder" callback after api call, err:', + err, + ' data:', + data + ); + + if (!err && !_.isEmpty(data.msg)) err = new Error(data.msg); + + if (err) { + log.error( + '[binance.js] unable to cancel order', + order, + '(', + err, + JSON.stringify(err), + ')' + ); + return this.retry(this.cancelOrder, args, err); + } + + callback(); + }; + + this.binance.cancelOrder( + { + symbol: this.pair, + orderId: order, + }, + _.bind(cancel, this) + ); +}; + +Trader.getCapabilities = function() { + return { + name: 'Binance', + slug: 'binance', + currencies: ['BTC', 'BNB', 'ETH', 'USDT'], + assets: [ + 'BTC', + 'BCC', + 'BCG', + 'BNB', + 'DASH', + 'ETH', + 'ETC', + 'EOS', + 'NEO', + 'OMG', + 'POWR', + 'QTUM', + 'ZEC', + ], + markets: [ + // https://www.binance.com/exchange/public/product + + //Tradeable againt BTC + { + pair: ['BTC', 'BCC'], + minimalOrder: { amount: 0.001, unit: 'asset' }, + precision: 0.000001, + }, + { + pair: ['BTC', 'BNB'], + minimalOrder: { amount: 1, unit: 'asset' }, + precision: 0.00000001, + }, + { + pair: ['BTC', 'DASH'], + minimalOrder: { amount: 0.001, unit: 'asset' }, + precision: 0.000001, + }, + { + pair: ['BTC', 'ETH'], + minimalOrder: { amount: 0.001, unit: 'asset' }, + precision: 0.000001, + }, + { + pair: ['BTC', 'ETC'], + minimalOrder: { amount: 0.01, unit: 'asset' }, + precision: 0.000001, + }, + { + pair: ['BTC', 'EOS'], + minimalOrder: { amount: 1.0, unit: 'asset' }, + precision: 0.00000001, + }, + { + pair: ['BTC', 'NEO'], + minimalOrder: { amount: 0.01, unit: 'asset' }, + precision: 0.000001, + }, + { + pair: ['BTC', 'OMG'], + minimalOrder: { amount: 0.01, unit: 'asset' }, + precision: 0.000001, + }, + { + pair: ['BTC', 'POWR'], + minimalOrder: { amount: 0.01, unit: 'asset' }, + precision: 0.00000001, + }, + { + pair: ['BTC', 'QTUM'], + minimalOrder: { amount: 0.01, unit: 'asset' }, + precision: 0.000001, + }, + { + pair: ['BTC', 'ZEC'], + minimalOrder: { amount: 0.001, unit: 'asset' }, + precision: 0.000001, + }, + + //Tradeable againt BNB + { + pair: ['BNB', 'BCC'], + minimalOrder: { amount: 0.00001, unit: 'asset' }, + precision: 0.01, + }, + { + pair: ['BNB', 'NEO'], + minimalOrder: { amount: 0.001, unit: 'asset' }, + precision: 0.001, + }, + + //Tradeable againt ETH + { + pair: ['ETH', 'BCC'], + minimalOrder: { amount: 0.001, unit: 'asset' }, + precision: 0.00001, + }, + { + pair: ['ETH', 'BNB'], + minimalOrder: { amount: 1.0, unit: 'asset' }, + precision: 0.00000001, + }, + { + pair: ['ETH', 'DASH'], + minimalOrder: { amount: 0.001, unit: 'asset' }, + precision: 0.00001, + }, + { + pair: ['ETH', 'ETC'], + minimalOrder: { amount: 0.01, unit: 'asset' }, + precision: 0.000001, + }, + { + pair: ['ETH', 'EOS'], + minimalOrder: { amount: 0.01, unit: 'asset' }, + precision: 0.000001, + }, + { + pair: ['ETH', 'NEO'], + minimalOrder: { amount: 0.01, unit: 'asset' }, + precision: 0.000001, + }, + { + pair: ['ETH', 'OMG'], + minimalOrder: { amount: 0.01, unit: 'asset' }, + precision: 0.000001, + }, + { + pair: ['ETH', 'POWR'], + minimalOrder: { amount: 1, unit: 'asset' }, + precision: 0.00000001, + }, + { + pair: ['ETH', 'QTUM'], + minimalOrder: { amount: 0.01, unit: 'asset' }, + precision: 0.000001, + }, + { + pair: ['ETH', 'ZEC'], + minimalOrder: { amount: 0.001, unit: 'asset' }, + precision: 00001, + }, + + //Tradeable againt USDT + { + pair: ['USDT', 'BTC'], + minimalOrder: { amount: 0.000001, unit: 'asset' }, + precision: 0.01, + }, + { + pair: ['USDT', 'BCC'], + minimalOrder: { amount: 0.00001, unit: 'asset' }, + precision: 0.01, + }, + { + pair: ['USDT', 'BNB'], + minimalOrder: { amount: 0.01, unit: 'asset' }, + precision: 0.01, + }, + { + pair: ['USDT', 'ETH'], + minimalOrder: { amount: 0.00001, unit: 'asset' }, + precision: 0.01, + }, + { + pair: ['USDT', 'NEO'], + minimalOrder: { amount: 0.001, unit: 'asset' }, + precision: 0.01, + }, + ], + requires: ['key', 'secret'], + providesHistory: 'date', + providesFullHistory: true, + tid: 'tid', + tradable: true, + }; +}; + +module.exports = Trader; diff --git a/exchanges/gdax.js b/exchanges/gdax.js index e9198d188..295eca099 100644 --- a/exchanges/gdax.js +++ b/exchanges/gdax.js @@ -226,6 +226,9 @@ Trader.prototype.getTrades = function(since, callback, descending) { var lastScan = 0; var process = function(err, response, data) { + if (data && data.message) + err = new Error(data.message); + if(err) return this.retry(this.getTrades, args); diff --git a/exchanges/kraken.js b/exchanges/kraken.js index 7d85fb5b1..eff3feb25 100644 --- a/exchanges/kraken.js +++ b/exchanges/kraken.js @@ -1,7 +1,9 @@ var Kraken = require('kraken-api-es5'); var moment = require('moment'); -var util = require('../core/util'); var _ = require('lodash'); + +var util = require('../core/util'); +var Errors = require('../core/error'); var log = require('../core/log'); var crypto_currencies = [ @@ -21,7 +23,7 @@ var crypto_currencies = [ "XMR", "XRP", "ZEC", - "BCH", + "BCH" ]; var fiat_currencies = [ @@ -37,6 +39,7 @@ var assets_without_prefix = [ 'DASH', 'EOS', 'GNO', + 'USDT' ] // Method to check if asset/currency is a crypto currency @@ -63,6 +66,9 @@ var addPrefix = function(value) { // Some currencies in Kraken don't use the prefix, not clearly documented var getAssetPair = function(asset, currency) { + if (asset === 'USDT') + return 'USDTZUSD'; // Yet another kraken inconsistency + if (_.contains(assets_without_prefix, asset)) return asset + currency; else @@ -90,44 +96,53 @@ var Trader = function(config) { ); } -var recoverableErrors = new RegExp(/(SOCKETTIMEDOUT|TIMEDOUT|CONNRESET|CONNREFUSED|NOTFOUND|API:Invalid nonce|between Cloudflare and the origin web server)/) +var retryCritical = { + retries: 10, + factor: 1.2, + minTimeout: 1 * 1000, + maxTimeout: 30 * 1000 +}; -Trader.prototype.retry = function(method, args, error) { - if (!error || !error.message.match(recoverableErrors)) { - log.error('[kraken.js] ', this.name, 'returned an irrecoverable error'); - return; +var retryForever = { + forever: true, + factor: 1.2, + minTimeout: 10, + maxTimeout: 30 +}; + +var recoverableErrors = new RegExp(/(SOCKETTIMEDOUT|TIMEDOUT|CONNRESET|CONNREFUSED|NOTFOUND|API:Invalid nonce|Service:Unavailable|Request timed out|Response code 520|Response code 504|Response code 502)/) + +Trader.prototype.processError = function(funcName, error) { + if (!error) return undefined; + + if (!error.message.match(recoverableErrors)) { + log.error(`[kraken.js] (${funcName}) returned an irrecoverable error: ${error.message}`); + return new Errors.AbortError('[kraken.js] ' + error.message); } - // 5 -> 10s to avoid more rejection - var wait = +moment.duration(10, 'seconds'); - log.debug('[kraken.js] (retry) ', this.name, 'returned an error, retrying..'); + log.debug(`[kraken.js] (${funcName}) returned an error, retrying: ${error.message}`); + return new Errors.RetryError('[kraken.js] ' + error.message); +}; - var self = this; +Trader.prototype.handleResponse = function(funcName, callback) { + return (error, body) => { + if(!error) { + if(_.isEmpty(body) || !body.result) + error = new Error('NO DATA WAS RETURNED'); - // make sure the callback (and any other fn) - // is bound to Trader - _.each(args, function(arg, i) { - if(_.isFunction(arg)) - args[i] = _.bind(arg, self); - }); + else if(!_.isEmpty(body.error)) + error = new Error(body.error); + } - // run the failed method again with the same - // arguments after wait - setTimeout( - function() { method.apply(self, args) }, - wait - ); + return callback(this.processError(funcName, error), body); + } }; Trader.prototype.getTrades = function(since, callback, descending) { - var args = _.toArray(arguments); var startTs = since ? moment(since).valueOf() : null; - var process = function(err, trades) { - if (err || !trades || trades.length === 0) { - log.error('error getting trades', err); - return this.retry(this.getTrades, args, err); - } + var processResults = function(err, trades) { + if (err) return callback(err); var parsedTrades = []; _.each(trades.result[this.pair], function(trade) { @@ -143,12 +158,12 @@ Trader.prototype.getTrades = function(since, callback, descending) { }, this); if(descending) - callback(null, parsedTrades.reverse()); + callback(undefined, parsedTrades.reverse()); else - callback(null, parsedTrades); + callback(undefined, parsedTrades); }; - var reqData = { + let reqData = { pair: this.pair }; @@ -157,24 +172,16 @@ Trader.prototype.getTrades = function(since, callback, descending) { reqData.since = startTs * 1000000; } - this.kraken.api('Trades', reqData, _.bind(process, this)); + let handler = (cb) => this.kraken.api('Trades', reqData, this.handleResponse('getTrades', cb)); + util.retryCustom(retryForever, _.bind(handler, this), _.bind(processResults, this)); }; Trader.prototype.getPortfolio = function(callback) { - var args = _.toArray(arguments); + console.log('getPortfolio'); var setBalance = function(err, data) { - log.debug('[kraken.js] entering "setBalance" callback after kraken-api call, err:', err, ' data:' , data); - - if(_.isEmpty(data)) - err = new Error('no data (getPortfolio)'); - - else if(!_.isEmpty(data.error)) - err = new Error(data.error); - - if (err || !data.result) { - log.error('[kraken.js] ' , err); - return this.retry(this.getPortfolio, args, err); - } + console.log('aa', arguments); + if(err) return callback(err); + log.debug('[kraken.js] entering "setBalance" callback after kraken-api call, data:' , data); // When using the prefix-less assets, you remove the prefix from the assset but leave // it on the curreny in this case. An undocumented Kraken quirk. @@ -197,41 +204,37 @@ Trader.prototype.getPortfolio = function(callback) { { name: this.currency, amount: currencyAmount } ]; - return callback(err.message, portfolio); + return callback(undefined, portfolio); }; - this.kraken.api('Balance', {}, _.bind(setBalance, this)); + let handler = (cb) => this.kraken.api('Balance', {}, this.handleResponse('getPortfolio', cb)); + util.retryCustom(retryForever, _.bind(handler, this), _.bind(setBalance, this)); }; // This assumes that only limit orders are being placed with standard assets pairs // It does not take into account volume discounts. // Base maker fee is 0.16%, taker fee is 0.26%. Trader.prototype.getFee = function(callback) { - var makerFee = 0.16; - callback(false, makerFee / 100); + const makerFee = 0.16; + callback(undefined, makerFee / 100); }; Trader.prototype.getTicker = function(callback) { var setTicker = function(err, data) { - - if(!err && _.isEmpty(data)) - err = new Error('no data (getTicker)'); - - else if(!err && !_.isEmpty(data.error)) - err = new Error(data.error); - - if (err) - return log.error('unable to get ticker', JSON.stringify(err)); + if (err) return callback(err); var result = data.result[this.pair]; var ticker = { ask: result.a[0], bid: result.b[0] }; - callback(err.message, ticker); + callback(undefined, ticker); }; - this.kraken.api('Ticker', {pair: this.pair}, _.bind(setTicker, this)); + let reqData = {pair: this.pair} + + let handler = (cb) => this.kraken.api('Ticker', reqData, this.handleResponse('getTicker', cb)); + util.retryCustom(retryForever, _.bind(handler, this), _.bind(setTicker, this)); }; Trader.prototype.roundAmount = function(amount) { @@ -253,63 +256,47 @@ Trader.prototype.roundAmount = function(amount) { }; Trader.prototype.addOrder = function(tradeType, amount, price, callback) { - var args = _.toArray(arguments); - amount = this.roundAmount(amount); price = this.roundAmount(price); // but the link talks about rounding price... And I had the bug log.debug('[kraken.js] (addOrder)', tradeType.toUpperCase(), amount, this.asset, '@', price, this.currency); var setOrder = function(err, data) { - - // console.log('blap', err, data); - - if(!err && _.isEmpty(data)) - err = new Error('no data (addOrder)'); - else if(!err && !_.isEmpty(data.error)) - err = new Error(data.error); - - if(err) { - log.error('unable to ' + tradeType.toLowerCase(), err); - return this.retry(this.addOrder, args, err); - } - + if(err) return callback(err); + var txid = data.result.txid[0]; - log.debug('added order with txid:', txid); + log.debug('[kraken.js] (addOrder) added order with txid:', txid); callback(undefined, txid); }; - this.kraken.api('AddOrder', { + let reqData = { pair: this.pair, type: tradeType.toLowerCase(), ordertype: 'limit', price: price, volume: amount.toString() - }, _.bind(setOrder, this)); + }; + + let handler = (cb) => this.kraken.api('AddOrder', reqData, this.handleResponse('addOrder', cb)); + util.retryCustom(retryCritical, _.bind(handler, this), _.bind(setOrder, this)); }; Trader.prototype.getOrder = function(order, callback) { - - var get = function(err, data) { - if(!err && _.isEmpty(data) && _.isEmpty(data.result)) - err = new Error('no data (getOrder)'); - - else if(!err && !_.isEmpty(data.error)) - err = new Error(data.error); - - if(err) - return log.error('Unable to get order', order, JSON.stringify(err)); + var getOrder = function(err, data) { + if(err) return callback(err); var price = parseFloat( data.result[ order ].price ); var amount = parseFloat( data.result[ order ].vol_exec ); var date = moment.unix( data.result[ order ].closetm ); callback(undefined, {price, amount, date}); - }.bind(this); + }; - this.kraken.api('QueryOrders', {txid: order}, get); + let reqData = {txid: order}; + let handler = (cb) => this.kraken.api('QueryOrders', reqData, this.handleResponse('getOrder', cb)); + util.retryCustom(retryCritical, _.bind(handler, this), _.bind(getOrder, this)); } Trader.prototype.buy = function(amount, price, callback) { @@ -322,40 +309,22 @@ Trader.prototype.sell = function(amount, price, callback) { Trader.prototype.checkOrder = function(order, callback) { var check = function(err, data) { - if(_.isEmpty(data)) - err = new Error('no data (checkOrder)'); - - if(!_.isEmpty(data.error)) - err = new Error(data.error); - - if(err) - return log.error('Unable to check order', order, JSON.stringify(err)); + if(err) return callback(err); var result = data.result[order]; var stillThere = result.status === 'open' || result.status === 'pending'; - callback(err.message, !stillThere); + callback(undefined, !stillThere); }; - this.kraken.api('QueryOrders', {txid: order}, _.bind(check, this)); + let reqData = {txid: order}; + let handler = (cb) => this.kraken.api('QueryOrders', reqData, this.handleResponse('checkOrder', cb)); + util.retryCustom(retryCritical, _.bind(handler, this), _.bind(check, this)); }; Trader.prototype.cancelOrder = function(order, callback) { - var args = _.toArray(arguments); - var cancel = function(err, data) { - if(!err && _.isEmpty(data)) - err = new Error('no data (cancelOrder)'); - else if(!err && !_.isEmpty(data.error)) - err = new Error(data.error); - - if(err) { - log.error('unable to cancel order', order, '(', err, JSON.stringify(err), ')'); - return this.retry(this.cancelOrder, args, err); - } - - callback(); - }; - - this.kraken.api('CancelOrder', {txid: order}, _.bind(cancel, this)); + let reqData = {txid: order}; + let handler = (cb) => this.kraken.api('CancelOrder', reqData, this.handleResponse('cancelOrder', cb)); + util.retryCustom(retryForever, _.bind(handler, this), callback); }; Trader.getCapabilities = function () { @@ -363,7 +332,7 @@ Trader.getCapabilities = function () { name: 'Kraken', slug: 'kraken', currencies: ['CAD', 'EUR', 'GBP', 'JPY', 'USD', 'XBT', 'ETH'], - assets: ['XBT', 'LTC', 'GNO', 'ICN', 'MLN', 'REP', 'XDG', 'XLM', 'XMR', 'XRP', 'ZEC', 'ETH', 'BCH', 'DASH', 'EOS', 'ETC'], + assets: ['XBT', 'LTC', 'GNO', 'ICN', 'MLN', 'REP', 'XDG', 'XLM', 'XMR', 'XRP', 'ZEC', 'ETH', 'BCH', 'DASH', 'EOS', 'ETC', 'USDT'], markets: [ //Tradeable againt ETH { pair: ['XBT', 'ETH'], minimalOrder: { amount: 0.01, unit: 'asset' }, precision: 5 }, @@ -452,6 +421,9 @@ Trader.getCapabilities = function () { { pair: ['GBP', 'XBT'], minimalOrder: { amount: 0.01, unit: 'asset' } }, { pair: ['JPY', 'XBT'], minimalOrder: { amount: 1, unit: 'asset' }, precision: 0 }, { pair: ['USD', 'XBT'], minimalOrder: { amount: 0.1, unit: 'asset' }, precision: 1 }, + + //Tradeable against USDT + { pair: ['USD', 'USDT'], minimalOrder: { amount: 0.1, unit: 'asset' }, precision: 2 }, ], requires: ['key', 'secret'], providesHistory: 'date', diff --git a/exchanges/quadriga.js b/exchanges/quadriga.js new file mode 100644 index 000000000..22b05ac9a --- /dev/null +++ b/exchanges/quadriga.js @@ -0,0 +1,248 @@ +var QuadrigaCX = require('quadrigacx'); +var moment = require('moment'); +var util = require('../core/util'); +var _ = require('lodash'); +var log = require('../core/log'); + + +var Trader = function(config) { + _.bindAll(this); + + if(_.isObject(config)) { + this.key = config.key; + this.secret = config.secret; + this.clientId = config.username; + this.asset = config.asset.toLowerCase(); + this.currency = config.currency.toLowerCase(); + } + + this.pair = this.asset + '_' + this.currency; + this.name = 'quadriga'; + this.since = null; + + this.quadriga = new QuadrigaCX( + this.clientId ? this.clientId : "1", + this.key ? this.key : "", + this.secret ? this.secret : "", + ); +} + +Trader.prototype.retry = function(method, warn, args, error) { + var wait = +moment.duration(30, 'seconds'); + if (error.code === 200) { + log.debug(`${this.name}: API rate limit exceeded! unable to call ${method}, will retry in 2 minutes`) + wait = +moment.duration(120, 'seconds'); + } + else { + log.debug(JSON.stringify(error)); + log.debug(`${this.name}: ${warn}, will retry in 30 seconds`); + } + + var self = this; + + // make sure the callback (and any other fn) + // is bound to Trader + _.each(args, function(arg, i) { + if(_.isFunction(arg)) + args[i] = _.bind(arg, self); + }); + + // run the failed method again with the same + // arguments after wait + setTimeout( + function() { method.apply(self, args) }, + wait + ); +}; + +Trader.prototype.getTrades = function(since, callback, descending) { + var args = _.toArray(arguments); + var process = function(err, trades) { + if (trades && trades.error) return this.retry(this.getTrades, 'unable to get trades', args, trades.error); + if (err) return this.retry(this.getTrades, 'unable to get trades', args, err); + + var parsedTrades = []; + _.each(trades, function(trade) { + parsedTrades.push({ + tid: trade.tid, + date: trade.date, + price: parseFloat(trade.price), + amount: parseFloat(trade.amount) + }); + }, this); + + if(descending) + callback(null, parsedTrades); + else + callback(null, parsedTrades.reverse()); + }; + + var reqData = { + book: this.pair, + time: 'hour' + }; + + this.quadriga.api('transactions', reqData, _.bind(process, this)); +}; + +Trader.prototype.getPortfolio = function(callback) { + var args = _.toArray(arguments); + var set = function(err, data) { + + if (data && data.error) return this.retry(this.getPortfolio, 'unable to get balance', args, data.error); + if (err) return this.retry(this.getPortfolio, 'unable to get balance', args, err); + + var assetAmount = parseFloat( data[this.asset + '_available'] ); + var currencyAmount = parseFloat( data[this.currency + '_available'] ); + + if(!_.isNumber(assetAmount) || _.isNaN(assetAmount)) { + log.error(`Quadriga did not return balance for ${this.asset}, assuming 0.`); + assetAmount = 0; + } + + if(!_.isNumber(currencyAmount) || _.isNaN(currencyAmount)) { + log.error(`Quadriga did not return balance for ${this.currency}, assuming 0.`); + currencyAmount = 0; + } + + var portfolio = [ + { name: this.asset, amount: assetAmount }, + { name: this.currency, amount: currencyAmount } + ]; + callback(err, portfolio); + }; + + this.quadriga.api('balance', _.bind(set, this)); +}; + +Trader.prototype.getFee = function(callback) { + callback(false, 0.005); +}; + +Trader.prototype.getTicker = function(callback) { + var set = function(err, data) { + + if (data && data.error) return this.retry(this.getTicker, 'unable to get quote', args, data.error); + if (err) return this.retry(this.getTicker, 'unable to get quote', args, err); + + var ticker = { + ask: data.ask, + bid: data.bid + }; + callback(err, ticker); + }; + + this.quadriga.api('ticker', {book: this.pair}, _.bind(set, this)); +}; + +Trader.prototype.roundAmount = function(amount) { + var precision = 100000000; + var market = this.getCapabilities().markets.find(function(market){ return market.pair[0] === this.currency && market.pair[1] === this.asset }); + + if(Number.isInteger(market.precision)) + precision = 10 * market.precision; + + amount *= precision; + amount = Math.floor(amount); + amount /= precision; + return amount; +}; + +Trader.prototype.addOrder = function(tradeType, amount, price, callback) { + var args = _.toArray(arguments); + + amount = this.roundAmount(amount); + log.debug(tradeType.toUpperCase(), amount, this.asset, '@', price, this.currency); + + var set = function(err, data) { + + if (data && data.error) return this.retry(this.addOrder, 'unable to place order', args, data.error); + if (err) return this.retry(this.addOrder, 'unable to place order', args, err); + + var txid = data.id; + log.debug('added order with txid:', txid); + + callback(undefined, txid); + }; + + this.quadriga.api(tradeType, { + book: this.pair, + price: price, + amount: amount + }, _.bind(set, this)); +}; + + +Trader.prototype.getOrder = function(order, callback) { + + var get = function(err, data) { + if (data && data.error) return this.retry(this.getOrder, 'unable to get order', args, data.error); + if (err) return this.retry(this.getOrder, 'unable to get order', args, err); + + var price = parseFloat( data[0].price ); + var amount = parseFloat( data[0].amount ); + var date = (data[0].updated) ? moment.unix( data[0].updated ) : false; + + callback(undefined, {price, amount, date}); + }.bind(this); + + this.quadriga.api('lookup_oder', {id: order}, get); +} + +Trader.prototype.buy = function(amount, price, callback) { + this.addOrder('buy', amount, price, callback); +}; + +Trader.prototype.sell = function(amount, price, callback) { + this.addOrder('sell', amount, price, callback); +}; + +Trader.prototype.checkOrder = function(order, callback) { + var check = function(err, data) { + + if (data && data.error) return this.retry(this.checkOrder, 'unable to get order', args, data.error); + if (err) return this.retry(this.checkOrder, 'unable to get order', args, err); + + var result = data[0]; + var stillThere = result.status === 0 || result.status === 1; + callback(err, !stillThere); + }; + + this.quadriga.api('lookup_order', {id: order}, _.bind(check, this)); +}; + +Trader.prototype.cancelOrder = function(order, callback) { + var args = _.toArray(arguments); + var cancel = function(err, data) { + + if (data && data.error) return this.retry(this.cancelOrder, 'unable to cancel order', args, data.error); + if (err) return this.retry(this.cancelOrder, 'unable to cancel order', args, err); + + callback(); + }; + + this.quadriga.api('cancel_order', {id: order}, _.bind(cancel, this)); +}; + +Trader.getCapabilities = function () { + return { + name: 'Quadriga', + slug: 'quadriga', + currencies: ['CAD', 'USD', 'BTC'], + assets: ['BTC', 'ETH', 'LTC', 'BCH'], + markets: [ + { pair: ['BTC', 'ETH'], minimalOrder: { amount: 0.00001, unit: 'asset' }, precision: 8 }, + { pair: ['CAD', 'ETH'], minimalOrder: { amount: 0.00001, unit: 'asset' }, precision: 8 }, + { pair: ['USD', 'BTC'], minimalOrder: { amount: 0.00001, unit: 'asset' }, precision: 8 }, + { pair: ['CAD', 'BTC'], minimalOrder: { amount: 0.00001, unit: 'asset' }, precision: 8 }, + { pair: ['CAD', 'LTC'], minimalOrder: { amount: 0.00001, unit: 'asset' }, precision: 8 }, + { pair: ['CAD', 'BCH'], minimalOrder: { amount: 0.00001, unit: 'asset' }, precision: 8 }, + ], + requires: ['key', 'secret', 'username'], + providesHistory: false, + tid: 'tid', + tradable: true + }; +} + +module.exports = Trader; diff --git a/importers/exchanges/binance.js b/importers/exchanges/binance.js new file mode 100644 index 000000000..d449a4bd2 --- /dev/null +++ b/importers/exchanges/binance.js @@ -0,0 +1,52 @@ +const moment = require('moment'); +const util = require('../../core/util.js'); +const _ = require('lodash'); +const log = require('../../core/log'); + +var config = util.getConfig(); +var dirs = util.dirs(); + +var Fetcher = require(dirs.exchanges + 'binance'); + +util.makeEventEmitter(Fetcher); + +var end = false; +var done = false; +var from = false; + +var fetcher = new Fetcher(config.watch); + +var fetch = () => { + fetcher.import = true; + fetcher.getTrades(from, handleFetch); +}; + +var handleFetch = (unk, trades) => { + if (trades.length > 0) { + var last = moment.unix(_.last(trades).date).utc(); + var next = last.clone(); + } else { + var next = from.clone().add(1, 'd'); + log.debug('Import step returned no results, moving to the next 24h period'); + } + + if (from.add(1, 'd') >= end) { + fetcher.emit('done'); + + var endUnix = end.unix(); + trades = _.filter(trades, t => t.date <= endUnix); + } + + from = next.clone(); + fetcher.emit('trades', trades); +}; + +module.exports = function(daterange) { + from = daterange.from.clone().utc(); + end = daterange.to.clone().utc(); + + return { + bus: fetcher, + fetch: fetch, + }; +}; diff --git a/importers/exchanges/kraken.js b/importers/exchanges/kraken.js index a5f6a1fec..2ba20cbf7 100644 --- a/importers/exchanges/kraken.js +++ b/importers/exchanges/kraken.js @@ -1,8 +1,10 @@ var KrakenClient = require('kraken-api-es5') -var util = require('../../core/util.js'); var _ = require('lodash'); var moment = require('moment'); + +var util = require('../../core/util.js'); var log = require('../../core/log'); +var Errors = require('../../core/error.js') var config = util.getConfig(); diff --git a/package-lock.json b/package-lock.json index f55317166..e97882838 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "gekko", - "version": "0.5.8", + "version": "0.5.10", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -216,11 +216,219 @@ "tweetnacl": "0.14.5" } }, + "binance": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/binance/-/binance-1.0.2.tgz", + "integrity": "sha1-43FS03OP5tLpHLytDJEm+2AAQrE=", + "requires": { + "request": "2.81.0", + "underscore": "1.8.3", + "ws": "3.3.2" + }, + "dependencies": { + "ultron": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.0.tgz", + "integrity": "sha1-sHoualQagV/Go0zNRTO67DB8qGQ=" + }, + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + }, + "ws": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.2.tgz", + "integrity": "sha512-t+WGpsNxhMR4v6EClXS8r8km5ZljKJzyGhJf7goJz9k5Ye3+b5Bvno5rjqPuIBn5mnn5GBb7o8IrIWHxX1qOLQ==", + "requires": { + "async-limiter": "1.0.0", + "safe-buffer": "5.1.1", + "ultron": "1.1.0" + } + } + } + }, "bintrees": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/bintrees/-/bintrees-1.0.0.tgz", "integrity": "sha1-nqCaZnLBE0tejEMToT5HzKloxyA=" }, + "bitcoin-co-id": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/bitcoin-co-id/-/bitcoin-co-id-0.0.1.tgz", + "integrity": "sha1-w1kKGMt0+vQzk3fOnhtc+j2xRPk=", + "requires": { + "crypto": "1.0.1", + "querystring": "0.2.0", + "request": "2.83.0", + "underscore": "1.8.3", + "verror": "1.10.0" + }, + "dependencies": { + "ajv": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.4.0.tgz", + "integrity": "sha1-MtHPCNvIDEMvQm8S4QslEfa0ZHQ=", + "requires": { + "co": "4.6.0", + "fast-deep-equal": "1.0.0", + "fast-json-stable-stringify": "2.0.0", + "json-schema-traverse": "0.3.1" + } + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" + }, + "boom": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/boom/-/boom-4.3.1.tgz", + "integrity": "sha1-T4owBctKfjiJ90kDD9JbluAdLjE=", + "requires": { + "hoek": "4.2.0" + } + }, + "cryptiles": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-3.1.2.tgz", + "integrity": "sha1-qJ+7Ig9c4l7FboxKqKT9e1sNKf4=", + "requires": { + "boom": "5.2.0" + }, + "dependencies": { + "boom": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/boom/-/boom-5.2.0.tgz", + "integrity": "sha512-Z5BTk6ZRe4tXXQlkqftmsAUANpXmuwlsF5Oov8ThoMbQRzdGTA1ngYRW160GexgOgjsFOKJz0LYhoNi+2AMBUw==", + "requires": { + "hoek": "4.2.0" + } + } + } + }, + "crypto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/crypto/-/crypto-1.0.1.tgz", + "integrity": "sha512-VxBKmeNcqQdiUQUW2Tzq0t377b54N2bMtXO/qiLa+6eRRmmC4qT3D4OnTGoT/U6O9aklQ/jTwbOtRMTTY8G0Ig==" + }, + "form-data": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.1.tgz", + "integrity": "sha1-b7lPvXGIUwbXPRXMSX/kzE7NRL8=", + "requires": { + "asynckit": "0.4.0", + "combined-stream": "1.0.5", + "mime-types": "2.1.17" + } + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + }, + "har-validator": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", + "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", + "requires": { + "ajv": "5.4.0", + "har-schema": "2.0.0" + } + }, + "hawk": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz", + "integrity": "sha512-miowhl2+U7Qle4vdLqDdPt9m09K6yZhkLDTWGoUiUzrQCn+mHHSmfJgAyGaLRZbPmTqfFFjRV1QWCW0VWUJBbQ==", + "requires": { + "boom": "4.3.1", + "cryptiles": "3.1.2", + "hoek": "4.2.0", + "sntp": "2.1.0" + } + }, + "hoek": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.0.tgz", + "integrity": "sha512-v0XCLxICi9nPfYrS9RL8HbYnXi9obYAeLbSP00BmnZwCK9+Ih9WOjoZ8YoHCoav2csqn4FOz4Orldsy2dmDwmQ==" + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "requires": { + "assert-plus": "1.0.0", + "jsprim": "1.4.1", + "sshpk": "1.13.1" + } + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + }, + "qs": { + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", + "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==" + }, + "request": { + "version": "2.83.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.83.0.tgz", + "integrity": "sha512-lR3gD69osqm6EYLk9wB/G1W/laGWjzH90t1vEa2xuxHD5KUrSzp9pUSfTm+YC5Nxt2T8nMPEvKlhbQayU7bgFw==", + "requires": { + "aws-sign2": "0.7.0", + "aws4": "1.6.0", + "caseless": "0.12.0", + "combined-stream": "1.0.5", + "extend": "3.0.1", + "forever-agent": "0.6.1", + "form-data": "2.3.1", + "har-validator": "5.0.3", + "hawk": "6.0.2", + "http-signature": "1.2.0", + "is-typedarray": "1.0.0", + "isstream": "0.1.2", + "json-stringify-safe": "5.0.1", + "mime-types": "2.1.17", + "oauth-sign": "0.8.2", + "performance-now": "2.1.0", + "qs": "6.5.1", + "safe-buffer": "5.1.1", + "stringstream": "0.0.5", + "tough-cookie": "2.3.3", + "tunnel-agent": "0.6.0", + "uuid": "3.1.0" + } + }, + "sntp": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/sntp/-/sntp-2.1.0.tgz", + "integrity": "sha512-FL1b58BDrqS3A11lJ0zEdnJ3UOKqVxawAkF3k7F0CVN7VQ34aZrV+G8BZ1WC9ZL7NyrwsW0oviwsWDgRuVYtJg==", + "requires": { + "hoek": "4.2.0" + } + }, + "tough-cookie": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.3.tgz", + "integrity": "sha1-C2GKVWW23qkL80JdBNVe3EdadWE=", + "requires": { + "punycode": "1.4.1" + } + }, + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } + } + }, "bitexthai": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/bitexthai/-/bitexthai-0.1.0.tgz", @@ -747,6 +955,11 @@ "resolved": "https://registry.npmjs.org/co-read/-/co-read-0.0.1.tgz", "integrity": "sha1-+Bs+uKhmdf7FHj2IOn9WToc8k4k=" }, + "coffeescript": { + "version": "1.12.7", + "resolved": "https://registry.npmjs.org/coffeescript/-/coffeescript-1.12.7.tgz", + "integrity": "sha512-pLXHFxQMPklVoEekowk8b3erNynC+DVJzChxS/LCBBgR6/8AJkHivkm//zbowcfc7BTCAjryuhx6gPqPRfsFoA==" + }, "colors": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz", @@ -1055,6 +1268,11 @@ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz", "integrity": "sha1-liVqO8l1WV6zbYLpkp0GDYk0Of8=" }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + }, "fill-keys": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/fill-keys/-/fill-keys-1.0.2.tgz", @@ -1246,6 +1464,176 @@ "resolved": "https://registry.npmjs.org/gekko/-/gekko-0.0.9.tgz", "integrity": "sha1-Q8ot+bv+VC+lntagY8leNVPaVVg=" }, + "gemini-exchange-coffee-api": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/gemini-exchange-coffee-api/-/gemini-exchange-coffee-api-2.0.6.tgz", + "integrity": "sha1-JHML1brLG0Fs1LzcQQyBzwjI9pc=", + "requires": { + "coffeescript": "1.12.7", + "request": "2.30.0" + }, + "dependencies": { + "asn1": { + "version": "0.1.11", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.1.11.tgz", + "integrity": "sha1-VZvhg3bQik7E2+gId9J4GGObLfc=", + "optional": true + }, + "assert-plus": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.1.5.tgz", + "integrity": "sha1-7nQAlBMALYTOxyGcasgRgS5yMWA=", + "optional": true + }, + "async": { + "version": "0.9.2", + "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz", + "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=", + "optional": true + }, + "aws-sign2": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.5.0.tgz", + "integrity": "sha1-xXED96F/wDfwLXwuZLYC6iI/fWM=", + "optional": true + }, + "boom": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/boom/-/boom-0.4.2.tgz", + "integrity": "sha1-emNune1O/O+xnO9JR6PGffrukRs=", + "requires": { + "hoek": "0.9.1" + } + }, + "combined-stream": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-0.0.7.tgz", + "integrity": "sha1-ATfmV7qlp1QcV6w3rF/AfXO03B8=", + "optional": true, + "requires": { + "delayed-stream": "0.0.5" + } + }, + "cryptiles": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-0.2.2.tgz", + "integrity": "sha1-7ZH/HxetE9N0gohZT4pIoNJvMlw=", + "optional": true, + "requires": { + "boom": "0.4.2" + } + }, + "delayed-stream": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-0.0.5.tgz", + "integrity": "sha1-1LH0OpPoKW3+AmlPRoC8N6MTxz8=", + "optional": true + }, + "forever-agent": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.5.2.tgz", + "integrity": "sha1-bQ4JxJIflKJ/Y9O0nF/v8epMUTA=" + }, + "form-data": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-0.1.4.tgz", + "integrity": "sha1-kavXiKupcCsaq/qLwBAxoqyeOxI=", + "optional": true, + "requires": { + "async": "0.9.2", + "combined-stream": "0.0.7", + "mime": "1.2.11" + } + }, + "hawk": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/hawk/-/hawk-1.0.0.tgz", + "integrity": "sha1-uQuxaYByhUEdp//LjdJZhQLTtS0=", + "optional": true, + "requires": { + "boom": "0.4.2", + "cryptiles": "0.2.2", + "hoek": "0.9.1", + "sntp": "0.2.4" + } + }, + "hoek": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-0.9.1.tgz", + "integrity": "sha1-PTIkYrrfB3Fup+uFuviAec3c5QU=" + }, + "http-signature": { + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-0.10.1.tgz", + "integrity": "sha1-T72sEyVZqoMjEh5UB3nAoBKyfmY=", + "optional": true, + "requires": { + "asn1": "0.1.11", + "assert-plus": "0.1.5", + "ctype": "0.5.3" + } + }, + "node-uuid": { + "version": "1.4.8", + "resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.8.tgz", + "integrity": "sha1-sEDrCSOWivq/jTL7HxfxFn/auQc=" + }, + "oauth-sign": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.3.0.tgz", + "integrity": "sha1-y1QPk7srIqfVlBaRoojWDo6pOG4=", + "optional": true + }, + "qs": { + "version": "0.6.6", + "resolved": "https://registry.npmjs.org/qs/-/qs-0.6.6.tgz", + "integrity": "sha1-bgFQmP9RlouKPIGQAdXyyJvEsQc=" + }, + "request": { + "version": "2.30.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.30.0.tgz", + "integrity": "sha1-jg028IBuiRFSSwcrZMXuU1oJ2GE=", + "requires": { + "aws-sign2": "0.5.0", + "forever-agent": "0.5.2", + "form-data": "0.1.4", + "hawk": "1.0.0", + "http-signature": "0.10.1", + "json-stringify-safe": "5.0.1", + "mime": "1.2.11", + "node-uuid": "1.4.8", + "oauth-sign": "0.3.0", + "qs": "0.6.6", + "tough-cookie": "0.9.15", + "tunnel-agent": "0.3.0" + } + }, + "sntp": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/sntp/-/sntp-0.2.4.tgz", + "integrity": "sha1-+4hfGLDzqtGJ+CSGJTa87ux1CQA=", + "optional": true, + "requires": { + "hoek": "0.9.1" + } + }, + "tough-cookie": { + "version": "0.9.15", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-0.9.15.tgz", + "integrity": "sha1-dWF6w0fjZZBSsDUBMYhYKWdzmfY=", + "optional": true, + "requires": { + "punycode": "1.4.1" + } + }, + "tunnel-agent": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.3.0.tgz", + "integrity": "sha1-rWgbaPUyGtKCfEz7G31d8s/pQu4=", + "optional": true + } + } + }, "generate-function": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.0.0.tgz", @@ -2965,6 +3353,19 @@ "resolved": "https://registry.npmjs.org/qs/-/qs-6.4.0.tgz", "integrity": "sha1-E+JtKK1rD/qpExLNO/cI7TUecjM=" }, + "quadrigacx": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/quadrigacx/-/quadrigacx-0.0.7.tgz", + "integrity": "sha1-vptrBG28vDpNqRbBpQtJ2kiulsQ=", + "requires": { + "request": "2.81.0" + } + }, + "querystring": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", + "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=" + }, "raw-body": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.2.tgz", diff --git a/package.json b/package.json index d20723951..b0a4f2294 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gekko", - "version": "0.5.10", + "version": "0.5.11", "description": "A bitcoin trading bot for auto trading at various exchanges", "keywords": [ "trading", @@ -17,6 +17,7 @@ "dependencies": { "@slack/client": "^3.10.0", "async": "2.1.2", + "binance": "^1.0.2", "bitcoin-co-id": "0.0.1", "bitexthai": "^0.1.0", "bitfinex-api-node": "^1.2.0", @@ -40,7 +41,7 @@ "kraken-api-es5": "^1.0.0", "lakebtc_nodejs": "0.1.x", "lodash": "2.x", - "moment": "2.4.x", + "moment": "2.19.3", "node-wex": "^1.0.3", "node.bittrex.api": "^0.4.3", "okcoin-china": "0.0.7", @@ -49,14 +50,14 @@ "promisify-node": "^0.4.0", "prompt-lite": "0.1.1", "pushbullet": "1.4.3", + "quadrigacx": "0.0.7", "relieve": "^2.1.3", "retry": "^0.10.1", - "semver": "2.2.1", + "semver": "5.4.1", "sqlite3": "^3.1.8", "stats-lite": "^2.0.4", "tiny-promisify": "^0.1.1", "toml": "^2.3.0", - "tulind": "^0.8.7", "twitter": "^1.7.1", "zaif.jp": "^0.1.4" }, diff --git a/plugins/adviceLogger.js b/plugins/adviceLogger.js index ecf031ae4..fb5a76a53 100644 --- a/plugins/adviceLogger.js +++ b/plugins/adviceLogger.js @@ -28,8 +28,9 @@ Actor.prototype.processAdvice = function(advice) { console.log() }; -Actor.prototype.finalize = function(advice) { +Actor.prototype.finalize = function(advice, done) { // todo + done(); }; module.exports = Actor; diff --git a/plugins/mongodb/writer.js b/plugins/mongodb/writer.js index 9f13f376b..5fd31999a 100644 --- a/plugins/mongodb/writer.js +++ b/plugins/mongodb/writer.js @@ -59,16 +59,23 @@ var processCandle = function processCandle (candle, done) { this.marketTime = candle.start; this.candleCache.push(candle); - _.defer(this.writeCandles); + if (this.candleCache.length > 100) + this.writeCandles(); done(); } -var processAdvice = function processAdvice (advice) { - if (config.candleWriter.muteSoft && advice.recommendation === 'soft') { - return; - } - - log.debug(`Writing advice '${advice.recommendation}' to database.`); +var finalize = function(done) { + this.writeCandles(); + this.db = null; + done(); +} + +var processAdvice = function processAdvice (advice) { + if (config.candleWriter.muteSoft && advice.recommendation === 'soft') { + return; + } + + log.debug(`Writing advice '${advice.recommendation}' to database.`); var mAdvice = { time: moment().utc(), marketTime: this.marketTime, @@ -89,6 +96,7 @@ if (config.adviceWriter.enabled) { if (config.candleWriter.enabled) { log.debug('Enabling candleWriter.'); Store.prototype.processCandle = processCandle; + Store.prototype.finalize = finalize; } module.exports = Store; diff --git a/plugins/performanceAnalyzer/performanceAnalyzer.js b/plugins/performanceAnalyzer/performanceAnalyzer.js index 1df947a7c..0e5ede9dc 100644 --- a/plugins/performanceAnalyzer/performanceAnalyzer.js +++ b/plugins/performanceAnalyzer/performanceAnalyzer.js @@ -166,9 +166,10 @@ PerformanceAnalyzer.prototype.calculateReportStatistics = function() { return report; } -PerformanceAnalyzer.prototype.finalize = function() { +PerformanceAnalyzer.prototype.finalize = function(done) { const report = this.calculateReportStatistics(); this.handler.finalize(report); + done(); } diff --git a/plugins/postgresql/writer.js b/plugins/postgresql/writer.js index 9d86acea1..029f74c9c 100755 --- a/plugins/postgresql/writer.js +++ b/plugins/postgresql/writer.js @@ -65,17 +65,22 @@ Store.prototype.writeCandles = function() { } var processCandle = function(candle, done) { - - // because we might get a lot of candles - // in the same tick, we rather batch them - // up and insert them at once at next tick. this.cache.push(candle); - _.defer(this.writeCandles); + if (this.cache.length > 100) + this.writeCandles(); + + done(); +}; + +var finalize = function(done) { + this.writeCandles(); + this.db = null; done(); } -if(config.candleWriter.enabled){ +if(config.candleWriter.enabled) { Store.prototype.processCandle = processCandle; + Store.prototype.finalize = finalize; } module.exports = Store; diff --git a/plugins/sqlite/handle.js b/plugins/sqlite/handle.js index 10371079e..af6e63efb 100644 --- a/plugins/sqlite/handle.js +++ b/plugins/sqlite/handle.js @@ -49,8 +49,12 @@ if(mode === 'realtime' || mode === 'importer') { util.die(`History database does not exist for exchange ${config.watch.exchange} at version ${version}.`); } +var journalMode = config.sqlite.journalMode || 'PERSIST'; +var syncMode = journalMode === 'WAL' ? 'NORMAL' : 'FULL'; + var db = new sqlite3.Database(fullPath); -db.run('PRAGMA journal_mode = ' + config.sqlite.journalMode||'WAL'); +db.run('PRAGMA synchronous = ' + syncMode); +db.run('PRAGMA journal_mode = ' + journalMode); db.configure('busyTimeout', 1500); module.exports = db; diff --git a/plugins/sqlite/reader.js b/plugins/sqlite/reader.js index b119cb371..6ce62f04d 100644 --- a/plugins/sqlite/reader.js +++ b/plugins/sqlite/reader.js @@ -162,6 +162,7 @@ Reader.prototype.getBoundry = function(next) { } Reader.prototype.close = function() { + this.db.close(); this.db = null; } diff --git a/plugins/sqlite/scanner.js b/plugins/sqlite/scanner.js index 31eaec801..9c7d81bae 100644 --- a/plugins/sqlite/scanner.js +++ b/plugins/sqlite/scanner.js @@ -32,7 +32,7 @@ module.exports = done => { async.each(dbs, (db, next) => { const exchange = _.first(db.split('_')); - const handle = new sqlite3.Database(dbDirectory + '/' + db, err => { + const handle = new sqlite3.Database(dbDirectory + '/' + db, sqlite3.OPEN_READONLY, err => { if(err) return next(err); diff --git a/plugins/sqlite/writer.js b/plugins/sqlite/writer.js index 08de137f1..0cd2f5ef9 100644 --- a/plugins/sqlite/writer.js +++ b/plugins/sqlite/writer.js @@ -14,6 +14,7 @@ var Store = function(done, pluginMeta) { this.db.serialize(this.upsertTables); this.cache = []; + this.buffered = util.gekkoMode() === "importer"; } Store.prototype.upsertTables = function() { @@ -51,51 +52,60 @@ Store.prototype.writeCandles = function() { if(_.isEmpty(this.cache)) return; - var stmt = this.db.prepare(` - INSERT OR IGNORE INTO ${sqliteUtil.table('candles')} - VALUES (?,?,?,?,?,?,?,?,?) - `, function(err, rows) { - if(err) { - log.error(err); - return util.die('DB error at INSERT: '+ err); - } + var transaction = function() { + this.db.run("BEGIN TRANSACTION"); + + var stmt = this.db.prepare(` + INSERT OR IGNORE INTO ${sqliteUtil.table('candles')} + VALUES (?,?,?,?,?,?,?,?,?) + `, function(err, rows) { + if(err) { + log.error(err); + return util.die('DB error at INSERT: '+ err); + } + }); + + _.each(this.cache, candle => { + stmt.run( + null, + candle.start.unix(), + candle.open, + candle.high, + candle.low, + candle.close, + candle.vwp, + candle.volume, + candle.trades + ); }); - _.each(this.cache, candle => { - stmt.run( - null, - candle.start.unix(), - candle.open, - candle.high, - candle.low, - candle.close, - candle.vwp, - candle.volume, - candle.trades - ); - }); - - stmt.finalize(); + stmt.finalize(); + this.db.run("COMMIT"); + + this.cache = []; + } - this.cache = []; + this.db.serialize(_.bind(transaction, this)); } var processCandle = function(candle, done) { - - // because we might get a lot of candles - // in the same tick, we rather batch them - // up and insert them at once at next tick. this.cache.push(candle); - _.defer(this.writeCandles); + if (!this.buffered || this.cache.length > 1000) + this.writeCandles(); - // NOTE: sqlite3 has it's own buffering, at - // this point we are confident that the candle will - // get written to disk on next tick. done(); +}; + +var finalize = function(done) { + this.writeCandles(); + this.db.close(() => { done(); }); + this.db = null; } -if(config.candleWriter.enabled) +if(config.candleWriter.enabled) { Store.prototype.processCandle = processCandle; + Store.prototype.finalize = finalize; +} // TODO: add storing of trades / advice? diff --git a/plugins/telegrambot.js b/plugins/telegrambot.js index 86c5f61f0..9763407f5 100644 --- a/plugins/telegrambot.js +++ b/plugins/telegrambot.js @@ -17,11 +17,11 @@ var Actor = function() { this.priceTime = utc(); this.commands = { - 'advice': 'emitAdvice', - 'price': 'emitPrice', - 'donate': 'emitDonation', - 'real advice': 'emitRealAdvice', - 'help': 'emitHelp' + '/advice': 'emitAdvice', + '/price': 'emitPrice', + '/donate': 'emitDonation', + '/real advice': 'emitRealAdvice', + '/help': 'emitHelp' }; this.rawCommands = _.keys(this.commands); diff --git a/plugins/trader/portfolioManager.js b/plugins/trader/portfolioManager.js index b58e3cf0a..b97a7fbb5 100644 --- a/plugins/trader/portfolioManager.js +++ b/plugins/trader/portfolioManager.js @@ -17,7 +17,6 @@ var log = require(dirs.core + 'log'); var async = require('async'); var checker = require(dirs.core + 'exchangeChecker.js'); var moment = require('moment'); -var async = require('async'); var Manager = function(conf) { _.bindAll(this); @@ -105,7 +104,7 @@ Manager.prototype.setPortfolio = function(callback) { }.bind(this); - util.retry(this.exchange.getPortfolio, set); + this.exchange.getPortfolio(set); }; Manager.prototype.setFee = function(callback) { @@ -118,7 +117,7 @@ Manager.prototype.setFee = function(callback) { if(_.isFunction(callback)) callback(); }.bind(this); - util.retry(this.exchange.getFee, set); + this.exchange.getFee(set); }; Manager.prototype.setTicker = function(callback) { @@ -131,7 +130,7 @@ Manager.prototype.setTicker = function(callback) { if(_.isFunction(callback)) callback(); }.bind(this); - util.retry(this.exchange.getTicker, set); + this.exchange.getTicker(set); }; // return the [fund] based on the data we have in memory diff --git a/plugins/tradingAdvisor/baseTradingMethod.js b/plugins/tradingAdvisor/baseTradingMethod.js index 76d637af2..75f0db939 100644 --- a/plugins/tradingAdvisor/baseTradingMethod.js +++ b/plugins/tradingAdvisor/baseTradingMethod.js @@ -9,44 +9,17 @@ var ENV = util.gekkoEnv(); var mode = util.gekkoMode(); var startTime = util.getStartTime(); -if(config.tradingAdvisor.talib.enabled) { - // verify talib is installed properly - var pluginHelper = require(dirs.core + 'pluginUtil'); - var pluginMock = { - slug: 'tradingAdvisor', - dependencies: [{ - module: 'talib', - version: config.tradingAdvisor.talib.version - }] - }; - - var cannotLoad = pluginHelper.cannotLoad(pluginMock); - if(cannotLoad) - util.die(cannotLoad); - - var talib = require(dirs.core + 'talib'); +var talib = require(dirs.core + 'talib'); +if(talib == null) { + log.warn('TALIB indicators could not be loaded, they will be unavailable.'); } -if(config.tradingAdvisor.tulind.enabled) { - // verify talib is installed properly - var pluginHelper = require(dirs.core + 'pluginUtil'); - var pluginMock = { - slug: 'tradingAdvisor', - dependencies: [{ - module: 'tulind', - version: config.tradingAdvisor.tulind.version - }] - }; - - var cannotLoad = pluginHelper.cannotLoad(pluginMock); - if(cannotLoad) - util.die(cannotLoad); - - var tulind = require(dirs.core + 'tulind'); +var tulind = require(dirs.core + 'tulind'); +if(tulind == null) { + log.warn('TULIP indicators could not be loaded, they will be unavailable.'); } var indicatorsPath = dirs.methods + 'indicators/'; - var indicatorFiles = fs.readdirSync(indicatorsPath); var Indicators = {}; diff --git a/sample-config.js b/sample-config.js index 45eedcf39..f516fada5 100644 --- a/sample-config.js +++ b/sample-config.js @@ -35,15 +35,7 @@ config.tradingAdvisor = { method: 'MACD', candleSize: 1, historySize: 3, - adapter: 'sqlite', - talib: { - enabled: false, - version: '1.0.2' - }, - tulind: { - enabled: false, - version: '0.8.7' - } + adapter: 'sqlite' } // Exponential Moving Averages settings: @@ -398,7 +390,7 @@ config.sqlite = { dataDirectory: 'history', version: 0.1, - journalMode: 'WAL', // setting this to 'DEL' may prevent db locking on windows + journalMode: require('./web/isWindows.js') ? 'DELETE' : 'WAL', dependencies: [] } @@ -446,7 +438,7 @@ config.backtest = { config.importer = { daterange: { // NOTE: these dates are in UTC - from: "2016-01-01 00:00:00" + from: "2017-11-01 00:00:00" } } diff --git a/strategies/PPO.js b/strategies/PPO.js index 6f39b7768..8c0f21488 100644 --- a/strategies/PPO.js +++ b/strategies/PPO.js @@ -40,12 +40,12 @@ method.update = function(candle) { method.log = function() { var digits = 8; var ppo = this.indicators.ppo; - var short = ppo.short.result; - var long = ppo.long.result; - var macd = ppo.macd; - var result = ppo.ppo; - var macdSignal = ppo.MACDsignal.result; - var ppoSignal = ppo.PPOsignal.result; + var long = ppo.result.longEMA; + var short = ppo.result.shortEMA; + var macd = ppo.result.macd; + var result = ppo.result.ppo; + var macdSignal = ppo.result.MACDsignal; + var ppoSignal = ppo.result.PPOsignal; log.debug('calculated MACD properties for candle:'); log.debug('\t', 'short:', short.toFixed(digits)); @@ -62,12 +62,12 @@ method.check = function(candle) { var price = candle.close; var ppo = this.indicators.ppo; - var long = ppo.long.result; - var short = ppo.short.result; - var macd = ppo.macd; - var result = ppo.ppo; - var macdSignal = ppo.MACDsignal.result; - var ppoSignal = ppo.PPOsignal.result; + var long = ppo.result.longEMA; + var short = ppo.result.shortEMA; + var macd = ppo.result.macd; + var result = ppo.result.ppo; + var macdSignal = ppo.result.MACDsignal; + var ppoSignal = ppo.result.PPOsignal; // TODO: is this part of the indicator or not? // if it is it should move there diff --git a/strategies/indicators/PPO.js b/strategies/indicators/PPO.js index eea3d827a..b49e592c7 100644 --- a/strategies/indicators/PPO.js +++ b/strategies/indicators/PPO.js @@ -2,9 +2,10 @@ var EMA = require('./EMA.js'); var Indicator = function(config) { + this.result = {}; this.input = 'price'; - this.macd = false; - this.ppo = false; + this.macd = 0; + this.ppo = 0; this.short = new EMA(config.short); this.long = new EMA(config.long); this.MACDsignal = new EMA(config.signal); @@ -15,17 +16,22 @@ Indicator.prototype.update = function(price) { this.short.update(price); this.long.update(price); this.calculatePPO(); - this.MACDsignal.update(this.macd); - this.MACDhist = this.macd - this.MACDsignal.result; - this.PPOsignal.update(this.ppo); - this.PPOhist = this.ppo - this.PPOsignal.result; + this.MACDsignal.update(this.result.macd); + this.MACDhist = this.result.macd - this.MACDsignal.result; + this.PPOsignal.update(this.result.ppo); + this.PPOhist = this.result.ppo - this.PPOsignal.result; + + this.result.MACDsignal = this.MACDsignal.result; + this.result.MACDhist = this.MACDhist; + this.result.PPOsignal = this.PPOsignal.result; + this.result.PPOhist = this.PPOhist; } Indicator.prototype.calculatePPO = function() { - var shortEMA = this.short.result; - var longEMA = this.long.result; - this.macd = shortEMA - longEMA; - this.ppo = 100 * (this.macd / longEMA); + this.result.shortEMA = this.short.result; + this.result.longEMA = this.long.result; + this.result.macd = this.result.shortEMA - this.result.longEMA; + this.result.ppo = 100 * (this.result.macd / this.result.longEMA); } module.exports = Indicator; diff --git a/strategies/tulip-multi-strat.js b/strategies/tulip-multi-strat.js new file mode 100644 index 000000000..753fdc8c7 --- /dev/null +++ b/strategies/tulip-multi-strat.js @@ -0,0 +1,57 @@ +var _ = require('lodash'); +var log = require('../core/log.js'); + +var method = {}; +method.init = function() { + // strat name + this.name = 'tulip-multi-strat'; + // trend information + this.trend = 'none' + // tulip indicators use this sometimes + this.requiredHistory = this.settings.historySize; + // define the indicators we need + this.addTulipIndicator('myadx', 'adx', this.settings); + this.addTulipIndicator('mymacd', 'macd', this.settings); +} + +// what happens on every new candle? +method.update = function(candle) { + // tulip results + this.adx = this.tulipIndicators.myadx.result.result; + this.macd = this.tulipIndicators.mymacd.result.macdHistogram; +} +// for debugging purposes log the last +// calculated parameters. +method.log = function() { + log.debug( +`--------------------- +Tulip ADX: ${this.adx} +Tulip MACD: ${this.macd} +`); +} + +method.check = function() { + // just add a long and short to each array when new indicators are used + const all_long = [ + this.adx > this.settings.up && this.trend!=='long', + this.settings.macd_up < this.macd && this.trend!=='long', + ].reduce((total, long)=>long && total, true) + const all_short = [ + this.adx < this.settings.down && this.trend!=='short', + this.settings.macd_down > this.macd && this.trend!=='short', + ].reduce((total, long)=>long && total, true) + + // combining all indicators with AND + if(all_long){ + log.debug(`tulip-multi-strat In low`); + this.advice('long'); + }else if(all_short){ + log.debug(`tulip-multi-strat In high`); + this.advice('short'); + }else{ + log.debug(`tulip-multi-strat In no trend`); + this.advice(); + } +} + +module.exports = method; diff --git a/test/indicators/macd.js b/test/indicators/macd.js index f19529ea1..7f5d97bc8 100644 --- a/test/indicators/macd.js +++ b/test/indicators/macd.js @@ -66,7 +66,7 @@ describe('indicators/PPO', function() { var ppo = new PPO({short: 12, long: 26, signal: 9}); _.each(prices, function(p, i) { ppo.update(p); - expect(ppo.ppo).to.equal(verified_ppo12v26v9[i]); + expect(ppo.result.ppo).to.equal(verified_ppo12v26v9[i]); }); }); @@ -74,7 +74,7 @@ describe('indicators/PPO', function() { var ppo = new PPO({short: 12, long: 26, signal: 9}); _.each(prices, function(p, i) { ppo.update(p); - expect(ppo.PPOsignal.result).to.equal(verified_ppo12v26v9signal[i]); + expect(ppo.result.PPOsignal).to.equal(verified_ppo12v26v9signal[i]); }); }); @@ -83,7 +83,7 @@ describe('indicators/PPO', function() { var ppo = new PPO({short: 12, long: 26, signal: 9}); _.each(prices, function(p, i) { ppo.update(p); - expect(ppo.PPOhist).to.equal(verified_ppo12v26v9hist[i]); + expect(ppo.result.PPOhist).to.equal(verified_ppo12v26v9hist[i]); }); }); }); @@ -97,4 +97,4 @@ xdescribe('indicators/DEMA', function() { }); -}); \ No newline at end of file +}); diff --git a/test/indicators/ppo.js b/test/indicators/ppo.js index 7518f33a4..0f2a7e684 100644 --- a/test/indicators/ppo.js +++ b/test/indicators/ppo.js @@ -32,7 +32,7 @@ describe('indicators/PPO', function() { var ppo = new PPO({short: 12, long: 26, signal: 9}); _.each(prices, function(p, i) { ppo.update(p); - expect(ppo.ppo).to.equal(verified_ppo12v26v9[i]); + expect(ppo.result.ppo).to.equal(verified_ppo12v26v9[i]); }); }); @@ -40,7 +40,7 @@ describe('indicators/PPO', function() { var ppo = new PPO({short: 12, long: 26, signal: 9}); _.each(prices, function(p, i) { ppo.update(p); - expect(ppo.PPOsignal.result).to.equal(verified_ppo12v26v9signal[i]); + expect(ppo.result.PPOsignal).to.equal(verified_ppo12v26v9signal[i]); }); }); @@ -49,7 +49,7 @@ describe('indicators/PPO', function() { var ppo = new PPO({short: 12, long: 26, signal: 9}); _.each(prices, function(p, i) { ppo.update(p); - expect(ppo.PPOhist).to.equal(verified_ppo12v26v9hist[i]); + expect(ppo.result.PPOhist).to.equal(verified_ppo12v26v9hist[i]); }); }); -}); \ No newline at end of file +}); diff --git a/web/isWindows.js b/web/isWindows.js new file mode 100644 index 000000000..691eb3dd8 --- /dev/null +++ b/web/isWindows.js @@ -0,0 +1,9 @@ +const os = require('os'); + +var isWindows = ( + os.platform() == 'win32' // true evenon 64 bit archs + || os.release().indexOf('Microsoft') > -1 // bash on Windows 10 scenario +); + +module.exports = isWindows; + diff --git a/web/routes/baseConfig.js b/web/routes/baseConfig.js index f0ebecf29..214ab1f97 100644 --- a/web/routes/baseConfig.js +++ b/web/routes/baseConfig.js @@ -14,14 +14,6 @@ config.debug = true; // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ config.tradingAdvisor = { - talib: { - enabled: require('../supportsTalib'), - version: '1.0.2' - }, - tulind: { - enabled: require('../supportsTulip'), - version: '0.8.7' - } } config.candleWriter = { @@ -43,7 +35,7 @@ config.sqlite = { path: 'plugins/sqlite', version: 0.1, dataDirectory: 'history', - journalMode: 'WAL', // setting this to 'DEL' may prevent db locking on windows + journalMode: require('../isWindows.js') ? 'PERSIST' : 'WAL', dependencies: [{ module: 'sqlite3', version: '3.1.4' diff --git a/web/server.js b/web/server.js index 1e737fff2..6f266579c 100644 --- a/web/server.js +++ b/web/server.js @@ -18,8 +18,6 @@ const wss = new WebSocketServer({ server: server }); const cache = require('./state/cache'); const ListManager = require('./state/listManager'); -require('./supportsTalib'); - // broadcast function const broadcast = data => { if(_.isEmpty(data)) @@ -95,8 +93,9 @@ server.listen(config.api.port, config.api.host, '::', () => { // this prevents opening the browser during development let nodeCommand = _.last(process.argv[1].split('/')); if(nodeCommand === 'gekko' && !config.headless) { - try { - opn(location); - } catch(e) {} + opn(location) + .catch(err => { + console.log('Something went wrong when trying to open your web browser. UI is running on ' + location + '.'); + }); } }); diff --git a/web/supportsTalib.js b/web/supportsTalib.js deleted file mode 100644 index 9ccfe38fe..000000000 --- a/web/supportsTalib.js +++ /dev/null @@ -1,11 +0,0 @@ -var CAN_RUN_TALIB = true; - -try { - var talib = require('talib'); -} catch(e) { - CAN_RUN_TALIB = false; -} - -console.log('TAlib is', CAN_RUN_TALIB ? 'enabled' : 'disabled'); - -module.exports = CAN_RUN_TALIB; \ No newline at end of file diff --git a/web/supportsTulip.js b/web/supportsTulip.js deleted file mode 100644 index d57ee85e2..000000000 --- a/web/supportsTulip.js +++ /dev/null @@ -1,11 +0,0 @@ -var CAN_RUN_TULIP = true; - -try { - var tulind = require('tulind'); -} catch(e) { - CAN_RUN_TULIP = false; -} - -console.log('TULIP indicators is', CAN_RUN_TULIP ? 'enabled' : 'disabled'); - -module.exports = CAN_RUN_TULIP; \ No newline at end of file diff --git a/web/vue/dist/build.js b/web/vue/dist/build.js index 37af9541a..a56e8a504 100644 --- a/web/vue/dist/build.js +++ b/web/vue/dist/build.js @@ -13,4 +13,4 @@ var C=function(t){function e(){var t=this.$options;t.store?this.$store=t.store:t * (c) 2017 Evan You * @license MIT */ -function n(t,e){if(!t)throw new Error("[vue-router] "+e)}function r(e,n){"production"===t.env.NODE_ENV||e||"undefined"!=typeof console&&console.warn("[vue-router] "+n)}function i(t){return Object.prototype.toString.call(t).indexOf("Error")>-1}function o(e,n){switch(typeof n){case"undefined":return;case"object":return n;case"function":return n(e);case"boolean":return n?e.params:void 0;default:"production"!==t.env.NODE_ENV&&r(!1,'props in "'+e.path+'" is a '+typeof n+", expecting an object, function or boolean.")}}function a(e,n,i){void 0===n&&(n={});var o,a=i||s;try{o=a(e||"")}catch(e){"production"!==t.env.NODE_ENV&&r(!1,e.message),o={}}for(var u in n){var c=n[u];o[u]=Array.isArray(c)?c.slice():c}return o}function s(t){var e={};return(t=t.trim().replace(/^(\?|#|&)/,""))?(t.split("&").forEach(function(t){var n=t.replace(/\+/g," ").split("="),r=Pt(n.shift()),i=n.length>0?Pt(n.join("=")):null;void 0===e[r]?e[r]=i:Array.isArray(e[r])?e[r].push(i):e[r]=[e[r],i]}),e):e}function u(t){var e=t?Object.keys(t).map(function(e){var n=t[e];if(void 0===n)return"";if(null===n)return Dt(e);if(Array.isArray(n)){var r=[];return n.forEach(function(t){void 0!==t&&(null===t?r.push(Dt(e)):r.push(Dt(e)+"="+Dt(t)))}),r.join("&")}return Dt(e)+"="+Dt(n)}).filter(function(t){return t.length>0}).join("&"):null;return e?"?"+e:""}function c(t,e,n,r){var i=r&&r.options.stringifyQuery,o={name:e.name||t&&t.name,meta:t&&t.meta||{},path:e.path||"/",hash:e.hash||"",query:e.query||{},params:e.params||{},fullPath:f(e,i),matched:t?l(t):[]};return n&&(o.redirectedFrom=f(n,i)),Object.freeze(o)}function l(t){for(var e=[];t;)e.unshift(t),t=t.parent;return e}function f(t,e){var n=t.path,r=t.query;void 0===r&&(r={});var i=t.hash;void 0===i&&(i="");var o=e||u;return(n||"/")+o(r)+i}function d(t,e){return e===It?t===e:!!e&&(t.path&&e.path?t.path.replace(Mt,"")===e.path.replace(Mt,"")&&t.hash===e.hash&&p(t.query,e.query):!(!t.name||!e.name)&&(t.name===e.name&&t.hash===e.hash&&p(t.query,e.query)&&p(t.params,e.params)))}function p(t,e){void 0===t&&(t={}),void 0===e&&(e={});var n=Object.keys(t),r=Object.keys(e);return n.length===r.length&&n.every(function(n){var r=t[n],i=e[n];return"object"==typeof r&&"object"==typeof i?p(r,i):String(r)===String(i)})}function h(t,e){return 0===t.path.replace(Mt,"/").indexOf(e.path.replace(Mt,"/"))&&(!e.hash||t.hash===e.hash)&&v(t.query,e.query)}function v(t,e){for(var n in e)if(!(n in t))return!1;return!0}function m(t){if(!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||t.defaultPrevented||void 0!==t.button&&0!==t.button)){if(t.currentTarget&&t.currentTarget.getAttribute){if(/\b_blank\b/i.test(t.currentTarget.getAttribute("target")))return}return t.preventDefault&&t.preventDefault(),!0}}function g(t){if(t)for(var e,n=0;n=0&&(e=t.slice(r),t=t.slice(0,r));var i=t.indexOf("?");return i>=0&&(n=t.slice(i+1),t=t.slice(0,i)),{path:t,query:n,hash:e}}function x(t){return t.replace(/\/\//g,"/")}function w(t,e){for(var n,r=[],i=0,o=0,a="",s=e&&e.delimiter||"/";null!=(n=Gt.exec(t));){var u=n[0],c=n[1],l=n.index;if(a+=t.slice(o,l),o=l+u.length,c)a+=c[1];else{var f=t[o],d=n[2],p=n[3],h=n[4],v=n[5],m=n[6],g=n[7];a&&(r.push(a),a="");var _=null!=d&&null!=f&&f!==d,y="+"===m||"*"===m,b="?"===m||"*"===m,x=n[2]||s,w=h||v;r.push({name:p||i++,prefix:d||"",delimiter:x,optional:b,repeat:y,partial:_,asterisk:!!g,pattern:w?$(w):g?".*":"[^"+A(x)+"]+?"})}}return o-1&&(a.params[f]=n.params[f]);if(u)return a.path=M(u.path,a.params,'named route "'+s+'"'),l(u,a,o)}else if(a.path){a.params={};for(var v=0;v=t.length?n():t[i]?e(t[i],function(){r(i+1)}):r(i+1)};r(0)}function st(e){return function(n,o,a){var s=!1,u=0,c=null;ut(e,function(e,n,o,l){if("function"==typeof e&&void 0===e.cid){s=!0,u++;var f,d=lt(function(t){t.__esModule&&t.default&&(t=t.default),e.resolved="function"==typeof t?t:St.extend(t),o.components[l]=t,--u<=0&&a()}),p=lt(function(e){var n="Failed to resolve async component "+l+": "+e;"production"!==t.env.NODE_ENV&&r(!1,n),c||(c=i(e)?e:new Error(n),a(c))});try{f=e(d,p)}catch(t){p(t)}if(f)if("function"==typeof f.then)f.then(d,p);else{var h=f.component;h&&"function"==typeof h.then&&h.then(d,p)}}}),s||a()}}function ut(t,e){return ct(t.map(function(t){return Object.keys(t.components).map(function(n){return e(t.components[n],t.instances[n],t,n)})}))}function ct(t){return Array.prototype.concat.apply([],t)}function lt(t){var e=!1;return function(){for(var n=[],r=arguments.length;r--;)n[r]=arguments[r];if(!e)return e=!0,t.apply(this,n)}}function ft(t){if(!t)if(Vt){var e=document.querySelector("base");t=e&&e.getAttribute("href")||"/",t=t.replace(/^https?:\/\/[^\/]+/,"")}else t="/";return"/"!==t.charAt(0)&&(t="/"+t),t.replace(/\/$/,"")}function dt(t,e){var n,r=Math.max(t.length,e.length);for(n=0;n=0?e.slice(0,n):e;window.location.replace(r+"#"+t)}function At(t,e){return t.push(e),function(){var n=t.indexOf(e);n>-1&&t.splice(n,1)}}function $t(t,e,n){var r="hash"===n?"#"+e:e;return t?x(t+"/"+r):r}var St,jt={name:"router-view",functional:!0,props:{name:{type:String,default:"default"}},render:function(t,e){var n=e.props,r=e.children,i=e.parent,a=e.data;a.routerView=!0;for(var s=i.$createElement,u=n.name,c=i.$route,l=i._routerViewCache||(i._routerViewCache={}),f=0,d=!1;i&&i._routerRoot!==i;)i.$vnode&&i.$vnode.data.routerView&&f++,i._inactive&&(d=!0),i=i.$parent;if(a.routerViewDepth=f,d)return s(l[u],a,r);var p=c.matched[f];if(!p)return l[u]=null,s();var h=l[u]=p.components[u];return a.registerRouteInstance=function(t,e){var n=p.instances[u];(e&&n!==t||!e&&n===t)&&(p.instances[u]=e)},(a.hook||(a.hook={})).prepatch=function(t,e){p.instances[u]=e.componentInstance},a.props=o(c,p.props&&p.props[u]),s(h,a,r)}},Tt=/[!'()*]/g,Nt=function(t){return"%"+t.charCodeAt(0).toString(16)},Rt=/%2C/g,Dt=function(t){return encodeURIComponent(t).replace(Tt,Nt).replace(Rt,",")},Pt=decodeURIComponent,Mt=/\/?$/,It=c(null,{path:"/"}),Ft=[String,Object],Lt=[String,Array],zt={name:"router-link",props:{to:{type:Ft,required:!0},tag:{type:String,default:"a"},exact:Boolean,append:Boolean,replace:Boolean,activeClass:String,exactActiveClass:String,event:{type:Lt,default:"click"}},render:function(t){var e=this,n=this.$router,r=this.$route,i=n.resolve(this.to,r,this.append),o=i.location,a=i.route,s=i.href,u={},l=n.options.linkActiveClass,f=n.options.linkExactActiveClass,p=null==l?"router-link-active":l,v=null==f?"router-link-exact-active":f,_=null==this.activeClass?p:this.activeClass,y=null==this.exactActiveClass?v:this.exactActiveClass,b=o.path?c(null,o,null,n):a;u[y]=d(r,b),u[_]=this.exact?u[y]:h(r,b);var x=function(t){m(t)&&(e.replace?n.replace(o):n.push(o))},w={click:m};Array.isArray(this.event)?this.event.forEach(function(t){w[t]=x}):w[this.event]=x;var k={class:u};if("a"===this.tag)k.on=w,k.attrs={href:s};else{var C=g(this.$slots.default);if(C){C.isStatic=!1;var E=St.util.extend;(C.data=E({},C.data)).on=w;(C.data.attrs=E({},C.data.attrs)).href=s}else k.on=w}return t(this.tag,k,this.$slots.default)}},Vt="undefined"!=typeof window,Ut=Array.isArray||function(t){return"[object Array]"==Object.prototype.toString.call(t)},qt=P,Ht=w,Wt=k,Bt=O,Yt=D,Gt=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g");qt.parse=Ht,qt.compile=Wt,qt.tokensToFunction=Bt,qt.tokensToRegExp=Yt;var Kt=Object.create(null),Xt=Object.create(null),Jt=Vt&&function(){var t=window.navigator.userAgent;return(-1===t.indexOf("Android 2.")&&-1===t.indexOf("Android 4.0")||-1===t.indexOf("Mobile Safari")||-1!==t.indexOf("Chrome")||-1!==t.indexOf("Windows Phone"))&&(window.history&&"pushState"in window.history)}(),Zt=Vt&&window.performance&&window.performance.now?window.performance:Date,Qt=et(),te=function(t,e){this.router=t,this.base=ft(e),this.current=It,this.pending=null,this.ready=!1,this.readyCbs=[],this.readyErrorCbs=[],this.errorCbs=[]};te.prototype.listen=function(t){this.cb=t},te.prototype.onReady=function(t,e){this.ready?t():(this.readyCbs.push(t),e&&this.readyErrorCbs.push(e))},te.prototype.onError=function(t){this.errorCbs.push(t)},te.prototype.transitionTo=function(t,e,n){var r=this,i=this.router.match(t,this.current);this.confirmTransition(i,function(){r.updateRoute(i),e&&e(i),r.ensureURL(),r.ready||(r.ready=!0,r.readyCbs.forEach(function(t){t(i)}))},function(t){n&&n(t),t&&!r.ready&&(r.ready=!0,r.readyErrorCbs.forEach(function(e){e(t)}))})},te.prototype.confirmTransition=function(t,e,n){var o=this,a=this.current,s=function(t){i(t)&&(o.errorCbs.length?o.errorCbs.forEach(function(e){e(t)}):(r(!1,"uncaught error during route navigation:"),console.error(t))),n&&n(t)};if(d(t,a)&&t.matched.length===a.matched.length)return this.ensureURL(),s();var u=dt(this.current.matched,t.matched),c=u.updated,l=u.deactivated,f=u.activated,p=[].concat(vt(l),this.router.beforeHooks,mt(c),f.map(function(t){return t.beforeEnter}),st(f));this.pending=t;var h=function(e,n){if(o.pending!==t)return s();try{e(t,a,function(t){!1===t||i(t)?(o.ensureURL(!0),s(t)):"string"==typeof t||"object"==typeof t&&("string"==typeof t.path||"string"==typeof t.name)?(s(),"object"==typeof t&&t.replace?o.replace(t):o.push(t)):n(t)})}catch(t){s(t)}};at(p,h,function(){var n=[];at(_t(f,n,function(){return o.current===t}).concat(o.router.resolveHooks),h,function(){if(o.pending!==t)return s();o.pending=null,e(t),o.router.app&&o.router.app.$nextTick(function(){n.forEach(function(t){t()})})})})},te.prototype.updateRoute=function(t){var e=this.current;this.current=t,this.cb&&this.cb(t),this.router.afterHooks.forEach(function(n){n&&n(t,e)})};var ee=function(t){function e(e,n){var r=this;t.call(this,e,n);var i=e.options.scrollBehavior;i&&B(),window.addEventListener("popstate",function(t){var n=r.current;r.transitionTo(xt(r.base),function(t){i&&Y(e,t,n,!0)})})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.go=function(t){window.history.go(t)},e.prototype.push=function(t,e,n){var r=this,i=this,o=i.current;this.transitionTo(t,function(t){it(x(r.base+t.fullPath)),Y(r.router,t,o,!1),e&&e(t)},n)},e.prototype.replace=function(t,e,n){var r=this,i=this,o=i.current;this.transitionTo(t,function(t){ot(x(r.base+t.fullPath)),Y(r.router,t,o,!1),e&&e(t)},n)},e.prototype.ensureURL=function(t){if(xt(this.base)!==this.current.fullPath){var e=x(this.base+this.current.fullPath);t?it(e):ot(e)}},e.prototype.getCurrentLocation=function(){return xt(this.base)},e}(te),ne=function(t){function e(e,n,r){t.call(this,e,n),r&&wt(this.base)||kt()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setupListeners=function(){var t=this;window.addEventListener("hashchange",function(){kt()&&t.transitionTo(Ct(),function(t){Ot(t.fullPath)})})},e.prototype.push=function(t,e,n){this.transitionTo(t,function(t){Et(t.fullPath),e&&e(t)},n)},e.prototype.replace=function(t,e,n){this.transitionTo(t,function(t){Ot(t.fullPath),e&&e(t)},n)},e.prototype.go=function(t){window.history.go(t)},e.prototype.ensureURL=function(t){var e=this.current.fullPath;Ct()!==e&&(t?Et(e):Ot(e))},e.prototype.getCurrentLocation=function(){return Ct()},e}(te),re=function(t){function e(e,n){t.call(this,e,n),this.stack=[],this.index=-1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.push=function(t,e,n){var r=this;this.transitionTo(t,function(t){r.stack=r.stack.slice(0,r.index+1).concat(t),r.index++,e&&e(t)},n)},e.prototype.replace=function(t,e,n){var r=this;this.transitionTo(t,function(t){r.stack=r.stack.slice(0,r.index).concat(t),e&&e(t)},n)},e.prototype.go=function(t){var e=this,n=this.index+t;if(!(n<0||n>=this.stack.length)){var r=this.stack[n];this.confirmTransition(r,function(){e.index=n,e.updateRoute(r)})}},e.prototype.getCurrentLocation=function(){var t=this.stack[this.stack.length-1];return t?t.fullPath:"/"},e.prototype.ensureURL=function(){},e}(te),ie=function(e){void 0===e&&(e={}),this.app=null,this.apps=[],this.options=e,this.beforeHooks=[],this.resolveHooks=[],this.afterHooks=[],this.matcher=q(e.routes||[],this);var r=e.mode||"hash";switch(this.fallback="history"===r&&!Jt&&!1!==e.fallback,this.fallback&&(r="hash"),Vt||(r="abstract"),this.mode=r,r){case"history":this.history=new ee(this,e.base);break;case"hash":this.history=new ne(this,e.base,this.fallback);break;case"abstract":this.history=new re(this,e.base);break;default:"production"!==t.env.NODE_ENV&&n(!1,"invalid mode: "+r)}},oe={currentRoute:{}};ie.prototype.match=function(t,e,n){return this.matcher.match(t,e,n)},oe.currentRoute.get=function(){return this.history&&this.history.current},ie.prototype.init=function(e){var r=this;if("production"!==t.env.NODE_ENV&&n(_.installed,"not installed. Make sure to call `Vue.use(VueRouter)` before creating root instance."),this.apps.push(e),!this.app){this.app=e;var i=this.history;if(i instanceof ee)i.transitionTo(i.getCurrentLocation());else if(i instanceof ne){var o=function(){i.setupListeners()};i.transitionTo(i.getCurrentLocation(),o,o)}i.listen(function(t){r.apps.forEach(function(e){e._route=t})})}},ie.prototype.beforeEach=function(t){return At(this.beforeHooks,t)},ie.prototype.beforeResolve=function(t){return At(this.resolveHooks,t)},ie.prototype.afterEach=function(t){return At(this.afterHooks,t)},ie.prototype.onReady=function(t,e){this.history.onReady(t,e)},ie.prototype.onError=function(t){this.history.onError(t)},ie.prototype.push=function(t,e,n){this.history.push(t,e,n)},ie.prototype.replace=function(t,e,n){this.history.replace(t,e,n)},ie.prototype.go=function(t){this.history.go(t)},ie.prototype.back=function(){this.go(-1)},ie.prototype.forward=function(){this.go(1)},ie.prototype.getMatchedComponents=function(t){var e=t?t.matched?t:this.resolve(t).route:this.currentRoute;return e?[].concat.apply([],e.matched.map(function(t){return Object.keys(t.components).map(function(e){return t.components[e]})})):[]},ie.prototype.resolve=function(t,e,n){var r=V(t,e||this.history.current,n,this),i=this.match(r,e),o=i.redirectedFrom||i.fullPath;return{location:r,route:i,href:$t(this.history.base,o,this.mode),normalizedTo:r,resolved:i}},ie.prototype.addRoutes=function(t){this.matcher.addRoutes(t),this.history.current!==It&&this.history.transitionTo(this.history.getCurrentLocation())},Object.defineProperties(ie.prototype,oe),ie.install=_,ie.version="2.7.0",Vt&&window.Vue&&window.Vue.use(ie),e.a=ie}).call(e,n(9))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(130),i=n.n(r),o=n(129),a=n.n(o),s=n(131),u=n.n(s);e.default={name:"app",components:{top:i.a,bottom:a.a,modal:u.a}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(125),i=n.n(r),o=n(20),a=n.n(o),s=n(18),u=n.n(s),c=n(3),l=n.n(c),f=n(2);e.default={created:function(){var t=this;n.i(f.a)("configPart/performanceAnalyzer",function(e,n){t.performanceAnalyzer=toml.parse(n.part),t.performanceAnalyzer.enabled=!0})},data:function(){return{dataset:{},strat:{},paperTrader:{},performanceAnalyzer:{}}},components:{stratPicker:a.a,datasetPicker:i.a,paperTrader:u.a},computed:{market:function(){return this.dataset.exchange?{exchange:this.dataset.exchange,currency:this.dataset.currency,asset:this.dataset.asset}:{}},range:function(){return this.dataset.exchange?{from:this.dataset.from,to:this.dataset.to}:{}},config:function(){var t={};return Object.assign(t,{watch:this.market},{paperTrader:this.paperTrader},this.strat,{backtest:{daterange:this.range}},{performanceAnalyzer:this.performanceAnalyzer}),t.valid=this.validConfig(t),t}},methods:{validConfig:function(t){if(!t.backtest)return!1;if(!t.backtest.daterange)return!1;if(l.a.isEmpty(t.backtest.daterange))return!1;if(!t.watch)return!1;if(!t.tradingAdvisor)return!1;var e=t.tradingAdvisor.method;if(l.a.isEmpty(t[e]))return!1;if(t.tradingAdvisor){if(l.a.isNaN(t.tradingAdvisor.candleSize))return!1;if(0==t.tradingAdvisor.candleSize)return!1}return!0},updateDataset:function(t){this.dataset=t,this.$emit("config",this.config)},updateStrat:function(t){this.strat=t,this.$emit("config",this.config)},updatePaperTrader:function(t){this.paperTrader=t,this.paperTrader.enabled=!0,this.$emit("config",this.config)}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(119),i=n.n(r),o=n(120),a=n.n(o),s=n(2),u=n(5),c=n.n(u);e.default={data:function(){return{backtestable:!1,backtestState:"idle",backtestResult:!1,config:!1}},methods:{check:function(t){if(this.config=t,!t.valid)return this.backtestable=!1;this.backtestable=!0},run:function(){var t=this;this.backtestState="fetching";var e={gekkoConfig:this.config,data:{candleProps:["close","start"],indicatorResults:!0,report:!0,roundtrips:!0,trades:!0}};n.i(s.b)("backtest",e,function(e,n){t.backtestState="fetched",t.backtestResult=n})}},components:{configBuilder:i.a,result:a.a,spinner:c.a}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(68),i=n(69);e.default={props:["data","height"],data:function(){return{isClicked:!1}},watch:{data:function(){this.render()}},created:function(){setTimeout(this.render,100)},beforeDestroy:function(){this.remove()},methods:{click:function(){this.isClicked=!0},render:function(){this.remove(),_.size(this.data.candles)<4?n.i(i.a)("Not enough data to spawn chart"):n.i(r.a)(this.data.candles,this.data.trades,this.height)},remove:function(){d3.select("#chart").html("")}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(121),i=n.n(r),o=n(10),a=n.n(o),s=n(16),u=n.n(s);e.default={props:["result"],data:function(){return{}},methods:{},components:{roundtripTable:u.a,resultSummary:i.a,chart:a.a}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={props:["roundtrips"],data:function(){return{}},methods:{diff:function(t){return moment.duration(t).humanize()},humanizeDuration:function(t){return window.humanizeDuration(t)},fmt:function(t){return moment.utc(t).format("YYYY-MM-DD HH:mm")},round:function(t){return(+t).toFixed(3)}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(21),i=n.n(r);e.default={props:["report"],components:{paperTradeSummary:i.a},methods:{round:function(t){return(+t).toFixed(5)}},computed:{profitClass:function(){return this.report.relativeProfit>0?"profit":"loss"}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(126),i=n.n(r),o=n(3),a=(n.n(o),n(2));e.default={data:function(){return{exchange:!1,credentials:{}}},components:{exchangePicker:i.a},computed:{apiKeySets:function(){return this.$store.state.apiKeys},exchanges:function(){return this.$store.state.exchanges},requires:function(){return this.exchanges&&this.exchange?this.exchanges[this.exchange].requires:[]},config:function(){return{exchange:this.exchange,values:this.credentials}}},watch:{credentials:function(){this.emitConfig()}},methods:{updateExchange:function(t){this.credentials={},this.exchange=t,this.emitConfig()},emitConfig:function(){this.$emit("config",this.config)},upload:function(){var t=this,e=this.config.exchange;this.exchanges&&this.apiKeySets.includes(e)&&!confirm("You already have API keys for "+e+" defined, do you want to overwrite them?")||n.i(a.b)("addApiKey",this.config,function(e,n){if(e)return alert(e);t.credentials={}})}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(122),i=n.n(r),o=n(2);e.default={components:{apiConfigBuilder:i.a},data:function(){return{addApiToggle:!1}},methods:{openAddApi:function(){this.addApiToggle=!0},removeApiKey:function(t){confirm("Are you sure you want to delete these API keys?")&&n.i(o.b)("removeApiKey",{exchange:t},function(t,e){if(t)return alert(t)})}},computed:{apiKeySets:function(){return this.$store.state.apiKeys}},watch:{apiKeySets:function(){this.addApiToggle=!1}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(5),i=n.n(r),o=n(8),a=n(13),s=n.i(o.a)("\n\n## Local data\n\nGekko needs local market data in order to backtest strategies. The local\ndata can also be used in a warmup period when running a strategy against a\nlive market.\n\n");e.default={mixins:[a.a],components:{spinner:i.a},data:function(){return{intro:s,viewUnscannable:!1}},methods:{toggleUnscannable:function(){this.viewUnscannable=!0},humanizeDuration:function(t){return window.humanizeDuration(t)},fmt:function(t){return t.format("YYYY-MM-DD HH:mm")}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(17),i=n.n(r),o=n(11),a=n.n(o),s=n(3);n.n(s);e.default={data:function(){return{market:{},range:{}}},components:{marketPicker:i.a,rangeCreator:a.a},computed:{config:function(){var t={};return Object.assign(t,this.market,{importer:{daterange:this.range}},{candleWriter:{enabled:!0}}),t}},methods:{updateMarketConfig:function(t){this.market=t,this.emitConfig()},updateRange:function(t){this.range=t,this.emitConfig()},emitConfig:function(){this.$emit("config",this.config)}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(2),i=n(5),o=n.n(i),a=n(123),s=n.n(a),u=n(8),c=n.i(u.a)("\n\n## Import data\n\nThe importer can download historical market data directly from the exchange.\n\n");e.default={components:{importConfigBuilder:s.a,spinner:o.a},data:function(){return{intro:c,config:{}}},computed:{imports:function(){return this.$store.state.imports}},methods:{daysApart:function(t){var e=moment(t.to),n=moment(t.from);return e.diff(n,"days")},updateConfig:function(t){this.config=t},run:function(){var t=this;if(this.daysApart(this.config.importer.daterange)<1)return alert("You can only import at least one day of data..");n.i(r.b)("import",this.config,function(e,n){if(e)return alert(e);t.$store.commit("addImport",n),t.$router.push({path:"/data/importer/import/"+n.id})})}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(3),i=n.n(r),o=n(128),a=n.n(o),s=n(5),u=n.n(s);e.default={components:{progressBar:a.a,spinner:u.a},computed:{data:function(){return i.a.find(this.$store.state.imports,{id:this.$route.params.id})},initialized:function(){if(this.data&&this.latest.isValid())return!0},latest:function(){if(this.data)return this.mom(this.data.latest)},fromEndMs:function(){if(this.data)return this.to.diff(this.latest)},fromEnd:function(){return this.latest?humanizeDuration(this.fromEndMs):"LOADING"},from:function(){if(this.data)return this.mom(this.data.from)},to:function(){if(this.data)return this.mom(this.data.to)},timespan:function(){if(this.data)return this.to.diff(this.from)},progress:function(){if(this.data){return 100*(this.timespan-this.fromEndMs)/this.timespan}}},methods:{fmt:function(t){return t.format("YYYY-MM-DD HH:mm:ss")},mom:function(t){return moment.utc(t)}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(17),i=n.n(r),o=n(127),a=n.n(o),s=n(20),u=n.n(s),c=n(18),l=n.n(c),f=n(2),d=n(3),p=n.n(d);e.default={created:function(){var t=this;n.i(f.a)("configPart/candleWriter",function(e,n){t.candleWriter=toml.parse(n.part)}),n.i(f.a)("configPart/performanceAnalyzer",function(e,n){t.performanceAnalyzer=toml.parse(n.part),t.performanceAnalyzer.enabled=!0})},data:function(){return{market:{},range:{},type:"",strat:{},paperTrader:{},candleWriter:{},performanceAnalyzer:{}}},components:{marketPicker:i.a,typePicker:a.a,stratPicker:u.a,paperTrader:l.a},computed:{isTradebot:function(){return"tradebot"===this.type},config:function(){var t={};return Object.assign(t,this.market,this.strat,{paperTrader:this.paperTrader},{candleWriter:this.candleWriter},{type:this.type},{performanceAnalyzer:this.performanceAnalyzer}),this.isTradebot&&(delete t.paperTrader,t.trader={enabled:!0}),t.valid=this.validConfig(t),t}},methods:{validConfig:function(t){if("market watcher"===t.type)return!0;if(!t.tradingAdvisor)return!1;if(p.a.isNaN(t.tradingAdvisor.candleSize))return!1;if(0==t.tradingAdvisor.candleSize)return!1;var e=t.tradingAdvisor.method;return!p.a.isEmpty(t[e])},updateMarketConfig:function(t){this.market=t,this.emitConfig()},updateType:function(t){this.type=t,this.emitConfig()},updateStrat:function(t){this.strat=t,this.emitConfig()},updatePaperTrader:function(t){this.paperTrader=t,this.paperTrader.enabled=!0,this.emitConfig()},emitConfig:function(){this.$emit("config",this.config)}}}},function(t,e,n){"use strict";function r(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}Object.defineProperty(e,"__esModule",{value:!0});var i,o=n(8),a=n.i(o.a)("\n\n## Live Gekko\n\nRun your strategy against the live market!\n\n");e.default=(i={data:function(){return{text:a}},created:function(){var t=this;this.timer=setInterval(function(){t.now=moment()},1e3)},destroyed:function(){clearTimeout(this.timer)}},r(i,"data",function(){return{text:a,timer:!1,now:moment()}}),r(i,"computed",{stratrunners:function(){return this.$store.state.stratrunners},watchers:function(){return this.$store.state.watchers}}),r(i,"methods",{humanizeDuration:function(t){return window.humanizeDuration(t)},moment:function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}(function(t){return moment.utc(t)}),fmt:function(t){return moment.utc(t).format("YYYY-MM-DD HH:mm")},round:function(t){return(+t).toFixed(3)},timespan:function(t,e){return this.humanizeDuration(this.moment(t).diff(this.moment(e)))}}),i)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(3),i=n.n(r),o=n(4),a=n(2),s=n(124),u=n.n(s);e.default={components:{gekkoConfigBuilder:u.a},data:function(){return{pendingStratrunner:!1,config:{}}},computed:{watchers:function(){return this.$store.state.watchers},stratrunners:function(){return this.$store.state.stratrunners},watchConfig:function(){var t=i.a.pick(this.config,"watch","candleWriter"),e=o.a.util.extend({},t);return e.type="market watcher",e.mode="realtime",e},requiredHistoricalData:function(){if(this.config.tradingAdvisor&&this.config.valid){var t=this.config.tradingAdvisor;return t.candleSize*t.historySize}},gekkoConfig:function(){var t;if(this.existingMarketWatcher){if(this.requiredHistoricalData){var e=moment().utc().startOf("minute").subtract(this.requiredHistoricalData,"minutes").unix(),n=moment.utc(this.existingMarketWatcher.firstCandle.start).unix();t=moment.unix(Math.max(e,n)).utc().format()}else t=moment().utc().startOf("minute").format();return o.a.util.extend({market:{type:"leech",from:t},mode:"realtime"},this.config)}},existingMarketWatcher:function(){var t=o.a.util.extend({},this.watchConfig.watch);return i.a.find(this.watchers,{watch:t})},exchange:function(){return this.watchConfig.watch.exchange},existingTradebot:function(){return i.a.find(this.stratrunners.filter(function(t){return"tradebot"===t.trader}),{watch:{exchange:this.exchange}})},availableApiKeys:function(){return this.$store.state.apiKeys}},watch:{existingMarketWatcher:function(t,e){var n=this;this.pendingStratrunner&&t&&t.firstCandle&&t.lastCandle&&(this.pendingStratrunner=!1,this.startGekko(function(t,e){n.$router.push({path:"/live-gekkos/stratrunner/"+e.id})}))}},methods:{updateConfig:function(t){this.config=t},start:function(){var t=this;if("tradebot"===this.config.type){if(this.existingTradebot){var e="You already have a tradebot running on this exchange";return e+=", you can only run one tradebot per exchange.",alert(e)}if(!this.availableApiKeys.includes(this.exchange))return alert("Please first configure API keys for this exchange in the config page.")}"market watcher"===this.config.type?this.existingMarketWatcher?(alert("This market is already being watched, redirecting you now..."),this.$router.push({path:"/live-gekkos/watcher/"+this.existingMarketWatcher.id})):this.startWatcher(function(e,n){t.$router.push({path:"/live-gekkos/watcher/"+n.id})}):this.existingMarketWatcher?this.startGekko(this.routeToGekko):this.startWatcher(function(e,n){t.pendingStratrunner=!0})},routeToGekko:function(t,e){if(t||e.error)return console.error(t,e.error);this.$router.push({path:"/live-gekkos/stratrunner/"+e.id})},startWatcher:function(t){n.i(a.b)("startGekko",this.watchConfig,t)},startGekko:function(t){n.i(a.b)("startGekko",this.gekkoConfig,t)}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(4),i=n(3),o=n.n(i),a=n(2),s=n(5),u=n.n(s),c=n(10),l=n.n(c),f=n(16),d=n.n(f),p=n(21),h=n.n(p);e.default={created:function(){this.isLoading||this.getCandles()},components:{spinner:u.a,chart:l.a,paperTradeSummary:h.a,roundtrips:d.a},data:function(){return{candleFetch:"idle",candles:!1}},computed:{stratrunners:function(){return this.$store.state.stratrunners},data:function(){return o.a.find(this.stratrunners,{id:this.$route.params.id})},chartData:function(){return{candles:this.candles,trades:this.trades}},trades:function(){return this.data?this.data.trades:[]},report:function(){if(this.data)return this.data.report},stratName:function(){if(this.data)return this.data.strat.tradingAdvisor.method},stratParams:function(){if(!this.data)return"";var t=r.a.util.extend({},this.data.strat.params);return delete t.__empty,o.a.isEmpty(t)?"No parameters":JSON.stringify(t,null,4)},isLoading:function(){return!this.data||(!o.a.isObject(this.data.firstCandle)||!o.a.isObject(this.data.lastCandle))},watchers:function(){return this.$store.state.watchers},watcher:function(){var t=r.a.util.extend({},this.data.watch);return o.a.find(this.watchers,{watch:t})}},watch:{"data.lastCandle.start":function(){this.candleFetch="dirty"},data:function(t,e){this.isLoading||"fetched"!==this.candleFetch&&this.getCandles()}},methods:{round:function(t){return(+t).toFixed(5)},humanizeDuration:function(t){return window.humanizeDuration(t)},moment:function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}(function(t){return moment.utc(t)}),fmt:function(t){return moment.utc(t).format("YYYY-MM-DD HH:mm")},getCandles:function(){var t=this;this.candleFetch="fetching";var e=this.data.lastCandle.start,r=this.data.firstCandle.start,i=this.data.strat.tradingAdvisor.candleSize,s={watch:this.data.watch,daterange:{to:e,from:r},candleSize:i};n.i(a.b)("getCandles",s,function(e,n){t.candleFetch="fetched",n&&!n.error&&o.a.isArray(n)||console.log(n),t.candles=n.map(function(t){return t.start=moment.unix(t.start).utc().format(),t})})}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(2),i=n(3),o=n.n(i),a=n(5),s=n.n(a),u=(n(4),n(10)),c=n.n(u);e.default={created:function(){this.isLoading||this.getCandles()},components:{spinner:s.a,chart:c.a},data:function(){return{candleFetch:"idle",candles:[]}},computed:{watchers:function(){return this.$store.state.watchers},data:function(){return o.a.find(this.watchers,{id:this.$route.params.id})},chartData:function(){return{candles:this.candles,trades:[]}},isLoading:function(){return!this.data||(!o.a.isObject(this.data.firstCandle)||!o.a.isObject(this.data.lastCandle))}},watch:{"data.lastCandle.start":function(){this.candleFetch="dirty"},data:function(t,e){t&&t.firstCandle&&t.lastCandle&&"fetched"!==this.candleFetch&&this.getCandles()}},methods:{humanizeDuration:function(t){return window.humanizeDuration(t)},moment:function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}(function(t){return moment.utc(t)}),fmt:function(t){return moment.utc(t).format("YYYY-MM-DD HH:mm")},getCandles:function(){var t=this;this.candleFetch="fetching";var e=moment.utc(this.data.lastCandle.start).unix(),i=Math.max(moment.utc(this.data.firstCandle.start).unix(),moment.utc(e).subtract(7,"days").unix()),o=e-i,a=60;o<86400&&(a=o<43200?1:5),i=moment.unix(i).utc().format(),e=moment.unix(e).utc().format();var s={watch:this.data.watch,daterange:{to:e,from:i},candleSize:a};n.i(r.b)("getCandles",s,function(e,n){t.candleFetch="fetched",t.candles=n.map(function(t){return t.start=moment.unix(t.start).utc().format(),t})})}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(3),i=(n.n(r),n(4)),o=(n(2),n(5)),a=n.n(o),s=n(13);e.default={components:{spinner:a.a},data:function(){return{setIndex:-1,customTo:!1,customFrom:!1,rangeVisible:!1,set:!1}},mixins:[s.a],methods:{humanizeDuration:function(t){return window.humanizeDuration(t,{largest:4})},fmt:function(t){return t.utc().format("YYYY-MM-DD HH:mm")},openRange:function(){if(-1===this.setIndex)return alert("Select a dataset to adjust range");this.updateCustomRange(),this.rangeVisible=!0},updateCustomRange:function(){this.customTo=this.fmt(this.set.to),this.customFrom=this.fmt(this.set.from)},emitSet:function(t){if(t){var e=void 0;this.customTo?(e=i.a.util.extend({},t),e.to=moment.utc(this.customTo,"YYYY-MM-DD HH:mm").format(),e.from=moment.utc(this.customFrom,"YYYY-MM-DD HH:mm").format()):e=t,this.$emit("dataset",e)}}},watch:{setIndex:function(){this.set=this.datasets[this.setIndex],this.updateCustomRange(),this.emitSet(this.set)},customTo:function(){this.emitSet(this.set)},customFrom:function(){this.emitSet(this.set)}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(3),i=n.n(r),o=n(19),a=(n.n(o),n(11));n.n(a),n(2);e.default={props:["onlyTradable","onlyImportable"],data:function(){return{exchange:"poloniex"}},created:function(){this.emitExchange()},computed:{exchanges:function(){var t=Object.assign({},this.$store.state.exchanges);return!i.a.isEmpty(t)&&(this.onlyTradable&&i.a.each(t,function(e,n){e.tradable||delete t[n]}),this.onlyImportable&&i.a.each(t,function(e,n){e.importable||delete t[n]}),t)}},watch:{exchanges:function(){this.emitExchange()},exchange:function(){this.emitExchange()}},methods:{emitExchange:function(){this.$emit("exchange",this.exchange)}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(3),i=n.n(r),o=n(19),a=(n.n(o),n(11));n.n(a),n(2);e.default={props:["onlyTradable","onlyImportable"],data:function(){return{exchange:"poloniex",currency:"USDT",asset:"BTC"}},created:function(){this.emitConfig()},computed:{exchanges:function(){var t=Object.assign({},this.$store.state.exchanges);return!i.a.isEmpty(t)&&(this.onlyTradable&&i.a.each(t,function(e,n){e.tradable||delete t[n]}),this.onlyImportable&&i.a.each(t,function(e,n){e.importable||delete t[n]}),t)},markets:function(){return this.exchanges?this.exchanges[this.exchange]:null},assets:function(){return this.exchanges?this.exchanges[this.exchange].markets[this.currency]:null},currencies:function(){return this.exchanges?i.a.keys(this.exchanges[this.exchange].markets):null},watchConfig:function(){return{watch:{exchange:this.exchange,currency:this.currency,asset:this.asset}}}},watch:{currency:function(){this.emitConfig()},asset:function(){this.emitConfig()},market:function(){this.emitConfig()},exchanges:function(){this.emitConfig()},exchange:function(){this.emitConfig()}},methods:{emitConfig:function(){this.$emit("market",this.watchConfig)}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(3),i=(n.n(r),n(2));e.default={created:function(){var t=this;n.i(i.a)("configPart/paperTrader",function(e,n){t.rawPaperTraderParams=n.part})},data:function(){return{rawPaperTraderParams:"",rawPaperTraderParamsError:!1,paperTraderParams:{},toggle:"closed"}},watch:{rawPaperTraderParams:function(){this.emitConfig()}},methods:{switchToggle:function(){"open"===this.toggle?this.toggle="closed":this.toggle="open"},emitConfig:function(){this.parseParams(),this.$emit("settings",this.paperTraderParams)},parseParams:function(){try{this.paperTraderParams=toml.parse(this.rawPaperTraderParams),this.paperTraderParams.reportRoundtrips=!0,this.rawPaperTraderParamsError=!1}catch(t){this.rawPaperTraderParamsError=t,this.paperTraderParams={}}}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(3);n.n(r),n(2);e.default={data:function(){return{from:"",to:""}},created:function(){var t=moment().startOf("minute"),e=t.clone().subtract(3,"months");this.to=this.fmt(t),this.from=this.fmt(e),this.emitRange()},methods:{fmtTs:function(t){return moment.unix(t).utc()},fmt:function(t){return t.utc().format("YYYY-MM-DD HH:mm")},emitRange:function(){this.$emit("range",{from:this.fmtTs(this.from),to:this.fmtTs(this.to)})},emitManualEntry:function(){if(this.from.length<"4"||this.from.length<"4")return this.$emit("range",{});var t=moment.utc(this.from),e=moment.utc(this.to);t.isValid()&&e.isValid()?this.$emit("range",{from:this.fmt(t),to:this.fmt(e)}):this.$emit("range",{})}},watch:{from:function(){this.emitManualEntry()},to:function(){this.emitManualEntry()},config:function(){this.scanned=!1},tab:function(){this.scanned=!1,this.$emit("range",{})},selectedRangeIndex:function(){var t=this.ranges[this.selectedRangeIndex];t&&this.emitRange(t)}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(3),i=(n.n(r),n(2));e.default={props:["config"],data:function(){return{scanned:!1,ranges:[],selectedRangeIndex:-1,tab:"scan",from:"",to:""}},methods:{scan:function(){var t=this;this.scanned="fetching",this.selectedRangeIndex=-1,n.i(i.b)("scan",this.config,function(e,n){t.scanned=!0,t.ranges=n,t.selectedRangeIndex=0})},printRange:function(t){var e=function(t){return t.format("YYYY-MM-DD HH:mm")},n=moment.unix(t.from),r=moment.unix(t.to),i=moment.duration(r.diff(n)).humanize();return e(n)+" to "+e(r)+" ("+i+")"},fmtTs:function(t){return moment.unix(t).utc()},fmt:function(t){return t.utc().format()},emitRange:function(t){this.$emit("range",{from:this.fmtTs(t.from),to:this.fmtTs(t.to)})},emitManualEntry:function(){if(this.from.length<"4"||this.from.length<"4")return this.$emit("range",{});var t=moment.utc(this.from),e=moment.utc(this.to);t.isValid()&&e.isValid()?this.$emit("range",{from:this.fmt(t),to:this.fmt(e)}):this.$emit("range",{})},reset:function(){this.scanned=!1,this.$emit("range",{})}},watch:{from:function(){this.emitManualEntry()},to:function(){this.emitManualEntry()},config:function(){this.reset()},tab:function(){this.reset()},selectedRangeIndex:function(){var t=this.ranges[this.selectedRangeIndex];t&&this.emitRange(t)}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(3),i=n.n(r),o=n(2);e.default={data:function(){return{strategies:[],candleSizeUnit:"hours",rawCandleSize:1,strategy:"MACD",historySize:10,rawStratParams:"",rawStratParamsError:!1,emptyStrat:!1,stratParams:{}}},created:function(){var t=this;n.i(o.a)("strategies",function(e,n){t.strategies=n,i.a.each(t.strategies,function(t){t.empty=""===t.params}),t.rawStratParams=i.a.find(t.strategies,{name:t.strategy}).params,t.emptyStrat=i.a.find(t.strategies,{name:t.strategy}).empty,t.emitConfig()})},watch:{strategy:function(t){t=i.a.find(this.strategies,{name:t}),this.rawStratParams=t.params,this.emptyStrat=t.empty,this.emitConfig()},candleSize:function(){this.emitConfig()},historySize:function(){this.emitConfig()},rawStratParams:function(){this.emitConfig()}},computed:{candleSize:function(){return"minutes"===this.candleSizeUnit?this.rawCandleSize:"hours"===this.candleSizeUnit?60*this.rawCandleSize:"days"===this.candleSizeUnit?60*this.rawCandleSize*24:void 0},singularCandleSizeUnit:function(){return this.candleSizeUnit.slice(0,-1)},config:function(){var t={tradingAdvisor:{enabled:!0,method:this.strategy,candleSize:+this.candleSize,historySize:+this.historySize}};return this.emptyStrat?t[this.strategy]={__empty:!0}:t[this.strategy]=this.stratParams,t}},methods:{humanizeDuration:function(t){return window.humanizeDuration(t)},emitConfig:function(){this.parseParams(),this.$emit("stratConfig",this.config)},parseParams:function(){try{this.stratParams=toml.parse(this.rawStratParams),this.rawStratParamsError=!1}catch(t){this.rawStratParamsError=t,this.stratParams={}}}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={created:function(){this.emitType()},data:function(){return{types:["paper trader","market watcher","tradebot"],selectedTypeIndex:0}},methods:{emitType:function(){this.$emit("type",this.type)}},watch:{type:function(){this.emitType()}},computed:{type:function(){return this.types[this.selectedTypeIndex]}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={props:["report"],methods:{round2:function(t){return(+t).toFixed(2)},round:function(t){return(+t).toFixed(5)}},computed:{profitClass:function(){return this.report.relativeProfit>0?"profit":"loss"}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={props:["progress"],methods:{round:function(t){return(+t).toFixed(2)}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(112),i=n(113);e.default={data:function(){return{version:{gekko:r.version,ui:i.version}}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(8),i=n.i(r.a)("\n\n## Gekko\n\nGekko is a Bitcoin trading bot and backtesting platform that\nconnects to popular Bitcoin exchanges. It is written in javascript\nand runs on nodejs.\n\n[Find out more](https://gekko.wizb.it/).\n\n*Gekko is 100% open source and free, if you paid for this you have been scammed.*\n\n");e.default={data:function(){return{left:i}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(8),i={disconnected:n.i(r.a)("\n\n## Disconnected\n\nSomething happened to either Gekko or the connection.\nPlease check the terminal where Gekko is running or\nyour network connection.\n\n ")};e.default={computed:{active:function(){return!this.$store.state.warnings.connected},content:function(){return this.$store.state.warnings.connected?"":i.disconnected}}}},function(t,e,n){"use strict";var r=n(3),i=n.n(r),o=function(){function t(t,e){var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){i=!0,o=t}finally{try{!r&&s.return&&s.return()}finally{if(i)throw o}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();e.a=function(t,e,n){function r(){if(!d3.event.sourceEvent||"zoom"!==d3.event.sourceEvent.type){var t=d3.event.selection||y.range();_.domain(t.map(y.invert,y)),a(_.domain()),d.select(".axis--y").call(C),T.attr("cx",function(t){return _(t.date)}).attr("cy",function(t){return b(t.price)}),S.select(".line").attr("d",A),S.select(".axis--x").call(w),d.select(".zoom").call(O.transform,d3.zoomIdentity.scale(m/(t[1]-t[0])).translate(-t[0],0))}}function a(t){var e=o(t,2),n=e[0],r=e[1],a=i.a.sortedIndex(l,n),s=i.a.sortedIndex(l,r),u=f.slice(a,s);b.domain([.9995*d3.min(u),1.0005*d3.max(u)])}function s(){if(!d3.event.sourceEvent||"brush"!==d3.event.sourceEvent.type){var t=d3.event.transform;a(t.rescaleX(y).domain()),d.select(".axis--y").call(C),_.domain(t.rescaleX(y).domain()),S.select(".line").attr("d",A),T.attr("cx",function(t){return _(t.date)}).attr("cy",function(t){return b(t.price)}),S.select(".axis--x").call(w),j.select(".brush").call(E.move,_.range().map(t.invertX,t))}}var u=e.map(function(t){return{price:t.price,date:new Date(t.date),action:t.action}}),c=t.map(function(t){return{price:t.close,date:new Date(t.start)}}),l=c.map(function(t){return+t.date}),f=c.map(function(t){return+t.price}),d=d3.select("#chart");d.attr("width",window.innerWidth-20);var p={top:20,right:20,bottom:110,left:40},h=n-p.top-p.bottom,v={top:n-70,right:20,bottom:30,left:40},m=+d.attr("width")-p.left-p.right,g=n-v.top-v.bottom,_=d3.scaleTime().range([0,m]),y=d3.scaleTime().range([0,m]),b=d3.scaleLinear().range([h,0]),x=d3.scaleLinear().range([g,0]),w=d3.axisBottom(_),k=d3.axisBottom(y),C=d3.axisLeft(b).ticks(n/50),E=d3.brushX().extent([[0,0],[m,g]]).on("brush end",r),O=d3.zoom().scaleExtent([1,100]).translateExtent([[0,0],[m,h]]).extent([[0,0],[m,h]]).on("zoom",s),A=d3.line().x(function(t){return _(t.date)}).y(function(t){return b(t.price)}),$=d3.line().x(function(t){return y(t.date)}).y(function(t){return x(t.price)});d.append("defs").append("clipPath").attr("id","clip").append("rect").attr("width",m).attr("height",h);var S=d.append("g").attr("class","focus").attr("transform","translate("+p.left+","+p.top+")"),j=d.append("g").attr("class","context").attr("transform","translate("+v.left+","+v.top+")");_.domain(d3.extent(c,function(t){return t.date})),b.domain([.99*d3.min(f),1.01*d3.max(f)]),y.domain(_.domain()),x.domain(b.domain()),S.append("path").datum(c).attr("class","line price").attr("d",A),S.append("g").attr("class","axis axis--x").attr("transform","translate(0,"+h+")").call(w),S.append("g").attr("class","axis axis--y").call(C),j.append("path").datum(c).attr("class","line").attr("d",$),j.append("g").attr("class","axis axis--x").attr("transform","translate(0,"+g+")").call(k);var T=d.append("g").attr("transform","translate("+p.left+","+p.top+")").selectAll("circle").data(u).enter().append("circle").attr("class",function(t){return t.action}).attr("cx",function(t){return _(t.date)}).attr("cy",function(t){return b(t.price)}).attr("r",5);j.append("g").selectAll("circle").data(u).enter().append("circle").attr("class",function(t){return t.action}).attr("cx",function(t){return y(t.date)}).attr("cy",function(t){return x(t.price)}).attr("r",3);j.append("g").attr("class","brush").call(E).call(E.move,_.range()),d.append("rect").attr("class","zoom").attr("width",m).attr("height",h).attr("transform","translate("+p.left+","+p.top+")").call(O)}},function(t,e,n){"use strict";n.d(e,"a",function(){return r});var r=function(t){d3.select("#chart").append("text").attr("class","message").attr("x",150).attr("y",150).text(t)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){var e=n(4),r=n(23),i=n.n(r),o=n(34),a=n(7),s=n(24),u=n.n(s),c=n(33),l=n.n(c),f=n(26),d=n.n(f),p=n(27),h=n.n(p),v=n(28),m=n.n(v),g=n(25),_=n.n(g),y=n(29),b=n.n(y),x=n(30),w=n.n(x),k=n(31),C=n.n(k),E=n(32),O=n.n(E),A=n(6);e.a.use(o.a);var $=new o.a({mode:"hash",base:t,routes:[{path:"/",redirect:"/home"},{path:"/home",component:l.a},{path:"/backtest",component:u.a},{path:"/config",component:_.a},{path:"/data",component:d.a},{path:"/data/importer",component:h.a},{path:"/data/importer/import/:id",component:m.a},{path:"/live-gekkos",component:b.a},{path:"/live-gekkos/new",component:w.a},{path:"/live-gekkos/stratrunner/:id",component:C.a},{path:"/live-gekkos/watcher/:id",component:O.a}]});n.i(A.a)(),new e.a({router:$,store:a.a,el:"#app",render:function(t){return t(i.a)}})}.call(e,"/")},function(t,e,n){"use strict";var r=(n(4),n(22),n(75)),i=n(81),o=n(79),a=n(77),s=n(73);e.a=function(){n.i(r.a)(),n.i(i.a)(),n.i(o.a)(),n.i(a.a)(),n.i(s.a)()}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),n.d(e,"syncApiKeys",function(){return i}),n.d(e,"syncExchanges",function(){return o});var r=n(4),i=function(t,e){return r.a.set(t,"apiKeys",e),t},o=function(t,e){return r.a.set(t,"exchanges",e),t}},function(t,e,n){"use strict";var r=n(2),i=n(7),o=n(6),a=function(){function t(t,e){var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){i=!0,o=t}finally{try{!r&&s.return&&s.return()}finally{if(i)throw o}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),s=function(t){var e=t,n={};return e.forEach(function(t){n[t.slug]=n[t.slug]||{markets:{}},t.markets.forEach(function(e){var r=a(e.pair,2),i=r[0],o=r[1];n[t.slug].markets[i]=n[t.slug].markets[i]||[],n[t.slug].markets[i].push(o)}),n[t.slug].importable=!!t.providesFullHistory,n[t.slug].tradable=!!t.tradable,n[t.slug].requires=t.requires}),n},u=function(){n.i(r.a)("apiKeys",function(t,e){i.a.commit("syncApiKeys",e)}),n.i(r.a)("exchanges",function(t,e){i.a.commit("syncExchanges",s(e))})},c=function(){o.b.$on("apiKeys",function(t){i.a.commit("syncApiKeys",t.exchanges)})};e.a=function(){u(),c()}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),n.d(e,"addImport",function(){return i}),n.d(e,"syncImports",function(){return o}),n.d(e,"updateImport",function(){return a});var r=n(4),i=function(t,e){return t.imports.push(e),t},o=function(t,e){return t.imports=e,t},a=function(t,e){var n=t.imports.findIndex(function(t){return t.id===e.import_id}),i=t.imports[n];if(!i)return t;var o=r.a.util.extend(i,e.updates);return r.a.set(t.imports,n,o),t}},function(t,e,n){"use strict";var r=n(2),i=n(7),o=n(6),a=function(){n.i(r.a)("imports",function(t,e){i.a.commit("syncImports",e)})},s=function(){o.b.$on("import_update",function(t){i.a.commit("updateImport",t)})};e.a=function(){a(),s()}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),n.d(e,"setGlobalWarning",function(){return i});var r=(n(4),n(3)),i=(n.n(r),function(t,e){return t.warnings[e.key]=e.value,t})},function(t,e,n){"use strict";var r=n(7),i=n(6),o=function(){i.b.$on("WS_STATUS_CHANGE",function(t){return r.a.commit("setGlobalWarning",{key:"connected",value:t.connected})})};e.a=function(){o()}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),n.d(e,"addStratrunner",function(){return i}),n.d(e,"syncStratrunners",function(){return o}),n.d(e,"updateStratrunner",function(){return a}),n.d(e,"addTradeToStratrunner",function(){return s}),n.d(e,"addRoundtripToStratrunner",function(){return u});var r=n(4),i=function(t,e){return t.stratrunners.push(e),t},o=function(t,e){return t.stratrunners=e,t},a=function(t,e){var n=t.stratrunners.findIndex(function(t){return t.id===e.gekko_id}),i=t.stratrunners[n];if(!i)return t;var o=r.a.util.extend(i,e.updates);return r.a.set(t.stratrunners,n,o),t},s=function(t,e){var n=t.stratrunners.findIndex(function(t){return t.id===e.gekko_id}),i=t.stratrunners[n];if(!i)return t;var o=r.a.util.extend({},i);return o.trades.push(e.trade),r.a.set(t.stratrunners,n,o),t},u=function(t,e){var n=t.stratrunners.findIndex(function(t){return t.id===e.gekko_id}),i=t.stratrunners[n];if(!i)return t;var o=r.a.util.extend({},i);return o.roundtrips.push(e.roundtrip),r.a.set(t.stratrunners,n,o),t}},function(t,e,n){"use strict";var r=n(2),i=n(7),o=n(6),a=n(3),s=n.n(a),u=function(){n.i(r.a)("gekkos",function(t,e){var n=s.a.filter(e,{type:"leech"});i.a.commit("syncStratrunners",n)})},c=function(){o.b.$on("new_gekko",function(t){"leech"===t.gekko.type&&i.a.commit("addStratrunner",t.gekko)});var t=function(t){i.a.commit("updateStratrunner",t)},e=function(t){i.a.commit("addTradeToStratrunner",t)},n=function(t){i.a.commit("addRoundtripToStratrunner",t)};o.b.$on("report",t),o.b.$on("trade",e),o.b.$on("update",t),o.b.$on("startAt",t),o.b.$on("lastCandle",t),o.b.$on("firstCandle",t),o.b.$on("roundtrip",n)};e.a=function(){u(),c()}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),n.d(e,"addWatcher",function(){return i}),n.d(e,"syncWatchers",function(){return o}),n.d(e,"updateWatcher",function(){return a});var r=n(4),i=function(t,e){return t.watchers.push(e),t},o=function(t,e){return t.watchers=e,t},a=function(t,e){var n=t.watchers.findIndex(function(t){return t.id===e.gekko_id}),i=t.watchers[n];if(!i)return t;var o=r.a.util.extend(i,e.updates);return r.a.set(t.watchers,n,o),t}},function(t,e,n){"use strict";var r=n(2),i=n(7),o=n(6),a=n(3),s=n.n(a),u=function(){n.i(r.a)("gekkos",function(t,e){var n=s.a.filter(e,{type:"watcher"});i.a.commit("syncWatchers",n)})},c=function(){o.b.$on("new_gekko",function(t){"watcher"===t.gekko.type&&i.a.commit("addWatcher",t.gekko)});var t=function(t){i.a.commit("updateWatcher",t)};o.b.$on("update",t),o.b.$on("startAt",t),o.b.$on("lastCandle",t),o.b.$on("firstCandle",t)};e.a=function(){u(),c()}},function(t,e,n){function r(t){if(t)return i(t)}function i(t){for(var e in r.prototype)t[e]=r.prototype[e];return t}t.exports=r,r.prototype.on=r.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},r.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var r,i=0;i4?t:document.documentMode}()},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,"#chartWrapper.clickable{position:relative}#chartWrapper.clickable .shield{cursor:zoom-in;position:absolute;top:0;bottom:0;left:0;right:0;background:grey;opacity:.1}#chart{background-color:#eee;width:100%}#chart circle{clip-path:url(#clip)}#chart .zoom{cursor:move;fill:none;pointer-events:all}#chart .line{fill:none;stroke:#4682b4;stroke-width:1.5px;clip-path:url(#clip)}#chart circle.buy{fill:#7fff00}#chart circle.sell{fill:red}",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,".scan-btn{margin-top:80px;margin-bottom:30px}.radio label{margin-top:0}",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,".progressbarWrapper p{text-align:center;font-size:20px}.progressbar{background-color:hsla(0,0%,85%,.99);border-radius:13px;padding:0}@keyframes shimmer{0%{background-position:0 0}to{background-position:960px 0}}.progressbar>div{height:20px;border-radius:10px;background-color:orange;animation-duration:1.5s;animation-fill-mode:forwards;animation-iteration-count:infinite;animation-name:shimmer;animation-timing-function:linear;background:#f6f7f8;background:linear-gradient(90deg,orange 10%,#ffce77 25%,orange 40%);background-size:960px 50px;background-position:0;position:relative}",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,".summary td{text-align:right}.big{font-size:1.3em}.big,.summary table{width:80%}.price.profit{color:#7fff00}.price.loss{color:red}",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,".summary td{text-align:right}",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,"",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,"",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,"",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,".scan-btn{margin-top:80px;margin-bottom:30px}.radio label{margin-top:0}",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,".clickable{cursor:pointer}table.full{width:100%}table.full td{padding:.5rem 0}table.full.data th{text-align:left;padding:.5rem 0}.warning p{margin:0;padding:0}",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,"",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,".menu{display:flex;width:100%;flex-direction:row;margin-top:0;margin-bottom:2rem}.menu a{flex:1 1 100%;display:block;text-align:center;text-decoration:none;color:inherit}.menu .router-link-active{background-color:hsla(0,0%,98%,.99)}.menu a:hover{text-decoration:underline}",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,".contain{max-width:900px;margin-left:auto;margin-right:auto}",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,".spinner{margin:20px auto 100px;width:50px;height:40px;text-align:center;font-size:10px}.spinner>div{background-color:#333;height:100%;width:6px;display:inline-block;margin-right:4px;-webkit-animation:sk-stretchdelay 1.2s infinite ease-in-out;animation:sk-stretchdelay 1.2s infinite ease-in-out}.spinner .rect2{-webkit-animation-delay:-1.1s;animation-delay:-1.1s}.spinner .rect3{-webkit-animation-delay:-1s;animation-delay:-1s}.spinner .rect4{-webkit-animation-delay:-.9s;animation-delay:-.9s}.spinner .rect5{-webkit-animation-delay:-.8s;animation-delay:-.8s}@-webkit-keyframes sk-stretchdelay{0%,40%,to{-webkit-transform:scaleY(.4)}20%{-webkit-transform:scaleY(1)}}@keyframes sk-stretchdelay{0%,40%,to{transform:scaleY(.4);-webkit-transform:scaleY(.4)}20%{transform:scaleY(1);-webkit-transform:scaleY(1)}}",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,".radio label{margin-top:0}",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,"#app{display:flex;min-height:100vh;flex-direction:column}.fill{flex:1}.text{max-width:500px}input{background:none;margin-top:.5em}.params{min-height:235px;line-height:1.3em}.hr{margin-top:2rem;margin-bottom:2rem;height:10px;background-color:hsla(0,0%,98%,.99)}.btn--primary{display:inline-block;margin-right:12px;margin-bottom:12px;height:40px;padding:0 18px;border-radius:4px;text-shadow:0 1px 3px rgba(36,180,126,.4);box-shadow:0 4px 6px rgba(50,50,93,.11),0 1px 3px rgba(0,0,0,.08);line-height:40px;transition:transform .25s}.btn--primary,.btn--primary:hover{background-color:#3498db;color:#fff;text-decoration:none}.btn--primary:hover{transform:translateY(-1px);box-shadow:0 7px 14px rgba(50,50,93,.1),0 3px 6px rgba(0,0,0,.08)}.btn--primary:active,.btn--primary:focus{background-color:#3498db;color:#fff;text-decoration:none}.btn--primary:active{transform:translateY(1px)}",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,"table.clickable{border-collapse:separate}tr.clickable td:first-child{padding-left:5px}tr.clickable{cursor:pointer}tr.clickable:hover{background:hsla(0,0%,85%,.99)}",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,"td.radio{width:45px}td label{display:inline;font-size:1em}",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,"",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,"#modal-background{position:fixed;top:0;bottom:0;left:0;right:0;background-color:#000;opacity:.5}.modal{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);width:600px;min-height:300px;background-color:#fff}.modal-guts{position:absolute;top:0;left:0;width:100%;height:100%;padding:20px 50px 20px 20px;overflow:auto}",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,".align .custom-select select{padding:.4em 1.2em .3em .8em}.label-like{display:block;font-size:.9em;color:#777}.align{padding-left:1em}",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,"",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,".align .custom-select select{padding:.4em 1.2em .3em .8em}.label-like{display:block;font-size:.9em;color:#777}.align{padding-left:1em}",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,"",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,"",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,"",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,"",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,".roundtrips{margin-top:50px;margin-bottom:50px}.roundtrips table{width:100%}.roundtrips table td,.roundtrips table th{border:1px solid #c6cbd1;padding:8px 12px}.roundtrips table td.loss{color:red;text-align:right}.roundtrips table td.profit{color:green;text-align:right}.roundtrips table tr:nth-child(2n){background-color:#f6f8fa}",""])},function(t,e){t.exports={name:"gekko",version:"0.5.9",description:"A bitcoin trading bot for auto trading at various exchanges",keywords:["trading","bot","bitcoin","TA","finance"],scripts:{test:"./node_modules/.bin/mocha test/*.js --recursive test -u tdd --reporter spec",start:"node ./gekko --config config.js --ui"},author:"Mike van Rossum ",dependencies:{"@slack/client":"^3.10.0",async:"2.1.2",bitexthai:"^0.1.0","bitfinex-api-node":"^1.2.0",bitstamp:"^1.0.3",bitx:"^1.5.0","btc-china-fork":"0.0.6","btc-markets":"0.0.10",cexio:"0.0.x","co-fs":"^1.2.0",commander:"^2.9.0",gdax:"^0.4.2",gekko:"0.0.9","humanize-duration":"^3.10.0",koa:"^1.2.0","koa-bodyparser":"^2.2.0","koa-cors":"0.0.16","koa-logger":"^1.3.0","koa-router":"^5.4.0","koa-static":"^2.0.0","kraken-api-es5":"^1.0.0",lakebtc_nodejs:"0.1.x",lodash:"2.x",moment:"2.4.x","node-wex":"^1.0.3","node.bittrex.api":"^0.4.3","okcoin-china":"0.0.7",opn:"^4.0.2","poloniex.js":"0.0.7","promisify-node":"^0.4.0","prompt-lite":"0.1.1",pushbullet:"1.4.3",relieve:"^2.1.3",retry:"^0.10.1",semver:"2.2.1",sqlite3:"^3.1.8","stats-lite":"^2.0.4","tiny-promisify":"^0.1.1",toml:"^2.3.0",twitter:"^1.7.1","zaif.jp":"^0.1.4"},devDependencies:{chai:"^2.0.0",mocha:"^2.1.1",proxyquire:"^1.7.10",sinon:"^1.12.2"},engines:{node:">=6.0"},license:"MIT",repository:{type:"git",url:"https://github.com/askmike/gekko.git"}}},function(t,e){t.exports={name:"vue",version:"0.2.0",description:"The frontend for the Gekko UI",author:"Mike van Rossum ",scripts:{dev:"cross-env NODE_ENV=development webpack-dev-server --open --inline --hot",build:"cross-env NODE_ENV=production webpack --progress --hide-modules"},devDependencies:{"babel-core":"^6.0.0","babel-loader":"^6.0.0","babel-preset-es2015":"^6.0.0","cross-env":"^3.0.0","css-loader":"^0.25.0","file-loader":"^0.9.0","json-loader":"^0.5.4",marked:"^0.3.6",superagent:"^2.3.0","superagent-no-cache":"uditalias/superagent-no-cache",vue:"^2.0.1","vue-loader":"^9.7.0","vue-router":"^2.0.3",vuex:"^2.2.1",webpack:"^2.1.0-beta.25","webpack-dev-server":"^2.1.0-beta.0"},dependencies:{jade:"^1.11.0"}}},function(t,e,n){(function(e){(function(){function e(t){this.tokens=[],this.tokens.links={},this.options=t||l.defaults,this.rules=f.normal,this.options.gfm&&(this.options.tables?this.rules=f.tables:this.rules=f.gfm)}function n(t,e){if(this.options=e||l.defaults,this.links=t,this.rules=d.normal,this.renderer=this.options.renderer||new r,this.renderer.options=this.options,!this.links)throw new Error("Tokens array requires a `links` property.");this.options.gfm?this.options.breaks?this.rules=d.breaks:this.rules=d.gfm:this.options.pedantic&&(this.rules=d.pedantic)}function r(t){this.options=t||{}}function i(t){this.tokens=[],this.token=null,this.options=t||l.defaults,this.options.renderer=this.options.renderer||new r,this.renderer=this.options.renderer,this.renderer.options=this.options}function o(t,e){return t.replace(e?/&/g:/&(?!#?\w+;)/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function a(t){return t.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/g,function(t,e){return e=e.toLowerCase(),"colon"===e?":":"#"===e.charAt(0)?"x"===e.charAt(1)?String.fromCharCode(parseInt(e.substring(2),16)):String.fromCharCode(+e.substring(1)):""})}function s(t,e){return t=t.source,e=e||"",function n(r,i){return r?(i=i.source||i,i=i.replace(/(^|[^\[])\^/g,"$1"),t=t.replace(r,i),n):new RegExp(t,e)}}function u(){}function c(t){for(var e,n,r=1;rAn error occured:

"+o(t.message+"",!0)+"
";throw t}}var f={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:u,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:u,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,def:/^ *\[([^\]]+)\]: *]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:u,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};f.bullet=/(?:[*+-]|\d+\.)/,f.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/,f.item=s(f.item,"gm")(/bull/g,f.bullet)(),f.list=s(f.list)(/bull/g,f.bullet)("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def","\\n+(?="+f.def.source+")")(),f.blockquote=s(f.blockquote)("def",f.def)(),f._tag="(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b",f.html=s(f.html)("comment",//)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/])*?>/)(/tag/g,f._tag)(),f.paragraph=s(f.paragraph)("hr",f.hr)("heading",f.heading)("lheading",f.lheading)("blockquote",f.blockquote)("tag","<"+f._tag)("def",f.def)(),f.normal=c({},f),f.gfm=c({},f.normal,{fences:/^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\s*\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/}),f.gfm.paragraph=s(f.paragraph)("(?!","(?!"+f.gfm.fences.source.replace("\\1","\\2")+"|"+f.list.source.replace("\\1","\\3")+"|")(),f.tables=c({},f.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/}),e.rules=f,e.lex=function(t,n){return new e(n).lex(t)},e.prototype.lex=function(t){return t=t.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n"),this.token(t,!0)},e.prototype.token=function(t,e,n){for(var r,i,o,a,s,u,c,l,d,t=t.replace(/^ +$/gm,"");t;)if((o=this.rules.newline.exec(t))&&(t=t.substring(o[0].length),o[0].length>1&&this.tokens.push({type:"space"})),o=this.rules.code.exec(t))t=t.substring(o[0].length),o=o[0].replace(/^ {4}/gm,""),this.tokens.push({type:"code",text:this.options.pedantic?o:o.replace(/\n+$/,"")});else if(o=this.rules.fences.exec(t))t=t.substring(o[0].length),this.tokens.push({type:"code",lang:o[2],text:o[3]||""});else if(o=this.rules.heading.exec(t))t=t.substring(o[0].length),this.tokens.push({type:"heading",depth:o[1].length,text:o[2]});else if(e&&(o=this.rules.nptable.exec(t))){for(t=t.substring(o[0].length),u={type:"table",header:o[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:o[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:o[3].replace(/\n$/,"").split("\n")},l=0;l ?/gm,""),this.token(o,e,!0),this.tokens.push({type:"blockquote_end"});else if(o=this.rules.list.exec(t)){for(t=t.substring(o[0].length),a=o[2],this.tokens.push({type:"list_start",ordered:a.length>1}),o=o[0].match(this.rules.item),r=!1,d=o.length,l=0;l1&&s.length>1||(t=o.slice(l+1).join("\n")+t,l=d-1)),i=r||/\n\n(?!\s*$)/.test(u),l!==d-1&&(r="\n"===u.charAt(u.length-1),i||(i=r)),this.tokens.push({type:i?"loose_item_start":"list_item_start"}),this.token(u,!1,n),this.tokens.push({type:"list_item_end"});this.tokens.push({type:"list_end"})}else if(o=this.rules.html.exec(t))t=t.substring(o[0].length),this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:!this.options.sanitizer&&("pre"===o[1]||"script"===o[1]||"style"===o[1]),text:o[0]});else if(!n&&e&&(o=this.rules.def.exec(t)))t=t.substring(o[0].length),this.tokens.links[o[1].toLowerCase()]={href:o[2],title:o[3]};else if(e&&(o=this.rules.table.exec(t))){for(t=t.substring(o[0].length),u={type:"table",header:o[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:o[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:o[3].replace(/(?: *\| *)?\n$/,"").split("\n")},l=0;l])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:u,tag:/^|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:[^_]|__)+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:u,text:/^[\s\S]+?(?=[\\?(?:\s+['"]([\s\S]*?)['"])?\s*/,d.link=s(d.link)("inside",d._inside)("href",d._href)(),d.reflink=s(d.reflink)("inside",d._inside)(),d.normal=c({},d),d.pedantic=c({},d.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/}),d.gfm=c({},d.normal,{escape:s(d.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:s(d.text)("]|","~]|")("|","|https?://|")()}),d.breaks=c({},d.gfm,{br:s(d.br)("{2,}","*")(),text:s(d.gfm.text)("{2,}","*")()}),n.rules=d,n.output=function(t,e,r){return new n(e,r).output(t)},n.prototype.output=function(t){for(var e,n,r,i,a="";t;)if(i=this.rules.escape.exec(t))t=t.substring(i[0].length),a+=i[1];else if(i=this.rules.autolink.exec(t))t=t.substring(i[0].length),"@"===i[2]?(n=":"===i[1].charAt(6)?this.mangle(i[1].substring(7)):this.mangle(i[1]),r=this.mangle("mailto:")+n):(n=o(i[1]),r=n),a+=this.renderer.link(r,null,n);else if(this.inLink||!(i=this.rules.url.exec(t))){if(i=this.rules.tag.exec(t))!this.inLink&&/^/i.test(i[0])&&(this.inLink=!1),t=t.substring(i[0].length),a+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(i[0]):o(i[0]):i[0];else if(i=this.rules.link.exec(t))t=t.substring(i[0].length),this.inLink=!0,a+=this.outputLink(i,{href:i[2],title:i[3]}),this.inLink=!1;else if((i=this.rules.reflink.exec(t))||(i=this.rules.nolink.exec(t))){if(t=t.substring(i[0].length),e=(i[2]||i[1]).replace(/\s+/g," "),!(e=this.links[e.toLowerCase()])||!e.href){a+=i[0].charAt(0),t=i[0].substring(1)+t;continue}this.inLink=!0,a+=this.outputLink(i,e),this.inLink=!1}else if(i=this.rules.strong.exec(t))t=t.substring(i[0].length),a+=this.renderer.strong(this.output(i[2]||i[1]));else if(i=this.rules.em.exec(t))t=t.substring(i[0].length),a+=this.renderer.em(this.output(i[2]||i[1]));else if(i=this.rules.code.exec(t))t=t.substring(i[0].length),a+=this.renderer.codespan(o(i[2],!0));else if(i=this.rules.br.exec(t))t=t.substring(i[0].length),a+=this.renderer.br();else if(i=this.rules.del.exec(t))t=t.substring(i[0].length),a+=this.renderer.del(this.output(i[1]));else if(i=this.rules.text.exec(t))t=t.substring(i[0].length),a+=this.renderer.text(o(this.smartypants(i[0])));else if(t)throw new Error("Infinite loop on byte: "+t.charCodeAt(0))}else t=t.substring(i[0].length),n=o(i[1]),r=n,a+=this.renderer.link(r,null,n);return a},n.prototype.outputLink=function(t,e){var n=o(e.href),r=e.title?o(e.title):null;return"!"!==t[0].charAt(0)?this.renderer.link(n,r,this.output(t[1])):this.renderer.image(n,r,o(t[1]))},n.prototype.smartypants=function(t){return this.options.smartypants?t.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014\/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014\/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…"):t},n.prototype.mangle=function(t){if(!this.options.mangle)return t;for(var e,n="",r=t.length,i=0;i.5&&(e="x"+e.toString(16)),n+="&#"+e+";";return n},r.prototype.code=function(t,e,n){if(this.options.highlight){var r=this.options.highlight(t,e);null!=r&&r!==t&&(n=!0,t=r)}return e?'
'+(n?t:o(t,!0))+"\n
\n":"
"+(n?t:o(t,!0))+"\n
"},r.prototype.blockquote=function(t){return"
\n"+t+"
\n"},r.prototype.html=function(t){return t},r.prototype.heading=function(t,e,n){return"'+t+"\n"},r.prototype.hr=function(){return this.options.xhtml?"
\n":"
\n"},r.prototype.list=function(t,e){var n=e?"ol":"ul";return"<"+n+">\n"+t+"\n"},r.prototype.listitem=function(t){return"
  • "+t+"
  • \n"},r.prototype.paragraph=function(t){return"

    "+t+"

    \n"},r.prototype.table=function(t,e){return"\n\n"+t+"\n\n"+e+"\n
    \n"},r.prototype.tablerow=function(t){return"\n"+t+"\n"},r.prototype.tablecell=function(t,e){var n=e.header?"th":"td";return(e.align?"<"+n+' style="text-align:'+e.align+'">':"<"+n+">")+t+"\n"},r.prototype.strong=function(t){return""+t+""},r.prototype.em=function(t){return""+t+""},r.prototype.codespan=function(t){return""+t+""},r.prototype.br=function(){return this.options.xhtml?"
    ":"
    "},r.prototype.del=function(t){return""+t+""},r.prototype.link=function(t,e,n){if(this.options.sanitize){try{var r=decodeURIComponent(a(t)).replace(/[^\w:]/g,"").toLowerCase()}catch(t){return""}if(0===r.indexOf("javascript:")||0===r.indexOf("vbscript:"))return""}var i='
    "},r.prototype.image=function(t,e,n){var r=''+n+'":">"},r.prototype.text=function(t){return t},i.parse=function(t,e,n){return new i(e,n).parse(t)},i.prototype.parse=function(t){this.inline=new n(t.links,this.options,this.renderer),this.tokens=t.reverse();for(var e="";this.next();)e+=this.tok();return e},i.prototype.next=function(){return this.token=this.tokens.pop()},i.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},i.prototype.parseText=function(){for(var t=this.token.text;"text"===this.peek().type;)t+="\n"+this.next().text;return this.inline.output(t)},i.prototype.tok=function(){switch(this.token.type){case"space":return"";case"hr":return this.renderer.hr();case"heading":return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,this.token.text);case"code":return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);case"table":var t,e,n,r,i="",o="";for(n="",t=0;t=300)&&(r=new Error(e.statusText||"Unsuccessful HTTP response"),r.original=t,r.response=e,r.status=e.status)}catch(t){r=t}r?n.callback(r,e):n.callback(null,e)})}function p(t,e){var n=_("DELETE",t);return e&&n.end(e),n}var h;"undefined"!=typeof window?h=window:"undefined"!=typeof self?h=self:(console.warn("Using browser-only version of superagent in non-browser environment"),h=this);var v=n(82),m=n(117),g=n(15),_=t.exports=n(118).bind(null,d);_.getXHR=function(){if(!(!h.XMLHttpRequest||h.location&&"file:"==h.location.protocol&&h.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(t){}throw Error("Browser-only verison of superagent could not find XHR")};var y="".trim?function(t){return t.trim()}:function(t){return t.replace(/(^\s*|\s*$)/g,"")};_.serializeObject=i,_.parseString=a,_.types={html:"text/html",json:"application/json",xml:"application/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},_.serialize={"application/x-www-form-urlencoded":i,"application/json":JSON.stringify},_.parse={"application/x-www-form-urlencoded":a,"application/json":JSON.parse},f.prototype.get=function(t){return this.header[t.toLowerCase()]},f.prototype._setHeaderProperties=function(t){var e=this.header["content-type"]||"";this.type=c(e);var n=l(e);for(var r in n)this[r]=n[r]},f.prototype._parseBody=function(t){var e=_.parse[this.type];return!e&&u(this.type)&&(e=_.parse["application/json"]),e&&t&&(t.length||t instanceof Object)?e(t):null},f.prototype._setStatusProperties=function(t){1223===t&&(t=204);var e=t/100|0;this.status=this.statusCode=t,this.statusType=e,this.info=1==e,this.ok=2==e,this.clientError=4==e,this.serverError=5==e,this.error=(4==e||5==e)&&this.toError(),this.accepted=202==t,this.noContent=204==t,this.badRequest=400==t,this.unauthorized=401==t,this.notAcceptable=406==t,this.notFound=404==t,this.forbidden=403==t},f.prototype.toError=function(){var t=this.req,e=t.method,n=t.url,r="cannot "+e+" "+n+" ("+this.status+")",i=new Error(r);return i.status=this.status,i.method=e,i.url=n,i},_.Response=f,v(d.prototype);for(var b in m)d.prototype[b]=m[b];d.prototype.type=function(t){return this.set("Content-Type",_.types[t]||t),this},d.prototype.responseType=function(t){return this._responseType=t,this},d.prototype.accept=function(t){return this.set("Accept",_.types[t]||t),this},d.prototype.auth=function(t,e,n){switch(n||(n={type:"basic"}),n.type){case"basic":var r=btoa(t+":"+e);this.set("Authorization","Basic "+r);break;case"auto":this.username=t,this.password=e}return this},d.prototype.query=function(t){return"string"!=typeof t&&(t=i(t)),t&&this._query.push(t),this},d.prototype.attach=function(t,e,n){return this._getFormData().append(t,e,n||e.name),this},d.prototype._getFormData=function(){return this._formData||(this._formData=new h.FormData),this._formData},d.prototype.callback=function(t,e){var n=this._callback;this.clearTimeout(),n(t,e)},d.prototype.crossDomainError=function(){var t=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");t.crossDomain=!0,t.status=this.status,t.method=this.method,t.url=this.url,this.callback(t)},d.prototype._timeoutError=function(){var t=this._timeout,e=new Error("timeout of "+t+"ms exceeded");e.timeout=t,this.callback(e)},d.prototype._appendQueryString=function(){var t=this._query.join("&");t&&(this.url+=~this.url.indexOf("?")?"&"+t:"?"+t)},d.prototype.end=function(t){var e=this,n=this.xhr=_.getXHR(),i=this._timeout,o=this._formData||this._data;this._callback=t||r,n.onreadystatechange=function(){if(4==n.readyState){var t;try{t=n.status}catch(e){t=0}if(0==t){if(e.timedout)return e._timeoutError();if(e._aborted)return;return e.crossDomainError()}e.emit("end")}};var a=function(t,n){n.total>0&&(n.percent=n.loaded/n.total*100),n.direction=t,e.emit("progress",n)};if(this.hasListeners("progress"))try{n.onprogress=a.bind(null,"download"),n.upload&&(n.upload.onprogress=a.bind(null,"upload"))}catch(t){}if(i&&!this._timer&&(this._timer=setTimeout(function(){e.timedout=!0,e.abort()},i)),this._appendQueryString(),this.username&&this.password?n.open(this.method,this.url,!0,this.username,this.password):n.open(this.method,this.url,!0),this._withCredentials&&(n.withCredentials=!0),"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof o&&!this._isHost(o)){var s=this._header["content-type"],c=this._serializer||_.serialize[s?s.split(";")[0]:""];!c&&u(s)&&(c=_.serialize["application/json"]),c&&(o=c(o))}for(var l in this.header)null!=this.header[l]&&n.setRequestHeader(l,this.header[l]);return this._responseType&&(n.responseType=this._responseType),this.emit("request",this),n.send(void 0!==o?o:null),this},_.Request=d,_.get=function(t,e,n){var r=_("GET",t);return"function"==typeof e&&(n=e,e=null),e&&r.query(e),n&&r.end(n),r},_.head=function(t,e,n){var r=_("HEAD",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},_.options=function(t,e,n){var r=_("OPTIONS",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},_.del=p,_.delete=p,_.patch=function(t,e,n){var r=_("PATCH",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},_.post=function(t,e,n){var r=_("POST",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},_.put=function(t,e,n){var r=_("PUT",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r}},function(t,e,n){var r=n(15);e.clearTimeout=function(){return this._timeout=0,clearTimeout(this._timer),this},e.parse=function(t){return this._parser=t,this},e.serialize=function(t){return this._serializer=t,this},e.timeout=function(t){return this._timeout=t,this},e.then=function(t,e){if(!this._fullfilledPromise){var n=this;this._fullfilledPromise=new Promise(function(t,e){n.end(function(n,r){n?e(n):t(r)})})}return this._fullfilledPromise.then(t,e)},e.catch=function(t){return this.then(void 0,t)},e.use=function(t){return t(this),this},e.get=function(t){return this._header[t.toLowerCase()]},e.getHeader=e.get,e.set=function(t,e){if(r(t)){for(var n in t)this.set(n,t[n]);return this}return this._header[t.toLowerCase()]=e,this.header[t]=e,this},e.unset=function(t){return delete this._header[t.toLowerCase()],delete this.header[t],this},e.field=function(t,e){if(null===t||void 0===t)throw new Error(".field(name, val) name can not be empty");if(r(t)){for(var n in t)this.field(n,t[n]);return this}if(null===e||void 0===e)throw new Error(".field(name, val) val can not be empty");return this._getFormData().append(t,e),this},e.abort=function(){return this._aborted?this:(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort"),this)},e.withCredentials=function(){return this._withCredentials=!0,this},e.redirects=function(t){return this._maxRedirects=t,this},e.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},e._isHost=function(t){switch({}.toString.call(t)){case"[object File]":case"[object Blob]":case"[object FormData]":return!0;default:return!1}},e.send=function(t){var e=r(t),n=this._header["content-type"];if(e&&r(this._data))for(var i in t)this._data[i]=t[i];else"string"==typeof t?(n||this.type("form"),n=this._header["content-type"],this._data="application/x-www-form-urlencoded"==n?this._data?this._data+"&"+t:t:(this._data||"")+t):this._data=t;return!e||this._isHost(t)?this:(n||this.type("json"),this)}},function(t,e){function n(t,e,n){return"function"==typeof n?new t("GET",e).end(n):2==arguments.length?new t("GET",e):new t(e,n)}t.exports=n},function(t,e,n){var r,i;n(191),r=n(36);var o=n(163);i=r=r||{},"object"!=typeof r.default&&"function"!=typeof r.default||(i=r=r.default),"function"==typeof i&&(i=i.options),i.render=o.render,i.staticRenderFns=o.staticRenderFns,t.exports=r},function(t,e,n){var r,i;n(170),r=n(39);var o=n(140);i=r=r||{},"object"!=typeof r.default&&"function"!=typeof r.default||(i=r=r.default),"function"==typeof i&&(i=i.options),i.render=o.render,i.staticRenderFns=o.staticRenderFns,t.exports=r},function(t,e,n){var r,i;n(169),r=n(41);var o=n(139);i=r=r||{},"object"!=typeof r.default&&"function"!=typeof r.default||(i=r=r.default),"function"==typeof i&&(i=i.options),i.render=o.render,i.staticRenderFns=o.staticRenderFns,t.exports=r},function(t,e,n){var r,i;n(189),r=n(42);var o=n(161);i=r=r||{},"object"!=typeof r.default&&"function"!=typeof r.default||(i=r=r.default),"function"==typeof i&&(i=i.options),i.render=o.render,i.staticRenderFns=o.staticRenderFns,t.exports=r},function(t,e,n){var r,i;n(175),r=n(45);var o=n(145);i=r=r||{},"object"!=typeof r.default&&"function"!=typeof r.default||(i=r=r.default),"function"==typeof i&&(i=i.options),i.render=o.render,i.staticRenderFns=o.staticRenderFns,t.exports=r},function(t,e,n){var r,i;n(190),r=n(48);var o=n(162);i=r=r||{},"object"!=typeof r.default&&"function"!=typeof r.default||(i=r=r.default),"function"==typeof i&&(i=i.options),i.render=o.render,i.staticRenderFns=o.staticRenderFns,t.exports=r},function(t,e,n){var r,i;n(182),r=n(54);var o=n(154);i=r=r||{},"object"!=typeof r.default&&"function"!=typeof r.default||(i=r=r.default),"function"==typeof i&&(i=i.options),i.render=o.render,i.staticRenderFns=o.staticRenderFns,t.exports=r},function(t,e,n){var r,i;r=n(55);var o=n(151);i=r=r||{},"object"!=typeof r.default&&"function"!=typeof r.default||(i=r=r.default),"function"==typeof i&&(i=i.options),i.render=o.render,i.staticRenderFns=o.staticRenderFns,t.exports=r},function(t,e,n){var r,i;n(179),r=n(61);var o=n(150);i=r=r||{},"object"!=typeof r.default&&"function"!=typeof r.default||(i=r=r.default),"function"==typeof i&&(i=i.options),i.render=o.render,i.staticRenderFns=o.staticRenderFns,t.exports=r},function(t,e,n){var r,i;n(167),r=n(63);var o=n(134);i=r=r||{},"object"!=typeof r.default&&"function"!=typeof r.default||(i=r=r.default),"function"==typeof i&&(i=i.options),i.render=o.render,i.staticRenderFns=o.staticRenderFns,t.exports=r},function(t,e,n){var r,i;r=n(64);var o=n(138);i=r=r||{},"object"!=typeof r.default&&"function"!=typeof r.default||(i=r=r.default),"function"==typeof i&&(i=i.options),i.render=o.render,i.staticRenderFns=o.staticRenderFns,t.exports=r},function(t,e,n){var r,i;n(176),r=n(65);var o=n(146);i=r=r||{},"object"!=typeof r.default&&"function"!=typeof r.default||(i=r=r.default),"function"==typeof i&&(i=i.options),i.render=o.render,i.staticRenderFns=o.staticRenderFns,t.exports=r},function(t,e,n){var r,i;n(184),r=n(67);var o=n(156);i=r=r||{},"object"!=typeof r.default&&"function"!=typeof r.default||(i=r=r.default),"function"==typeof i&&(i=i.options),i.render=o.render,i.staticRenderFns=o.staticRenderFns,t.exports=r},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{class:{clickable:!t.isClicked},attrs:{id:"chartWrapper"}},[n("div",{staticClass:"shield",on:{click:function(e){e.preventDefault(),t.click(e)}}}),n("svg",{attrs:{id:"chart",width:"960",height:t.height}})])},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("h3",[t._v("Daterange")]),n("div",[n("label",{attrs:{for:"from"}},[t._v("From")]),n("input",{directives:[{name:"model",rawName:"v-model",value:t.from,expression:"from"}],domProps:{value:t.from},on:{input:function(e){e.target.composing||(t.from=e.target.value)}}})]),n("div",[n("label",{attrs:{for:"to"}},[t._v("To")]),n("input",{directives:[{name:"model",rawName:"v-model",value:t.to,expression:"to"}],domProps:{value:t.to},on:{input:function(e){e.target.composing||(t.to=e.target.value)}}})])])},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return t.progress?n("div",{staticClass:"progressbarWrapper"},[n("p",[n("strong",[t._v(t._s(t.round(t.progress))+"%")])]),n("div",{staticClass:"progressbar"},[n("div",{style:{width:t.progress+"%"}})])]):t._e()},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("div",{staticClass:"mx1"},[n("label",{staticClass:"wrapper",attrs:{for:"exchange"}},[t._v("Exchange:")]),n("div",{staticClass:"custom-select button"},[n("select",{directives:[{name:"model",rawName:"v-model",value:t.exchange,expression:"exchange"}],on:{change:function(e){var n=Array.prototype.filter.call(e.target.options,function(t){return t.selected}).map(function(t){return"_value"in t?t._value:t.value});t.exchange=e.target.multiple?n:n[0]}}},t._l(t.exchanges,function(e,r){return n("option",[t._v(t._s(r))])}))])]),n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-3-6 mx1"},[n("label",{attrs:{for:"currency"}},[t._v("Currency:")]),n("div",{staticClass:"custom-select button"},[n("select",{directives:[{name:"model",rawName:"v-model",value:t.currency,expression:"currency"}],on:{change:function(e){var n=Array.prototype.filter.call(e.target.options,function(t){return t.selected}).map(function(t){return"_value"in t?t._value:t.value});t.currency=e.target.multiple?n:n[0]}}},t._l(t.currencies,function(e){return n("option",[t._v(t._s(e))])}))])]),n("div",{staticClass:"grd-row-col-3-6 mx1"},[n("label",{attrs:{for:"asset"}},[t._v("Asset:")]),n("div",{staticClass:"custom-select button"},[n("select",{directives:[{name:"model",rawName:"v-model",value:t.asset,expression:"asset"}],on:{change:function(e){var n=Array.prototype.filter.call(e.target.options,function(t){return t.selected}).map(function(t){return"_value"in t?t._value:t.value});t.asset=e.target.multiple?n:n[0]}}},t._l(t.assets,function(e){return n("option",[t._v(t._s(e))])}))])])])])},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"grd-row-col-3-6"},[n("table",{staticClass:"p1"},[n("tr",[n("th",[t._v("amount of trades")]),n("td",[t._v(t._s(t.report.trades))])]),n("tr",[n("th",[t._v("sharpe ratio")]),n("td",[t._v(t._s(t.round2(t.report.sharpe)))])]),n("tr",[n("th",[t._v("start balance")]),n("td",[t._v(t._s(t.round(t.report.startBalance))+" "+t._s(t.report.currency))])]),n("tr",[n("th",[t._v("final balance")]),n("td",[t._v(t._s(t.round(t.report.balance))+" "+t._s(t.report.currency))])]),t._m(0)]),n("div",{staticClass:"big txt--right price",class:t.profitClass},[t._v(t._s(t.round(t.report.relativeProfit))+"%")])])},staticRenderFns:[function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("tr",[n("th",[t._v("simulated profit")])])}]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"contain"},[n("h2",[t._v("Config")]),n("div",{staticClass:"hr"}),n("h3",[t._v("Available API keys")]),t.apiKeySets.length?t._e():n("p",[n("em",[t._v("You don't have any API keys yet.")])]),n("ul",t._l(t.apiKeySets,function(e){return n("li",[t._v(t._s(e)+" ("),n("a",{attrs:{href:"#"},on:{click:function(n){n.preventDefault(),t.removeApiKey(e)}}},[t._v("remove")]),t._v(")")])})),t.addApiToggle?t._e():n("a",{staticClass:"btn--primary",attrs:{href:"#"},on:{click:function(e){e.preventDefault(),t.openAddApi(e)}}},[t._v("Add an API key")]),t.addApiToggle?[n("div",{staticClass:"hr"}),n("apiConfigBuilder")]:t._e(),n("div",{staticClass:"hr"})],2)},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("footer",{staticClass:"p2 bg--off-white"},[n("div",{staticClass:"contain"},[t._m(0),n("p",[t._v("Using Gekko v"+t._s(t.version.gekko)+" and Gekko UI v"+t._s(t.version.ui)+".")])])])},staticRenderFns:[function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("p",[n("em",[t._v("Use Gekko at your own risk.")])])}]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"contain"},[n("div",{staticClass:"grd-row summary"},[n("div",{staticClass:"grd-row-col-3-6"},[n("table",{staticClass:"p1"},[n("tr",[n("th",[t._v("start time")]),n("td",[t._v(t._s(t.report.startTime))])]),n("tr",[n("th",[t._v("end time")]),n("td",[t._v(t._s(t.report.endTime))])]),n("tr",[n("th",[t._v("timespan")]),n("td",[t._v(t._s(t.report.timespan))])]),n("tr",[n("th",[t._v("start price")]),n("td",[t._v(t._s(t.round(t.report.startPrice))+" "+t._s(t.report.currency))])]),n("tr",[n("th",[t._v("end price")]),n("td",[t._v(t._s(t.round(t.report.endPrice))+" "+t._s(t.report.currency))])]),n("tr",[n("th",[t._v("market")]),n("td",[t._v(t._s(t.round(t.report.market))+"%")])])])]),n("paperTradeSummary",{attrs:{report:t.report}})],1)])},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("div",{staticClass:"hr contain"}),t._m(0),n("result-summary",{attrs:{report:t.result.report}}),n("div",{staticClass:"hr contain"}),n("chart",{attrs:{data:t.result,height:"500"}}),n("div",{staticClass:"hr contain"}),n("roundtripTable",{attrs:{roundtrips:t.result.roundtrips}})],1)},staticRenderFns:[function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"contain"},[n("h3",[t._v("Backtest result")])])}]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"contain my2"},[n("h3",[t._v("Start a new gekko")]),n("gekko-config-builder",{on:{config:t.updateConfig}}),n("div",{staticClass:"hr"}),t.config.valid?n("div",{staticClass:"txt--center"},[n("a",{staticClass:"w100--s my1 btn--primary",attrs:{href:"#"},on:{click:function(e){e.preventDefault(),t.start(e)}}},[t._v("Start")])]):t._e()],1)},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"contain my2"},[n("div",{staticClass:"text",domProps:{innerHTML:t._s(t.intro)}}),n("div",{staticClass:"hr"}),n("h3",[t._v("Currently running imports")]),0===t.imports.length?n("p",[t._v("You currently don't have any imports running.")]):t._e(),t.imports.length?n("ul",t._l(t.imports,function(e){return n("li",[n("router-link",{attrs:{to:"/data/importer/import/"+e.id}},[t._v(t._s(e.watch.exchange)+":"+t._s(e.watch.currency)+"/"+t._s(e.watch.asset))])],1)})):t._e(),n("div",{staticClass:"hr"}),n("h3",[t._v("Start a new import")]),n("import-config-builder",{on:{config:t.updateConfig}}),n("div",{staticClass:"hr"}),n("div",{staticClass:"txt--center"},[n("a",{staticClass:"w100--s my1 btn--primary",attrs:{href:"#"},on:{click:function(e){e.preventDefault(),t.run(e)}}},[t._v("Import")])])],1)},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("h3",[t._v("Daterange")]),"scan"===t.tab?[t.scanned?t._e():n("div",{staticClass:"txt--center"},[n("a",{staticClass:"w100--s btn--primary scan-btn",attrs:{href:"#"},on:{click:function(e){e.preventDefault(),t.scan(e)}}},[t._v("Scan available data")])]),"fetching"==t.scanned?n("div",{staticClass:"txt--center"},[n("p",{staticClass:"scan-btn"},[t._v("Scanning..")])]):t._e(),1==t.scanned?[0===t.ranges.length?[n("p",[n("strong",[t._v('Unable to find any local data, do you have local data available for\n"'+t._s(t.config.watch.exchange)+":"+t._s(t.config.watch.currency)+"/"+t._s(t.config.watch.asset)+'"?')])])]:[n("label",{staticClass:"wrapper",attrs:{for:"exchange"}},[t._v("Run simulation over:")]),n("form",{staticClass:"radio grd"},t._l(t.ranges,function(e,r){return n("div",{staticClass:"grd-row m1"},[n("input",{directives:[{name:"model",rawName:"v-model",value:t.selectedRangeIndex,expression:"selectedRangeIndex"}],staticClass:"grd-row-col-1-6",attrs:{type:"radio"},domProps:{value:r,checked:t._q(t.selectedRangeIndex,r)},on:{__c:function(e){t.selectedRangeIndex=r}}}),n("label",{staticClass:"grd-row-col-5-6",attrs:{for:r}},[t._v(t._s(t.printRange(e)))])])}))],n("p",[n("em",[n("a",{attrs:{href:"#"},on:{click:function(e){e.preventDefault(),t.scan(e)}}},[t._v("rescan")])])])]:t._e(),n("p",{staticClass:"txt--center"},[n("em",[n("a",{attrs:{href:"#"},on:{click:function(e){e.preventDefault(),t.tab="manual"}}},[t._v("Or manually set a daterange")])])])]:t._e(),"manual"===t.tab?[n("div",[n("label",{attrs:{for:"from"}},[t._v("From:")]),n("input",{directives:[{name:"model",rawName:"v-model",value:t.from,expression:"from"}],domProps:{value:t.from},on:{input:function(e){e.target.composing||(t.from=e.target.value)}}})]),n("div",[n("label",{attrs:{for:"to"}},[t._v("To:")]),n("input",{directives:[{name:"model",rawName:"v-model",value:t.to,expression:"to"}],domProps:{value:t.to},on:{input:function(e){e.target.composing||(t.to=e.target.value)}}})]),n("p",{staticClass:"txt--center"}),n("em",[n("a",{attrs:{href:"#"},on:{click:function(e){e.preventDefault(),t.tab="scan"}}},[t._v("Or scan for a daterange")])])]:t._e()],2)},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"contain"},[n("div",{staticClass:"text",domProps:{innerHTML:t._s(t.intro)}}),n("div",{staticClass:"hr"}),n("h2",[t._v("Available datasets")]),"idle"===t.datasetScanstate?n("div",{staticClass:"txt--center my2"},[n("a",{staticClass:"w100--s btn--primary scan-btn",attrs:{href:"#"},on:{click:function(e){e.preventDefault(),t.scan(e)}}},[t._v("Scan available data")])]):t._e(),"scanning"===t.datasetScanstate?n("div",{staticClass:"txt--center my2"},[n("spinner")],1):t._e(),"scanned"===t.datasetScanstate?n("div",{staticClass:"my2"},[t.unscannableMakets.length?n("div",{staticClass:"bg--orange p1 warning my1"},[t.viewUnscannable?t._e():n("p",{staticClass:"clickable",on:{click:function(e){e.preventDefault(),t.toggleUnscannable(e)}}},[t._v("Some markets were unscannable, click here for details.")]),t.viewUnscannable?[n("p",[t._v("Unable to find datasets in the following markets:")]),t._l(t.unscannableMakets,function(e){return n("div",{staticClass:"mx2"},[t._v("- "+t._s(e.exchange)+":"+t._s(e.currency)+":"+t._s(e.asset))])})]:t._e()],2):t._e(),t.datasets.length?[n("table",{staticClass:"full data"},[t._m(0),n("tbody",t._l(t.datasets,function(e){return n("tr",[n("td",[t._v(t._s(e.exchange))]),n("td",[t._v(t._s(e.currency))]),n("td",[t._v(t._s(e.asset))]),n("td",[t._v(t._s(t.fmt(e.from)))]),n("td",[t._v(t._s(t.fmt(e.to)))]),n("td",[t._v(t._s(t.humanizeDuration(e.to.diff(e.from))))])])}))])]:t._e(),t.datasets.length?t._e():[n("p",[t._v("It looks like you don't have any local data yet.")])]],2):t._e(),n("div",{staticClass:"my2"},[n("h2",[t._v("Import more data")]),n("p",{staticClass:"text"},[t._v("You can easily import more market data directly from exchanges using the importer.")]),n("router-link",{staticClass:"btn--primary",attrs:{to:"/data/importer"}},[t._v("Go to the importer!")])],1)])},staticRenderFns:[function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("thead",[n("tr",[n("th",[t._v("exchange")]),n("th",[t._v("currency")]),n("th",[t._v("asset")]),n("th",[t._v("from")]),n("th",[t._v("to")]),n("th",[t._v("duration")])])])}]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"grd contain"},[n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-3-6 mx1"},[n("h3",[t._v("Market")]),n("market-picker",{staticClass:"contain",attrs:{"only-importable":"true"},on:{market:t.updateMarketConfig}})],1),n("div",{staticClass:"grd-row-col-3-6 mx1"},[n("range-creator",{on:{range:t.updateRange}})],1)])])},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("div",{attrs:{id:"top"}}),t._m(0),n("nav",{staticClass:"bg--light-gray"},[n("div",{staticClass:"menu contain"},[n("router-link",{staticClass:"py1",attrs:{to:"/home"}},[t._v("Home")]),n("router-link",{staticClass:"py1",attrs:{to:"/live-gekkos"}},[t._v("Live Gekkos")]),n("router-link",{staticClass:"py1",attrs:{to:"/backtest"}},[t._v("Backtest")]),n("router-link",{staticClass:"py1",attrs:{to:"/data"}},[t._v("Local data")]),n("router-link",{staticClass:"py1",attrs:{to:"/config"}},[t._v("Config")]),n("a",{staticClass:"py1",attrs:{href:"https://gekko.wizb.it/docs/introduction/about_gekko.html",target:"_blank"}},[t._v("Documentation")])],1)])])},staticRenderFns:[function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("header",{staticClass:"bg--off-white grd"},[n("div",{staticClass:"contain grd-row"},[n("h3",{staticClass:"py1 px2 col-2"},[t._v("Gekko UI")])])])}]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("section",{staticClass:"contain grd-row"},[n("div",{staticClass:"grd-row-col-3-6",domProps:{innerHTML:t._s(t.left)}}),t._m(0)])},staticRenderFns:[function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"grd-row-col-3-6 txt--center"},[n("img",{attrs:{src:"/assets/gekko.jpg"}}),n("p",[n("em",[t._v("The most valuable commodity I know of is information.")])])])}]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("h2",{staticClass:"contain"},[t._v("Backtest")]),n("div",{staticClass:"hr contain"}),n("config-builder",{on:{config:t.check}}),t.backtestable?n("div",[n("div",{staticClass:"txt--center"},["fetching"!==t.backtestState?n("a",{staticClass:"w100--s my1 btn--primary",attrs:{href:"#"},on:{click:function(e){e.preventDefault(),t.run(e)}}},[t._v("Backtest")]):t._e(),"fetching"===t.backtestState?n("div",{staticClass:"scan-btn"},[n("p",[t._v("Running backtest..")]),n("spinner")],1):t._e()])]):t._e(),t.backtestResult&&"fetched"===t.backtestState?n("result",{attrs:{result:t.backtestResult}}):t._e()],1)},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement;t._self._c;return t._m(0)},staticRenderFns:[function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"spinner"},[n("div",{staticClass:"rect1"}),n("div",{staticClass:"rect2"}),n("div",{staticClass:"rect3"}),n("div",{staticClass:"rect4"})])}]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("h3",[t._v("Type")]),[n("label",{staticClass:"wrapper",attrs:{for:"type"}},[t._v("What do you want to do with gekko?")]),n("form",{staticClass:"radio grd"},t._l(t.types,function(e,r){return n("div",{staticClass:"grd-row m1"},[n("input",{directives:[{name:"model",rawName:"v-model",value:t.selectedTypeIndex,expression:"selectedTypeIndex"}],staticClass:"grd-row-col-1-6",attrs:{type:"radio"},domProps:{value:r,checked:t._q(t.selectedTypeIndex,r)},on:{__c:function(e){t.selectedTypeIndex=r}}}),n("label",{staticClass:"grd-row-col-5-6",attrs:{for:r}},[t._v(t._s(e))])])}))]],2)},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("div",{staticClass:"mx1"},[n("label",{staticClass:"wrapper",attrs:{for:"exchange"}},[t._v("Exchange:")]),n("div",{staticClass:"custom-select button"},[n("select",{directives:[{name:"model",rawName:"v-model",value:t.exchange,expression:"exchange"}],on:{change:function(e){var n=Array.prototype.filter.call(e.target.options,function(t){return t.selected}).map(function(t){return"_value"in t?t._value:t.value});t.exchange=e.target.multiple?n:n[0]}}},t._l(t.exchanges,function(e,r){return n("option",[t._v(t._s(r))])}))])])])},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{attrs:{id:"app"}},[n("top"),n("div",{staticClass:"fill"},[n("router-view",{staticClass:"view"})],1),n("bottom"),n("modal")],1)},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"contain py2"},[n("div",{staticClass:"text",domProps:{innerHTML:t._s(t.text)}}),n("div",{staticClass:"hr"}),n("h3",[t._v("Market watchers")]),t.watchers.length?t._e():n("div",{staticClass:"text"},[n("p",[t._v("You are currently not watching any markets.")])]),t.watchers.length?n("table",{staticClass:"full clickable"},[t._m(0),n("tbody",t._l(t.watchers,function(e){return n("tr",{staticClass:"clickable",on:{click:function(n){t.$router.push({path:"live-gekkos/watcher/"+e.id})}}},[n("td",[t._v(t._s(e.watch.exchange))]),n("td",[t._v(t._s(e.watch.currency))]),n("td",[t._v(t._s(e.watch.asset))]),n("td",[e.firstCandle?[t._v(t._s(t.fmt(e.firstCandle.start)))]:t._e()],2),n("td",[e.lastCandle?[t._v(t._s(t.fmt(e.lastCandle.start)))]:t._e()],2),n("td",[e.firstCandle&&e.lastCandle?[t._v(t._s(t.timespan(e.lastCandle.start,e.firstCandle.start)))]:t._e()],2)])}))]):t._e(),n("h3",[t._v("Strat runners")]),t.stratrunners.length?t._e():n("div",{staticClass:"text"},[n("p",[t._v("You are currently not running any strategies.")])]),t.stratrunners.length?n("table",{staticClass:"full"},[t._m(1),n("tbody",t._l(t.stratrunners,function(e){return n("tr",{staticClass:"clickable",on:{click:function(n){t.$router.push({path:"live-gekkos/stratrunner/"+e.id})}}},[n("td",[t._v(t._s(e.watch.exchange))]),n("td",[t._v(t._s(e.watch.currency))]),n("td",[t._v(t._s(e.watch.asset))]),n("td",[e.lastCandle?[t._v(t._s(t.fmt(e.lastCandle.start)))]:t._e()],2),n("td",[e.firstCandle&&e.lastCandle?[t._v(t._s(t.timespan(e.lastCandle.start,e.firstCandle.start)))]:t._e()],2),n("td",[t._v(t._s(e.strat.name))]),n("td",[e.report?t._e():[t._v("0")],e.report?[t._v(t._s(t.round(e.report.profit))+" "+t._s(e.watch.currency))]:t._e()],2)])}))]):t._e(),n("div",{staticClass:"hr"}),n("h2",[t._v("Start a new live Gekko")]),n("router-link",{staticClass:"btn--primary",attrs:{to:"/live-gekkos/new"}},[t._v("Start a new live Gekko!")])],1)},staticRenderFns:[function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("thead",[n("tr",[n("th",[t._v("exchange")]),n("th",[t._v("currency")]),n("th",[t._v("asset")]),n("th",[t._v("started at")]),n("th",[t._v("last update")]),n("th",[t._v("duration")])])])},function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("thead",[n("tr",[n("th",[t._v("exchange")]),n("th",[t._v("currency")]),n("th",[t._v("asset")]),n("th",[t._v("last update")]),n("th",[t._v("duration")]),n("th",[t._v("strategy")]),n("th",[t._v("profit")])])])}]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("h3",[t._v("Select a dataset")]),"idle"===t.datasetScanstate?n("div",{staticClass:"txt--center my2"},[n("a",{staticClass:"w100--s btn--primary scan-btn",attrs:{href:"#"},on:{click:function(e){e.preventDefault(),t.scan(e)}}},[t._v("Scan available data")])]):t._e(),"scanning"===t.datasetScanstate?n("div",{staticClass:"txt--center my2"},[n("spinner")],1):t._e(),"scanned"===t.datasetScanstate?n("div",{staticClass:"my2"},[0!=t.datasets.length?n("div",[n("table",{staticClass:"full"},[t._m(0),n("tbody",t._l(t.datasets,function(e,r){return n("tr",[n("td",{staticClass:"radio"},[n("input",{directives:[{name:"model",rawName:"v-model",value:t.setIndex,expression:"setIndex"}],attrs:{type:"radio",name:"dataset",id:e.id},domProps:{value:r,checked:t._q(t.setIndex,r)},on:{__c:function(e){t.setIndex=r}}})]),n("td",[n("label",{attrs:{for:e.id}},[t._v(t._s(e.exchange))])]),n("td",[n("label",{attrs:{for:e.id}},[t._v(t._s(e.currency))])]),n("td",[n("label",{attrs:{for:e.id}},[t._v(t._s(e.asset))])]),n("td",[n("label",{attrs:{for:e.id}},[t._v(t._s(t.fmt(e.from)))])]),n("td",[n("label",{attrs:{for:e.id}},[t._v(t._s(t.fmt(e.to)))])]),n("td",[n("label",{attrs:{for:e.id}},[t._v(t._s(t.humanizeDuration(e.to.diff(e.from))))])])])}))]),t.rangeVisible?t._e():n("a",{staticClass:"btn--primary",attrs:{href:"#"},on:{click:function(e){e.preventDefault(),t.openRange(e)}}},[t._v("Adjust range")]),t.rangeVisible?[n("div",[n("label",{attrs:{for:"customFrom"}},[t._v("From:")]),n("input",{directives:[{name:"model",rawName:"v-model",value:t.customFrom,expression:"customFrom"}],domProps:{value:t.customFrom},on:{input:function(e){e.target.composing||(t.customFrom=e.target.value)}}})]),n("div",[n("label",{attrs:{for:"customTo"}},[t._v("To:")]),n("input",{directives:[{name:"model",rawName:"v-model",value:t.customTo,expression:"customTo"}],domProps:{value:t.customTo},on:{input:function(e){e.target.composing||(t.customTo=e.target.value)}}})])]:t._e()],2):n("em",[t._v("No Data found "),n("a",{attrs:{href:"#/data/importer"}},[t._v("Lets add some")])])]):t._e()])},staticRenderFns:[function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("thead",[n("tr",[n("th"),n("th",[t._v("exchange")]),n("th",[t._v("currency")]),n("th",[t._v("asset")]),n("th",[t._v("from")]),n("th",[t._v("to")]),n("th",[t._v("duration")])])])}]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"my2"},[t.data?t._e():n("div",{staticClass:"contain"},[n("h1",[t._v("Unknown Strat runner")]),n("p",[t._v("Gekko doesn't know what strat runner this is...")])]),t.data?n("div",[n("h2",{staticClass:"contain"},[t._v("Strat runner")]),n("div",{staticClass:"grd contain"},[n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-3-6"},[n("h3",[t._v("Market")]),n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-3-6"},[t._v("Exchange")]),n("div",{staticClass:"grd-row-col-3-6"},[t._v(t._s(t.data.watch.exchange))])]),n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-3-6"},[t._v("Currency")]),n("div",{staticClass:"grd-row-col-3-6"},[t._v(t._s(t.data.watch.currency))])]),n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-3-6"},[t._v("Asset")]),n("div",{staticClass:"grd-row-col-3-6"},[t._v(t._s(t.data.watch.asset))])])]),n("div",{staticClass:"grd-row-col-3-6"},[n("h3",[t._v("Runtime")]),t.isLoading?n("spinner"):t._e(),t.isLoading?t._e():[t.data.firstCandle?n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-2-6"},[t._v("Watching since")]),n("div",{staticClass:"grd-row-col-4-6"},[t._v(t._s(t.fmt(t.data.firstCandle.start)))])]):t._e(),t.data.lastCandle?n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-2-6"},[t._v("Received data until")]),n("div",{staticClass:"grd-row-col-4-6"},[t._v(t._s(t.fmt(t.data.lastCandle.start)))])]):t._e(),t.data.lastCandle&&t.data.firstCandle?n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-2-6"},[t._v("Data spanning")]),n("div",{staticClass:"grd-row-col-4-6"},[t._v(t._s(t.humanizeDuration(t.moment(t.data.lastCandle.start).diff(t.moment(t.data.firstCandle.start)))))])]):t._e(),t.data.lastCandle&&t.data.firstCandle?n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-2-6"},[t._v("Amount of trades")]),n("div",{staticClass:"grd-row-col-4-6"},[t._v(t._s(t.data.trades.length))])]):t._e()]],2)]),n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-3-6"},[n("h3",[t._v("Strategy")]),n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-3-6"},[t._v("Name")]),n("div",{staticClass:"grd-row-col-3-6"},[n("strong",[t._v(t._s(t.stratName))])])]),t._v("Parameters"),n("pre",[t._v(t._s(t.stratParams))])]),n("div",{staticClass:"grd-row-col-3-6"},[n("h3",[t._v("Profit report")]),t.report?t._e():[t._m(0)],t.report?[n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-3-6"},[t._v("Start balance")]),n("div",{staticClass:"grd-row-col-3-6"},[t._v(t._s(t.round(t.report.startBalance)))])]),n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-3-6"},[t._v("Current balance")]),n("div",{staticClass:"grd-row-col-3-6"},[t._v(t._s(t.round(t.report.balance)))])]),n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-3-6"},[t._v("Market")]),n("div",{staticClass:"grd-row-col-3-6"},[t._v(t._s(t.round(t.report.market))+" "+t._s(t.data.watch.currency))])]),n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-3-6"},[t._v("Profit")]),n("div",{staticClass:"grd-row-col-3-6"},[t._v(t._s(t.round(t.report.profit))+" "+t._s(t.data.watch.currency))])]),n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-3-6"},[t._v("Alpha")]),n("div",{staticClass:"grd-row-col-3-6"},[t._v(t._s(t.round(t.report.alpha))+" "+t._s(t.data.watch.currency))])])]:t._e()],2)]),t.watcher?n("p",[n("em",[t._v("This strat runner gets data from "),n("router-link",{attrs:{to:"/live-gekkos/watcher/"+t.watcher.id}},[t._v("this market watcher")])],1),t._v(".")]):t._e()]),t.isLoading?t._e():[n("h3",{staticClass:"contain"},[t._v("Market graph")]),"fetching"===t.candleFetch?n("spinner"):t._e(),"fetched"===t.candleFetch?[n("chart",{attrs:{data:t.chartData,height:300}})]:t._e(),n("roundtrips",{attrs:{roundtrips:t.data.roundtrips}})]],2):t._e()])},staticRenderFns:[function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("p",[n("em",[t._v("Waiting for at least one trade..")])])}]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return t.active?n("div",[n("div",{attrs:{id:"modal-background"}}),n("div",{staticClass:"modal",attrs:{id:"modal"}},[n("div",{staticClass:"modal-guts",domProps:{innerHTML:t._s(t.content)}})])]):t._e()},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"grd"},[n("div",{staticClass:"px1"},[n("h3",[t._v("Paper trader")]),"closed"===t.toggle?n("a",{staticClass:"btn--primary",attrs:{href:"#"},on:{click:function(e){e.preventDefault(),t.switchToggle(e)}}},[t._v("Change paper trader settings")]):t._e(),"open"===t.toggle?[n("p",[t._v("Settings:")]),n("textarea",{directives:[{name:"model",rawName:"v-model",value:t.rawPaperTraderParams,expression:"rawPaperTraderParams"}],staticClass:"params",domProps:{value:t.rawPaperTraderParams},on:{input:function(e){e.target.composing||(t.rawPaperTraderParams=e.target.value)}}}),t.rawPaperTraderParamsError?n("p",{staticClass:"bg--red p1"},[t._v(t._s(t.rawPaperTraderParamsError.message))]):t._e()]:t._e()],2)])},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"contain my2"},[t.data&&!t.data.done?n("div",[n("h2",[t._v("Importing data..")]),n("div",{staticClass:"grd"},[n("div",{staticClass:"grd-row"},[t._m(0),n("div",{staticClass:"grd-row-col-4-6"},[t._v(t._s(t.data.watch.exchange))])]),n("div",{staticClass:"grd-row"},[t._m(1),n("div",{staticClass:"grd-row-col-4-6"},[t._v(t._s(t.data.watch.currency)+"/"+t._s(t.data.watch.asset))])])]),n("div",{staticClass:"grd"},[n("div",{staticClass:"grd-row"},[t._m(2),n("div",{staticClass:"grd-row-col-4-6"},[t._v(t._s(t.fmt(t.from)))])]),n("div",{staticClass:"grd-row"},[t._m(3),n("div",{staticClass:"grd-row-col-4-6"},[t._v(t._s(t.fmt(t.to)))])]),t.initialized?n("div",{staticClass:"grd-row"},[t._m(4),n("div",{staticClass:"grd-row-col-4-6"},[t._v(t._s(t.fmt(t.latest)))])]):t._e(),t.initialized?n("div",{staticClass:"grd-row"},[t._m(5),n("div",{staticClass:"grd-row-col-4-6"},[t._v(t._s(t.fromEnd))])]):t._e()]),t.initialized?t._e():n("spinner"),t.initialized?n("div",{staticClass:"contain"},[n("progressBar",{attrs:{progress:t.progress}})],1):t._e(),n("p",[n("em",[t._v("(you don't have to wait until the import is done,\nyou can already start "),n("router-link",{attrs:{to:"/backtest"}},[t._v("backtesting")]),t._v(").")],1)])],1):t._e(),t.data&&t.data.done?n("div",{staticClass:"txt--center"},[n("h2",[t._v("Import done")]),n("p",[t._v(" \nGo and "),n("router-link",{attrs:{to:"/backtest"}},[t._v("backtest")]),t._v(" with your new data!")],1)]):t._e(),t.data?t._e():n("div",{staticClass:"txt--center"},[n("h2",[t._v("ERROR: Uknown import")]),n("p",[n("I",[t._v("don't know this import..")])],1)])])},staticRenderFns:[function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"grd-row-col-2-6"},[n("strong",[t._v("Market:")])])},function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"grd-row-col-2-6"},[n("strong",[t._v("Currency/Asset:")])])},function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"grd-row-col-2-6"},[n("strong",[t._v("From:")])])},function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"grd-row-col-2-6"},[n("strong",[t._v("To:")])])},function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"grd-row-col-2-6"},[n("strong",[t._v("Imported data until:")])])},function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"grd-row-col-2-6"},[n("strong",[t._v("Remaining:")])])}]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"grd"},[n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-3-6 px1"},[n("h3",[t._v("Strategy")]),n("div",[n("label",{staticClass:"wrapper",attrs:{for:"strat"}},[t._v("Strategy:")]),n("div",{staticClass:"custom-select button"},[n("select",{directives:[{name:"model",rawName:"v-model",value:t.strategy,expression:"strategy"}],on:{change:function(e){var n=Array.prototype.filter.call(e.target.options,function(t){return t.selected}).map(function(t){return"_value"in t?t._value:t.value});t.strategy=e.target.multiple?n:n[0]}}},t._l(t.strategies,function(e){return n("option",[t._v(t._s(e.name))])}))])]),n("div",[n("label",{attrs:{for:"candleSize"}},[t._v("Candle Size")]),n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-3-6"},[n("input",{directives:[{name:"model",rawName:"v-model",value:t.rawCandleSize,expression:"rawCandleSize"}],domProps:{value:t.rawCandleSize},on:{input:function(e){e.target.composing||(t.rawCandleSize=e.target.value)}}})]),n("div",{staticClass:"grd-row-col-3-6 align"},[n("div",{staticClass:"custom-select button"},[n("select",{directives:[{name:"model",rawName:"v-model",value:t.candleSizeUnit,expression:"candleSizeUnit"}],on:{change:function(e){var n=Array.prototype.filter.call(e.target.options,function(t){return t.selected}).map(function(t){return"_value"in t?t._value:t.value});t.candleSizeUnit=e.target.multiple?n:n[0]}}},[n("option",[t._v("minutes")]),n("option",[t._v("hours")]),n("option",[t._v("days")])])])])])]),n("div",[n("label",{attrs:{for:"historySize"}},[t._v("Warmup period (in "+t._s(t.rawCandleSize)+" "+t._s(t.singularCandleSizeUnit)+" candles):")]),n("input",{directives:[{name:"model",rawName:"v-model",value:t.historySize,expression:"historySize"}],domProps:{value:t.historySize},on:{input:function(e){e.target.composing||(t.historySize=e.target.value)}}}),n("em",{staticClass:"label-like"},[t._v("(will use "+t._s(t.humanizeDuration(t.candleSize*t.historySize*1e3*60))+" of data as history)")])])]),n("div",{staticClass:"grd-row-col-2-6 px1"},[n("div",[n("h3",[t._v("Parameters")]),n("p",[t._v(t._s(t.strategy)+" Parameters:")]),n("textarea",{directives:[{name:"model",rawName:"v-model",value:t.rawStratParams,expression:"rawStratParams"}],staticClass:"params",domProps:{value:t.rawStratParams},on:{input:function(e){e.target.composing||(t.rawStratParams=e.target.value)}}}),t.rawStratParamsError?n("p",{staticClass:"bg--red p1"},[t._v(t._s(t.rawStratParamsError.message))]):t._e()])])])])},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"my2"},[t.data?t._e():n("div",{staticClass:"contain"},[n("h1",[t._v("Unknown Watcher")]),n("p",[t._v("Gekko doesn't know what whatcher this is...")])]),t.data?n("div",[n("h2",{staticClass:"contain"},[t._v("Market Watcher")]),n("div",{staticClass:"grd contain"},[n("h3",[t._v("Market")]),n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-2-6"},[t._v("Exchange")]),n("div",{staticClass:"grd-row-col-4-6"},[t._v(t._s(t.data.watch.exchange))])]),n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-2-6"},[t._v("Currency")]),n("div",{staticClass:"grd-row-col-4-6"},[t._v(t._s(t.data.watch.currency))])]),n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-2-6"},[t._v("Asset")]),n("div",{staticClass:"grd-row-col-4-6"},[t._v(t._s(t.data.watch.asset))])]),n("h3",[t._v("Statistics")]),t.isLoading?n("spinner"):t._e(),t.isLoading?t._e():[t.data.firstCandle?n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-2-6"},[t._v("Watching since")]),n("div",{staticClass:"grd-row-col-4-6"},[t._v(t._s(t.fmt(t.data.firstCandle.start)))])]):t._e(),t.data.lastCandle?n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-2-6"},[t._v("Received data until")]),n("div",{staticClass:"grd-row-col-4-6"},[t._v(t._s(t.fmt(t.data.lastCandle.start)))])]):t._e(),t.data.lastCandle&&t.data.firstCandle?n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-2-6"},[t._v("Data spanning")]),n("div",{staticClass:"grd-row-col-4-6"},[t._v(t._s(t.humanizeDuration(t.moment(t.data.lastCandle.start).diff(t.moment(t.data.firstCandle.start)))))])]):t._e()]],2),t.isLoading?t._e():[n("h3",{staticClass:"contain"},[t._v("Market graph")]),"fetching"===t.candleFetch?n("spinner"):t._e(),t.candles.length?[n("chart",{attrs:{data:t.chartData,height:500}})]:t._e()]],2):t._e()])},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"grd contain"},[n("h3",[t._v("Add an API key")]),n("p",[t._v("Make sure that the API key has the permissions to create and cancel orders and view balances.")]),n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-3-6 mx1"},[n("h3",[t._v("Exchange")]),n("exchange-picker",{staticClass:"contain",attrs:{"only-tradable":"true"},on:{exchange:t.updateExchange}})],1),n("div",{staticClass:"grd-row-col-3-6 mx1"},[n("h3",[t._v("Credentials")]),t._l(t.requires,function(e){return[n("label",[t._v(t._s(e))]),n("input",{directives:[{name:"model",rawName:"v-model",value:t.credentials[e],expression:"credentials[cred]"}],domProps:{value:t.credentials[e]},on:{input:function(n){n.target.composing||t.$set(t.credentials,e,n.target.value)}}})]})],2)]),n("div",{staticClass:"txt--center"},[n("a",{staticClass:"w100--s my1 btn--primary",attrs:{href:"#"},on:{click:function(e){e.preventDefault(),t.upload(e)}}},[t._v("Add")])])])},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"grd contain"},[n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-3-6 mx1"},[n("h3",[t._v("Market")]),n("market-picker",{staticClass:"contain",attrs:{"only-tradable":t.isTradebot},on:{market:t.updateMarketConfig}})],1),n("div",{staticClass:"grd-row-col-3-6 mx1"},[n("type-picker",{on:{type:t.updateType}})],1)]),"market watcher"!==t.type?[n("div",{staticClass:"hr"}),n("strat-picker",{staticClass:"contain my2",on:{stratConfig:t.updateStrat}}),"paper trader"===t.type?n("div",{staticClass:"hr"}):t._e(),"paper trader"===t.type?n("paper-trader",{on:{settings:t.updatePaperTrader}}):t._e()]:t._e()],2)},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"contain"},[n("dataset-picker",{staticClass:"contain my2",on:{dataset:t.updateDataset}}),n("div",{staticClass:"hr"}),n("strat-picker",{staticClass:"contain my2",on:{stratConfig:t.updateStrat}}),n("div",{staticClass:"hr"}),n("paper-trader",{on:{settings:t.updatePaperTrader}}),n("div",{staticClass:"hr"})],1)},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"contain roundtrips"},[n("h2",[t._v("Roundtrips")]),t.roundtrips.length?n("table",[n("thead",[t._m(0),t._l(t.roundtrips,function(e){return n("tr",[n("td",[t._v(t._s(t.fmt(e.entryAt)))]),n("td",[t._v(t._s(t.fmt(e.exitAt)))]),n("td",[t._v(t._s(t.diff(e.duration)))]),n("td",[t._v(t._s(t.round(e.entryBalance)))]),n("td",[t._v(t._s(t.round(e.exitBalance)))]),-1===Math.sign(e.pnl)?[n("td",{staticClass:"loss"},[t._v(t._s(Math.sign(e.pnl)*e.pnl.toFixed(2)))]),n("td",{staticClass:"loss"},[t._v(t._s(e.profit.toFixed(2))+"%")])]:[n("td",{staticClass:"profit"},[t._v(t._s(e.pnl.toFixed(2)))]),n("td",{staticClass:"profit"},[t._v(t._s(e.profit.toFixed(2))+"%")])]],2)})],2)]):t._e(),t.roundtrips.length?t._e():n("div",[n("p",[t._v("Not enough data to display")])])])},staticRenderFns:[function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("tr",[n("th",[t._v("Entry at")]),n("th",[t._v("Exit at")]),n("th",[t._v("Exposure")]),n("th",[t._v("Entry balance")]),n("th",[t._v("Exit balance")]),n("th",[t._v("P&L")]),n("th",[t._v("Profit")])])}]}},function(t,e,n){var r=n(84);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(85);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(86);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(87);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(88);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(89);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(90);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(91);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(92);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(93);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(94);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(95);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(96);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(97);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(98);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(99);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(100);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(101);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(102);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(103);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(104);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(105);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(106);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(107);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(108);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(109);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(110);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(111);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}}]); \ No newline at end of file +function n(t,e){if(!t)throw new Error("[vue-router] "+e)}function r(e,n){"production"===t.env.NODE_ENV||e||"undefined"!=typeof console&&console.warn("[vue-router] "+n)}function i(t){return Object.prototype.toString.call(t).indexOf("Error")>-1}function o(e,n){switch(typeof n){case"undefined":return;case"object":return n;case"function":return n(e);case"boolean":return n?e.params:void 0;default:"production"!==t.env.NODE_ENV&&r(!1,'props in "'+e.path+'" is a '+typeof n+", expecting an object, function or boolean.")}}function a(e,n,i){void 0===n&&(n={});var o,a=i||s;try{o=a(e||"")}catch(e){"production"!==t.env.NODE_ENV&&r(!1,e.message),o={}}for(var u in n){var c=n[u];o[u]=Array.isArray(c)?c.slice():c}return o}function s(t){var e={};return(t=t.trim().replace(/^(\?|#|&)/,""))?(t.split("&").forEach(function(t){var n=t.replace(/\+/g," ").split("="),r=Pt(n.shift()),i=n.length>0?Pt(n.join("=")):null;void 0===e[r]?e[r]=i:Array.isArray(e[r])?e[r].push(i):e[r]=[e[r],i]}),e):e}function u(t){var e=t?Object.keys(t).map(function(e){var n=t[e];if(void 0===n)return"";if(null===n)return Dt(e);if(Array.isArray(n)){var r=[];return n.forEach(function(t){void 0!==t&&(null===t?r.push(Dt(e)):r.push(Dt(e)+"="+Dt(t)))}),r.join("&")}return Dt(e)+"="+Dt(n)}).filter(function(t){return t.length>0}).join("&"):null;return e?"?"+e:""}function c(t,e,n,r){var i=r&&r.options.stringifyQuery,o={name:e.name||t&&t.name,meta:t&&t.meta||{},path:e.path||"/",hash:e.hash||"",query:e.query||{},params:e.params||{},fullPath:f(e,i),matched:t?l(t):[]};return n&&(o.redirectedFrom=f(n,i)),Object.freeze(o)}function l(t){for(var e=[];t;)e.unshift(t),t=t.parent;return e}function f(t,e){var n=t.path,r=t.query;void 0===r&&(r={});var i=t.hash;void 0===i&&(i="");var o=e||u;return(n||"/")+o(r)+i}function d(t,e){return e===It?t===e:!!e&&(t.path&&e.path?t.path.replace(Mt,"")===e.path.replace(Mt,"")&&t.hash===e.hash&&p(t.query,e.query):!(!t.name||!e.name)&&(t.name===e.name&&t.hash===e.hash&&p(t.query,e.query)&&p(t.params,e.params)))}function p(t,e){void 0===t&&(t={}),void 0===e&&(e={});var n=Object.keys(t),r=Object.keys(e);return n.length===r.length&&n.every(function(n){var r=t[n],i=e[n];return"object"==typeof r&&"object"==typeof i?p(r,i):String(r)===String(i)})}function h(t,e){return 0===t.path.replace(Mt,"/").indexOf(e.path.replace(Mt,"/"))&&(!e.hash||t.hash===e.hash)&&v(t.query,e.query)}function v(t,e){for(var n in e)if(!(n in t))return!1;return!0}function m(t){if(!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||t.defaultPrevented||void 0!==t.button&&0!==t.button)){if(t.currentTarget&&t.currentTarget.getAttribute){if(/\b_blank\b/i.test(t.currentTarget.getAttribute("target")))return}return t.preventDefault&&t.preventDefault(),!0}}function g(t){if(t)for(var e,n=0;n=0&&(e=t.slice(r),t=t.slice(0,r));var i=t.indexOf("?");return i>=0&&(n=t.slice(i+1),t=t.slice(0,i)),{path:t,query:n,hash:e}}function x(t){return t.replace(/\/\//g,"/")}function w(t,e){for(var n,r=[],i=0,o=0,a="",s=e&&e.delimiter||"/";null!=(n=Gt.exec(t));){var u=n[0],c=n[1],l=n.index;if(a+=t.slice(o,l),o=l+u.length,c)a+=c[1];else{var f=t[o],d=n[2],p=n[3],h=n[4],v=n[5],m=n[6],g=n[7];a&&(r.push(a),a="");var _=null!=d&&null!=f&&f!==d,y="+"===m||"*"===m,b="?"===m||"*"===m,x=n[2]||s,w=h||v;r.push({name:p||i++,prefix:d||"",delimiter:x,optional:b,repeat:y,partial:_,asterisk:!!g,pattern:w?$(w):g?".*":"[^"+A(x)+"]+?"})}}return o-1&&(a.params[f]=n.params[f]);if(u)return a.path=M(u.path,a.params,'named route "'+s+'"'),l(u,a,o)}else if(a.path){a.params={};for(var v=0;v=t.length?n():t[i]?e(t[i],function(){r(i+1)}):r(i+1)};r(0)}function st(e){return function(n,o,a){var s=!1,u=0,c=null;ut(e,function(e,n,o,l){if("function"==typeof e&&void 0===e.cid){s=!0,u++;var f,d=lt(function(t){t.__esModule&&t.default&&(t=t.default),e.resolved="function"==typeof t?t:St.extend(t),o.components[l]=t,--u<=0&&a()}),p=lt(function(e){var n="Failed to resolve async component "+l+": "+e;"production"!==t.env.NODE_ENV&&r(!1,n),c||(c=i(e)?e:new Error(n),a(c))});try{f=e(d,p)}catch(t){p(t)}if(f)if("function"==typeof f.then)f.then(d,p);else{var h=f.component;h&&"function"==typeof h.then&&h.then(d,p)}}}),s||a()}}function ut(t,e){return ct(t.map(function(t){return Object.keys(t.components).map(function(n){return e(t.components[n],t.instances[n],t,n)})}))}function ct(t){return Array.prototype.concat.apply([],t)}function lt(t){var e=!1;return function(){for(var n=[],r=arguments.length;r--;)n[r]=arguments[r];if(!e)return e=!0,t.apply(this,n)}}function ft(t){if(!t)if(Vt){var e=document.querySelector("base");t=e&&e.getAttribute("href")||"/",t=t.replace(/^https?:\/\/[^\/]+/,"")}else t="/";return"/"!==t.charAt(0)&&(t="/"+t),t.replace(/\/$/,"")}function dt(t,e){var n,r=Math.max(t.length,e.length);for(n=0;n=0?e.slice(0,n):e;window.location.replace(r+"#"+t)}function At(t,e){return t.push(e),function(){var n=t.indexOf(e);n>-1&&t.splice(n,1)}}function $t(t,e,n){var r="hash"===n?"#"+e:e;return t?x(t+"/"+r):r}var St,jt={name:"router-view",functional:!0,props:{name:{type:String,default:"default"}},render:function(t,e){var n=e.props,r=e.children,i=e.parent,a=e.data;a.routerView=!0;for(var s=i.$createElement,u=n.name,c=i.$route,l=i._routerViewCache||(i._routerViewCache={}),f=0,d=!1;i&&i._routerRoot!==i;)i.$vnode&&i.$vnode.data.routerView&&f++,i._inactive&&(d=!0),i=i.$parent;if(a.routerViewDepth=f,d)return s(l[u],a,r);var p=c.matched[f];if(!p)return l[u]=null,s();var h=l[u]=p.components[u];return a.registerRouteInstance=function(t,e){var n=p.instances[u];(e&&n!==t||!e&&n===t)&&(p.instances[u]=e)},(a.hook||(a.hook={})).prepatch=function(t,e){p.instances[u]=e.componentInstance},a.props=o(c,p.props&&p.props[u]),s(h,a,r)}},Tt=/[!'()*]/g,Nt=function(t){return"%"+t.charCodeAt(0).toString(16)},Rt=/%2C/g,Dt=function(t){return encodeURIComponent(t).replace(Tt,Nt).replace(Rt,",")},Pt=decodeURIComponent,Mt=/\/?$/,It=c(null,{path:"/"}),Ft=[String,Object],Lt=[String,Array],zt={name:"router-link",props:{to:{type:Ft,required:!0},tag:{type:String,default:"a"},exact:Boolean,append:Boolean,replace:Boolean,activeClass:String,exactActiveClass:String,event:{type:Lt,default:"click"}},render:function(t){var e=this,n=this.$router,r=this.$route,i=n.resolve(this.to,r,this.append),o=i.location,a=i.route,s=i.href,u={},l=n.options.linkActiveClass,f=n.options.linkExactActiveClass,p=null==l?"router-link-active":l,v=null==f?"router-link-exact-active":f,_=null==this.activeClass?p:this.activeClass,y=null==this.exactActiveClass?v:this.exactActiveClass,b=o.path?c(null,o,null,n):a;u[y]=d(r,b),u[_]=this.exact?u[y]:h(r,b);var x=function(t){m(t)&&(e.replace?n.replace(o):n.push(o))},w={click:m};Array.isArray(this.event)?this.event.forEach(function(t){w[t]=x}):w[this.event]=x;var k={class:u};if("a"===this.tag)k.on=w,k.attrs={href:s};else{var C=g(this.$slots.default);if(C){C.isStatic=!1;var E=St.util.extend;(C.data=E({},C.data)).on=w;(C.data.attrs=E({},C.data.attrs)).href=s}else k.on=w}return t(this.tag,k,this.$slots.default)}},Vt="undefined"!=typeof window,Ut=Array.isArray||function(t){return"[object Array]"==Object.prototype.toString.call(t)},qt=P,Ht=w,Wt=k,Bt=O,Yt=D,Gt=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g");qt.parse=Ht,qt.compile=Wt,qt.tokensToFunction=Bt,qt.tokensToRegExp=Yt;var Kt=Object.create(null),Xt=Object.create(null),Jt=Vt&&function(){var t=window.navigator.userAgent;return(-1===t.indexOf("Android 2.")&&-1===t.indexOf("Android 4.0")||-1===t.indexOf("Mobile Safari")||-1!==t.indexOf("Chrome")||-1!==t.indexOf("Windows Phone"))&&(window.history&&"pushState"in window.history)}(),Zt=Vt&&window.performance&&window.performance.now?window.performance:Date,Qt=et(),te=function(t,e){this.router=t,this.base=ft(e),this.current=It,this.pending=null,this.ready=!1,this.readyCbs=[],this.readyErrorCbs=[],this.errorCbs=[]};te.prototype.listen=function(t){this.cb=t},te.prototype.onReady=function(t,e){this.ready?t():(this.readyCbs.push(t),e&&this.readyErrorCbs.push(e))},te.prototype.onError=function(t){this.errorCbs.push(t)},te.prototype.transitionTo=function(t,e,n){var r=this,i=this.router.match(t,this.current);this.confirmTransition(i,function(){r.updateRoute(i),e&&e(i),r.ensureURL(),r.ready||(r.ready=!0,r.readyCbs.forEach(function(t){t(i)}))},function(t){n&&n(t),t&&!r.ready&&(r.ready=!0,r.readyErrorCbs.forEach(function(e){e(t)}))})},te.prototype.confirmTransition=function(t,e,n){var o=this,a=this.current,s=function(t){i(t)&&(o.errorCbs.length?o.errorCbs.forEach(function(e){e(t)}):(r(!1,"uncaught error during route navigation:"),console.error(t))),n&&n(t)};if(d(t,a)&&t.matched.length===a.matched.length)return this.ensureURL(),s();var u=dt(this.current.matched,t.matched),c=u.updated,l=u.deactivated,f=u.activated,p=[].concat(vt(l),this.router.beforeHooks,mt(c),f.map(function(t){return t.beforeEnter}),st(f));this.pending=t;var h=function(e,n){if(o.pending!==t)return s();try{e(t,a,function(t){!1===t||i(t)?(o.ensureURL(!0),s(t)):"string"==typeof t||"object"==typeof t&&("string"==typeof t.path||"string"==typeof t.name)?(s(),"object"==typeof t&&t.replace?o.replace(t):o.push(t)):n(t)})}catch(t){s(t)}};at(p,h,function(){var n=[];at(_t(f,n,function(){return o.current===t}).concat(o.router.resolveHooks),h,function(){if(o.pending!==t)return s();o.pending=null,e(t),o.router.app&&o.router.app.$nextTick(function(){n.forEach(function(t){t()})})})})},te.prototype.updateRoute=function(t){var e=this.current;this.current=t,this.cb&&this.cb(t),this.router.afterHooks.forEach(function(n){n&&n(t,e)})};var ee=function(t){function e(e,n){var r=this;t.call(this,e,n);var i=e.options.scrollBehavior;i&&B(),window.addEventListener("popstate",function(t){var n=r.current;r.transitionTo(xt(r.base),function(t){i&&Y(e,t,n,!0)})})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.go=function(t){window.history.go(t)},e.prototype.push=function(t,e,n){var r=this,i=this,o=i.current;this.transitionTo(t,function(t){it(x(r.base+t.fullPath)),Y(r.router,t,o,!1),e&&e(t)},n)},e.prototype.replace=function(t,e,n){var r=this,i=this,o=i.current;this.transitionTo(t,function(t){ot(x(r.base+t.fullPath)),Y(r.router,t,o,!1),e&&e(t)},n)},e.prototype.ensureURL=function(t){if(xt(this.base)!==this.current.fullPath){var e=x(this.base+this.current.fullPath);t?it(e):ot(e)}},e.prototype.getCurrentLocation=function(){return xt(this.base)},e}(te),ne=function(t){function e(e,n,r){t.call(this,e,n),r&&wt(this.base)||kt()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setupListeners=function(){var t=this;window.addEventListener("hashchange",function(){kt()&&t.transitionTo(Ct(),function(t){Ot(t.fullPath)})})},e.prototype.push=function(t,e,n){this.transitionTo(t,function(t){Et(t.fullPath),e&&e(t)},n)},e.prototype.replace=function(t,e,n){this.transitionTo(t,function(t){Ot(t.fullPath),e&&e(t)},n)},e.prototype.go=function(t){window.history.go(t)},e.prototype.ensureURL=function(t){var e=this.current.fullPath;Ct()!==e&&(t?Et(e):Ot(e))},e.prototype.getCurrentLocation=function(){return Ct()},e}(te),re=function(t){function e(e,n){t.call(this,e,n),this.stack=[],this.index=-1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.push=function(t,e,n){var r=this;this.transitionTo(t,function(t){r.stack=r.stack.slice(0,r.index+1).concat(t),r.index++,e&&e(t)},n)},e.prototype.replace=function(t,e,n){var r=this;this.transitionTo(t,function(t){r.stack=r.stack.slice(0,r.index).concat(t),e&&e(t)},n)},e.prototype.go=function(t){var e=this,n=this.index+t;if(!(n<0||n>=this.stack.length)){var r=this.stack[n];this.confirmTransition(r,function(){e.index=n,e.updateRoute(r)})}},e.prototype.getCurrentLocation=function(){var t=this.stack[this.stack.length-1];return t?t.fullPath:"/"},e.prototype.ensureURL=function(){},e}(te),ie=function(e){void 0===e&&(e={}),this.app=null,this.apps=[],this.options=e,this.beforeHooks=[],this.resolveHooks=[],this.afterHooks=[],this.matcher=q(e.routes||[],this);var r=e.mode||"hash";switch(this.fallback="history"===r&&!Jt&&!1!==e.fallback,this.fallback&&(r="hash"),Vt||(r="abstract"),this.mode=r,r){case"history":this.history=new ee(this,e.base);break;case"hash":this.history=new ne(this,e.base,this.fallback);break;case"abstract":this.history=new re(this,e.base);break;default:"production"!==t.env.NODE_ENV&&n(!1,"invalid mode: "+r)}},oe={currentRoute:{}};ie.prototype.match=function(t,e,n){return this.matcher.match(t,e,n)},oe.currentRoute.get=function(){return this.history&&this.history.current},ie.prototype.init=function(e){var r=this;if("production"!==t.env.NODE_ENV&&n(_.installed,"not installed. Make sure to call `Vue.use(VueRouter)` before creating root instance."),this.apps.push(e),!this.app){this.app=e;var i=this.history;if(i instanceof ee)i.transitionTo(i.getCurrentLocation());else if(i instanceof ne){var o=function(){i.setupListeners()};i.transitionTo(i.getCurrentLocation(),o,o)}i.listen(function(t){r.apps.forEach(function(e){e._route=t})})}},ie.prototype.beforeEach=function(t){return At(this.beforeHooks,t)},ie.prototype.beforeResolve=function(t){return At(this.resolveHooks,t)},ie.prototype.afterEach=function(t){return At(this.afterHooks,t)},ie.prototype.onReady=function(t,e){this.history.onReady(t,e)},ie.prototype.onError=function(t){this.history.onError(t)},ie.prototype.push=function(t,e,n){this.history.push(t,e,n)},ie.prototype.replace=function(t,e,n){this.history.replace(t,e,n)},ie.prototype.go=function(t){this.history.go(t)},ie.prototype.back=function(){this.go(-1)},ie.prototype.forward=function(){this.go(1)},ie.prototype.getMatchedComponents=function(t){var e=t?t.matched?t:this.resolve(t).route:this.currentRoute;return e?[].concat.apply([],e.matched.map(function(t){return Object.keys(t.components).map(function(e){return t.components[e]})})):[]},ie.prototype.resolve=function(t,e,n){var r=V(t,e||this.history.current,n,this),i=this.match(r,e),o=i.redirectedFrom||i.fullPath;return{location:r,route:i,href:$t(this.history.base,o,this.mode),normalizedTo:r,resolved:i}},ie.prototype.addRoutes=function(t){this.matcher.addRoutes(t),this.history.current!==It&&this.history.transitionTo(this.history.getCurrentLocation())},Object.defineProperties(ie.prototype,oe),ie.install=_,ie.version="2.7.0",Vt&&window.Vue&&window.Vue.use(ie),e.a=ie}).call(e,n(9))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(130),i=n.n(r),o=n(129),a=n.n(o),s=n(131),u=n.n(s);e.default={name:"app",components:{top:i.a,bottom:a.a,modal:u.a}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(125),i=n.n(r),o=n(20),a=n.n(o),s=n(18),u=n.n(s),c=n(3),l=n.n(c),f=n(2);e.default={created:function(){var t=this;n.i(f.a)("configPart/performanceAnalyzer",function(e,n){t.performanceAnalyzer=toml.parse(n.part),t.performanceAnalyzer.enabled=!0})},data:function(){return{dataset:{},strat:{},paperTrader:{},performanceAnalyzer:{}}},components:{stratPicker:a.a,datasetPicker:i.a,paperTrader:u.a},computed:{market:function(){return this.dataset.exchange?{exchange:this.dataset.exchange,currency:this.dataset.currency,asset:this.dataset.asset}:{}},range:function(){return this.dataset.exchange?{from:this.dataset.from,to:this.dataset.to}:{}},config:function(){var t={};return Object.assign(t,{watch:this.market},{paperTrader:this.paperTrader},this.strat,{backtest:{daterange:this.range}},{performanceAnalyzer:this.performanceAnalyzer}),t.valid=this.validConfig(t),t}},methods:{validConfig:function(t){if(!t.backtest)return!1;if(!t.backtest.daterange)return!1;if(l.a.isEmpty(t.backtest.daterange))return!1;if(!t.watch)return!1;if(!t.tradingAdvisor)return!1;var e=t.tradingAdvisor.method;if(l.a.isEmpty(t[e]))return!1;if(t.tradingAdvisor){if(l.a.isNaN(t.tradingAdvisor.candleSize))return!1;if(0==t.tradingAdvisor.candleSize)return!1}return!0},updateDataset:function(t){this.dataset=t,this.$emit("config",this.config)},updateStrat:function(t){this.strat=t,this.$emit("config",this.config)},updatePaperTrader:function(t){this.paperTrader=t,this.paperTrader.enabled=!0,this.$emit("config",this.config)}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(119),i=n.n(r),o=n(120),a=n.n(o),s=n(2),u=n(5),c=n.n(u);e.default={data:function(){return{backtestable:!1,backtestState:"idle",backtestResult:!1,config:!1}},methods:{check:function(t){if(this.config=t,!t.valid)return this.backtestable=!1;this.backtestable=!0},run:function(){var t=this;this.backtestState="fetching";var e={gekkoConfig:this.config,data:{candleProps:["close","start"],indicatorResults:!0,report:!0,roundtrips:!0,trades:!0}};n.i(s.b)("backtest",e,function(e,n){t.backtestState="fetched",t.backtestResult=n})}},components:{configBuilder:i.a,result:a.a,spinner:c.a}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(68),i=n(69);e.default={props:["data","height"],data:function(){return{isClicked:!1}},watch:{data:function(){this.render()}},created:function(){setTimeout(this.render,100)},beforeDestroy:function(){this.remove()},methods:{click:function(){this.isClicked=!0},render:function(){this.remove(),_.size(this.data.candles)<4?n.i(i.a)("Not enough data to spawn chart"):n.i(r.a)(this.data.candles,this.data.trades,this.height)},remove:function(){d3.select("#chart").html("")}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(121),i=n.n(r),o=n(10),a=n.n(o),s=n(16),u=n.n(s);e.default={props:["result"],data:function(){return{}},methods:{},components:{roundtripTable:u.a,resultSummary:i.a,chart:a.a}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={props:["roundtrips"],data:function(){return{}},methods:{diff:function(t){return moment.duration(t).humanize()},humanizeDuration:function(t){return window.humanizeDuration(t)},fmt:function(t){return moment.utc(t).format("YYYY-MM-DD HH:mm")},round:function(t){return(+t).toFixed(3)}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(21),i=n.n(r);e.default={props:["report"],components:{paperTradeSummary:i.a},methods:{round:function(t){return(+t).toFixed(5)}},computed:{profitClass:function(){return this.report.relativeProfit>0?"profit":"loss"}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(126),i=n.n(r),o=n(3),a=(n.n(o),n(2));e.default={data:function(){return{exchange:!1,credentials:{}}},components:{exchangePicker:i.a},computed:{apiKeySets:function(){return this.$store.state.apiKeys},exchanges:function(){return this.$store.state.exchanges},requires:function(){return this.exchanges&&this.exchange?this.exchanges[this.exchange].requires:[]},config:function(){return{exchange:this.exchange,values:this.credentials}}},watch:{credentials:function(){this.emitConfig()}},methods:{updateExchange:function(t){this.credentials={},this.exchange=t,this.emitConfig()},emitConfig:function(){this.$emit("config",this.config)},upload:function(){var t=this,e=this.config.exchange;this.exchanges&&this.apiKeySets.includes(e)&&!confirm("You already have API keys for "+e+" defined, do you want to overwrite them?")||n.i(a.b)("addApiKey",this.config,function(e,n){if(e)return alert(e);t.credentials={}})}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(122),i=n.n(r),o=n(2);e.default={components:{apiConfigBuilder:i.a},data:function(){return{addApiToggle:!1}},methods:{openAddApi:function(){this.addApiToggle=!0},removeApiKey:function(t){confirm("Are you sure you want to delete these API keys?")&&n.i(o.b)("removeApiKey",{exchange:t},function(t,e){if(t)return alert(t)})}},computed:{apiKeySets:function(){return this.$store.state.apiKeys}},watch:{apiKeySets:function(){this.addApiToggle=!1}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(5),i=n.n(r),o=n(8),a=n(13),s=n.i(o.a)("\n\n## Local data\n\nGekko needs local market data in order to backtest strategies. The local\ndata can also be used in a warmup period when running a strategy against a\nlive market.\n\n");e.default={mixins:[a.a],components:{spinner:i.a},data:function(){return{intro:s,viewUnscannable:!1}},methods:{toggleUnscannable:function(){this.viewUnscannable=!0},humanizeDuration:function(t){return window.humanizeDuration(t)},fmt:function(t){return t.format("YYYY-MM-DD HH:mm")}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(17),i=n.n(r),o=n(11),a=n.n(o),s=n(3);n.n(s);e.default={data:function(){return{market:{},range:{}}},components:{marketPicker:i.a,rangeCreator:a.a},computed:{config:function(){var t={};return Object.assign(t,this.market,{importer:{daterange:this.range}},{candleWriter:{enabled:!0}}),t}},methods:{updateMarketConfig:function(t){this.market=t,this.emitConfig()},updateRange:function(t){this.range=t,this.emitConfig()},emitConfig:function(){this.$emit("config",this.config)}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(2),i=n(5),o=n.n(i),a=n(123),s=n.n(a),u=n(8),c=n.i(u.a)("\n\n## Import data\n\nThe importer can download historical market data directly from the exchange.\n\n");e.default={components:{importConfigBuilder:s.a,spinner:o.a},data:function(){return{intro:c,config:{}}},computed:{imports:function(){return this.$store.state.imports}},methods:{daysApart:function(t){var e=moment(t.to),n=moment(t.from);return e.diff(n,"days")},updateConfig:function(t){this.config=t},run:function(){var t=this;if(this.daysApart(this.config.importer.daterange)<1)return alert("You can only import at least one day of data..");n.i(r.b)("import",this.config,function(e,n){if(e)return alert(e);t.$store.commit("addImport",n),t.$router.push({path:"/data/importer/import/"+n.id})})}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(3),i=n.n(r),o=n(128),a=n.n(o),s=n(5),u=n.n(s);e.default={components:{progressBar:a.a,spinner:u.a},computed:{data:function(){return i.a.find(this.$store.state.imports,{id:this.$route.params.id})},initialized:function(){if(this.data&&this.latest.isValid())return!0},latest:function(){if(this.data)return this.mom(this.data.latest)},fromEndMs:function(){if(this.data)return this.to.diff(this.latest)},fromEnd:function(){return this.latest?humanizeDuration(this.fromEndMs):"LOADING"},from:function(){if(this.data)return this.mom(this.data.from)},to:function(){if(this.data)return this.mom(this.data.to)},timespan:function(){if(this.data)return this.to.diff(this.from)},progress:function(){if(this.data){return 100*(this.timespan-this.fromEndMs)/this.timespan}}},methods:{fmt:function(t){return t.format("YYYY-MM-DD HH:mm:ss")},mom:function(t){return moment.utc(t)}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(17),i=n.n(r),o=n(127),a=n.n(o),s=n(20),u=n.n(s),c=n(18),l=n.n(c),f=n(2),d=n(3),p=n.n(d);e.default={created:function(){var t=this;n.i(f.a)("configPart/candleWriter",function(e,n){t.candleWriter=toml.parse(n.part)}),n.i(f.a)("configPart/performanceAnalyzer",function(e,n){t.performanceAnalyzer=toml.parse(n.part),t.performanceAnalyzer.enabled=!0})},data:function(){return{market:{},range:{},type:"",strat:{},paperTrader:{},candleWriter:{},performanceAnalyzer:{}}},components:{marketPicker:i.a,typePicker:a.a,stratPicker:u.a,paperTrader:l.a},computed:{isTradebot:function(){return"tradebot"===this.type},config:function(){var t={};return Object.assign(t,this.market,this.strat,{paperTrader:this.paperTrader},{candleWriter:this.candleWriter},{type:this.type},{performanceAnalyzer:this.performanceAnalyzer}),this.isTradebot&&(delete t.paperTrader,t.trader={enabled:!0}),t.valid=this.validConfig(t),t}},methods:{validConfig:function(t){if("market watcher"===t.type)return!0;if(!t.tradingAdvisor)return!1;if(p.a.isNaN(t.tradingAdvisor.candleSize))return!1;if(0==t.tradingAdvisor.candleSize)return!1;var e=t.tradingAdvisor.method;return!p.a.isEmpty(t[e])},updateMarketConfig:function(t){this.market=t,this.emitConfig()},updateType:function(t){this.type=t,this.emitConfig()},updateStrat:function(t){this.strat=t,this.emitConfig()},updatePaperTrader:function(t){this.paperTrader=t,this.paperTrader.enabled=!0,this.emitConfig()},emitConfig:function(){this.$emit("config",this.config)}}}},function(t,e,n){"use strict";function r(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}Object.defineProperty(e,"__esModule",{value:!0});var i,o=n(8),a=n.i(o.a)("\n\n## Live Gekko\n\nRun your strategy against the live market!\n\n");e.default=(i={data:function(){return{text:a}},created:function(){var t=this;this.timer=setInterval(function(){t.now=moment()},1e3)},destroyed:function(){clearTimeout(this.timer)}},r(i,"data",function(){return{text:a,timer:!1,now:moment()}}),r(i,"computed",{stratrunners:function(){return this.$store.state.stratrunners},watchers:function(){return this.$store.state.watchers}}),r(i,"methods",{humanizeDuration:function(t){return window.humanizeDuration(t)},moment:function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}(function(t){return moment.utc(t)}),fmt:function(t){return moment.utc(t).format("YYYY-MM-DD HH:mm")},round:function(t){return(+t).toFixed(3)},timespan:function(t,e){return this.humanizeDuration(this.moment(t).diff(this.moment(e)))}}),i)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(3),i=n.n(r),o=n(4),a=n(2),s=n(124),u=n.n(s);e.default={components:{gekkoConfigBuilder:u.a},data:function(){return{pendingStratrunner:!1,config:{}}},computed:{watchers:function(){return this.$store.state.watchers},stratrunners:function(){return this.$store.state.stratrunners},watchConfig:function(){var t=i.a.pick(this.config,"watch","candleWriter"),e=o.a.util.extend({},t);return e.type="market watcher",e.mode="realtime",e},requiredHistoricalData:function(){if(this.config.tradingAdvisor&&this.config.valid){var t=this.config.tradingAdvisor;return t.candleSize*t.historySize}},gekkoConfig:function(){var t;if(this.existingMarketWatcher){if(this.requiredHistoricalData){var e=moment().utc().startOf("minute").subtract(this.requiredHistoricalData,"minutes").unix(),n=moment.utc(this.existingMarketWatcher.firstCandle.start).unix();t=moment.unix(Math.max(e,n)).utc().format()}else t=moment().utc().startOf("minute").format();return o.a.util.extend({market:{type:"leech",from:t},mode:"realtime"},this.config)}},existingMarketWatcher:function(){var t=o.a.util.extend({},this.watchConfig.watch);return i.a.find(this.watchers,{watch:t})},exchange:function(){return this.watchConfig.watch.exchange},existingTradebot:function(){return i.a.find(this.stratrunners.filter(function(t){return"tradebot"===t.trader}),{watch:{exchange:this.exchange}})},availableApiKeys:function(){return this.$store.state.apiKeys}},watch:{existingMarketWatcher:function(t,e){var n=this;this.pendingStratrunner&&t&&t.firstCandle&&t.lastCandle&&(this.pendingStratrunner=!1,this.startGekko(function(t,e){n.$router.push({path:"/live-gekkos/stratrunner/"+e.id})}))}},methods:{updateConfig:function(t){this.config=t},start:function(){var t=this;if("tradebot"===this.config.type){if(this.existingTradebot){var e="You already have a tradebot running on this exchange";return e+=", you can only run one tradebot per exchange.",alert(e)}if(!this.availableApiKeys.includes(this.exchange))return alert("Please first configure API keys for this exchange in the config page.")}"market watcher"===this.config.type?this.existingMarketWatcher?(alert("This market is already being watched, redirecting you now..."),this.$router.push({path:"/live-gekkos/watcher/"+this.existingMarketWatcher.id})):this.startWatcher(function(e,n){t.$router.push({path:"/live-gekkos/watcher/"+n.id})}):this.existingMarketWatcher?this.startGekko(this.routeToGekko):this.startWatcher(function(e,n){t.pendingStratrunner=!0})},routeToGekko:function(t,e){if(t||e.error)return console.error(t,e.error);this.$router.push({path:"/live-gekkos/stratrunner/"+e.id})},startWatcher:function(t){n.i(a.b)("startGekko",this.watchConfig,t)},startGekko:function(t){n.i(a.b)("startGekko",this.gekkoConfig,t)}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(4),i=n(3),o=n.n(i),a=n(2),s=n(5),u=n.n(s),c=n(10),l=n.n(c),f=n(16),d=n.n(f),p=n(21),h=n.n(p);e.default={created:function(){this.isLoading||this.getCandles()},components:{spinner:u.a,chart:l.a,paperTradeSummary:h.a,roundtrips:d.a},data:function(){return{candleFetch:"idle",candles:!1}},computed:{stratrunners:function(){return this.$store.state.stratrunners},data:function(){return o.a.find(this.stratrunners,{id:this.$route.params.id})},chartData:function(){return{candles:this.candles,trades:this.trades}},trades:function(){return this.data?this.data.trades:[]},report:function(){if(this.data)return this.data.report},stratName:function(){if(this.data)return this.data.strat.tradingAdvisor.method},stratParams:function(){if(!this.data)return"";var t=r.a.util.extend({},this.data.strat.params);return delete t.__empty,o.a.isEmpty(t)?"No parameters":JSON.stringify(t,null,4)},isLoading:function(){return!this.data||(!o.a.isObject(this.data.firstCandle)||!o.a.isObject(this.data.lastCandle))},watchers:function(){return this.$store.state.watchers},watcher:function(){var t=r.a.util.extend({},this.data.watch);return o.a.find(this.watchers,{watch:t})}},watch:{"data.lastCandle.start":function(){this.candleFetch="dirty"},data:function(t,e){this.isLoading||"fetched"!==this.candleFetch&&this.getCandles()}},methods:{round:function(t){return(+t).toFixed(5)},humanizeDuration:function(t){return window.humanizeDuration(t)},moment:function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}(function(t){return moment.utc(t)}),fmt:function(t){return moment.utc(t).format("YYYY-MM-DD HH:mm")},getCandles:function(){var t=this;this.candleFetch="fetching";var e=this.data.lastCandle.start,r=this.data.firstCandle.start,i=this.data.strat.tradingAdvisor.candleSize,s={watch:this.data.watch,daterange:{to:e,from:r},candleSize:i};n.i(a.b)("getCandles",s,function(e,n){t.candleFetch="fetched",n&&!n.error&&o.a.isArray(n)||console.log(n),t.candles=n.map(function(t){return t.start=moment.unix(t.start).utc().format(),t})})}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(2),i=n(3),o=n.n(i),a=n(5),s=n.n(a),u=(n(4),n(10)),c=n.n(u);e.default={created:function(){this.isLoading||this.getCandles()},components:{spinner:s.a,chart:c.a},data:function(){return{candleFetch:"idle",candles:[]}},computed:{watchers:function(){return this.$store.state.watchers},data:function(){return o.a.find(this.watchers,{id:this.$route.params.id})},chartData:function(){return{candles:this.candles,trades:[]}},isLoading:function(){return!this.data||(!o.a.isObject(this.data.firstCandle)||!o.a.isObject(this.data.lastCandle))}},watch:{"data.lastCandle.start":function(){this.candleFetch="dirty"},data:function(t,e){t&&t.firstCandle&&t.lastCandle&&"fetched"!==this.candleFetch&&this.getCandles()}},methods:{humanizeDuration:function(t){return window.humanizeDuration(t)},moment:function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}(function(t){return moment.utc(t)}),fmt:function(t){return moment.utc(t).format("YYYY-MM-DD HH:mm")},getCandles:function(){var t=this;this.candleFetch="fetching";var e=moment.utc(this.data.lastCandle.start).unix(),i=Math.max(moment.utc(this.data.firstCandle.start).unix(),moment.utc(e).subtract(7,"days").unix()),o=e-i,a=60;o<86400&&(a=o<43200?1:5),i=moment.unix(i).utc().format(),e=moment.unix(e).utc().format();var s={watch:this.data.watch,daterange:{to:e,from:i},candleSize:a};n.i(r.b)("getCandles",s,function(e,n){t.candleFetch="fetched",t.candles=n.map(function(t){return t.start=moment.unix(t.start).utc().format(),t})})}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(3),i=(n.n(r),n(4)),o=(n(2),n(5)),a=n.n(o),s=n(13);e.default={components:{spinner:a.a},data:function(){return{setIndex:-1,customTo:!1,customFrom:!1,rangeVisible:!1,set:!1}},mixins:[s.a],methods:{humanizeDuration:function(t){return window.humanizeDuration(t,{largest:4})},fmt:function(t){return t.utc().format("YYYY-MM-DD HH:mm")},openRange:function(){if(-1===this.setIndex)return alert("Select a dataset to adjust range");this.updateCustomRange(),this.rangeVisible=!0},updateCustomRange:function(){this.customTo=this.fmt(this.set.to),this.customFrom=this.fmt(this.set.from)},emitSet:function(t){if(t){var e=void 0;this.customTo?(e=i.a.util.extend({},t),e.to=moment.utc(this.customTo,"YYYY-MM-DD HH:mm").format(),e.from=moment.utc(this.customFrom,"YYYY-MM-DD HH:mm").format()):e=t,this.$emit("dataset",e)}}},watch:{setIndex:function(){this.set=this.datasets[this.setIndex],this.updateCustomRange(),this.emitSet(this.set)},customTo:function(){this.emitSet(this.set)},customFrom:function(){this.emitSet(this.set)}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(3),i=n.n(r),o=n(19),a=(n.n(o),n(11));n.n(a),n(2);e.default={props:["onlyTradable","onlyImportable"],data:function(){return{exchange:"poloniex"}},created:function(){this.emitExchange()},computed:{exchanges:function(){var t=Object.assign({},this.$store.state.exchanges);return!i.a.isEmpty(t)&&(this.onlyTradable&&i.a.each(t,function(e,n){e.tradable||delete t[n]}),this.onlyImportable&&i.a.each(t,function(e,n){e.importable||delete t[n]}),t)}},watch:{exchanges:function(){this.emitExchange()},exchange:function(){this.emitExchange()}},methods:{emitExchange:function(){this.$emit("exchange",this.exchange)}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(3),i=n.n(r),o=n(19),a=(n.n(o),n(11));n.n(a),n(2);e.default={props:["onlyTradable","onlyImportable"],data:function(){return{exchange:"poloniex",currency:"USDT",asset:"BTC"}},created:function(){this.emitConfig()},computed:{exchanges:function(){var t=Object.assign({},this.$store.state.exchanges);return!i.a.isEmpty(t)&&(this.onlyTradable&&i.a.each(t,function(e,n){e.tradable||delete t[n]}),this.onlyImportable&&i.a.each(t,function(e,n){e.importable||delete t[n]}),t)},markets:function(){return this.exchanges?this.exchanges[this.exchange]:null},assets:function(){return this.exchanges?this.exchanges[this.exchange].markets[this.currency]:null},currencies:function(){return this.exchanges?i.a.keys(this.exchanges[this.exchange].markets):null},watchConfig:function(){return{watch:{exchange:this.exchange,currency:this.currency,asset:this.asset}}}},watch:{currency:function(){this.emitConfig()},asset:function(){this.emitConfig()},market:function(){this.emitConfig()},exchanges:function(){this.emitConfig()},exchange:function(){this.emitConfig()}},methods:{emitConfig:function(){this.$emit("market",this.watchConfig)}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(3),i=(n.n(r),n(2));e.default={created:function(){var t=this;n.i(i.a)("configPart/paperTrader",function(e,n){t.rawPaperTraderParams=n.part})},data:function(){return{rawPaperTraderParams:"",rawPaperTraderParamsError:!1,paperTraderParams:{},toggle:"closed"}},watch:{rawPaperTraderParams:function(){this.emitConfig()}},methods:{switchToggle:function(){"open"===this.toggle?this.toggle="closed":this.toggle="open"},emitConfig:function(){this.parseParams(),this.$emit("settings",this.paperTraderParams)},parseParams:function(){try{this.paperTraderParams=toml.parse(this.rawPaperTraderParams),this.paperTraderParams.reportRoundtrips=!0,this.rawPaperTraderParamsError=!1}catch(t){this.rawPaperTraderParamsError=t,this.paperTraderParams={}}}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(3);n.n(r),n(2);e.default={data:function(){return{from:"",to:""}},created:function(){var t=moment().startOf("minute"),e=t.clone().subtract(3,"months");this.to=this.fmt(t),this.from=this.fmt(e),this.emitRange()},methods:{fmtTs:function(t){return moment.unix(t).utc()},fmt:function(t){return t.utc().format("YYYY-MM-DD HH:mm")},emitRange:function(){this.$emit("range",{from:this.fmtTs(this.from),to:this.fmtTs(this.to)})},emitManualEntry:function(){if(this.from.length<"4"||this.from.length<"4")return this.$emit("range",{});var t=moment.utc(this.from),e=moment.utc(this.to);t.isValid()&&e.isValid()?this.$emit("range",{from:this.fmt(t),to:this.fmt(e)}):this.$emit("range",{})}},watch:{from:function(){this.emitManualEntry()},to:function(){this.emitManualEntry()},config:function(){this.scanned=!1},tab:function(){this.scanned=!1,this.$emit("range",{})},selectedRangeIndex:function(){var t=this.ranges[this.selectedRangeIndex];t&&this.emitRange(t)}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(3),i=(n.n(r),n(2));e.default={props:["config"],data:function(){return{scanned:!1,ranges:[],selectedRangeIndex:-1,tab:"scan",from:"",to:""}},methods:{scan:function(){var t=this;this.scanned="fetching",this.selectedRangeIndex=-1,n.i(i.b)("scan",this.config,function(e,n){t.scanned=!0,t.ranges=n,t.selectedRangeIndex=0})},printRange:function(t){var e=function(t){return t.format("YYYY-MM-DD HH:mm")},n=moment.unix(t.from),r=moment.unix(t.to),i=moment.duration(r.diff(n)).humanize();return e(n)+" to "+e(r)+" ("+i+")"},fmtTs:function(t){return moment.unix(t).utc()},fmt:function(t){return t.utc().format()},emitRange:function(t){this.$emit("range",{from:this.fmtTs(t.from),to:this.fmtTs(t.to)})},emitManualEntry:function(){if(this.from.length<"4"||this.from.length<"4")return this.$emit("range",{});var t=moment.utc(this.from),e=moment.utc(this.to);t.isValid()&&e.isValid()?this.$emit("range",{from:this.fmt(t),to:this.fmt(e)}):this.$emit("range",{})},reset:function(){this.scanned=!1,this.$emit("range",{})}},watch:{from:function(){this.emitManualEntry()},to:function(){this.emitManualEntry()},config:function(){this.reset()},tab:function(){this.reset()},selectedRangeIndex:function(){var t=this.ranges[this.selectedRangeIndex];t&&this.emitRange(t)}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(3),i=n.n(r),o=n(2);e.default={data:function(){return{strategies:[],candleSizeUnit:"hours",rawCandleSize:1,strategy:"MACD",historySize:10,rawStratParams:"",rawStratParamsError:!1,emptyStrat:!1,stratParams:{}}},created:function(){var t=this;n.i(o.a)("strategies",function(e,n){t.strategies=n,i.a.each(t.strategies,function(t){t.empty=""===t.params}),t.rawStratParams=i.a.find(t.strategies,{name:t.strategy}).params,t.emptyStrat=i.a.find(t.strategies,{name:t.strategy}).empty,t.emitConfig()})},watch:{strategy:function(t){t=i.a.find(this.strategies,{name:t}),this.rawStratParams=t.params,this.emptyStrat=t.empty,this.emitConfig()},candleSize:function(){this.emitConfig()},historySize:function(){this.emitConfig()},rawStratParams:function(){this.emitConfig()}},computed:{candleSize:function(){return"minutes"===this.candleSizeUnit?this.rawCandleSize:"hours"===this.candleSizeUnit?60*this.rawCandleSize:"days"===this.candleSizeUnit?60*this.rawCandleSize*24:void 0},singularCandleSizeUnit:function(){return this.candleSizeUnit.slice(0,-1)},config:function(){var t={tradingAdvisor:{enabled:!0,method:this.strategy,candleSize:+this.candleSize,historySize:+this.historySize}};return this.emptyStrat?t[this.strategy]={__empty:!0}:t[this.strategy]=this.stratParams,t}},methods:{humanizeDuration:function(t){return window.humanizeDuration(t)},emitConfig:function(){this.parseParams(),this.$emit("stratConfig",this.config)},parseParams:function(){try{this.stratParams=toml.parse(this.rawStratParams),this.rawStratParamsError=!1}catch(t){this.rawStratParamsError=t,this.stratParams={}}}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={created:function(){this.emitType()},data:function(){return{types:["paper trader","market watcher","tradebot"],selectedTypeIndex:0}},methods:{emitType:function(){this.$emit("type",this.type)}},watch:{type:function(){this.emitType()}},computed:{type:function(){return this.types[this.selectedTypeIndex]}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={props:["report"],methods:{round2:function(t){return(+t).toFixed(2)},round:function(t){return(+t).toFixed(5)}},computed:{profitClass:function(){return this.report.relativeProfit>0?"profit":"loss"}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={props:["progress"],methods:{round:function(t){return(+t).toFixed(2)}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(112),i=n(113);e.default={data:function(){return{version:{gekko:r.version,ui:i.version}}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(8),i=n.i(r.a)("\n\n## Gekko\n\nGekko is a Bitcoin trading bot and backtesting platform that\nconnects to popular Bitcoin exchanges. It is written in javascript\nand runs on nodejs.\n\n[Find out more](https://gekko.wizb.it/).\n\n*Gekko is 100% open source and free, if you paid for this you have been scammed.*\n\n");e.default={data:function(){return{left:i}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(8),i={disconnected:n.i(r.a)("\n\n## Disconnected\n\nSomething happened to either Gekko or the connection.\nPlease check the terminal where Gekko is running or\nyour network connection.\n\n ")};e.default={computed:{active:function(){return!this.$store.state.warnings.connected},content:function(){return this.$store.state.warnings.connected?"":i.disconnected}}}},function(t,e,n){"use strict";var r=n(3),i=n.n(r),o=function(){function t(t,e){var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){i=!0,o=t}finally{try{!r&&s.return&&s.return()}finally{if(i)throw o}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();e.a=function(t,e,n){function r(){if(!d3.event.sourceEvent||"zoom"!==d3.event.sourceEvent.type){var t=d3.event.selection||y.range();_.domain(t.map(y.invert,y)),a(_.domain()),d.select(".axis--y").call(C),T.attr("cx",function(t){return _(t.date)}).attr("cy",function(t){return b(t.price)}),S.select(".line").attr("d",A),S.select(".axis--x").call(w),d.select(".zoom").call(O.transform,d3.zoomIdentity.scale(m/(t[1]-t[0])).translate(-t[0],0))}}function a(t){var e=o(t,2),n=e[0],r=e[1],a=i.a.sortedIndex(l,n),s=i.a.sortedIndex(l,r),u=f.slice(a,s);b.domain([.9995*d3.min(u),1.0005*d3.max(u)])}function s(){if(!d3.event.sourceEvent||"brush"!==d3.event.sourceEvent.type){var t=d3.event.transform;a(t.rescaleX(y).domain()),d.select(".axis--y").call(C),_.domain(t.rescaleX(y).domain()),S.select(".line").attr("d",A),T.attr("cx",function(t){return _(t.date)}).attr("cy",function(t){return b(t.price)}),S.select(".axis--x").call(w),j.select(".brush").call(E.move,_.range().map(t.invertX,t))}}var u=e.map(function(t){return{price:t.price,date:moment.utc(t.date).toDate(),action:t.action}}),c=t.map(function(t){return{price:t.close,date:moment.utc(t.start).toDate()}}),l=c.map(function(t){return+t.date}),f=c.map(function(t){return+t.price}),d=d3.select("#chart");d.attr("width",window.innerWidth-20);var p={top:20,right:20,bottom:110,left:40},h=n-p.top-p.bottom,v={top:n-70,right:20,bottom:30,left:40},m=+d.attr("width")-p.left-p.right,g=n-v.top-v.bottom,_=d3.scaleUtc().range([0,m]),y=d3.scaleUtc().range([0,m]),b=d3.scaleLinear().range([h,0]),x=d3.scaleLinear().range([g,0]),w=d3.axisBottom(_),k=d3.axisBottom(y),C=d3.axisLeft(b).ticks(n/50),E=d3.brushX().extent([[0,0],[m,g]]).on("brush end",r),O=d3.zoom().scaleExtent([1,100]).translateExtent([[0,0],[m,h]]).extent([[0,0],[m,h]]).on("zoom",s),A=d3.line().x(function(t){return _(t.date)}).y(function(t){return b(t.price)}),$=d3.line().x(function(t){return y(t.date)}).y(function(t){return x(t.price)});d.append("defs").append("clipPath").attr("id","clip").append("rect").attr("width",m).attr("height",h);var S=d.append("g").attr("class","focus").attr("transform","translate("+p.left+","+p.top+")"),j=d.append("g").attr("class","context").attr("transform","translate("+v.left+","+v.top+")");_.domain(d3.extent(c,function(t){return t.date})),b.domain([.99*d3.min(f),1.01*d3.max(f)]),y.domain(_.domain()),x.domain(b.domain()),S.append("path").datum(c).attr("class","line price").attr("d",A),S.append("g").attr("class","axis axis--x").attr("transform","translate(0,"+h+")").call(w),S.append("g").attr("class","axis axis--y").call(C),j.append("path").datum(c).attr("class","line").attr("d",$),j.append("g").attr("class","axis axis--x").attr("transform","translate(0,"+g+")").call(k);var T=d.append("g").attr("transform","translate("+p.left+","+p.top+")").selectAll("circle").data(u).enter().append("circle").attr("class",function(t){return t.action}).attr("cx",function(t){return _(t.date)}).attr("cy",function(t){return b(t.price)}).attr("r",5);j.append("g").selectAll("circle").data(u).enter().append("circle").attr("class",function(t){return t.action}).attr("cx",function(t){return y(t.date)}).attr("cy",function(t){return x(t.price)}).attr("r",3);j.append("g").attr("class","brush").call(E).call(E.move,_.range()),d.append("rect").attr("class","zoom").attr("width",m).attr("height",h).attr("transform","translate("+p.left+","+p.top+")").call(O)}},function(t,e,n){"use strict";n.d(e,"a",function(){return r});var r=function(t){d3.select("#chart").append("text").attr("class","message").attr("x",150).attr("y",150).text(t)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){var e=n(4),r=n(23),i=n.n(r),o=n(34),a=n(7),s=n(24),u=n.n(s),c=n(33),l=n.n(c),f=n(26),d=n.n(f),p=n(27),h=n.n(p),v=n(28),m=n.n(v),g=n(25),_=n.n(g),y=n(29),b=n.n(y),x=n(30),w=n.n(x),k=n(31),C=n.n(k),E=n(32),O=n.n(E),A=n(6);e.a.use(o.a);var $=new o.a({mode:"hash",base:t,routes:[{path:"/",redirect:"/home"},{path:"/home",component:l.a},{path:"/backtest",component:u.a},{path:"/config",component:_.a},{path:"/data",component:d.a},{path:"/data/importer",component:h.a},{path:"/data/importer/import/:id",component:m.a},{path:"/live-gekkos",component:b.a},{path:"/live-gekkos/new",component:w.a},{path:"/live-gekkos/stratrunner/:id",component:C.a},{path:"/live-gekkos/watcher/:id",component:O.a}]});n.i(A.a)(),new e.a({router:$,store:a.a,el:"#app",render:function(t){return t(i.a)}})}.call(e,"/")},function(t,e,n){"use strict";var r=(n(4),n(22),n(75)),i=n(81),o=n(79),a=n(77),s=n(73);e.a=function(){n.i(r.a)(),n.i(i.a)(),n.i(o.a)(),n.i(a.a)(),n.i(s.a)()}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),n.d(e,"syncApiKeys",function(){return i}),n.d(e,"syncExchanges",function(){return o});var r=n(4),i=function(t,e){return r.a.set(t,"apiKeys",e),t},o=function(t,e){return r.a.set(t,"exchanges",e),t}},function(t,e,n){"use strict";var r=n(2),i=n(7),o=n(6),a=function(){function t(t,e){var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){i=!0,o=t}finally{try{!r&&s.return&&s.return()}finally{if(i)throw o}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),s=function(t){var e=t,n={};return e.forEach(function(t){n[t.slug]=n[t.slug]||{markets:{}},t.markets.forEach(function(e){var r=a(e.pair,2),i=r[0],o=r[1];n[t.slug].markets[i]=n[t.slug].markets[i]||[],n[t.slug].markets[i].push(o)}),n[t.slug].importable=!!t.providesFullHistory,n[t.slug].tradable=!!t.tradable,n[t.slug].requires=t.requires}),n},u=function(){n.i(r.a)("apiKeys",function(t,e){i.a.commit("syncApiKeys",e)}),n.i(r.a)("exchanges",function(t,e){i.a.commit("syncExchanges",s(e))})},c=function(){o.b.$on("apiKeys",function(t){i.a.commit("syncApiKeys",t.exchanges)})};e.a=function(){u(),c()}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),n.d(e,"addImport",function(){return i}),n.d(e,"syncImports",function(){return o}),n.d(e,"updateImport",function(){return a});var r=n(4),i=function(t,e){return t.imports.push(e),t},o=function(t,e){return t.imports=e,t},a=function(t,e){var n=t.imports.findIndex(function(t){return t.id===e.import_id}),i=t.imports[n];if(!i)return t;var o=r.a.util.extend(i,e.updates);return r.a.set(t.imports,n,o),t}},function(t,e,n){"use strict";var r=n(2),i=n(7),o=n(6),a=function(){n.i(r.a)("imports",function(t,e){i.a.commit("syncImports",e)})},s=function(){o.b.$on("import_update",function(t){i.a.commit("updateImport",t)})};e.a=function(){a(),s()}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),n.d(e,"setGlobalWarning",function(){return i});var r=(n(4),n(3)),i=(n.n(r),function(t,e){return t.warnings[e.key]=e.value,t})},function(t,e,n){"use strict";var r=n(7),i=n(6),o=function(){i.b.$on("WS_STATUS_CHANGE",function(t){return r.a.commit("setGlobalWarning",{key:"connected",value:t.connected})})};e.a=function(){o()}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),n.d(e,"addStratrunner",function(){return i}),n.d(e,"syncStratrunners",function(){return o}),n.d(e,"updateStratrunner",function(){return a}),n.d(e,"addTradeToStratrunner",function(){return s}),n.d(e,"addRoundtripToStratrunner",function(){return u});var r=n(4),i=function(t,e){return t.stratrunners.push(e),t},o=function(t,e){return t.stratrunners=e,t},a=function(t,e){var n=t.stratrunners.findIndex(function(t){return t.id===e.gekko_id}),i=t.stratrunners[n];if(!i)return t;var o=r.a.util.extend(i,e.updates);return r.a.set(t.stratrunners,n,o),t},s=function(t,e){var n=t.stratrunners.findIndex(function(t){return t.id===e.gekko_id}),i=t.stratrunners[n];if(!i)return t;var o=r.a.util.extend({},i);return o.trades.push(e.trade),r.a.set(t.stratrunners,n,o),t},u=function(t,e){var n=t.stratrunners.findIndex(function(t){return t.id===e.gekko_id}),i=t.stratrunners[n];if(!i)return t;var o=r.a.util.extend({},i);return o.roundtrips.push(e.roundtrip),r.a.set(t.stratrunners,n,o),t}},function(t,e,n){"use strict";var r=n(2),i=n(7),o=n(6),a=n(3),s=n.n(a),u=function(){n.i(r.a)("gekkos",function(t,e){var n=s.a.filter(e,{type:"leech"});i.a.commit("syncStratrunners",n)})},c=function(){o.b.$on("new_gekko",function(t){"leech"===t.gekko.type&&i.a.commit("addStratrunner",t.gekko)});var t=function(t){i.a.commit("updateStratrunner",t)},e=function(t){i.a.commit("addTradeToStratrunner",t)},n=function(t){i.a.commit("addRoundtripToStratrunner",t)};o.b.$on("report",t),o.b.$on("trade",e),o.b.$on("update",t),o.b.$on("startAt",t),o.b.$on("lastCandle",t),o.b.$on("firstCandle",t),o.b.$on("roundtrip",n)};e.a=function(){u(),c()}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),n.d(e,"addWatcher",function(){return i}),n.d(e,"syncWatchers",function(){return o}),n.d(e,"updateWatcher",function(){return a});var r=n(4),i=function(t,e){return t.watchers.push(e),t},o=function(t,e){return t.watchers=e,t},a=function(t,e){var n=t.watchers.findIndex(function(t){return t.id===e.gekko_id}),i=t.watchers[n];if(!i)return t;var o=r.a.util.extend(i,e.updates);return r.a.set(t.watchers,n,o),t}},function(t,e,n){"use strict";var r=n(2),i=n(7),o=n(6),a=n(3),s=n.n(a),u=function(){n.i(r.a)("gekkos",function(t,e){var n=s.a.filter(e,{type:"watcher"});i.a.commit("syncWatchers",n)})},c=function(){o.b.$on("new_gekko",function(t){"watcher"===t.gekko.type&&i.a.commit("addWatcher",t.gekko)});var t=function(t){i.a.commit("updateWatcher",t)};o.b.$on("update",t),o.b.$on("startAt",t),o.b.$on("lastCandle",t),o.b.$on("firstCandle",t)};e.a=function(){u(),c()}},function(t,e,n){function r(t){if(t)return i(t)}function i(t){for(var e in r.prototype)t[e]=r.prototype[e];return t}t.exports=r,r.prototype.on=r.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},r.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var r,i=0;i4?t:document.documentMode}()},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,"#chartWrapper.clickable{position:relative}#chartWrapper.clickable .shield{cursor:zoom-in;position:absolute;top:0;bottom:0;left:0;right:0;background:grey;opacity:.1}#chart{background-color:#eee;width:100%}#chart circle{clip-path:url(#clip)}#chart .zoom{cursor:move;fill:none;pointer-events:all}#chart .line{fill:none;stroke:#4682b4;stroke-width:1.5px;clip-path:url(#clip)}#chart circle.buy{fill:#7fff00}#chart circle.sell{fill:red}",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,".scan-btn{margin-top:80px;margin-bottom:30px}.radio label{margin-top:0}",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,".progressbarWrapper p{text-align:center;font-size:20px}.progressbar{background-color:hsla(0,0%,85%,.99);border-radius:13px;padding:0}@keyframes shimmer{0%{background-position:0 0}to{background-position:960px 0}}.progressbar>div{height:20px;border-radius:10px;background-color:orange;animation-duration:1.5s;animation-fill-mode:forwards;animation-iteration-count:infinite;animation-name:shimmer;animation-timing-function:linear;background:#f6f7f8;background:linear-gradient(90deg,orange 10%,#ffce77 25%,orange 40%);background-size:960px 50px;background-position:0;position:relative}",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,".summary td{text-align:right}.big{font-size:1.3em}.big,.summary table{width:80%}.price.profit{color:#7fff00}.price.loss{color:red}",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,".summary td{text-align:right}",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,"",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,"",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,"",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,".scan-btn{margin-top:80px;margin-bottom:30px}.radio label{margin-top:0}",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,".clickable{cursor:pointer}table.full{width:100%}table.full td{padding:.5rem 0}table.full.data th{text-align:left;padding:.5rem 0}.warning p{margin:0;padding:0}",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,"",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,".menu{display:flex;width:100%;flex-direction:row;margin-top:0;margin-bottom:2rem}.menu a{flex:1 1 100%;display:block;text-align:center;text-decoration:none;color:inherit}.menu .router-link-active{background-color:hsla(0,0%,98%,.99)}.menu a:hover{text-decoration:underline}",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,".contain{max-width:900px;margin-left:auto;margin-right:auto}",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,".spinner{margin:20px auto 100px;width:50px;height:40px;text-align:center;font-size:10px}.spinner>div{background-color:#333;height:100%;width:6px;display:inline-block;margin-right:4px;-webkit-animation:sk-stretchdelay 1.2s infinite ease-in-out;animation:sk-stretchdelay 1.2s infinite ease-in-out}.spinner .rect2{-webkit-animation-delay:-1.1s;animation-delay:-1.1s}.spinner .rect3{-webkit-animation-delay:-1s;animation-delay:-1s}.spinner .rect4{-webkit-animation-delay:-.9s;animation-delay:-.9s}.spinner .rect5{-webkit-animation-delay:-.8s;animation-delay:-.8s}@-webkit-keyframes sk-stretchdelay{0%,40%,to{-webkit-transform:scaleY(.4)}20%{-webkit-transform:scaleY(1)}}@keyframes sk-stretchdelay{0%,40%,to{transform:scaleY(.4);-webkit-transform:scaleY(.4)}20%{transform:scaleY(1);-webkit-transform:scaleY(1)}}",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,".radio label{margin-top:0}",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,"#app{display:flex;min-height:100vh;flex-direction:column}.fill{flex:1}.text{max-width:500px}input{background:none;margin-top:.5em}.params{min-height:235px;line-height:1.3em}.hr{margin-top:2rem;margin-bottom:2rem;height:10px;background-color:hsla(0,0%,98%,.99)}.btn--primary{display:inline-block;margin-right:12px;margin-bottom:12px;height:40px;padding:0 18px;border-radius:4px;text-shadow:0 1px 3px rgba(36,180,126,.4);box-shadow:0 4px 6px rgba(50,50,93,.11),0 1px 3px rgba(0,0,0,.08);line-height:40px;transition:transform .25s}.btn--primary,.btn--primary:hover{background-color:#3498db;color:#fff;text-decoration:none}.btn--primary:hover{transform:translateY(-1px);box-shadow:0 7px 14px rgba(50,50,93,.1),0 3px 6px rgba(0,0,0,.08)}.btn--primary:active,.btn--primary:focus{background-color:#3498db;color:#fff;text-decoration:none}.btn--primary:active{transform:translateY(1px)}",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,"table.clickable{border-collapse:separate}tr.clickable td:first-child{padding-left:5px}tr.clickable{cursor:pointer}tr.clickable:hover{background:hsla(0,0%,85%,.99)}",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,"td.radio{width:45px}td label{display:inline;font-size:1em}",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,"",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,"#modal-background{position:fixed;top:0;bottom:0;left:0;right:0;background-color:#000;opacity:.5}.modal{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);width:600px;min-height:300px;background-color:#fff}.modal-guts{position:absolute;top:0;left:0;width:100%;height:100%;padding:20px 50px 20px 20px;overflow:auto}",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,".align .custom-select select{padding:.4em 1.2em .3em .8em}.label-like{display:block;font-size:.9em;color:#777}.align{padding-left:1em}",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,"",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,".align .custom-select select{padding:.4em 1.2em .3em .8em}.label-like{display:block;font-size:.9em;color:#777}.align{padding-left:1em}",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,"",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,"",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,"",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,"",""])},function(t,e,n){e=t.exports=n(0)(),e.push([t.i,".roundtrips{margin-top:50px;margin-bottom:50px}.roundtrips table{width:100%}.roundtrips table td,.roundtrips table th{border:1px solid #c6cbd1;padding:8px 12px}.roundtrips table td.loss{color:red;text-align:right}.roundtrips table td.profit{color:green;text-align:right}.roundtrips table tr:nth-child(2n){background-color:#f6f8fa}",""])},function(t,e){t.exports={name:"gekko",version:"0.5.11",description:"A bitcoin trading bot for auto trading at various exchanges",keywords:["trading","bot","bitcoin","TA","finance"],scripts:{test:"./node_modules/.bin/mocha test/*.js --recursive test -u tdd --reporter spec",start:"node ./gekko --config config.js --ui"},author:"Mike van Rossum ",dependencies:{"@slack/client":"^3.10.0",async:"2.1.2",binance:"^1.0.2","bitcoin-co-id":"0.0.1",bitexthai:"^0.1.0","bitfinex-api-node":"^1.2.0",bitstamp:"^1.0.3",bitx:"^1.5.0","btc-china-fork":"0.0.6","btc-markets":"0.0.10",cexio:"0.0.x","co-fs":"^1.2.0",commander:"^2.9.0",gdax:"^0.4.2",gekko:"0.0.9","gemini-exchange-coffee-api":"2.0.6","humanize-duration":"^3.10.0",koa:"^1.2.0","koa-bodyparser":"^2.2.0","koa-cors":"0.0.16","koa-logger":"^1.3.0","koa-router":"^5.4.0","koa-static":"^2.0.0","kraken-api-es5":"^1.0.0",lakebtc_nodejs:"0.1.x",lodash:"2.x",moment:"2.19.3","node-wex":"^1.0.3","node.bittrex.api":"^0.4.3","okcoin-china":"0.0.7",opn:"^4.0.2","poloniex.js":"0.0.7","promisify-node":"^0.4.0","prompt-lite":"0.1.1",pushbullet:"1.4.3",quadrigacx:"0.0.7",relieve:"^2.1.3",retry:"^0.10.1",semver:"5.4.1",sqlite3:"^3.1.8","stats-lite":"^2.0.4","tiny-promisify":"^0.1.1",toml:"^2.3.0",twitter:"^1.7.1","zaif.jp":"^0.1.4"},devDependencies:{chai:"^2.0.0",mocha:"^2.1.1",proxyquire:"^1.7.10",sinon:"^1.12.2"},engines:{node:">=6.0"},license:"MIT",repository:{type:"git",url:"https://github.com/askmike/gekko.git"}}},function(t,e){t.exports={name:"vue",version:"0.2.0",description:"The frontend for the Gekko UI",author:"Mike van Rossum ",scripts:{dev:"cross-env NODE_ENV=development webpack-dev-server --open --inline --hot",build:"cross-env NODE_ENV=production webpack --progress --hide-modules"},devDependencies:{"babel-core":"^6.0.0","babel-loader":"^6.0.0","babel-preset-es2015":"^6.0.0","cross-env":"^3.0.0","css-loader":"^0.25.0","file-loader":"^0.9.0","json-loader":"^0.5.4",marked:"^0.3.6",superagent:"^2.3.0","superagent-no-cache":"uditalias/superagent-no-cache",vue:"^2.0.1","vue-loader":"^9.7.0","vue-router":"^2.0.3",vuex:"^2.2.1",webpack:"^2.1.0-beta.25","webpack-dev-server":"^2.1.0-beta.0"},dependencies:{jade:"^1.11.0"}}},function(t,e,n){(function(e){(function(){function e(t){this.tokens=[],this.tokens.links={},this.options=t||l.defaults,this.rules=f.normal,this.options.gfm&&(this.options.tables?this.rules=f.tables:this.rules=f.gfm)}function n(t,e){if(this.options=e||l.defaults,this.links=t,this.rules=d.normal,this.renderer=this.options.renderer||new r,this.renderer.options=this.options,!this.links)throw new Error("Tokens array requires a `links` property.");this.options.gfm?this.options.breaks?this.rules=d.breaks:this.rules=d.gfm:this.options.pedantic&&(this.rules=d.pedantic)}function r(t){this.options=t||{}}function i(t){this.tokens=[],this.token=null,this.options=t||l.defaults,this.options.renderer=this.options.renderer||new r,this.renderer=this.options.renderer,this.renderer.options=this.options}function o(t,e){return t.replace(e?/&/g:/&(?!#?\w+;)/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function a(t){return t.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/g,function(t,e){return e=e.toLowerCase(),"colon"===e?":":"#"===e.charAt(0)?"x"===e.charAt(1)?String.fromCharCode(parseInt(e.substring(2),16)):String.fromCharCode(+e.substring(1)):""})}function s(t,e){return t=t.source,e=e||"",function n(r,i){return r?(i=i.source||i,i=i.replace(/(^|[^\[])\^/g,"$1"),t=t.replace(r,i),n):new RegExp(t,e)}}function u(){}function c(t){for(var e,n,r=1;rAn error occured:

    "+o(t.message+"",!0)+"
    ";throw t}}var f={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:u,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:u,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,def:/^ *\[([^\]]+)\]: *]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:u,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};f.bullet=/(?:[*+-]|\d+\.)/,f.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/,f.item=s(f.item,"gm")(/bull/g,f.bullet)(),f.list=s(f.list)(/bull/g,f.bullet)("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def","\\n+(?="+f.def.source+")")(),f.blockquote=s(f.blockquote)("def",f.def)(),f._tag="(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b",f.html=s(f.html)("comment",//)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/])*?>/)(/tag/g,f._tag)(),f.paragraph=s(f.paragraph)("hr",f.hr)("heading",f.heading)("lheading",f.lheading)("blockquote",f.blockquote)("tag","<"+f._tag)("def",f.def)(),f.normal=c({},f),f.gfm=c({},f.normal,{fences:/^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\s*\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/}),f.gfm.paragraph=s(f.paragraph)("(?!","(?!"+f.gfm.fences.source.replace("\\1","\\2")+"|"+f.list.source.replace("\\1","\\3")+"|")(),f.tables=c({},f.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/}),e.rules=f,e.lex=function(t,n){return new e(n).lex(t)},e.prototype.lex=function(t){return t=t.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n"),this.token(t,!0)},e.prototype.token=function(t,e,n){for(var r,i,o,a,s,u,c,l,d,t=t.replace(/^ +$/gm,"");t;)if((o=this.rules.newline.exec(t))&&(t=t.substring(o[0].length),o[0].length>1&&this.tokens.push({type:"space"})),o=this.rules.code.exec(t))t=t.substring(o[0].length),o=o[0].replace(/^ {4}/gm,""),this.tokens.push({type:"code",text:this.options.pedantic?o:o.replace(/\n+$/,"")});else if(o=this.rules.fences.exec(t))t=t.substring(o[0].length),this.tokens.push({type:"code",lang:o[2],text:o[3]||""});else if(o=this.rules.heading.exec(t))t=t.substring(o[0].length),this.tokens.push({type:"heading",depth:o[1].length,text:o[2]});else if(e&&(o=this.rules.nptable.exec(t))){for(t=t.substring(o[0].length),u={type:"table",header:o[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:o[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:o[3].replace(/\n$/,"").split("\n")},l=0;l ?/gm,""),this.token(o,e,!0),this.tokens.push({type:"blockquote_end"});else if(o=this.rules.list.exec(t)){for(t=t.substring(o[0].length),a=o[2],this.tokens.push({type:"list_start",ordered:a.length>1}),o=o[0].match(this.rules.item),r=!1,d=o.length,l=0;l1&&s.length>1||(t=o.slice(l+1).join("\n")+t,l=d-1)),i=r||/\n\n(?!\s*$)/.test(u),l!==d-1&&(r="\n"===u.charAt(u.length-1),i||(i=r)),this.tokens.push({type:i?"loose_item_start":"list_item_start"}),this.token(u,!1,n),this.tokens.push({type:"list_item_end"});this.tokens.push({type:"list_end"})}else if(o=this.rules.html.exec(t))t=t.substring(o[0].length),this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:!this.options.sanitizer&&("pre"===o[1]||"script"===o[1]||"style"===o[1]),text:o[0]});else if(!n&&e&&(o=this.rules.def.exec(t)))t=t.substring(o[0].length),this.tokens.links[o[1].toLowerCase()]={href:o[2],title:o[3]};else if(e&&(o=this.rules.table.exec(t))){for(t=t.substring(o[0].length),u={type:"table",header:o[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:o[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:o[3].replace(/(?: *\| *)?\n$/,"").split("\n")},l=0;l])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:u,tag:/^|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:[^_]|__)+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:u,text:/^[\s\S]+?(?=[\\?(?:\s+['"]([\s\S]*?)['"])?\s*/,d.link=s(d.link)("inside",d._inside)("href",d._href)(),d.reflink=s(d.reflink)("inside",d._inside)(),d.normal=c({},d),d.pedantic=c({},d.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/}),d.gfm=c({},d.normal,{escape:s(d.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:s(d.text)("]|","~]|")("|","|https?://|")()}),d.breaks=c({},d.gfm,{br:s(d.br)("{2,}","*")(),text:s(d.gfm.text)("{2,}","*")()}),n.rules=d,n.output=function(t,e,r){return new n(e,r).output(t)},n.prototype.output=function(t){for(var e,n,r,i,a="";t;)if(i=this.rules.escape.exec(t))t=t.substring(i[0].length),a+=i[1];else if(i=this.rules.autolink.exec(t))t=t.substring(i[0].length),"@"===i[2]?(n=":"===i[1].charAt(6)?this.mangle(i[1].substring(7)):this.mangle(i[1]),r=this.mangle("mailto:")+n):(n=o(i[1]),r=n),a+=this.renderer.link(r,null,n);else if(this.inLink||!(i=this.rules.url.exec(t))){if(i=this.rules.tag.exec(t))!this.inLink&&/^
    /i.test(i[0])&&(this.inLink=!1),t=t.substring(i[0].length),a+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(i[0]):o(i[0]):i[0];else if(i=this.rules.link.exec(t))t=t.substring(i[0].length),this.inLink=!0,a+=this.outputLink(i,{href:i[2],title:i[3]}),this.inLink=!1;else if((i=this.rules.reflink.exec(t))||(i=this.rules.nolink.exec(t))){if(t=t.substring(i[0].length),e=(i[2]||i[1]).replace(/\s+/g," "),!(e=this.links[e.toLowerCase()])||!e.href){a+=i[0].charAt(0),t=i[0].substring(1)+t;continue}this.inLink=!0,a+=this.outputLink(i,e),this.inLink=!1}else if(i=this.rules.strong.exec(t))t=t.substring(i[0].length),a+=this.renderer.strong(this.output(i[2]||i[1]));else if(i=this.rules.em.exec(t))t=t.substring(i[0].length),a+=this.renderer.em(this.output(i[2]||i[1]));else if(i=this.rules.code.exec(t))t=t.substring(i[0].length),a+=this.renderer.codespan(o(i[2],!0));else if(i=this.rules.br.exec(t))t=t.substring(i[0].length),a+=this.renderer.br();else if(i=this.rules.del.exec(t))t=t.substring(i[0].length),a+=this.renderer.del(this.output(i[1]));else if(i=this.rules.text.exec(t))t=t.substring(i[0].length),a+=this.renderer.text(o(this.smartypants(i[0])));else if(t)throw new Error("Infinite loop on byte: "+t.charCodeAt(0))}else t=t.substring(i[0].length),n=o(i[1]),r=n,a+=this.renderer.link(r,null,n);return a},n.prototype.outputLink=function(t,e){var n=o(e.href),r=e.title?o(e.title):null;return"!"!==t[0].charAt(0)?this.renderer.link(n,r,this.output(t[1])):this.renderer.image(n,r,o(t[1]))},n.prototype.smartypants=function(t){return this.options.smartypants?t.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014\/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014\/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…"):t},n.prototype.mangle=function(t){if(!this.options.mangle)return t;for(var e,n="",r=t.length,i=0;i.5&&(e="x"+e.toString(16)),n+="&#"+e+";";return n},r.prototype.code=function(t,e,n){if(this.options.highlight){var r=this.options.highlight(t,e);null!=r&&r!==t&&(n=!0,t=r)}return e?'
    '+(n?t:o(t,!0))+"\n
    \n":"
    "+(n?t:o(t,!0))+"\n
    "},r.prototype.blockquote=function(t){return"
    \n"+t+"
    \n"},r.prototype.html=function(t){return t},r.prototype.heading=function(t,e,n){return"'+t+"\n"},r.prototype.hr=function(){return this.options.xhtml?"
    \n":"
    \n"},r.prototype.list=function(t,e){var n=e?"ol":"ul";return"<"+n+">\n"+t+"\n"},r.prototype.listitem=function(t){return"
  • "+t+"
  • \n"},r.prototype.paragraph=function(t){return"

    "+t+"

    \n"},r.prototype.table=function(t,e){return"\n\n"+t+"\n\n"+e+"\n
    \n"},r.prototype.tablerow=function(t){return"\n"+t+"\n"},r.prototype.tablecell=function(t,e){var n=e.header?"th":"td";return(e.align?"<"+n+' style="text-align:'+e.align+'">':"<"+n+">")+t+"\n"},r.prototype.strong=function(t){return""+t+""},r.prototype.em=function(t){return""+t+""},r.prototype.codespan=function(t){return""+t+""},r.prototype.br=function(){return this.options.xhtml?"
    ":"
    "},r.prototype.del=function(t){return""+t+""},r.prototype.link=function(t,e,n){if(this.options.sanitize){try{var r=decodeURIComponent(a(t)).replace(/[^\w:]/g,"").toLowerCase()}catch(t){return""}if(0===r.indexOf("javascript:")||0===r.indexOf("vbscript:"))return""}var i='
    "},r.prototype.image=function(t,e,n){var r=''+n+'":">"},r.prototype.text=function(t){return t},i.parse=function(t,e,n){return new i(e,n).parse(t)},i.prototype.parse=function(t){this.inline=new n(t.links,this.options,this.renderer),this.tokens=t.reverse();for(var e="";this.next();)e+=this.tok();return e},i.prototype.next=function(){return this.token=this.tokens.pop()},i.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},i.prototype.parseText=function(){for(var t=this.token.text;"text"===this.peek().type;)t+="\n"+this.next().text;return this.inline.output(t)},i.prototype.tok=function(){switch(this.token.type){case"space":return"";case"hr":return this.renderer.hr();case"heading":return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,this.token.text);case"code":return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);case"table":var t,e,n,r,i="",o="";for(n="",t=0;t=300)&&(r=new Error(e.statusText||"Unsuccessful HTTP response"),r.original=t,r.response=e,r.status=e.status)}catch(t){r=t}r?n.callback(r,e):n.callback(null,e)})}function p(t,e){var n=_("DELETE",t);return e&&n.end(e),n}var h;"undefined"!=typeof window?h=window:"undefined"!=typeof self?h=self:(console.warn("Using browser-only version of superagent in non-browser environment"),h=this);var v=n(82),m=n(117),g=n(15),_=t.exports=n(118).bind(null,d);_.getXHR=function(){if(!(!h.XMLHttpRequest||h.location&&"file:"==h.location.protocol&&h.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(t){}throw Error("Browser-only verison of superagent could not find XHR")};var y="".trim?function(t){return t.trim()}:function(t){return t.replace(/(^\s*|\s*$)/g,"")};_.serializeObject=i,_.parseString=a,_.types={html:"text/html",json:"application/json",xml:"application/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},_.serialize={"application/x-www-form-urlencoded":i,"application/json":JSON.stringify},_.parse={"application/x-www-form-urlencoded":a,"application/json":JSON.parse},f.prototype.get=function(t){return this.header[t.toLowerCase()]},f.prototype._setHeaderProperties=function(t){var e=this.header["content-type"]||"";this.type=c(e);var n=l(e);for(var r in n)this[r]=n[r]},f.prototype._parseBody=function(t){var e=_.parse[this.type];return!e&&u(this.type)&&(e=_.parse["application/json"]),e&&t&&(t.length||t instanceof Object)?e(t):null},f.prototype._setStatusProperties=function(t){1223===t&&(t=204);var e=t/100|0;this.status=this.statusCode=t,this.statusType=e,this.info=1==e,this.ok=2==e,this.clientError=4==e,this.serverError=5==e,this.error=(4==e||5==e)&&this.toError(),this.accepted=202==t,this.noContent=204==t,this.badRequest=400==t,this.unauthorized=401==t,this.notAcceptable=406==t,this.notFound=404==t,this.forbidden=403==t},f.prototype.toError=function(){var t=this.req,e=t.method,n=t.url,r="cannot "+e+" "+n+" ("+this.status+")",i=new Error(r);return i.status=this.status,i.method=e,i.url=n,i},_.Response=f,v(d.prototype);for(var b in m)d.prototype[b]=m[b];d.prototype.type=function(t){return this.set("Content-Type",_.types[t]||t),this},d.prototype.responseType=function(t){return this._responseType=t,this},d.prototype.accept=function(t){return this.set("Accept",_.types[t]||t),this},d.prototype.auth=function(t,e,n){switch(n||(n={type:"basic"}),n.type){case"basic":var r=btoa(t+":"+e);this.set("Authorization","Basic "+r);break;case"auto":this.username=t,this.password=e}return this},d.prototype.query=function(t){return"string"!=typeof t&&(t=i(t)),t&&this._query.push(t),this},d.prototype.attach=function(t,e,n){return this._getFormData().append(t,e,n||e.name),this},d.prototype._getFormData=function(){return this._formData||(this._formData=new h.FormData),this._formData},d.prototype.callback=function(t,e){var n=this._callback;this.clearTimeout(),n(t,e)},d.prototype.crossDomainError=function(){var t=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");t.crossDomain=!0,t.status=this.status,t.method=this.method,t.url=this.url,this.callback(t)},d.prototype._timeoutError=function(){var t=this._timeout,e=new Error("timeout of "+t+"ms exceeded");e.timeout=t,this.callback(e)},d.prototype._appendQueryString=function(){var t=this._query.join("&");t&&(this.url+=~this.url.indexOf("?")?"&"+t:"?"+t)},d.prototype.end=function(t){var e=this,n=this.xhr=_.getXHR(),i=this._timeout,o=this._formData||this._data;this._callback=t||r,n.onreadystatechange=function(){if(4==n.readyState){var t;try{t=n.status}catch(e){t=0}if(0==t){if(e.timedout)return e._timeoutError();if(e._aborted)return;return e.crossDomainError()}e.emit("end")}};var a=function(t,n){n.total>0&&(n.percent=n.loaded/n.total*100),n.direction=t,e.emit("progress",n)};if(this.hasListeners("progress"))try{n.onprogress=a.bind(null,"download"),n.upload&&(n.upload.onprogress=a.bind(null,"upload"))}catch(t){}if(i&&!this._timer&&(this._timer=setTimeout(function(){e.timedout=!0,e.abort()},i)),this._appendQueryString(),this.username&&this.password?n.open(this.method,this.url,!0,this.username,this.password):n.open(this.method,this.url,!0),this._withCredentials&&(n.withCredentials=!0),"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof o&&!this._isHost(o)){var s=this._header["content-type"],c=this._serializer||_.serialize[s?s.split(";")[0]:""];!c&&u(s)&&(c=_.serialize["application/json"]),c&&(o=c(o))}for(var l in this.header)null!=this.header[l]&&n.setRequestHeader(l,this.header[l]);return this._responseType&&(n.responseType=this._responseType),this.emit("request",this),n.send(void 0!==o?o:null),this},_.Request=d,_.get=function(t,e,n){var r=_("GET",t);return"function"==typeof e&&(n=e,e=null),e&&r.query(e),n&&r.end(n),r},_.head=function(t,e,n){var r=_("HEAD",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},_.options=function(t,e,n){var r=_("OPTIONS",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},_.del=p,_.delete=p,_.patch=function(t,e,n){var r=_("PATCH",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},_.post=function(t,e,n){var r=_("POST",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},_.put=function(t,e,n){var r=_("PUT",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r}},function(t,e,n){var r=n(15);e.clearTimeout=function(){return this._timeout=0,clearTimeout(this._timer),this},e.parse=function(t){return this._parser=t,this},e.serialize=function(t){return this._serializer=t,this},e.timeout=function(t){return this._timeout=t,this},e.then=function(t,e){if(!this._fullfilledPromise){var n=this;this._fullfilledPromise=new Promise(function(t,e){n.end(function(n,r){n?e(n):t(r)})})}return this._fullfilledPromise.then(t,e)},e.catch=function(t){return this.then(void 0,t)},e.use=function(t){return t(this),this},e.get=function(t){return this._header[t.toLowerCase()]},e.getHeader=e.get,e.set=function(t,e){if(r(t)){for(var n in t)this.set(n,t[n]);return this}return this._header[t.toLowerCase()]=e,this.header[t]=e,this},e.unset=function(t){return delete this._header[t.toLowerCase()],delete this.header[t],this},e.field=function(t,e){if(null===t||void 0===t)throw new Error(".field(name, val) name can not be empty");if(r(t)){for(var n in t)this.field(n,t[n]);return this}if(null===e||void 0===e)throw new Error(".field(name, val) val can not be empty");return this._getFormData().append(t,e),this},e.abort=function(){return this._aborted?this:(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort"),this)},e.withCredentials=function(){return this._withCredentials=!0,this},e.redirects=function(t){return this._maxRedirects=t,this},e.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},e._isHost=function(t){switch({}.toString.call(t)){case"[object File]":case"[object Blob]":case"[object FormData]":return!0;default:return!1}},e.send=function(t){var e=r(t),n=this._header["content-type"];if(e&&r(this._data))for(var i in t)this._data[i]=t[i];else"string"==typeof t?(n||this.type("form"),n=this._header["content-type"],this._data="application/x-www-form-urlencoded"==n?this._data?this._data+"&"+t:t:(this._data||"")+t):this._data=t;return!e||this._isHost(t)?this:(n||this.type("json"),this)}},function(t,e){function n(t,e,n){return"function"==typeof n?new t("GET",e).end(n):2==arguments.length?new t("GET",e):new t(e,n)}t.exports=n},function(t,e,n){var r,i;n(191),r=n(36);var o=n(163);i=r=r||{},"object"!=typeof r.default&&"function"!=typeof r.default||(i=r=r.default),"function"==typeof i&&(i=i.options),i.render=o.render,i.staticRenderFns=o.staticRenderFns,t.exports=r},function(t,e,n){var r,i;n(170),r=n(39);var o=n(140);i=r=r||{},"object"!=typeof r.default&&"function"!=typeof r.default||(i=r=r.default),"function"==typeof i&&(i=i.options),i.render=o.render,i.staticRenderFns=o.staticRenderFns,t.exports=r},function(t,e,n){var r,i;n(169),r=n(41);var o=n(139);i=r=r||{},"object"!=typeof r.default&&"function"!=typeof r.default||(i=r=r.default),"function"==typeof i&&(i=i.options),i.render=o.render,i.staticRenderFns=o.staticRenderFns,t.exports=r},function(t,e,n){var r,i;n(189),r=n(42);var o=n(161);i=r=r||{},"object"!=typeof r.default&&"function"!=typeof r.default||(i=r=r.default),"function"==typeof i&&(i=i.options),i.render=o.render,i.staticRenderFns=o.staticRenderFns,t.exports=r},function(t,e,n){var r,i;n(175),r=n(45);var o=n(145);i=r=r||{},"object"!=typeof r.default&&"function"!=typeof r.default||(i=r=r.default),"function"==typeof i&&(i=i.options),i.render=o.render,i.staticRenderFns=o.staticRenderFns,t.exports=r},function(t,e,n){var r,i;n(190),r=n(48);var o=n(162);i=r=r||{},"object"!=typeof r.default&&"function"!=typeof r.default||(i=r=r.default),"function"==typeof i&&(i=i.options),i.render=o.render,i.staticRenderFns=o.staticRenderFns,t.exports=r},function(t,e,n){var r,i;n(182),r=n(54);var o=n(154);i=r=r||{},"object"!=typeof r.default&&"function"!=typeof r.default||(i=r=r.default),"function"==typeof i&&(i=i.options),i.render=o.render,i.staticRenderFns=o.staticRenderFns,t.exports=r},function(t,e,n){var r,i;r=n(55);var o=n(151);i=r=r||{},"object"!=typeof r.default&&"function"!=typeof r.default||(i=r=r.default),"function"==typeof i&&(i=i.options),i.render=o.render,i.staticRenderFns=o.staticRenderFns,t.exports=r},function(t,e,n){var r,i;n(179),r=n(61);var o=n(150);i=r=r||{},"object"!=typeof r.default&&"function"!=typeof r.default||(i=r=r.default),"function"==typeof i&&(i=i.options),i.render=o.render,i.staticRenderFns=o.staticRenderFns,t.exports=r},function(t,e,n){var r,i;n(167),r=n(63);var o=n(134);i=r=r||{},"object"!=typeof r.default&&"function"!=typeof r.default||(i=r=r.default),"function"==typeof i&&(i=i.options),i.render=o.render,i.staticRenderFns=o.staticRenderFns,t.exports=r},function(t,e,n){var r,i;r=n(64);var o=n(138);i=r=r||{},"object"!=typeof r.default&&"function"!=typeof r.default||(i=r=r.default),"function"==typeof i&&(i=i.options),i.render=o.render,i.staticRenderFns=o.staticRenderFns,t.exports=r},function(t,e,n){var r,i;n(176),r=n(65);var o=n(146);i=r=r||{},"object"!=typeof r.default&&"function"!=typeof r.default||(i=r=r.default),"function"==typeof i&&(i=i.options),i.render=o.render,i.staticRenderFns=o.staticRenderFns,t.exports=r},function(t,e,n){var r,i;n(184),r=n(67);var o=n(156);i=r=r||{},"object"!=typeof r.default&&"function"!=typeof r.default||(i=r=r.default),"function"==typeof i&&(i=i.options),i.render=o.render,i.staticRenderFns=o.staticRenderFns,t.exports=r},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{class:{clickable:!t.isClicked},attrs:{id:"chartWrapper"}},[n("div",{staticClass:"shield",on:{click:function(e){e.preventDefault(),t.click(e)}}}),n("svg",{attrs:{id:"chart",width:"960",height:t.height}})])},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("h3",[t._v("Daterange")]),n("div",[n("label",{attrs:{for:"from"}},[t._v("From")]),n("input",{directives:[{name:"model",rawName:"v-model",value:t.from,expression:"from"}],domProps:{value:t.from},on:{input:function(e){e.target.composing||(t.from=e.target.value)}}})]),n("div",[n("label",{attrs:{for:"to"}},[t._v("To")]),n("input",{directives:[{name:"model",rawName:"v-model",value:t.to,expression:"to"}],domProps:{value:t.to},on:{input:function(e){e.target.composing||(t.to=e.target.value)}}})])])},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return t.progress?n("div",{staticClass:"progressbarWrapper"},[n("p",[n("strong",[t._v(t._s(t.round(t.progress))+"%")])]),n("div",{staticClass:"progressbar"},[n("div",{style:{width:t.progress+"%"}})])]):t._e()},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("div",{staticClass:"mx1"},[n("label",{staticClass:"wrapper",attrs:{for:"exchange"}},[t._v("Exchange:")]),n("div",{staticClass:"custom-select button"},[n("select",{directives:[{name:"model",rawName:"v-model",value:t.exchange,expression:"exchange"}],on:{change:function(e){var n=Array.prototype.filter.call(e.target.options,function(t){return t.selected}).map(function(t){return"_value"in t?t._value:t.value});t.exchange=e.target.multiple?n:n[0]}}},t._l(t.exchanges,function(e,r){return n("option",[t._v(t._s(r))])}))])]),n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-3-6 mx1"},[n("label",{attrs:{for:"currency"}},[t._v("Currency:")]),n("div",{staticClass:"custom-select button"},[n("select",{directives:[{name:"model",rawName:"v-model",value:t.currency,expression:"currency"}],on:{change:function(e){var n=Array.prototype.filter.call(e.target.options,function(t){return t.selected}).map(function(t){return"_value"in t?t._value:t.value});t.currency=e.target.multiple?n:n[0]}}},t._l(t.currencies,function(e){return n("option",[t._v(t._s(e))])}))])]),n("div",{staticClass:"grd-row-col-3-6 mx1"},[n("label",{attrs:{for:"asset"}},[t._v("Asset:")]),n("div",{staticClass:"custom-select button"},[n("select",{directives:[{name:"model",rawName:"v-model",value:t.asset,expression:"asset"}],on:{change:function(e){var n=Array.prototype.filter.call(e.target.options,function(t){return t.selected}).map(function(t){return"_value"in t?t._value:t.value});t.asset=e.target.multiple?n:n[0]}}},t._l(t.assets,function(e){return n("option",[t._v(t._s(e))])}))])])])])},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"grd-row-col-3-6"},[n("table",{staticClass:"p1"},[n("tr",[n("th",[t._v("amount of trades")]),n("td",[t._v(t._s(t.report.trades))])]),n("tr",[n("th",[t._v("sharpe ratio")]),n("td",[t._v(t._s(t.round2(t.report.sharpe)))])]),n("tr",[n("th",[t._v("start balance")]),n("td",[t._v(t._s(t.round(t.report.startBalance))+" "+t._s(t.report.currency))])]),n("tr",[n("th",[t._v("final balance")]),n("td",[t._v(t._s(t.round(t.report.balance))+" "+t._s(t.report.currency))])]),t._m(0)]),n("div",{staticClass:"big txt--right price",class:t.profitClass},[t._v(t._s(t.round(t.report.relativeProfit))+"%")])])},staticRenderFns:[function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("tr",[n("th",[t._v("simulated profit")])])}]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"contain"},[n("h2",[t._v("Config")]),n("div",{staticClass:"hr"}),n("h3",[t._v("Available API keys")]),t.apiKeySets.length?t._e():n("p",[n("em",[t._v("You don't have any API keys yet.")])]),n("ul",t._l(t.apiKeySets,function(e){return n("li",[t._v(t._s(e)+" ("),n("a",{attrs:{href:"#"},on:{click:function(n){n.preventDefault(),t.removeApiKey(e)}}},[t._v("remove")]),t._v(")")])})),t.addApiToggle?t._e():n("a",{staticClass:"btn--primary",attrs:{href:"#"},on:{click:function(e){e.preventDefault(),t.openAddApi(e)}}},[t._v("Add an API key")]),t.addApiToggle?[n("div",{staticClass:"hr"}),n("apiConfigBuilder")]:t._e(),n("div",{staticClass:"hr"})],2)},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("footer",{staticClass:"p2 bg--off-white"},[n("div",{staticClass:"contain"},[t._m(0),n("p",[t._v("Using Gekko v"+t._s(t.version.gekko)+" and Gekko UI v"+t._s(t.version.ui)+".")])])])},staticRenderFns:[function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("p",[n("em",[t._v("Use Gekko at your own risk.")])])}]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"contain"},[n("div",{staticClass:"grd-row summary"},[n("div",{staticClass:"grd-row-col-3-6"},[n("table",{staticClass:"p1"},[n("tr",[n("th",[t._v("start time")]),n("td",[t._v(t._s(t.report.startTime))])]),n("tr",[n("th",[t._v("end time")]),n("td",[t._v(t._s(t.report.endTime))])]),n("tr",[n("th",[t._v("timespan")]),n("td",[t._v(t._s(t.report.timespan))])]),n("tr",[n("th",[t._v("start price")]),n("td",[t._v(t._s(t.round(t.report.startPrice))+" "+t._s(t.report.currency))])]),n("tr",[n("th",[t._v("end price")]),n("td",[t._v(t._s(t.round(t.report.endPrice))+" "+t._s(t.report.currency))])]),n("tr",[n("th",[t._v("market")]),n("td",[t._v(t._s(t.round(t.report.market))+"%")])])])]),n("paperTradeSummary",{attrs:{report:t.report}})],1)])},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("div",{staticClass:"hr contain"}),t._m(0),n("result-summary",{attrs:{report:t.result.report}}),n("div",{staticClass:"hr contain"}),n("chart",{attrs:{data:t.result,height:"500"}}),n("div",{staticClass:"hr contain"}),n("roundtripTable",{attrs:{roundtrips:t.result.roundtrips}})],1)},staticRenderFns:[function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"contain"},[n("h3",[t._v("Backtest result")])])}]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"contain my2"},[n("h3",[t._v("Start a new gekko")]),n("gekko-config-builder",{on:{config:t.updateConfig}}),n("div",{staticClass:"hr"}),t.config.valid?n("div",{staticClass:"txt--center"},[n("a",{staticClass:"w100--s my1 btn--primary",attrs:{href:"#"},on:{click:function(e){e.preventDefault(),t.start(e)}}},[t._v("Start")])]):t._e()],1)},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"contain my2"},[n("div",{staticClass:"text",domProps:{innerHTML:t._s(t.intro)}}),n("div",{staticClass:"hr"}),n("h3",[t._v("Currently running imports")]),0===t.imports.length?n("p",[t._v("You currently don't have any imports running.")]):t._e(),t.imports.length?n("ul",t._l(t.imports,function(e){return n("li",[n("router-link",{attrs:{to:"/data/importer/import/"+e.id}},[t._v(t._s(e.watch.exchange)+":"+t._s(e.watch.currency)+"/"+t._s(e.watch.asset))])],1)})):t._e(),n("div",{staticClass:"hr"}),n("h3",[t._v("Start a new import")]),n("import-config-builder",{on:{config:t.updateConfig}}),n("div",{staticClass:"hr"}),n("div",{staticClass:"txt--center"},[n("a",{staticClass:"w100--s my1 btn--primary",attrs:{href:"#"},on:{click:function(e){e.preventDefault(),t.run(e)}}},[t._v("Import")])])],1)},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("h3",[t._v("Daterange")]),"scan"===t.tab?[t.scanned?t._e():n("div",{staticClass:"txt--center"},[n("a",{staticClass:"w100--s btn--primary scan-btn",attrs:{href:"#"},on:{click:function(e){e.preventDefault(),t.scan(e)}}},[t._v("Scan available data")])]),"fetching"==t.scanned?n("div",{staticClass:"txt--center"},[n("p",{staticClass:"scan-btn"},[t._v("Scanning..")])]):t._e(),1==t.scanned?[0===t.ranges.length?[n("p",[n("strong",[t._v('Unable to find any local data, do you have local data available for\n"'+t._s(t.config.watch.exchange)+":"+t._s(t.config.watch.currency)+"/"+t._s(t.config.watch.asset)+'"?')])])]:[n("label",{staticClass:"wrapper",attrs:{for:"exchange"}},[t._v("Run simulation over:")]),n("form",{staticClass:"radio grd"},t._l(t.ranges,function(e,r){return n("div",{staticClass:"grd-row m1"},[n("input",{directives:[{name:"model",rawName:"v-model",value:t.selectedRangeIndex,expression:"selectedRangeIndex"}],staticClass:"grd-row-col-1-6",attrs:{type:"radio"},domProps:{value:r,checked:t._q(t.selectedRangeIndex,r)},on:{__c:function(e){t.selectedRangeIndex=r}}}),n("label",{staticClass:"grd-row-col-5-6",attrs:{for:r}},[t._v(t._s(t.printRange(e)))])])}))],n("p",[n("em",[n("a",{attrs:{href:"#"},on:{click:function(e){e.preventDefault(),t.scan(e)}}},[t._v("rescan")])])])]:t._e(),n("p",{staticClass:"txt--center"},[n("em",[n("a",{attrs:{href:"#"},on:{click:function(e){e.preventDefault(),t.tab="manual"}}},[t._v("Or manually set a daterange")])])])]:t._e(),"manual"===t.tab?[n("div",[n("label",{attrs:{for:"from"}},[t._v("From:")]),n("input",{directives:[{name:"model",rawName:"v-model",value:t.from,expression:"from"}],domProps:{value:t.from},on:{input:function(e){e.target.composing||(t.from=e.target.value)}}})]),n("div",[n("label",{attrs:{for:"to"}},[t._v("To:")]),n("input",{directives:[{name:"model",rawName:"v-model",value:t.to,expression:"to"}],domProps:{value:t.to},on:{input:function(e){e.target.composing||(t.to=e.target.value)}}})]),n("p",{staticClass:"txt--center"}),n("em",[n("a",{attrs:{href:"#"},on:{click:function(e){e.preventDefault(),t.tab="scan"}}},[t._v("Or scan for a daterange")])])]:t._e()],2)},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"contain"},[n("div",{staticClass:"text",domProps:{innerHTML:t._s(t.intro)}}),n("div",{staticClass:"hr"}),n("h2",[t._v("Available datasets")]),"idle"===t.datasetScanstate?n("div",{staticClass:"txt--center my2"},[n("a",{staticClass:"w100--s btn--primary scan-btn",attrs:{href:"#"},on:{click:function(e){e.preventDefault(),t.scan(e)}}},[t._v("Scan available data")])]):t._e(),"scanning"===t.datasetScanstate?n("div",{staticClass:"txt--center my2"},[n("spinner")],1):t._e(),"scanned"===t.datasetScanstate?n("div",{staticClass:"my2"},[t.unscannableMakets.length?n("div",{staticClass:"bg--orange p1 warning my1"},[t.viewUnscannable?t._e():n("p",{staticClass:"clickable",on:{click:function(e){e.preventDefault(),t.toggleUnscannable(e)}}},[t._v("Some markets were unscannable, click here for details.")]),t.viewUnscannable?[n("p",[t._v("Unable to find datasets in the following markets:")]),t._l(t.unscannableMakets,function(e){return n("div",{staticClass:"mx2"},[t._v("- "+t._s(e.exchange)+":"+t._s(e.currency)+":"+t._s(e.asset))])})]:t._e()],2):t._e(),t.datasets.length?[n("table",{staticClass:"full data"},[t._m(0),n("tbody",t._l(t.datasets,function(e){return n("tr",[n("td",[t._v(t._s(e.exchange))]),n("td",[t._v(t._s(e.currency))]),n("td",[t._v(t._s(e.asset))]),n("td",[t._v(t._s(t.fmt(e.from)))]),n("td",[t._v(t._s(t.fmt(e.to)))]),n("td",[t._v(t._s(t.humanizeDuration(e.to.diff(e.from))))])])}))])]:t._e(),t.datasets.length?t._e():[n("p",[t._v("It looks like you don't have any local data yet.")])]],2):t._e(),n("div",{staticClass:"my2"},[n("h2",[t._v("Import more data")]),n("p",{staticClass:"text"},[t._v("You can easily import more market data directly from exchanges using the importer.")]),n("router-link",{staticClass:"btn--primary",attrs:{to:"/data/importer"}},[t._v("Go to the importer!")])],1)])},staticRenderFns:[function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("thead",[n("tr",[n("th",[t._v("exchange")]),n("th",[t._v("currency")]),n("th",[t._v("asset")]),n("th",[t._v("from")]),n("th",[t._v("to")]),n("th",[t._v("duration")])])])}]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"grd contain"},[n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-3-6 mx1"},[n("h3",[t._v("Market")]),n("market-picker",{staticClass:"contain",attrs:{"only-importable":"true"},on:{market:t.updateMarketConfig}})],1),n("div",{staticClass:"grd-row-col-3-6 mx1"},[n("range-creator",{on:{range:t.updateRange}})],1)])])},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("div",{attrs:{id:"top"}}),t._m(0),n("nav",{staticClass:"bg--light-gray"},[n("div",{staticClass:"menu contain"},[n("router-link",{staticClass:"py1",attrs:{to:"/home"}},[t._v("Home")]),n("router-link",{staticClass:"py1",attrs:{to:"/live-gekkos"}},[t._v("Live Gekkos")]),n("router-link",{staticClass:"py1",attrs:{to:"/backtest"}},[t._v("Backtest")]),n("router-link",{staticClass:"py1",attrs:{to:"/data"}},[t._v("Local data")]),n("router-link",{staticClass:"py1",attrs:{to:"/config"}},[t._v("Config")]),n("a",{staticClass:"py1",attrs:{href:"https://gekko.wizb.it/docs/introduction/about_gekko.html",target:"_blank"}},[t._v("Documentation")])],1)])])},staticRenderFns:[function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("header",{staticClass:"bg--off-white grd"},[n("div",{staticClass:"contain grd-row"},[n("h3",{staticClass:"py1 px2 col-2"},[t._v("Gekko UI")])])])}]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("section",{staticClass:"contain grd-row"},[n("div",{staticClass:"grd-row-col-3-6",domProps:{innerHTML:t._s(t.left)}}),t._m(0)])},staticRenderFns:[function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"grd-row-col-3-6 txt--center"},[n("img",{attrs:{src:"/assets/gekko.jpg"}}),n("p",[n("em",[t._v("The most valuable commodity I know of is information.")])])])}]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("h2",{staticClass:"contain"},[t._v("Backtest")]),n("div",{staticClass:"hr contain"}),n("config-builder",{on:{config:t.check}}),t.backtestable?n("div",[n("div",{staticClass:"txt--center"},["fetching"!==t.backtestState?n("a",{staticClass:"w100--s my1 btn--primary",attrs:{href:"#"},on:{click:function(e){e.preventDefault(),t.run(e)}}},[t._v("Backtest")]):t._e(),"fetching"===t.backtestState?n("div",{staticClass:"scan-btn"},[n("p",[t._v("Running backtest..")]),n("spinner")],1):t._e()])]):t._e(),t.backtestResult&&"fetched"===t.backtestState?n("result",{attrs:{result:t.backtestResult}}):t._e()],1)},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement;t._self._c;return t._m(0)},staticRenderFns:[function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"spinner"},[n("div",{staticClass:"rect1"}),n("div",{staticClass:"rect2"}),n("div",{staticClass:"rect3"}),n("div",{staticClass:"rect4"})])}]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("h3",[t._v("Type")]),[n("label",{staticClass:"wrapper",attrs:{for:"type"}},[t._v("What do you want to do with gekko?")]),n("form",{staticClass:"radio grd"},t._l(t.types,function(e,r){return n("div",{staticClass:"grd-row m1"},[n("input",{directives:[{name:"model",rawName:"v-model",value:t.selectedTypeIndex,expression:"selectedTypeIndex"}],staticClass:"grd-row-col-1-6",attrs:{type:"radio"},domProps:{value:r,checked:t._q(t.selectedTypeIndex,r)},on:{__c:function(e){t.selectedTypeIndex=r}}}),n("label",{staticClass:"grd-row-col-5-6",attrs:{for:r}},[t._v(t._s(e))])])}))]],2)},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("div",{staticClass:"mx1"},[n("label",{staticClass:"wrapper",attrs:{for:"exchange"}},[t._v("Exchange:")]),n("div",{staticClass:"custom-select button"},[n("select",{directives:[{name:"model",rawName:"v-model",value:t.exchange,expression:"exchange"}],on:{change:function(e){var n=Array.prototype.filter.call(e.target.options,function(t){return t.selected}).map(function(t){return"_value"in t?t._value:t.value});t.exchange=e.target.multiple?n:n[0]}}},t._l(t.exchanges,function(e,r){return n("option",[t._v(t._s(r))])}))])])])},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{attrs:{id:"app"}},[n("top"),n("div",{staticClass:"fill"},[n("router-view",{staticClass:"view"})],1),n("bottom"),n("modal")],1)},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"contain py2"},[n("div",{staticClass:"text",domProps:{innerHTML:t._s(t.text)}}),n("div",{staticClass:"hr"}),n("h3",[t._v("Market watchers")]),t.watchers.length?t._e():n("div",{staticClass:"text"},[n("p",[t._v("You are currently not watching any markets.")])]),t.watchers.length?n("table",{staticClass:"full clickable"},[t._m(0),n("tbody",t._l(t.watchers,function(e){return n("tr",{staticClass:"clickable",on:{click:function(n){t.$router.push({path:"live-gekkos/watcher/"+e.id})}}},[n("td",[t._v(t._s(e.watch.exchange))]),n("td",[t._v(t._s(e.watch.currency))]),n("td",[t._v(t._s(e.watch.asset))]),n("td",[e.firstCandle?[t._v(t._s(t.fmt(e.firstCandle.start)))]:t._e()],2),n("td",[e.lastCandle?[t._v(t._s(t.fmt(e.lastCandle.start)))]:t._e()],2),n("td",[e.firstCandle&&e.lastCandle?[t._v(t._s(t.timespan(e.lastCandle.start,e.firstCandle.start)))]:t._e()],2)])}))]):t._e(),n("h3",[t._v("Strat runners")]),t.stratrunners.length?t._e():n("div",{staticClass:"text"},[n("p",[t._v("You are currently not running any strategies.")])]),t.stratrunners.length?n("table",{staticClass:"full"},[t._m(1),n("tbody",t._l(t.stratrunners,function(e){return n("tr",{staticClass:"clickable",on:{click:function(n){t.$router.push({path:"live-gekkos/stratrunner/"+e.id})}}},[n("td",[t._v(t._s(e.watch.exchange))]),n("td",[t._v(t._s(e.watch.currency))]),n("td",[t._v(t._s(e.watch.asset))]),n("td",[e.lastCandle?[t._v(t._s(t.fmt(e.lastCandle.start)))]:t._e()],2),n("td",[e.firstCandle&&e.lastCandle?[t._v(t._s(t.timespan(e.lastCandle.start,e.firstCandle.start)))]:t._e()],2),n("td",[t._v(t._s(e.strat.name))]),n("td",[e.report?t._e():[t._v("0")],e.report?[t._v(t._s(t.round(e.report.profit))+" "+t._s(e.watch.currency))]:t._e()],2)])}))]):t._e(),n("div",{staticClass:"hr"}),n("h2",[t._v("Start a new live Gekko")]),n("router-link",{staticClass:"btn--primary",attrs:{to:"/live-gekkos/new"}},[t._v("Start a new live Gekko!")])],1)},staticRenderFns:[function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("thead",[n("tr",[n("th",[t._v("exchange")]),n("th",[t._v("currency")]),n("th",[t._v("asset")]),n("th",[t._v("started at")]),n("th",[t._v("last update")]),n("th",[t._v("duration")])])])},function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("thead",[n("tr",[n("th",[t._v("exchange")]),n("th",[t._v("currency")]),n("th",[t._v("asset")]),n("th",[t._v("last update")]),n("th",[t._v("duration")]),n("th",[t._v("strategy")]),n("th",[t._v("profit")])])])}]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("h3",[t._v("Select a dataset")]),"idle"===t.datasetScanstate?n("div",{staticClass:"txt--center my2"},[n("a",{staticClass:"w100--s btn--primary scan-btn",attrs:{href:"#"},on:{click:function(e){e.preventDefault(),t.scan(e)}}},[t._v("Scan available data")])]):t._e(),"scanning"===t.datasetScanstate?n("div",{staticClass:"txt--center my2"},[n("spinner")],1):t._e(),"scanned"===t.datasetScanstate?n("div",{staticClass:"my2"},[0!=t.datasets.length?n("div",[n("table",{staticClass:"full"},[t._m(0),n("tbody",t._l(t.datasets,function(e,r){return n("tr",[n("td",{staticClass:"radio"},[n("input",{directives:[{name:"model",rawName:"v-model",value:t.setIndex,expression:"setIndex"}],attrs:{type:"radio",name:"dataset",id:e.id},domProps:{value:r,checked:t._q(t.setIndex,r)},on:{__c:function(e){t.setIndex=r}}})]),n("td",[n("label",{attrs:{for:e.id}},[t._v(t._s(e.exchange))])]),n("td",[n("label",{attrs:{for:e.id}},[t._v(t._s(e.currency))])]),n("td",[n("label",{attrs:{for:e.id}},[t._v(t._s(e.asset))])]),n("td",[n("label",{attrs:{for:e.id}},[t._v(t._s(t.fmt(e.from)))])]),n("td",[n("label",{attrs:{for:e.id}},[t._v(t._s(t.fmt(e.to)))])]),n("td",[n("label",{attrs:{for:e.id}},[t._v(t._s(t.humanizeDuration(e.to.diff(e.from))))])])])}))]),t.rangeVisible?t._e():n("a",{staticClass:"btn--primary",attrs:{href:"#"},on:{click:function(e){e.preventDefault(),t.openRange(e)}}},[t._v("Adjust range")]),t.rangeVisible?[n("div",[n("label",{attrs:{for:"customFrom"}},[t._v("From:")]),n("input",{directives:[{name:"model",rawName:"v-model",value:t.customFrom,expression:"customFrom"}],domProps:{value:t.customFrom},on:{input:function(e){e.target.composing||(t.customFrom=e.target.value)}}})]),n("div",[n("label",{attrs:{for:"customTo"}},[t._v("To:")]),n("input",{directives:[{name:"model",rawName:"v-model",value:t.customTo,expression:"customTo"}],domProps:{value:t.customTo},on:{input:function(e){e.target.composing||(t.customTo=e.target.value)}}})])]:t._e()],2):n("em",[t._v("No Data found "),n("a",{attrs:{href:"#/data/importer"}},[t._v("Lets add some")])])]):t._e()])},staticRenderFns:[function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("thead",[n("tr",[n("th"),n("th",[t._v("exchange")]),n("th",[t._v("currency")]),n("th",[t._v("asset")]),n("th",[t._v("from")]),n("th",[t._v("to")]),n("th",[t._v("duration")])])])}]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"my2"},[t.data?t._e():n("div",{staticClass:"contain"},[n("h1",[t._v("Unknown Strat runner")]),n("p",[t._v("Gekko doesn't know what strat runner this is...")])]),t.data?n("div",[n("h2",{staticClass:"contain"},[t._v("Strat runner")]),n("div",{staticClass:"grd contain"},[n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-3-6"},[n("h3",[t._v("Market")]),n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-3-6"},[t._v("Exchange")]),n("div",{staticClass:"grd-row-col-3-6"},[t._v(t._s(t.data.watch.exchange))])]),n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-3-6"},[t._v("Currency")]),n("div",{staticClass:"grd-row-col-3-6"},[t._v(t._s(t.data.watch.currency))])]),n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-3-6"},[t._v("Asset")]),n("div",{staticClass:"grd-row-col-3-6"},[t._v(t._s(t.data.watch.asset))])])]),n("div",{staticClass:"grd-row-col-3-6"},[n("h3",[t._v("Runtime")]),t.isLoading?n("spinner"):t._e(),t.isLoading?t._e():[t.data.firstCandle?n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-2-6"},[t._v("Watching since")]),n("div",{staticClass:"grd-row-col-4-6"},[t._v(t._s(t.fmt(t.data.firstCandle.start)))])]):t._e(),t.data.lastCandle?n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-2-6"},[t._v("Received data until")]),n("div",{staticClass:"grd-row-col-4-6"},[t._v(t._s(t.fmt(t.data.lastCandle.start)))])]):t._e(),t.data.lastCandle&&t.data.firstCandle?n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-2-6"},[t._v("Data spanning")]),n("div",{staticClass:"grd-row-col-4-6"},[t._v(t._s(t.humanizeDuration(t.moment(t.data.lastCandle.start).diff(t.moment(t.data.firstCandle.start)))))])]):t._e(),t.data.lastCandle&&t.data.firstCandle?n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-2-6"},[t._v("Amount of trades")]),n("div",{staticClass:"grd-row-col-4-6"},[t._v(t._s(t.data.trades.length))])]):t._e()]],2)]),n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-3-6"},[n("h3",[t._v("Strategy")]),n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-3-6"},[t._v("Name")]),n("div",{staticClass:"grd-row-col-3-6"},[n("strong",[t._v(t._s(t.stratName))])])]),t._v("Parameters"),n("pre",[t._v(t._s(t.stratParams))])]),n("div",{staticClass:"grd-row-col-3-6"},[n("h3",[t._v("Profit report")]),t.report?t._e():[t._m(0)],t.report?[n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-3-6"},[t._v("Start balance")]),n("div",{staticClass:"grd-row-col-3-6"},[t._v(t._s(t.round(t.report.startBalance)))])]),n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-3-6"},[t._v("Current balance")]),n("div",{staticClass:"grd-row-col-3-6"},[t._v(t._s(t.round(t.report.balance)))])]),n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-3-6"},[t._v("Market")]),n("div",{staticClass:"grd-row-col-3-6"},[t._v(t._s(t.round(t.report.market))+" "+t._s(t.data.watch.currency))])]),n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-3-6"},[t._v("Profit")]),n("div",{staticClass:"grd-row-col-3-6"},[t._v(t._s(t.round(t.report.profit))+" "+t._s(t.data.watch.currency))])]),n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-3-6"},[t._v("Alpha")]),n("div",{staticClass:"grd-row-col-3-6"},[t._v(t._s(t.round(t.report.alpha))+" "+t._s(t.data.watch.currency))])])]:t._e()],2)]),t.watcher?n("p",[n("em",[t._v("This strat runner gets data from "),n("router-link",{attrs:{to:"/live-gekkos/watcher/"+t.watcher.id}},[t._v("this market watcher")])],1),t._v(".")]):t._e()]),t.isLoading?t._e():[n("h3",{staticClass:"contain"},[t._v("Market graph")]),"fetching"===t.candleFetch?n("spinner"):t._e(),"fetched"===t.candleFetch?[n("chart",{attrs:{data:t.chartData,height:300}})]:t._e(),n("roundtrips",{attrs:{roundtrips:t.data.roundtrips}})]],2):t._e()])},staticRenderFns:[function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("p",[n("em",[t._v("Waiting for at least one trade..")])])}]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return t.active?n("div",[n("div",{attrs:{id:"modal-background"}}),n("div",{staticClass:"modal",attrs:{id:"modal"}},[n("div",{staticClass:"modal-guts",domProps:{innerHTML:t._s(t.content)}})])]):t._e()},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"grd"},[n("div",{staticClass:"px1"},[n("h3",[t._v("Paper trader")]),"closed"===t.toggle?n("a",{staticClass:"btn--primary",attrs:{href:"#"},on:{click:function(e){e.preventDefault(),t.switchToggle(e)}}},[t._v("Change paper trader settings")]):t._e(),"open"===t.toggle?[n("p",[t._v("Settings:")]),n("textarea",{directives:[{name:"model",rawName:"v-model",value:t.rawPaperTraderParams,expression:"rawPaperTraderParams"}],staticClass:"params",domProps:{value:t.rawPaperTraderParams},on:{input:function(e){e.target.composing||(t.rawPaperTraderParams=e.target.value)}}}),t.rawPaperTraderParamsError?n("p",{staticClass:"bg--red p1"},[t._v(t._s(t.rawPaperTraderParamsError.message))]):t._e()]:t._e()],2)])},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"contain my2"},[t.data&&!t.data.done?n("div",[n("h2",[t._v("Importing data..")]),n("div",{staticClass:"grd"},[n("div",{staticClass:"grd-row"},[t._m(0),n("div",{staticClass:"grd-row-col-4-6"},[t._v(t._s(t.data.watch.exchange))])]),n("div",{staticClass:"grd-row"},[t._m(1),n("div",{staticClass:"grd-row-col-4-6"},[t._v(t._s(t.data.watch.currency)+"/"+t._s(t.data.watch.asset))])])]),n("div",{staticClass:"grd"},[n("div",{staticClass:"grd-row"},[t._m(2),n("div",{staticClass:"grd-row-col-4-6"},[t._v(t._s(t.fmt(t.from)))])]),n("div",{staticClass:"grd-row"},[t._m(3),n("div",{staticClass:"grd-row-col-4-6"},[t._v(t._s(t.fmt(t.to)))])]),t.initialized?n("div",{staticClass:"grd-row"},[t._m(4),n("div",{staticClass:"grd-row-col-4-6"},[t._v(t._s(t.fmt(t.latest)))])]):t._e(),t.initialized?n("div",{staticClass:"grd-row"},[t._m(5),n("div",{staticClass:"grd-row-col-4-6"},[t._v(t._s(t.fromEnd))])]):t._e()]),t.initialized?t._e():n("spinner"),t.initialized?n("div",{staticClass:"contain"},[n("progressBar",{attrs:{progress:t.progress}})],1):t._e(),n("p",[n("em",[t._v("(you don't have to wait until the import is done,\nyou can already start "),n("router-link",{attrs:{to:"/backtest"}},[t._v("backtesting")]),t._v(").")],1)])],1):t._e(),t.data&&t.data.done?n("div",{staticClass:"txt--center"},[n("h2",[t._v("Import done")]),n("p",[t._v(" \nGo and "),n("router-link",{attrs:{to:"/backtest"}},[t._v("backtest")]),t._v(" with your new data!")],1)]):t._e(),t.data?t._e():n("div",{staticClass:"txt--center"},[n("h2",[t._v("ERROR: Uknown import")]),n("p",[n("I",[t._v("don't know this import..")])],1)])])},staticRenderFns:[function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"grd-row-col-2-6"},[n("strong",[t._v("Market:")])])},function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"grd-row-col-2-6"},[n("strong",[t._v("Currency/Asset:")])])},function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"grd-row-col-2-6"},[n("strong",[t._v("From:")])])},function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"grd-row-col-2-6"},[n("strong",[t._v("To:")])])},function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"grd-row-col-2-6"},[n("strong",[t._v("Imported data until:")])])},function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"grd-row-col-2-6"},[n("strong",[t._v("Remaining:")])])}]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"grd"},[n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-3-6 px1"},[n("h3",[t._v("Strategy")]),n("div",[n("label",{staticClass:"wrapper",attrs:{for:"strat"}},[t._v("Strategy:")]),n("div",{staticClass:"custom-select button"},[n("select",{directives:[{name:"model",rawName:"v-model",value:t.strategy,expression:"strategy"}],on:{change:function(e){var n=Array.prototype.filter.call(e.target.options,function(t){return t.selected}).map(function(t){return"_value"in t?t._value:t.value});t.strategy=e.target.multiple?n:n[0]}}},t._l(t.strategies,function(e){return n("option",[t._v(t._s(e.name))])}))])]),n("div",[n("label",{attrs:{for:"candleSize"}},[t._v("Candle Size")]),n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-3-6"},[n("input",{directives:[{name:"model",rawName:"v-model",value:t.rawCandleSize,expression:"rawCandleSize"}],domProps:{value:t.rawCandleSize},on:{input:function(e){e.target.composing||(t.rawCandleSize=e.target.value)}}})]),n("div",{staticClass:"grd-row-col-3-6 align"},[n("div",{staticClass:"custom-select button"},[n("select",{directives:[{name:"model",rawName:"v-model",value:t.candleSizeUnit,expression:"candleSizeUnit"}],on:{change:function(e){var n=Array.prototype.filter.call(e.target.options,function(t){return t.selected}).map(function(t){return"_value"in t?t._value:t.value});t.candleSizeUnit=e.target.multiple?n:n[0]}}},[n("option",[t._v("minutes")]),n("option",[t._v("hours")]),n("option",[t._v("days")])])])])])]),n("div",[n("label",{attrs:{for:"historySize"}},[t._v("Warmup period (in "+t._s(t.rawCandleSize)+" "+t._s(t.singularCandleSizeUnit)+" candles):")]),n("input",{directives:[{name:"model",rawName:"v-model",value:t.historySize,expression:"historySize"}],domProps:{value:t.historySize},on:{input:function(e){e.target.composing||(t.historySize=e.target.value)}}}),n("em",{staticClass:"label-like"},[t._v("(will use "+t._s(t.humanizeDuration(t.candleSize*t.historySize*1e3*60))+" of data as history)")])])]),n("div",{staticClass:"grd-row-col-2-6 px1"},[n("div",[n("h3",[t._v("Parameters")]),n("p",[t._v(t._s(t.strategy)+" Parameters:")]),n("textarea",{directives:[{name:"model",rawName:"v-model",value:t.rawStratParams,expression:"rawStratParams"}],staticClass:"params",domProps:{value:t.rawStratParams},on:{input:function(e){e.target.composing||(t.rawStratParams=e.target.value)}}}),t.rawStratParamsError?n("p",{staticClass:"bg--red p1"},[t._v(t._s(t.rawStratParamsError.message))]):t._e()])])])])},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"my2"},[t.data?t._e():n("div",{staticClass:"contain"},[n("h1",[t._v("Unknown Watcher")]),n("p",[t._v("Gekko doesn't know what whatcher this is...")])]),t.data?n("div",[n("h2",{staticClass:"contain"},[t._v("Market Watcher")]),n("div",{staticClass:"grd contain"},[n("h3",[t._v("Market")]),n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-2-6"},[t._v("Exchange")]),n("div",{staticClass:"grd-row-col-4-6"},[t._v(t._s(t.data.watch.exchange))])]),n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-2-6"},[t._v("Currency")]),n("div",{staticClass:"grd-row-col-4-6"},[t._v(t._s(t.data.watch.currency))])]),n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-2-6"},[t._v("Asset")]),n("div",{staticClass:"grd-row-col-4-6"},[t._v(t._s(t.data.watch.asset))])]),n("h3",[t._v("Statistics")]),t.isLoading?n("spinner"):t._e(),t.isLoading?t._e():[t.data.firstCandle?n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-2-6"},[t._v("Watching since")]),n("div",{staticClass:"grd-row-col-4-6"},[t._v(t._s(t.fmt(t.data.firstCandle.start)))])]):t._e(),t.data.lastCandle?n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-2-6"},[t._v("Received data until")]),n("div",{staticClass:"grd-row-col-4-6"},[t._v(t._s(t.fmt(t.data.lastCandle.start)))])]):t._e(),t.data.lastCandle&&t.data.firstCandle?n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-2-6"},[t._v("Data spanning")]),n("div",{staticClass:"grd-row-col-4-6"},[t._v(t._s(t.humanizeDuration(t.moment(t.data.lastCandle.start).diff(t.moment(t.data.firstCandle.start)))))])]):t._e()]],2),t.isLoading?t._e():[n("h3",{staticClass:"contain"},[t._v("Market graph")]),"fetching"===t.candleFetch?n("spinner"):t._e(),t.candles.length?[n("chart",{attrs:{data:t.chartData,height:500}})]:t._e()]],2):t._e()])},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"grd contain"},[n("h3",[t._v("Add an API key")]),n("p",[t._v("Make sure that the API key has the permissions to create and cancel orders and view balances.")]),n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-3-6 mx1"},[n("h3",[t._v("Exchange")]),n("exchange-picker",{staticClass:"contain",attrs:{"only-tradable":"true"},on:{exchange:t.updateExchange}})],1),n("div",{staticClass:"grd-row-col-3-6 mx1"},[n("h3",[t._v("Credentials")]),t._l(t.requires,function(e){return[n("label",[t._v(t._s(e))]),n("input",{directives:[{name:"model",rawName:"v-model",value:t.credentials[e],expression:"credentials[cred]"}],domProps:{value:t.credentials[e]},on:{input:function(n){n.target.composing||t.$set(t.credentials,e,n.target.value)}}})]})],2)]),n("div",{staticClass:"txt--center"},[n("a",{staticClass:"w100--s my1 btn--primary",attrs:{href:"#"},on:{click:function(e){e.preventDefault(),t.upload(e)}}},[t._v("Add")])])])},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"grd contain"},[n("div",{staticClass:"grd-row"},[n("div",{staticClass:"grd-row-col-3-6 mx1"},[n("h3",[t._v("Market")]),n("market-picker",{staticClass:"contain",attrs:{"only-tradable":t.isTradebot},on:{market:t.updateMarketConfig}})],1),n("div",{staticClass:"grd-row-col-3-6 mx1"},[n("type-picker",{on:{type:t.updateType}})],1)]),"market watcher"!==t.type?[n("div",{staticClass:"hr"}),n("strat-picker",{staticClass:"contain my2",on:{stratConfig:t.updateStrat}}),"paper trader"===t.type?n("div",{staticClass:"hr"}):t._e(),"paper trader"===t.type?n("paper-trader",{on:{settings:t.updatePaperTrader}}):t._e()]:t._e()],2)},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"contain"},[n("dataset-picker",{staticClass:"contain my2",on:{dataset:t.updateDataset}}),n("div",{staticClass:"hr"}),n("strat-picker",{staticClass:"contain my2",on:{stratConfig:t.updateStrat}}),n("div",{staticClass:"hr"}),n("paper-trader",{on:{settings:t.updatePaperTrader}}),n("div",{staticClass:"hr"})],1)},staticRenderFns:[]}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"contain roundtrips"},[n("h2",[t._v("Roundtrips")]),t.roundtrips.length?n("table",[n("thead",[t._m(0),t._l(t.roundtrips,function(e){return n("tr",[n("td",[t._v(t._s(t.fmt(e.entryAt)))]),n("td",[t._v(t._s(t.fmt(e.exitAt)))]),n("td",[t._v(t._s(t.diff(e.duration)))]),n("td",[t._v(t._s(t.round(e.entryBalance)))]),n("td",[t._v(t._s(t.round(e.exitBalance)))]),-1===Math.sign(e.pnl)?[n("td",{staticClass:"loss"},[t._v(t._s(Math.sign(e.pnl)*e.pnl.toFixed(2)))]),n("td",{staticClass:"loss"},[t._v(t._s(e.profit.toFixed(2))+"%")])]:[n("td",{staticClass:"profit"},[t._v(t._s(e.pnl.toFixed(2)))]),n("td",{staticClass:"profit"},[t._v(t._s(e.profit.toFixed(2))+"%")])]],2)})],2)]):t._e(),t.roundtrips.length?t._e():n("div",[n("p",[t._v("Not enough data to display")])])])},staticRenderFns:[function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("tr",[n("th",[t._v("Entry at (UTC)")]),n("th",[t._v("Exit at (UTC)")]),n("th",[t._v("Exposure")]),n("th",[t._v("Entry balance")]),n("th",[t._v("Exit balance")]),n("th",[t._v("P&L")]),n("th",[t._v("Profit")])])}]}},function(t,e,n){var r=n(84);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(85);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(86);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(87);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(88);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(89);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(90);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(91);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(92);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(93);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(94);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(95);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(96);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(97);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(98);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(99);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(100);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(101);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(102);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(103);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(104);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(105);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(106);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(107);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(108);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(109);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(110);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(111);"string"==typeof r&&(r=[[t.i,r,""]]);n(1)(r,{});r.locals&&(t.exports=r.locals)},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}}]); \ No newline at end of file