├── .editorconfig ├── .eslintignore ├── .gitattributes ├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── __tests__ └── app.js ├── generators └── app │ ├── currencies.js │ ├── defaultValues.js │ ├── index.js │ ├── parameters.js │ ├── strategies.js │ └── templates │ ├── ALLPAIRS-params.js │ ├── bittrex-BTX_XXX-config.js │ ├── kraken-BTX_XXX-config.js │ └── poloniex-BTX_XXX-config.js ├── install-loud.sh ├── install.sh ├── package.json └── update.sh /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | charset = utf-8 7 | trim_trailing_whitespace = true 8 | insert_final_newline = true 9 | 10 | [*.md] 11 | trim_trailing_whitespace = false 12 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | coverage 2 | **/templates 3 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | coverage 3 | .idea 4 | *.iml 5 | .yo-rc.json 6 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - 7 4 | 5 | after_script: 'cat ./coverage/lcov.info | coveralls' 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 BeerK0in 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # generator-gunbot [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url] [![Coverage percentage][coveralls-image]][coveralls-url] 2 | > Setup and manage GUNBOT 3.3 on Linux. 3 | 4 | If you want to setup a brand new Debian or Ubuntu VPS to run GUNBOT, just log into your new VPS as root and run this install script: 5 | 6 | ```bash 7 | cd 8 | curl -qsL https://raw.githubusercontent.com/BeerK0in/generator-gunbot/master/install.sh | bash -- && exec bash 9 | ``` 10 | After the setup run: 11 | ```bash 12 | gcd 13 | ginit 14 | ``` 15 | 16 | That script will 17 | * update the system (`apt upgrade`), 18 | * install node 6.x, 19 | * install required tools (`yo`, `pm2`, `unzip`), 20 | * install the GUNBOT 3.3, 21 | * creates some handy aliases, 22 | * install this generator-gunbot 23 | 24 | If you want to create a VPS at DigitalOcean, you can use this affiliate link: [get $10 credit at DigitalOcean](https://m.do.co/c/fade3d3435ba) 25 | 26 | 27 | **Aliases** 28 | 29 | The installer also sets up some aliases to do more with less. :) 30 | 31 | - `gcd`: Go to the folder GUNBOT is installed 32 | - `gadd`: Use the generator to add a new pair _(*)_ 33 | - `gl`: Get a list of all running GUNBOTs 34 | - `glog [botname or number]`: Shows the log of the selected bot (use `gl` to get name) 35 | - `gstop [botname or number]`: Stops a running bot (use `gl` to get name) 36 | - `gstart [botname or number]`: Starts a stopped bot (use `gl` to get name) 37 | 38 | _(*)For now `gadd` will use the same settings as defined in the first run of the generator. A next version will allow you to set specific strategies for new trade pairs._ 39 | 40 | 41 | **Updates** 42 | 43 | To update follow these steps: 44 | 45 | 1. Login to your server. 46 | 2. Run this update script 47 | ```bash 48 | cd 49 | curl -qsL https://raw.githubusercontent.com/BeerK0in/generator-gunbot/master/update.sh | bash -- 50 | ``` 51 | 3. Run `ginit` again to start all bots with delay 52 | ```bash 53 | gcd 54 | ginit 55 | ``` 56 | 4. Press ENTER for every question (it will use your last settings) 57 | 5. _[optional]_ Press ENTER on the conflict of ALLPAIRS _(*)_ 58 | 6. Wait till all bots are started. 59 | 7. _[optional]_ If you have changed some configs manually, please copy them from the backup folder back into the gunbot folder: 60 | ```bash 61 | cp /opt/gunbot-backup-/poloniex-BTC_XXX-config.js /opt/gunbot/ 62 | ``` 63 | 64 | _(*)_ The conflict could happen if you hav an older version of the generator, because the default settings have changed a bit. 65 | In that case it is very likely you see this question. Just press ENTER: 66 | ``` 67 | conflict ALLPAIRS-params.js 68 | ? Overwrite ALLPAIRS-params.js? (Ynaxdh) 69 | ``` 70 | 71 | --- 72 | 73 | > **If you just want to use the generator on any OS with installed GUNBOT 3.3 Core Edition, read on.** 74 | 75 | ## Installation 76 | 77 | First, install [Yeoman](http://yeoman.io), [pm2](http://pm2.keymetrics.io/) and generator-gunbot using [npm](https://www.npmjs.com/) (we assume you have pre-installed [node.js](https://nodejs.org/)). 78 | 79 | ```bash 80 | npm install -g yo 81 | npm install -g pm2 82 | npm install -g generator-gunbot 83 | ``` 84 | 85 | ## Usage 86 | 87 | To init GUNBOT: 88 | 89 | ```bash 90 | cd /path/to/gunbot 91 | yo gunbot init 92 | ``` 93 | 94 | To add a new currency to GUNBOT: 95 | 96 | ```bash 97 | yo gunbot add 98 | ``` 99 | 100 | 101 | ## Limits 102 | 103 | This initial version of the generator-gunbot has some limitations: 104 | 105 | * Only GUNBOT 3.3 support 106 | * Only Poloniex support 107 | * Only BTC to XXX support 108 | 109 | ## License 110 | 111 | MIT © [BeerK0in](https://github.com/BeerK0in) 112 | 113 | 114 | [npm-image]: https://badge.fury.io/js/generator-gunbot.svg 115 | [npm-url]: https://npmjs.org/package/generator-gunbot 116 | [travis-image]: https://travis-ci.org/BeerK0in/generator-gunbot.svg?branch=master 117 | [travis-url]: https://travis-ci.org/BeerK0in/generator-gunbot 118 | [daviddm-image]: https://david-dm.org/BeerK0in/generator-gunbot.svg?theme=shields.io 119 | [daviddm-url]: https://david-dm.org/BeerK0in/generator-gunbot 120 | [coveralls-image]: https://coveralls.io/repos/github/BeerK0in/generator-gunbot/badge.svg?branch=master 121 | [coveralls-url]: https://coveralls.io/github/BeerK0in/generator-gunbot?branch=master 122 | 123 | -------------------------------------------------------------------------------- /__tests__/app.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const path = require('path'); 3 | const assert = require('yeoman-assert'); 4 | const helpers = require('yeoman-test'); 5 | const mockSpawn = require('mock-spawn'); 6 | const parameters = require('../generators/app/parameters'); 7 | const defaultValues = require('../generators/app/defaultValues.js'); 8 | 9 | const promptsParamsInit = { 10 | market: 'poloniex', 11 | poloniexApiKey: 'this is the poloniexApiKey', 12 | poloniexApiSecret: 'this is the poloniexApiSecret', 13 | btcTradingLimit: '123', 14 | strategy: 'BB', 15 | currencies: ['ABC', 'DEF', 'JKL', 'XYZ'], 16 | currenciesToStart: ['ABC', 'DEF', 'XYZ'] 17 | }; 18 | 19 | const promptsParamsAdd = { 20 | market: 'bittrex', 21 | currencyToAdd: 'MNO', 22 | btcTradingLimit: '987', 23 | strategy: 'GAIN', 24 | startCurrencyToAdd: true 25 | }; 26 | 27 | let mySpawn = mockSpawn(); 28 | 29 | describe('generator-gunbot:app init', () => { 30 | beforeAll(() => { 31 | mySpawn = mockSpawn(); 32 | require('child_process').spawn = mySpawn; 33 | 34 | return helpers.run(path.join(__dirname, '../generators/app')) 35 | .withOptions({skipInstall: true}) 36 | .withArguments(['init']) 37 | .withPrompts({ 38 | market: promptsParamsInit.market, 39 | poloniexApiKey: promptsParamsInit.poloniexApiKey, 40 | poloniexApiSecret: promptsParamsInit.poloniexApiSecret, 41 | btcTradingLimit: promptsParamsInit.btcTradingLimit, 42 | buyStrategy: promptsParamsInit.strategy, 43 | sellStrategy: promptsParamsInit.strategy, 44 | currencies: promptsParamsInit.currencies, 45 | currenciesToStart: promptsParamsInit.currenciesToStart 46 | }); 47 | }); 48 | test('creates files', () => { 49 | assert.file([ 50 | 'ALLPAIRS-params.js' 51 | ]); 52 | 53 | for (let currency of promptsParamsInit.currencies) { 54 | assert.file([ 55 | `${promptsParamsInit.market}-BTC_${currency}-config.js` 56 | ]); 57 | } 58 | }); 59 | 60 | test('sets the content of the files', () => { 61 | for (let currency of promptsParamsInit.currencies) { 62 | assert.fileContent([ 63 | [`${promptsParamsInit.market}-BTC_${currency}-config.js`, `BTC_TRADING_LIMIT: ${promptsParamsInit.btcTradingLimit},`], 64 | [`${promptsParamsInit.market}-BTC_${currency}-config.js`, `SELL_STRATEGY: '${promptsParamsInit.strategy}',`], 65 | [`${promptsParamsInit.market}-BTC_${currency}-config.js`, `LOW_BB: ${defaultValues.bbLow},`] 66 | ]); 67 | } 68 | }); 69 | 70 | test('starts pm2', done => { 71 | setTimeout(() => { 72 | assert.equal(promptsParamsInit.currenciesToStart.length, mySpawn.calls.length); 73 | 74 | let index = 0; 75 | for (let currency of promptsParamsInit.currenciesToStart) { 76 | let spawnCall = mySpawn.calls[index]; 77 | assert.equal('pm2', spawnCall.command); 78 | assert.deepEqual(['start', 79 | `./${parameters.gunbotExeName}`, 80 | '--name', 81 | `BTC_${currency}_${promptsParamsInit.market[0].toUpperCase()}`, 82 | '--', 83 | `BTC_${currency}`, 84 | promptsParamsInit.market], spawnCall.args); 85 | assert.equal(0, spawnCall.exitCode); 86 | index++; 87 | } 88 | 89 | done(); 90 | }, promptsParamsInit.currenciesToStart.length * parameters.timeoutBetweenGunbotStarts * 1.1); 91 | }, promptsParamsInit.currenciesToStart.length * parameters.timeoutBetweenGunbotStarts * 1.2); 92 | }); 93 | 94 | describe('generator-gunbot:app add', () => { 95 | beforeAll(() => { 96 | mySpawn = mockSpawn(); 97 | require('child_process').spawn = mySpawn; 98 | 99 | return helpers.run(path.join(__dirname, '../generators/app')) 100 | .withArguments(['add']) 101 | .withPrompts({ 102 | market: promptsParamsAdd.market, 103 | btcTradingLimit: promptsParamsAdd.btcTradingLimit, 104 | currencyToAdd: promptsParamsAdd.currencyToAdd, 105 | buyStrategy: promptsParamsAdd.strategy, 106 | sellStrategy: promptsParamsAdd.strategy, 107 | startCurrencyToAdd: promptsParamsAdd.startCurrencyToAdd 108 | }); 109 | }); 110 | 111 | test('creates files', () => { 112 | assert.file([ 113 | `${promptsParamsAdd.market}-BTC_${promptsParamsAdd.currencyToAdd}-config.js` 114 | ]); 115 | 116 | assert.noFile([ 117 | 'ALLPAIRS-params.js' 118 | ]); 119 | 120 | for (let currency of promptsParamsInit.currencies) { 121 | assert.noFile([ 122 | `${promptsParamsInit.market}-BTC_${currency}-config.js` 123 | ]); 124 | } 125 | }); 126 | 127 | test('sets the content of the files', () => { 128 | assert.fileContent([ 129 | [`${promptsParamsAdd.market}-BTC_${promptsParamsAdd.currencyToAdd}-config.js`, `BTC_TRADING_LIMIT: ${promptsParamsAdd.btcTradingLimit},`], 130 | [`${promptsParamsAdd.market}-BTC_${promptsParamsAdd.currencyToAdd}-config.js`, `SELL_STRATEGY: '${promptsParamsAdd.strategy}',`] 131 | ]); 132 | }); 133 | 134 | test('starts pm2', () => { 135 | assert.equal(1, mySpawn.calls.length); 136 | 137 | let firstCall = mySpawn.calls[0]; 138 | assert.equal('pm2', firstCall.command); 139 | assert.deepEqual(['start', 140 | `./${parameters.gunbotExeName}`, 141 | '--name', 142 | `BTC_${promptsParamsAdd.currencyToAdd}_${promptsParamsAdd.market[0].toUpperCase()}`, 143 | '--', 144 | `BTC_${promptsParamsAdd.currencyToAdd}`, 145 | promptsParamsAdd.market], firstCall.args); 146 | assert.equal(0, firstCall.exitCode); 147 | }, 20000); 148 | }); 149 | -------------------------------------------------------------------------------- /generators/app/currencies.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | poloniex: [ 3 | {value: 'AMP', name: 'AMP (Synereo AMP)'}, 4 | {value: 'ARDR', name: 'ARDR (Ardor)'}, 5 | {value: 'BCN', name: 'BCN (Bytecoin)'}, 6 | {value: 'BCY', name: 'BCY (BitCrystals)'}, 7 | {value: 'BELA', name: 'BELA (Belacoin)'}, 8 | {value: 'BLK', name: 'BLK (BlackCoin)'}, 9 | {value: 'BTCD', name: 'BTCD (BitcoinDark)'}, 10 | {value: 'BTM', name: 'BTM (Bitmark)'}, 11 | {value: 'BTS', name: 'BTS (BitShares)'}, 12 | {value: 'BURST', name: 'BURST (Burst)'}, 13 | {value: 'CLAM', name: 'CLAM (CLAMS)'}, 14 | {value: 'DASH', name: 'DASH (Dash)'}, 15 | {value: 'DCR', name: 'DCR (Decred)'}, 16 | {value: 'DGB', name: 'DGB (DigiByte)'}, 17 | {value: 'DOGE', name: 'DOGE (Dogecoin)'}, 18 | {value: 'EMC2', name: 'EMC2 (Einsteinium)'}, 19 | {value: 'ETC', name: 'ETC (Ethereum Classic)'}, 20 | {value: 'ETH', name: 'ETH (Ethereum)'}, 21 | {value: 'EXP', name: 'EXP (Expanse)'}, 22 | {value: 'FCT', name: 'FCT (Factom)'}, 23 | {value: 'FLDC', name: 'FLDC (FoldingCoin)'}, 24 | {value: 'FLO', name: 'FLO (Florincoin)'}, 25 | {value: 'GAME', name: 'GAME (GameCredits)'}, 26 | {value: 'GNO', name: 'GNO (Gnosis)'}, 27 | {value: 'GNT', name: 'GNT (Golem)'}, 28 | {value: 'GRC', name: 'GRC (Gridcoin Research)'}, 29 | {value: 'HUC', name: 'HUC (Huntercoin)'}, 30 | {value: 'LBC', name: 'LBC (LBRY Credits)'}, 31 | {value: 'LSK', name: 'LSK (Lisk)'}, 32 | {value: 'LTC', name: 'LTC (Litecoin)'}, 33 | {value: 'MAID', name: 'MAID (MaidSafeCoin)'}, 34 | {value: 'NAUT', name: 'NAUT (Nautiluscoin)'}, 35 | {value: 'NAV', name: 'NAV (NAVCoin)'}, 36 | {value: 'NEOS', name: 'NEOS (Neoscoin)'}, 37 | {value: 'NMC', name: 'NMC (Namecoin)'}, 38 | {value: 'NOTE', name: 'NOTE (DNotes)'}, 39 | {value: 'NXC', name: 'NXC (Nexium)'}, 40 | {value: 'NXT', name: 'NXT (NXT)'}, 41 | {value: 'OMNI', name: 'OMNI (Omni)'}, 42 | {value: 'PASC', name: 'PASC (PascalCoin)'}, 43 | {value: 'PINK', name: 'PINK (Pinkcoin)'}, 44 | {value: 'POT', name: 'POT (PotCoin)'}, 45 | {value: 'PPC', name: 'PPC (Peercoin)'}, 46 | {value: 'RADS', name: 'RADS (Radium)'}, 47 | {value: 'REP', name: 'REP (Augur)'}, 48 | {value: 'RIC', name: 'RIC (Riecoin)'}, 49 | {value: 'SBD', name: 'SBD (Steem Dollars)'}, 50 | {value: 'SC', name: 'SC (Siacoin)'}, 51 | {value: 'SJCX', name: 'SJCX (Storjcoin X)'}, 52 | {value: 'STEEM', name: 'STEEM (STEEM)'}, 53 | {value: 'STR', name: 'STR (Stellar)'}, 54 | {value: 'STRAT', name: 'STRAT (Stratis)'}, 55 | {value: 'SYS', name: 'SYS (Syscoin)'}, 56 | {value: 'VIA', name: 'VIA (Viacoin)'}, 57 | {value: 'VRC', name: 'VRC (VeriCoin)'}, 58 | {value: 'VTC', name: 'VTC (Vertcoin)'}, 59 | {value: 'XBC', name: 'XBC (BitcoinPlus)'}, 60 | {value: 'XCP', name: 'XCP (Counterparty)'}, 61 | {value: 'XEM', name: 'XEM (NEM)'}, 62 | {value: 'XMR', name: 'XMR (Monero)'}, 63 | {value: 'XPM', name: 'XPM (Primecoin)'}, 64 | {value: 'XRP', name: 'XRP (Ripple)'}, 65 | {value: 'XVC', name: 'XVC (Vcash)'}, 66 | {value: 'ZEC', name: 'ZEC (Zcash)'}], 67 | bittrex: [ 68 | '1ST', 69 | '2GIVE', 70 | 'ABY', 71 | 'ADT', 72 | 'ADX', 73 | 'AEON', 74 | 'AGRS', 75 | 'AMP', 76 | 'ANT', 77 | 'APX', 78 | 'ARDR', 79 | 'ARK', 80 | 'AUR', 81 | 'BAT', 82 | 'BAY', 83 | 'BCC', 84 | 'BCY', 85 | 'BITB', 86 | 'BLITZ', 87 | 'BLK', 88 | 'BLOCK', 89 | 'BNT', 90 | 'BRK', 91 | 'BRX', 92 | 'BSD', 93 | 'BTA', 94 | 'BTCD', 95 | 'BTS', 96 | 'BURST', 97 | 'BYC', 98 | 'CANN', 99 | 'CFI', 100 | 'CLAM', 101 | 'CLOAK', 102 | 'CLUB', 103 | 'COVAL', 104 | 'CPC', 105 | 'CRB', 106 | 'CRW', 107 | 'CURE', 108 | 'CVC', 109 | 'DAR', 110 | 'DASH', 111 | 'DCR', 112 | 'DCT', 113 | 'DGB', 114 | 'DGD', 115 | 'DMD', 116 | 'DOGE', 117 | 'DOPE', 118 | 'DRACO', 119 | 'DTB', 120 | 'DYN', 121 | 'EBST', 122 | 'EDG', 123 | 'EFL', 124 | 'EGC', 125 | 'EMC', 126 | 'EMC2', 127 | 'ENRG', 128 | 'ERC', 129 | 'ETC', 130 | 'ETH', 131 | 'EXCL', 132 | 'EXP', 133 | 'FAIR', 134 | 'FCT', 135 | 'FLDC', 136 | 'FLO', 137 | 'FTC', 138 | 'FUN', 139 | 'GAM', 140 | 'GAME', 141 | 'GBG', 142 | 'GBYTE', 143 | 'GCR', 144 | 'GEO', 145 | 'GLD', 146 | 'GNO', 147 | 'GNT', 148 | 'GOLOS', 149 | 'GRC', 150 | 'GRS', 151 | 'GUP', 152 | 'HKG', 153 | 'HMQ', 154 | 'INCNT', 155 | 'INFX', 156 | 'IOC', 157 | 'ION', 158 | 'IOP', 159 | 'KMD', 160 | 'KORE', 161 | 'LBC', 162 | 'LGD', 163 | 'LMC', 164 | 'LSK', 165 | 'LTC', 166 | 'LUN', 167 | 'MAID', 168 | 'MCO', 169 | 'MEME', 170 | 'MLN', 171 | 'MONA', 172 | 'MTL', 173 | 'MUE', 174 | 'MUSIC', 175 | 'MYST', 176 | 'NAUT', 177 | 'NAV', 178 | 'NBT', 179 | 'NEO', 180 | 'NEOS', 181 | 'NLG', 182 | 'NMR', 183 | 'NXC', 184 | 'NXS', 185 | 'NXT', 186 | 'OK', 187 | 'OMG', 188 | 'OMNI', 189 | 'PART', 190 | 'PAY', 191 | 'PDC', 192 | 'PINK', 193 | 'PIVX', 194 | 'PKB', 195 | 'POT', 196 | 'PPC', 197 | 'PTC', 198 | 'PTOY', 199 | 'QRL', 200 | 'QTUM', 201 | 'QWARK', 202 | 'RADS', 203 | 'RBY', 204 | 'RDD', 205 | 'REP', 206 | 'RISE', 207 | 'RLC', 208 | 'SAFEX', 209 | 'SBD', 210 | 'SC', 211 | 'SEQ', 212 | 'SHIFT', 213 | 'SIB', 214 | 'SLR', 215 | 'SLS', 216 | 'SNGLS', 217 | 'SNRG', 218 | 'SNT', 219 | 'SPHR', 220 | 'SPR', 221 | 'START', 222 | 'STEEM', 223 | 'STORJ', 224 | 'STRAT', 225 | 'SWIFT', 226 | 'SWT', 227 | 'SYNX', 228 | 'SYS', 229 | 'THC', 230 | 'TIME', 231 | 'TKN', 232 | 'TKS', 233 | 'TRIG', 234 | 'TRST', 235 | 'TRUST', 236 | 'TX', 237 | 'UBQ', 238 | 'UNB', 239 | 'UNO', 240 | 'VIA', 241 | 'VOX', 242 | 'VRC', 243 | 'VRM', 244 | 'VTC', 245 | 'VTR', 246 | 'WAVES', 247 | 'WINGS', 248 | 'XAUR', 249 | 'XBB', 250 | 'XCP', 251 | 'XDN', 252 | 'XEL', 253 | 'XEM', 254 | 'XLM', 255 | 'XMG', 256 | 'XMR', 257 | 'XMY', 258 | 'XRP', 259 | 'XST', 260 | 'XVC', 261 | 'XVG', 262 | 'XWC', 263 | 'XZC', 264 | 'ZCL', 265 | 'ZEC', 266 | 'ZEN' 267 | ], 268 | kraken: [ 269 | 'DASH', 270 | 'EOS', 271 | 'ETC', 272 | 'ETH', 273 | 'GNO', 274 | 'ICN', 275 | 'LTC', 276 | 'MLN', 277 | 'REP', 278 | 'XDG', 279 | 'XLM', 280 | 'XMR', 281 | 'XRP', 282 | 'ZEC' 283 | ] 284 | }; 285 | -------------------------------------------------------------------------------- /generators/app/defaultValues.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | 3 | poloniexApiKey: '', 4 | poloniexApiSecret: '', 5 | bittrexApiKey: '', 6 | bittrexApiSecret: '', 7 | krakenApiKey: '', 8 | krakenApiSecret: '', 9 | 10 | btcTradingLimit: 0.01, 11 | 12 | buyStrategy: 'BB', 13 | sellStrategy: 'BB', 14 | 15 | bbLow: 25, 16 | bbHigh: 25, 17 | 18 | gainBuyLevel: 3, 19 | gainSellLevel: 5, 20 | 21 | pingpongBuyPrice: 0.000001, 22 | pingpongSellPrice: 0.000002, 23 | 24 | stepgainBuyLevelOne: 2, 25 | stepgainBuyLevelTwo: 5, 26 | stepgainBuyLevelThree: 41, 27 | 28 | stepgainSellLevelOne: 2, 29 | stepgainSellLevelTwo: 5, 30 | stepgainSellLevelThree: 70, 31 | 32 | botSleepDelay: 120, 33 | botOnFailSleepDelay: 60 34 | 35 | }; 36 | -------------------------------------------------------------------------------- /generators/app/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const Generator = require('yeoman-generator'); 3 | const chalk = require('chalk'); 4 | const parameters = require('./parameters'); 5 | const altCurrencies = require('./currencies.js'); 6 | const defaultValues = require('./defaultValues.js'); 7 | const strategies = require('./strategies.js'); 8 | 9 | module.exports = class extends Generator { 10 | 11 | constructor(args, opts) { 12 | super(args, opts); 13 | 14 | // The actions are: init, add 15 | this.argument('action', {type: String, required: true}); 16 | 17 | // Helper function to start a GUNBOT for the given currency index. 18 | this.startGunbotCurrency = (market, currencies, index) => { 19 | if (!this.isCurrencyIndexValid(currencies, index)) { 20 | return; 21 | } 22 | 23 | let args = [ 24 | 'start', 25 | `./${parameters.gunbotExeName}`, 26 | '--name', 27 | `BTC_${currencies[index]}_${market[0].toUpperCase()}`, 28 | '--', 29 | `BTC_${currencies[index]}`, 30 | market]; 31 | 32 | // Start GUNBOT 33 | let spawn = require('child_process').spawn; 34 | let process = spawn('pm2', args); 35 | 36 | // Print success or error 37 | process.on('close', code => { 38 | if (code) { 39 | this.log(`${chalk.red('ERROR!')} - There was an error starting GUNBOT for ${chalk.bold(`BTC_${currencies[index]}`)}:`); 40 | this.log(code); 41 | return; 42 | } 43 | 44 | this.log(`${chalk.green('YEAH!')} - Started GUNBOT for BTC_${currencies[index]}. :)`); 45 | 46 | // Start next bot if there are currencies left. 47 | index++; 48 | if (!this.isCurrencyIndexValid(currencies, index)) { 49 | return; 50 | } 51 | setTimeout(() => this.startGunbotCurrency(market, currencies, index), parameters.timeoutBetweenGunbotStarts); 52 | }); 53 | }; 54 | 55 | this.isCurrencyIndexValid = (currencies, index) => { 56 | if (currencies.length < index + 1) { 57 | return false; 58 | } 59 | 60 | if (currencies[index] === undefined) { 61 | return false; 62 | } 63 | 64 | return true; 65 | }; 66 | } 67 | 68 | prompting() { 69 | if (this.options.action === 'init') { 70 | this.log(chalk.green(' /-----------------------------------------------------------------------------------\\')); 71 | this.log(` You need your ${chalk.bold.green('API key')} and ${chalk.bold.green('API secret')} now to setup the GUNBOT config files.`); 72 | this.log(''); 73 | this.log(` Press ${chalk.bold('CTRL+C')} if you want to abort this process.`); 74 | this.log(` Enter ${chalk.bold('ginit')} if you want to restart this process.`); 75 | this.log(chalk.green(' \\-----------------------------------------------------------------------------------/')); 76 | this.log(''); 77 | } 78 | 79 | const prompts = [ 80 | { 81 | type: 'list', 82 | name: 'market', 83 | message: 'What market?', 84 | choices: parameters.markets 85 | }, { 86 | when: props => props.market === 'poloniex', 87 | type: 'input', 88 | name: 'poloniexApiKey', 89 | message: '[POLONIEX_KEY] Your Poloniex API key:', 90 | store: true 91 | }, { 92 | when: props => props.market === 'poloniex', 93 | type: 'password', 94 | name: 'poloniexApiSecret', 95 | message: '[POLONIEX_SECRET] Your Poloniex API secret:', 96 | store: true 97 | }, { 98 | when: props => props.market === 'bittrex', 99 | type: 'input', 100 | name: 'bittrexApiKey', 101 | message: '[BITTREX_KEY] Your Bittrex API key:', 102 | store: true 103 | }, { 104 | when: props => props.market === 'bittrex', 105 | type: 'password', 106 | name: 'bittrexApiSecret', 107 | message: '[BITTREX_SECRET] Your Bittrex API secret:', 108 | store: true 109 | }, { 110 | when: props => props.market === 'kraken', 111 | type: 'input', 112 | name: 'krakenApiKey', 113 | message: '[KRAKEN_KEY] Your Kraken API key:', 114 | store: true 115 | }, { 116 | when: props => props.market === 'kraken', 117 | type: 'password', 118 | name: 'krakenApiSecret', 119 | message: '[KRAKEN_SECRET] Your Kraken API secret:', 120 | store: true 121 | }, { 122 | when: () => this.options.action === 'init', 123 | type: 'input', 124 | name: 'btcTradingLimit', 125 | message: '[BTC_TRADING_LIMIT] Max amount of BTC used by each pair per trade:', 126 | default: defaultValues.btcTradingLimit, 127 | store: true 128 | }, { 129 | when: () => this.options.action === 'add', 130 | type: 'input', 131 | name: 'btcTradingLimit', 132 | message: '[BTC_TRADING_LIMIT] Max amount of BTC used by the new pair per trade:', 133 | default: defaultValues.btcTradingLimit, 134 | store: true 135 | }, 136 | 137 | // STRATEGY 138 | // ------------------------ 139 | { 140 | type: 'list', 141 | name: 'buyStrategy', 142 | message: '[BUY_STRATEGY] What BUY strategy do you want to use?', 143 | default: defaultValues.buyStrategy, 144 | choices: strategies, 145 | store: true 146 | }, { 147 | type: 'list', 148 | name: 'sellStrategy', 149 | message: '[SELL_STRATEGY] What SELL strategy do you want to use?', 150 | default: defaultValues.buyStrategy, 151 | choices: strategies, 152 | store: true 153 | }, 154 | 155 | // BUY SETTINGS 156 | // ------------------------ 157 | { 158 | when: props => props.buyStrategy === 'BB', 159 | type: 'input', 160 | name: 'bbLow', 161 | message: '[LOW_BB] Percent. Buy if price is x% or less above the lowerst Bollinger Band:', 162 | default: defaultValues.bbLow, 163 | store: true 164 | }, { 165 | when: props => props.buyStrategy === 'GAIN', 166 | type: 'input', 167 | name: 'gainBuyLevel', 168 | message: '[BUY_LEVEL] Percent. Buy if price is x% below the lower ema value:', 169 | default: defaultValues.gainBuyLevel, 170 | store: true 171 | }, { 172 | when: props => props.buyStrategy === 'PINGPONG', 173 | type: 'input', 174 | name: 'pingpongBuyPrice', 175 | message: '[PINGPONG_BUY] Buy price:', 176 | default: defaultValues.pingpongBuyPrice, 177 | store: true 178 | }, { 179 | when: props => props.buyStrategy === 'STEPGAIN', 180 | type: 'input', 181 | name: 'stepgainBuyLevelOne', 182 | message: '[BUYLVL1] Percent. Buy when the price drops by x% or lower:', 183 | default: defaultValues.stepgainBuyLevelOne, 184 | store: true 185 | }, { 186 | when: props => props.buyStrategy === 'STEPGAIN', 187 | type: 'input', 188 | name: 'stepgainBuyLevelTwo', 189 | message: '[BUYLVL2] Percent. Buy when the price drops by x% or lower:', 190 | default: defaultValues.stepgainBuyLevelTwo, 191 | store: true 192 | }, { 193 | when: props => props.buyStrategy === 'STEPGAIN', 194 | type: 'input', 195 | name: 'stepgainBuyLevelThree', 196 | message: '[BUYLVL3] Percent. Buy when the price drops by x% or lower:', 197 | default: defaultValues.stepgainBuyLevelThree, 198 | store: true 199 | }, 200 | 201 | // SELL SETTINGS 202 | // ------------------------ 203 | { 204 | when: props => props.sellStrategy === 'BB', 205 | type: 'input', 206 | name: 'bbHigh', 207 | message: '[HIGH_BB] Percent. Sell if price is x% or less below the highest Bollinger Band:', 208 | default: defaultValues.bbHigh, 209 | store: true 210 | }, { 211 | when: props => props.sellStrategy === 'GAIN', 212 | type: 'input', 213 | name: 'gainSellLevel', 214 | message: '[GAIN] Percent. Sell if price is x% above bought price:', 215 | default: defaultValues.gainSellLevel, 216 | store: true 217 | }, { 218 | when: props => props.sellStrategy === 'PINGPONG', 219 | type: 'input', 220 | name: 'pingpongSellPrice', 221 | message: '[PINGPONG_SELL] Sell price:', 222 | default: defaultValues.pingpongSellPrice, 223 | store: true 224 | }, { 225 | when: props => props.sellStrategy === 'STEPGAIN', 226 | type: 'input', 227 | name: 'stepgainSellLevelOne', 228 | message: '[SELLLVL1] Percent. Sell if price is x% above bought price:', 229 | default: defaultValues.stepgainSellLevelOne, 230 | store: true 231 | }, { 232 | when: props => props.sellStrategy === 'STEPGAIN', 233 | type: 'input', 234 | name: 'stepgainSellLevelTwo', 235 | message: '[SELLLVL2] Percent. Sell if price is x% above bought price:', 236 | default: defaultValues.stepgainSellLevelTwo, 237 | store: true 238 | }, { 239 | when: props => props.sellStrategy === 'STEPGAIN', 240 | type: 'input', 241 | name: 'stepgainSellLevelThree', 242 | message: '[SELLLVL3] Percent. Sell if price is x% above bought price:', 243 | default: defaultValues.stepgainSellLevelThree, 244 | store: true 245 | }, 246 | 247 | // TIMINGS 248 | // ------------------------ 249 | { 250 | type: 'input', 251 | name: 'botSleepDelay', 252 | message: '[BOT_SLEEP_DELAY] Bot cycle delay. Time the bot sleeps between cycles:', 253 | default: defaultValues.botSleepDelay, 254 | store: true 255 | }, { 256 | type: 'input', 257 | name: 'botOnFailSleepDelay', 258 | message: '[BOT_ON_FAIL_DELAY] Bot repeat cycle delay if previous cycle failed:', 259 | default: defaultValues.botOnFailSleepDelay, 260 | store: true 261 | }, 262 | 263 | // CURRENCY/ CURRENCIES 264 | // ------------------------ 265 | { 266 | when: () => this.options.action === 'init', 267 | type: 'checkbox', 268 | name: 'currencies', 269 | message: 'Select the currencies you want to trade:', 270 | choices: props => altCurrencies[props.market], 271 | store: true 272 | }, { 273 | when: () => this.options.action === 'init', 274 | type: 'checkbox', 275 | name: 'currenciesToStart', 276 | message: 'Select the trade pair currencies you want to automatically start right now:', 277 | choices: props => props.currencies, 278 | default: props => props.currencies, 279 | store: true 280 | }, { 281 | when: () => this.options.action === 'add', 282 | type: 'list', 283 | name: 'currencyToAdd', 284 | message: 'Select the currency you want to add to GUNBOT:', 285 | choices: props => altCurrencies[props.market] 286 | }, { 287 | when: () => this.options.action === 'add', 288 | type: 'confirm', 289 | name: 'startCurrencyToAdd', 290 | message: 'Do you want the new trade pair automatically start right now:', 291 | default: true, 292 | store: true 293 | }]; 294 | 295 | return this.prompt(prompts).then(props => { 296 | this.props = props; 297 | }); 298 | } 299 | 300 | writing() { 301 | // INIT action 302 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 303 | if (this.options.action === 'init') { 304 | this.fs.copyTpl( 305 | this.templatePath('ALLPAIRS-params.js'), 306 | this.destinationPath('ALLPAIRS-params.js') 307 | ); 308 | 309 | for (let currency of this.props.currencies) { 310 | // Create empty config files. 311 | this.fs.copyTpl( 312 | this.templatePath(`${this.props.market}-BTX_XXX-config.js`), 313 | this.destinationPath(`${this.props.market}-BTC_${currency}-config.js`), 314 | { 315 | poloniexApiKey: this.props.poloniexApiKey || defaultValues.poloniexApiKey, 316 | poloniexApiSecret: this.props.poloniexApiSecret || defaultValues.poloniexApiSecret, 317 | bittrexApiKey: this.props.bittrexApiKey || defaultValues.bittrexApiKey, 318 | bittrexApiSecret: this.props.bittrexApiSecret || defaultValues.bittrexApiSecret, 319 | krakenApiKey: this.props.krakenApiKey || defaultValues.krakenApiKey, 320 | krakenApiSecret: this.props.krakenApiSecret || defaultValues.krakenApiSecret, 321 | btcTradingLimit: this.props.btcTradingLimit || defaultValues.btcTradingLimit, 322 | buyStrategy: this.props.buyStrategy || defaultValues.buyStrategy, 323 | sellStrategy: this.props.sellStrategy || defaultValues.sellStrategy, 324 | bbLow: this.props.bbLow || defaultValues.bbLow, 325 | bbHigh: this.props.bbHigh || defaultValues.bbHigh, 326 | gainBuyLevel: this.props.gainBuyLevel || defaultValues.gainBuyLevel, 327 | gainSellLevel: this.props.gainSellLevel || defaultValues.gainSellLevel, 328 | pingpongBuyPrice: this.props.pingpongBuyPrice || defaultValues.pingpongBuyPrice, 329 | pingpongSellPrice: this.props.pingpongSellPrice || defaultValues.pingpongSellPrice, 330 | stepgainBuyLevelOne: this.props.stepgainBuyLevelOne || defaultValues.stepgainBuyLevelOne, 331 | stepgainBuyLevelTwo: this.props.stepgainBuyLevelTwo || defaultValues.stepgainBuyLevelTwo, 332 | stepgainBuyLevelThree: this.props.stepgainBuyLevelThree || defaultValues.stepgainBuyLevelThree, 333 | stepgainSellLevelOne: this.props.stepgainSellLevelOne || defaultValues.stepgainSellLevelOne, 334 | stepgainSellLevelTwo: this.props.stepgainSellLevelTwo || defaultValues.stepgainSellLevelTwo, 335 | stepgainSellLevelThree: this.props.stepgainSellLevelThree || defaultValues.stepgainSellLevelThree, 336 | botSleepDelay: this.props.botSleepDelay || defaultValues.botSleepDelay, 337 | botOnFailSleepDelay: this.props.botOnFailSleepDelay || defaultValues.botOnFailSleepDelay 338 | } 339 | ); 340 | } 341 | } 342 | 343 | // ADD action 344 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 345 | if (this.options.action === 'add') { 346 | this.fs.copyTpl( 347 | this.templatePath(`${this.props.market}-BTX_XXX-config.js`), 348 | this.destinationPath(`${this.props.market}-BTC_${this.props.currencyToAdd}-config.js`), 349 | { 350 | poloniexApiKey: this.props.poloniexApiKey || defaultValues.poloniexApiKey, 351 | poloniexApiSecret: this.props.poloniexApiSecret || defaultValues.poloniexApiSecret, 352 | bittrexApiKey: this.props.bittrexApiKey || defaultValues.bittrexApiKey, 353 | bittrexApiSecret: this.props.bittrexApiSecret || defaultValues.bittrexApiSecret, 354 | krakenApiKey: this.props.krakenApiKey || defaultValues.krakenApiKey, 355 | krakenApiSecret: this.props.krakenApiSecret || defaultValues.krakenApiSecret, 356 | btcTradingLimit: this.props.btcTradingLimit || defaultValues.btcTradingLimit, 357 | buyStrategy: this.props.buyStrategy || defaultValues.buyStrategy, 358 | sellStrategy: this.props.sellStrategy || defaultValues.sellStrategy, 359 | bbLow: this.props.bbLow || defaultValues.bbLow, 360 | bbHigh: this.props.bbHigh || defaultValues.bbHigh, 361 | gainBuyLevel: this.props.gainBuyLevel || defaultValues.gainBuyLevel, 362 | gainSellLevel: this.props.gainSellLevel || defaultValues.gainSellLevel, 363 | pingpongBuyPrice: this.props.pingpongBuyPrice || defaultValues.pingpongBuyPrice, 364 | pingpongSellPrice: this.props.pingpongSellPrice || defaultValues.pingpongSellPrice, 365 | stepgainBuyLevelOne: this.props.stepgainBuyLevelOne || defaultValues.stepgainBuyLevelOne, 366 | stepgainBuyLevelTwo: this.props.stepgainBuyLevelTwo || defaultValues.stepgainBuyLevelTwo, 367 | stepgainBuyLevelThree: this.props.stepgainBuyLevelThree || defaultValues.stepgainBuyLevelThree, 368 | stepgainSellLevelOne: this.props.stepgainSellLevelOne || defaultValues.stepgainSellLevelOne, 369 | stepgainSellLevelTwo: this.props.stepgainSellLevelTwo || defaultValues.stepgainSellLevelTwo, 370 | stepgainSellLevelThree: this.props.stepgainSellLevelThree || defaultValues.stepgainSellLevelThree, 371 | botSleepDelay: this.props.botSleepDelay || defaultValues.botSleepDelay, 372 | botOnFailSleepDelay: this.props.botOnFailSleepDelay || defaultValues.botOnFailSleepDelay 373 | } 374 | ); 375 | } 376 | } 377 | 378 | install() { 379 | // INIT action 380 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 381 | if (this.options.action === 'init') { 382 | this.startGunbotCurrency(this.props.market, this.props.currenciesToStart, 0); 383 | } 384 | 385 | // ADD action 386 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 387 | if (this.options.action === 'add') { 388 | if (this.props.startCurrencyToAdd) { 389 | this.startGunbotCurrency(this.props.market, [this.props.currencyToAdd], 0); 390 | } 391 | } 392 | } 393 | 394 | }; 395 | -------------------------------------------------------------------------------- /generators/app/parameters.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | gunbotExeName: 'gunthy-linuxx64', 3 | timeoutBetweenGunbotStarts: 12000, 4 | markets: ['poloniex', 'kraken', 'bittrex'] 5 | }; 6 | -------------------------------------------------------------------------------- /generators/app/strategies.js: -------------------------------------------------------------------------------- 1 | module.exports = [ 2 | {value: 'BB', name: 'Bollinger Band'}, 3 | {value: 'GAIN', name: 'Gain'}, 4 | {value: 'STEPGAIN', name: 'StepGain'}, 5 | {value: 'PINGPONG', name: 'Ping Pong'} 6 | ]; 7 | -------------------------------------------------------------------------------- /generators/app/templates/ALLPAIRS-params.js: -------------------------------------------------------------------------------- 1 | var config = { 2 | 3 | }; 4 | 5 | module.exports = config; 6 | -------------------------------------------------------------------------------- /generators/app/templates/bittrex-BTX_XXX-config.js: -------------------------------------------------------------------------------- 1 | var config = { 2 | 3 | //----------------------------------------------- 4 | // DEBUG 5 | //----------------------------------------------- 6 | DEBUG_LOG: false, 7 | I_REALLY_WANT_IT: false, 8 | BUY_SMALL_PORTION: 1, 9 | INSUFFICIENT_FUNDS_ON_SELL_FIX: 0.0005, 10 | INSUFFICIENT_FUNDS_ON_BUY_FIX: 0.0005, 11 | 12 | 13 | //----------------------------------------------- 14 | // STARTUP OPTIONS 15 | //----------------------------------------------- 16 | SELL_ON_START: false, 17 | CANCEL_SELL_ORDERS_ON_START: false, 18 | CANCEL_BUY_ORDERS_ON_START: false, 19 | CANCEL_OPEN_ORDERS_ON_START: false, 20 | 21 | 22 | MAX_LATEST_PRICES: 300, // Limit of latest prices to analyze to determine if price is growing or falling. 23 | MAX_LATEST_PRICES_TREND: 30, // Limit of latest prices to analyze to determine if price is growing or falling. 24 | MAX_LATEST_DIRECTIONS: 30, // Limit of latest price directions, used in supergun detection. 25 | MAX_LAST_ORDERS: 5, // Keeping last orders bought. 26 | PERIOD: 15, // Candlestick period. 27 | 28 | SAVEFILE_SUFFIX: '-save.json', 29 | 30 | 31 | //----------------------------------------------- 32 | // PRIMARY SETTINGS 33 | //----------------------------------------------- 34 | DEFAULT_MARKET_NAME: 'bittrex', 35 | DEFAULT_CURRENCY_PAIR: 'BTC_ETH', // Single pair format for all markets! 36 | BTC_TRADING_LIMIT: <%= btcTradingLimit %>, // [DEFAULT: 0.01] Max amount of BTC balance to use for each pair. 37 | SECURITY_MARGIN: 60, // Sell all balance if currency decreases x% after you bought it. 38 | 39 | 40 | //----------------------------------------------- 41 | // STRATEGY 42 | //----------------------------------------------- 43 | MIN_VOLUME_TO_BUY: 0.0005, // Bitrex min volume. 44 | 45 | BUY_STRATEGY: '<%= buyStrategy %>', // [DEFAULT: BB] accepted values BB or STEPGAIN or GAIN or PINGPONG 46 | SELL_STRATEGY: '<%= sellStrategy %>', // [DEFAULT: BB] accepted values BB or STEPGAIN or GAIN or PINGPONG 47 | 48 | // BB 49 | LOW_BB: <%= bbLow %>, // [DEFAULT: 25] Percent. Buy if price is x% or less above the lowerst Bollinger Band. 50 | HIGH_BB: <%= bbHigh %>, // [DEFAULT: 25] Percent. Sell if price is x% or less below the highest Bollinger Band. 51 | 52 | // GAIN 53 | // Example: 54 | // if you set BUY_LEVEL to 3 and GAIN to 5, 55 | // - it will buy at 3% or more and 56 | // - it will sell at 5% or more 57 | BUY_LEVEL: <%= gainBuyLevel %>, // [DEFAULT: 3] Percent. Buy if price is x% below the lower ema value. 58 | GAIN: <%= gainSellLevel %>, // [DEFAULT: 5] Percent. Sell if price is x% above bought price. 59 | 60 | // PINGPONG 61 | PINGPONG_BUY: <%= pingpongBuyPrice %>, // [DEFAULT: 0.000001] Buy price. 62 | PINGPONG_SELL: <%= pingpongSellPrice %>, // [DEFAULT: 0.000002] Sell price. 63 | 64 | // STEPGAIN 65 | BUYLVL1: <%= stepgainBuyLevelOne %>, // [DEFAULT: 2] Percent. Buy if price is x% below the lower ema value. But try also to reach BUYLVL2 66 | BUYLVL2: <%= stepgainBuyLevelTwo %>, // [DEFAULT: 5] Percent. Buy if price is x% below the lower ema value. But try also to reach BUYLVL3 67 | BUYLVL3: <%= stepgainBuyLevelThree %>, // [DEFAULT: 41] Percent. Buy if price is x% below the lower ema value or even less. 68 | 69 | SELLLVL1: <%= stepgainSellLevelOne %>, // [DEFAULT: 2] Percent. Sell if price is x% above bought price. But try also to reach SELLLVL2 70 | SELLLVL2: <%= stepgainSellLevelTwo %>, // [DEFAULT: 5] Percent. Sell if price is x% above bought price. But try also to reach SELLLVL3 71 | SELLLVL3: <%= stepgainSellLevelThree %>, // [DEFAULT: 70] Percent. Sell if price is x% above bought price or even more. 72 | 73 | //----------------------------------------------- 74 | // MARKETS 75 | //----------------------------------------------- 76 | //---BITTREX 77 | BITTREX_KEY: '<%= bittrexApiKey %>', 78 | BITTREX_SECRET: '<%= bittrexApiSecret %>', 79 | 80 | BITTREX_PRICE_METHOD:'ohlc',// ohlc OR vwa price to buy definition method 81 | BITTREX_VWA_1_INTERVAL: 0.02,// weighted average interval in minutes 82 | BITTREX_VWA_2_INTERVAL: 0.04,// weighted average interval in minutes 83 | 84 | 85 | //---KRAKEN 86 | KRAKEN_ASSET_PAIR: 'XETHXXBT', 87 | 88 | KRAKEN_KEY: '<%= krakenApiKey %>', 89 | KRAKEN_SECRET: '<%= krakenApiSecret %>', 90 | 91 | KRAKEN_PRICE_METHOD:'ohlc',// ohlc OR vwa price to buy definition method 92 | KRAKEN_VWA_1_INTERVAL: 0.02,// weighted average interval in minutes 93 | KRAKEN_VWA_2_INTERVAL: 0.04,// weighted average interval in minutes 94 | 95 | //---POLONIEX 96 | POLONIEX_KEY: '<%= poloniexApiKey %>', 97 | POLONIEX_SECRET: '<%= poloniexApiSecret %>', 98 | 99 | POLONIEX_PRICE_METHOD:'vwa',// ohlc OR vwa price to buy definition method 100 | POLONIEX_VWA_1_INTERVAL: 0.02,// weighted average interval in hours 101 | POLONIEX_VWA_2_INTERVAL: 0.04,// weighted average interval in hours 102 | 103 | 104 | //----------------------------------------------- 105 | // BOT TIMINGS 106 | //----------------------------------------------- 107 | // All timings are (milliseconds) * seconds 108 | BOT_SLEEP_DELAY: (1000) * <%= botSleepDelay %>, // [Default: 120] Bot cycle delay. Time the bot sleeps between cycles. 109 | BOT_ON_FAIL_DELAY: (1000) * <%= botOnFailSleepDelay %>, // [Default: 60] Bot repeat cycle delay if previous cycle failed. 110 | BOT_MAX_LIFETIME: 999999999, // Overall bot lifetime. 999999999 = 'never end'. 111 | API_CALLS_DELAY: 777, 112 | 113 | 114 | //----------------------------------------------- 115 | // EMAIL 116 | //----------------------------------------------- 117 | ALERT_ON_NO_FUNDS: false, // Email on insufficcient funds. 118 | SMTP_EMAIL: '%40@gmail.com', 119 | ALERT_EMAIL: '********', 120 | SMTP_PASSWORD: '**********', 121 | SMTP: true, 122 | SMTP_PROTOCOL: 'SMTPS', 123 | SMTP_HOST: 'smtp.gmail.com', 124 | 125 | 126 | //----------------------------------------------- 127 | // OUTPUT 128 | //----------------------------------------------- 129 | MAX_LATEST_PRICES_SHOWN: 0, // Limit of latest prices to show in console.log. 130 | SHOW_LASTEST_DIRECTIONS: false, // Show chart in console. 131 | MAX_LATEST_DIRECTIONS_SHOWN: 0, // Chart height. 132 | LASTEST_DIRECTIONS_LIST_WIDTH: 0, // Chart width. 133 | 134 | 135 | //----------------------------------------------- 136 | // OTHER (might be deprecated/not in use) 137 | //----------------------------------------------- 138 | BTC_BALANCE: 2 // BTC balance for test purposes. 139 | }; 140 | 141 | module.exports = config; 142 | -------------------------------------------------------------------------------- /generators/app/templates/kraken-BTX_XXX-config.js: -------------------------------------------------------------------------------- 1 | var config = { 2 | 3 | //----------------------------------------------- 4 | // DEBUG 5 | //----------------------------------------------- 6 | DEBUG_LOG: false, 7 | I_REALLY_WANT_IT: false, 8 | BUY_SMALL_PORTION: 1, 9 | INSUFFICIENT_FUNDS_ON_SELL_FIX: 0.0005, 10 | INSUFFICIENT_FUNDS_ON_BUY_FIX: 0.0005, 11 | 12 | 13 | //----------------------------------------------- 14 | // STARTUP OPTIONS 15 | //----------------------------------------------- 16 | SELL_ON_START: false, 17 | CANCEL_SELL_ORDERS_ON_START: false, 18 | CANCEL_BUY_ORDERS_ON_START: false, 19 | CANCEL_OPEN_ORDERS_ON_START: false, 20 | 21 | 22 | MAX_LATEST_PRICES: 300, // Limit of latest prices to analyze to determine if price is growing or falling. 23 | MAX_LATEST_PRICES_TREND: 30, // Limit of latest prices to analyze to determine if price is growing or falling. 24 | MAX_LATEST_DIRECTIONS: 30, // Limit of latest price directions, used in supergun detection. 25 | MAX_LAST_ORDERS: 5, // Keeping last orders bought. 26 | PERIOD: 15, // Candlestick period. 27 | 28 | SAVEFILE_SUFFIX: '-save.json', 29 | 30 | 31 | //----------------------------------------------- 32 | // PRIMARY SETTINGS 33 | //----------------------------------------------- 34 | DEFAULT_MARKET_NAME: 'kraken', 35 | DEFAULT_CURRENCY_PAIR: 'BTC_ETH', // Single pair format for all markets! 36 | BTC_TRADING_LIMIT: <%= btcTradingLimit %>, // [DEFAULT: 0.01] Max amount of BTC balance to use for each pair. 37 | SECURITY_MARGIN: 60, // Sell all balance if currency decreases x% after you bought it. 38 | 39 | 40 | //----------------------------------------------- 41 | // STRATEGY 42 | //----------------------------------------------- 43 | MIN_VOLUME_TO_BUY: 0.0005, // Bitrex min volume. 44 | 45 | BUY_STRATEGY: '<%= buyStrategy %>', // [DEFAULT: BB] accepted values BB or STEPGAIN or GAIN or PINGPONG 46 | SELL_STRATEGY: '<%= sellStrategy %>', // [DEFAULT: BB] accepted values BB or STEPGAIN or GAIN or PINGPONG 47 | 48 | // BB 49 | LOW_BB: <%= bbLow %>, // [DEFAULT: 25] Percent. Buy if price is x% or less above the lowerst Bollinger Band. 50 | HIGH_BB: <%= bbHigh %>, // [DEFAULT: 25] Percent. Sell if price is x% or less below the highest Bollinger Band. 51 | 52 | // GAIN 53 | // Example: 54 | // if you set BUY_LEVEL to 3 and GAIN to 5, 55 | // - it will buy at 3% or more and 56 | // - it will sell at 5% or more 57 | BUY_LEVEL: <%= gainBuyLevel %>, // [DEFAULT: 3] Percent. Buy if price is x% below the lower ema value. 58 | GAIN: <%= gainSellLevel %>, // [DEFAULT: 5] Percent. Sell if price is x% above bought price. 59 | 60 | // PINGPONG 61 | PINGPONG_BUY: <%= pingpongBuyPrice %>, // [DEFAULT: 0.000001] Buy price. 62 | PINGPONG_SELL: <%= pingpongSellPrice %>, // [DEFAULT: 0.000002] Sell price. 63 | 64 | // STEPGAIN 65 | BUYLVL1: <%= stepgainBuyLevelOne %>, // [DEFAULT: 2] Percent. Buy if price is x% below the lower ema value. But try also to reach BUYLVL2 66 | BUYLVL2: <%= stepgainBuyLevelTwo %>, // [DEFAULT: 5] Percent. Buy if price is x% below the lower ema value. But try also to reach BUYLVL3 67 | BUYLVL3: <%= stepgainBuyLevelThree %>, // [DEFAULT: 41] Percent. Buy if price is x% below the lower ema value or even less. 68 | 69 | SELLLVL1: <%= stepgainSellLevelOne %>, // [DEFAULT: 2] Percent. Sell if price is x% above bought price. But try also to reach SELLLVL2 70 | SELLLVL2: <%= stepgainSellLevelTwo %>, // [DEFAULT: 5] Percent. Sell if price is x% above bought price. But try also to reach SELLLVL3 71 | SELLLVL3: <%= stepgainSellLevelThree %>, // [DEFAULT: 70] Percent. Sell if price is x% above bought price or even more. 72 | 73 | //----------------------------------------------- 74 | // MARKETS 75 | //----------------------------------------------- 76 | //---BITTREX 77 | BITTREX_KEY: '<%= bittrexApiKey %>', 78 | BITTREX_SECRET: '<%= bittrexApiSecret %>', 79 | 80 | BITTREX_PRICE_METHOD:'ohlc',// ohlc OR vwa price to buy definition method 81 | BITTREX_VWA_1_INTERVAL: 0.02,// weighted average interval in minutes 82 | BITTREX_VWA_2_INTERVAL: 0.04,// weighted average interval in minutes 83 | 84 | 85 | //---KRAKEN 86 | KRAKEN_ASSET_PAIR: 'XETHXXBT', 87 | 88 | KRAKEN_KEY: '<%= krakenApiKey %>', 89 | KRAKEN_SECRET: '<%= krakenApiSecret %>', 90 | 91 | KRAKEN_PRICE_METHOD:'ohlc',// ohlc OR vwa price to buy definition method 92 | KRAKEN_VWA_1_INTERVAL: 0.02,// weighted average interval in minutes 93 | KRAKEN_VWA_2_INTERVAL: 0.04,// weighted average interval in minutes 94 | 95 | //---POLONIEX 96 | POLONIEX_KEY: '<%= poloniexApiKey %>', 97 | POLONIEX_SECRET: '<%= poloniexApiSecret %>', 98 | 99 | POLONIEX_PRICE_METHOD:'vwa',// ohlc OR vwa price to buy definition method 100 | POLONIEX_VWA_1_INTERVAL: 0.02,// weighted average interval in hours 101 | POLONIEX_VWA_2_INTERVAL: 0.04,// weighted average interval in hours 102 | 103 | 104 | //----------------------------------------------- 105 | // BOT TIMINGS 106 | //----------------------------------------------- 107 | // All timings are (milliseconds) * seconds 108 | BOT_SLEEP_DELAY: (1000) * <%= botSleepDelay %>, // [Default: 120] Bot cycle delay. Time the bot sleeps between cycles. 109 | BOT_ON_FAIL_DELAY: (1000) * <%= botOnFailSleepDelay %>, // [Default: 60] Bot repeat cycle delay if previous cycle failed. 110 | BOT_MAX_LIFETIME: 999999999, // Overall bot lifetime. 999999999 = 'never end'. 111 | API_CALLS_DELAY: 777, 112 | 113 | 114 | //----------------------------------------------- 115 | // EMAIL 116 | //----------------------------------------------- 117 | ALERT_ON_NO_FUNDS: false, // Email on insufficcient funds. 118 | SMTP_EMAIL: '%40@gmail.com', 119 | ALERT_EMAIL: '********', 120 | SMTP_PASSWORD: '**********', 121 | SMTP: true, 122 | SMTP_PROTOCOL: 'SMTPS', 123 | SMTP_HOST: 'smtp.gmail.com', 124 | 125 | 126 | //----------------------------------------------- 127 | // OUTPUT 128 | //----------------------------------------------- 129 | MAX_LATEST_PRICES_SHOWN: 0, // Limit of latest prices to show in console.log. 130 | SHOW_LASTEST_DIRECTIONS: false, // Show chart in console. 131 | MAX_LATEST_DIRECTIONS_SHOWN: 0, // Chart height. 132 | LASTEST_DIRECTIONS_LIST_WIDTH: 0, // Chart width. 133 | 134 | 135 | //----------------------------------------------- 136 | // OTHER (might be deprecated/not in use) 137 | //----------------------------------------------- 138 | BTC_BALANCE: 2 // BTC balance for test purposes. 139 | }; 140 | 141 | module.exports = config; 142 | -------------------------------------------------------------------------------- /generators/app/templates/poloniex-BTX_XXX-config.js: -------------------------------------------------------------------------------- 1 | var config = { 2 | 3 | //----------------------------------------------- 4 | // DEBUG 5 | //----------------------------------------------- 6 | DEBUG_LOG: false, 7 | I_REALLY_WANT_IT: false, 8 | BUY_SMALL_PORTION: 1, 9 | INSUFFICIENT_FUNDS_ON_SELL_FIX: 0.0005, 10 | INSUFFICIENT_FUNDS_ON_BUY_FIX: 0.0005, 11 | 12 | 13 | //----------------------------------------------- 14 | // STARTUP OPTIONS 15 | //----------------------------------------------- 16 | SELL_ON_START: false, 17 | CANCEL_SELL_ORDERS_ON_START: false, 18 | CANCEL_BUY_ORDERS_ON_START: false, 19 | CANCEL_OPEN_ORDERS_ON_START: false, 20 | 21 | 22 | MAX_LATEST_PRICES: 300, // Limit of latest prices to analyze to determine if price is growing or falling. 23 | MAX_LATEST_PRICES_TREND: 30, // Limit of latest prices to analyze to determine if price is growing or falling. 24 | MAX_LATEST_DIRECTIONS: 30, // Limit of latest price directions, used in supergun detection. 25 | MAX_LAST_ORDERS: 5, // Keeping last orders bought. 26 | PERIOD: 15, // Candlestick period. 27 | 28 | SAVEFILE_SUFFIX: '-save.json', 29 | 30 | 31 | //----------------------------------------------- 32 | // PRIMARY SETTINGS 33 | //----------------------------------------------- 34 | DEFAULT_MARKET_NAME: 'poloniex', 35 | DEFAULT_CURRENCY_PAIR: 'BTC_ETH', // Single pair format for all markets! 36 | BTC_TRADING_LIMIT: <%= btcTradingLimit %>, // [DEFAULT: 0.01] Max amount of BTC balance to use for each pair. 37 | SECURITY_MARGIN: 60, // Sell all balance if currency decreases x% after you bought it. 38 | 39 | 40 | //----------------------------------------------- 41 | // STRATEGY 42 | //----------------------------------------------- 43 | MIN_VOLUME_TO_BUY: 0.0005, // Bitrex min volume. 44 | 45 | BUY_STRATEGY: '<%= buyStrategy %>', // [DEFAULT: BB] accepted values BB or STEPGAIN or GAIN or PINGPONG 46 | SELL_STRATEGY: '<%= sellStrategy %>', // [DEFAULT: BB] accepted values BB or STEPGAIN or GAIN or PINGPONG 47 | 48 | // BB 49 | LOW_BB: <%= bbLow %>, // [DEFAULT: 25] Percent. Buy if price is x% or less above the lowerst Bollinger Band. 50 | HIGH_BB: <%= bbHigh %>, // [DEFAULT: 25] Percent. Sell if price is x% or less below the highest Bollinger Band. 51 | 52 | // GAIN 53 | // Example: 54 | // if you set BUY_LEVEL to 3 and GAIN to 5, 55 | // - it will buy at 3% or more and 56 | // - it will sell at 5% or more 57 | BUY_LEVEL: <%= gainBuyLevel %>, // [DEFAULT: 3] Percent. Buy if price is x% below the lower ema value. 58 | GAIN: <%= gainSellLevel %>, // [DEFAULT: 5] Percent. Sell if price is x% above bought price. 59 | 60 | // PINGPONG 61 | PINGPONG_BUY: <%= pingpongBuyPrice %>, // [DEFAULT: 0.000001] Buy price. 62 | PINGPONG_SELL: <%= pingpongSellPrice %>, // [DEFAULT: 0.000002] Sell price. 63 | 64 | // STEPGAIN 65 | BUYLVL1: <%= stepgainBuyLevelOne %>, // [DEFAULT: 2] Percent. Buy if price is x% below the lower ema value. But try also to reach BUYLVL2 66 | BUYLVL2: <%= stepgainBuyLevelTwo %>, // [DEFAULT: 5] Percent. Buy if price is x% below the lower ema value. But try also to reach BUYLVL3 67 | BUYLVL3: <%= stepgainBuyLevelThree %>, // [DEFAULT: 41] Percent. Buy if price is x% below the lower ema value or even less. 68 | 69 | SELLLVL1: <%= stepgainSellLevelOne %>, // [DEFAULT: 2] Percent. Sell if price is x% above bought price. But try also to reach SELLLVL2 70 | SELLLVL2: <%= stepgainSellLevelTwo %>, // [DEFAULT: 5] Percent. Sell if price is x% above bought price. But try also to reach SELLLVL3 71 | SELLLVL3: <%= stepgainSellLevelThree %>, // [DEFAULT: 70] Percent. Sell if price is x% above bought price or even more. 72 | 73 | //----------------------------------------------- 74 | // MARKETS 75 | //----------------------------------------------- 76 | //---BITTREX 77 | BITTREX_KEY: '<%= bittrexApiKey %>', 78 | BITTREX_SECRET: '<%= bittrexApiSecret %>', 79 | 80 | BITTREX_PRICE_METHOD:'ohlc',// ohlc OR vwa price to buy definition method 81 | BITTREX_VWA_1_INTERVAL: 0.02,// weighted average interval in minutes 82 | BITTREX_VWA_2_INTERVAL: 0.04,// weighted average interval in minutes 83 | 84 | 85 | //---KRAKEN 86 | KRAKEN_ASSET_PAIR: 'XETHXXBT', 87 | 88 | KRAKEN_KEY: '<%= krakenApiKey %>', 89 | KRAKEN_SECRET: '<%= krakenApiSecret %>', 90 | 91 | KRAKEN_PRICE_METHOD:'ohlc',// ohlc OR vwa price to buy definition method 92 | KRAKEN_VWA_1_INTERVAL: 0.02,// weighted average interval in minutes 93 | KRAKEN_VWA_2_INTERVAL: 0.04,// weighted average interval in minutes 94 | 95 | //---POLONIEX 96 | POLONIEX_KEY: '<%= poloniexApiKey %>', 97 | POLONIEX_SECRET: '<%= poloniexApiSecret %>', 98 | 99 | POLONIEX_PRICE_METHOD:'vwa',// ohlc OR vwa price to buy definition method 100 | POLONIEX_VWA_1_INTERVAL: 0.02,// weighted average interval in hours 101 | POLONIEX_VWA_2_INTERVAL: 0.04,// weighted average interval in hours 102 | 103 | 104 | //----------------------------------------------- 105 | // BOT TIMINGS 106 | //----------------------------------------------- 107 | // All timings are (milliseconds) * seconds 108 | BOT_SLEEP_DELAY: (1000) * <%= botSleepDelay %>, // [Default: 120] Bot cycle delay. Time the bot sleeps between cycles. 109 | BOT_ON_FAIL_DELAY: (1000) * <%= botOnFailSleepDelay %>, // [Default: 60] Bot repeat cycle delay if previous cycle failed. 110 | BOT_MAX_LIFETIME: 999999999, // Overall bot lifetime. 999999999 = 'never end'. 111 | API_CALLS_DELAY: 777, 112 | 113 | 114 | //----------------------------------------------- 115 | // EMAIL 116 | //----------------------------------------------- 117 | ALERT_ON_NO_FUNDS: false, // Email on insufficcient funds. 118 | SMTP_EMAIL: '%40@gmail.com', 119 | ALERT_EMAIL: '********', 120 | SMTP_PASSWORD: '**********', 121 | SMTP: true, 122 | SMTP_PROTOCOL: 'SMTPS', 123 | SMTP_HOST: 'smtp.gmail.com', 124 | 125 | 126 | //----------------------------------------------- 127 | // OUTPUT 128 | //----------------------------------------------- 129 | MAX_LATEST_PRICES_SHOWN: 0, // Limit of latest prices to show in console.log. 130 | SHOW_LASTEST_DIRECTIONS: false, // Show chart in console. 131 | MAX_LATEST_DIRECTIONS_SHOWN: 0, // Chart height. 132 | LASTEST_DIRECTIONS_LIST_WIDTH: 0, // Chart width. 133 | 134 | 135 | //----------------------------------------------- 136 | // OTHER (might be deprecated/not in use) 137 | //----------------------------------------------- 138 | BTC_BALANCE: 2 // BTC balance for test purposes. 139 | }; 140 | 141 | module.exports = config; 142 | -------------------------------------------------------------------------------- /install-loud.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Set variables 4 | # ----------------------------------- 5 | GUNBOT_GITHUB_FOLDER_NAME="Gunbot3.3.2" 6 | GUNBOT_GITHUB_FILE_NAME="GUNBOT_v3.3.2_Poloniex_Bittrex_Patch" 7 | 8 | 9 | # Set functions 10 | # ----------------------------------- 11 | logMessage () { 12 | echo " $1" 13 | echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" 14 | } 15 | 16 | 17 | echo "" 18 | echo " ============================================================" 19 | echo " GUNBOT 3.3.2 SETUP started" 20 | echo "" 21 | echo " This will take a few seconds" 22 | echo "" 23 | echo " DEBUG VERSION WITH A LOT OF OUTPUT" 24 | echo "" 25 | echo " ============================================================" 26 | echo "" 27 | 28 | logMessage "(1/6) Update the base system" 29 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 30 | apt-get update 31 | 32 | 33 | logMessage "(2/6) Install nodejs 6.x" 34 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 35 | curl -sL https://deb.nodesource.com/setup_6.x | bash - 36 | apt-get -y install nodejs 37 | 38 | 39 | logMessage "(3/6) Install tools" 40 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 41 | apt-get -y install unzip 42 | npm install -g pm2 yo@1.8.5 generator-gunbot gunbot-monitor 43 | 44 | 45 | logMessage "(4/6) Install GUNBOT" 46 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 47 | wget https://github.com/GuntharDeNiro/BTCT/releases/download/${GUNBOT_GITHUB_FOLDER_NAME}/${GUNBOT_GITHUB_FILE_NAME}.zip -P /opt/ 48 | unzip -o /opt/${GUNBOT_GITHUB_FILE_NAME}.zip -d /opt/unzip-tmp 49 | 50 | # create folder for the current version. 51 | mkdir /opt/${GUNBOT_GITHUB_FILE_NAME} -p 52 | 53 | # Copy only the executables. 54 | cp /opt/unzip-tmp/gunthy-* /opt/${GUNBOT_GITHUB_FILE_NAME} 55 | 56 | # creates a symbolic link to the gunbot folder. 57 | rm /opt/gunbot > /dev/null 58 | ln -s /opt/${GUNBOT_GITHUB_FILE_NAME} /opt/gunbot 59 | 60 | # Cleanup 61 | rm /opt/${GUNBOT_GITHUB_FILE_NAME}.zip 62 | rm -R /opt/unzip-tmp 63 | 64 | # Set rights 65 | chmod +x /opt/gunbot/gunthy-* 66 | 67 | 68 | 69 | logMessage "(5/6) Add GUNBOT aliases" 70 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 71 | echo "" >> ~/.bashrc 72 | echo "# GUNBOT ALIASES" >> ~/.bashrc 73 | echo "alias gcd='cd /opt/gunbot'" >> ~/.bashrc 74 | echo "alias ginit='gcd && yo gunbot init'" >> ~/.bashrc 75 | echo "alias gadd='gcd && yo gunbot add'" >> ~/.bashrc 76 | echo "alias gl='pm2 l'" >> ~/.bashrc 77 | echo "alias glog='pm2 logs'" >> ~/.bashrc 78 | echo "alias gstart='pm2 start'" >> ~/.bashrc 79 | echo "alias gstop='pm2 stop'" >> ~/.bashrc 80 | 81 | 82 | 83 | logMessage "(6/6) Init generator" 84 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 85 | # Create folder for yeoman. 86 | chmod g+rwx /root 87 | chmod g+rwx /opt/gunbot 88 | 89 | # Yeoman write rights. 90 | mkdir /root/.config/configstore -p 91 | cat > /root/.config/configstore/insight-yo.json << EOM 92 | { 93 | "clientId": 1337, 94 | "optOut": true 95 | } 96 | EOM 97 | chmod g+rwx /root/.config 98 | chmod g+rwx /root/.config/configstore 99 | chmod g+rw /root/.config/configstore/* 100 | 101 | # pm2 write rights. 102 | mkdir /root/.pm2 -p 103 | echo "1337" > /root/.pm2/touch 104 | chmod g+rwx /root/.pm2 105 | chmod g+rw /root/.pm2/* 106 | 107 | 108 | echo "" 109 | echo " ============================================================" 110 | echo " GUNBOT SETUP complete!" 111 | echo "" 112 | echo " Please run this command to init the GUNBOT:" 113 | echo " gcd" 114 | echo " ginit" 115 | echo "" 116 | echo " ============================================================" 117 | echo "" 118 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Set variables 4 | # ----------------------------------- 5 | GUNBOT_GITHUB_FOLDER_NAME="Gunbot3.3.2" 6 | GUNBOT_GITHUB_FILE_NAME="GUNBOT_v3.3.2_Poloniex_Bittrex_Patch" 7 | 8 | 9 | # Set functions 10 | # ----------------------------------- 11 | logMessage () { 12 | echo " $1" 13 | echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" 14 | } 15 | 16 | 17 | echo "" 18 | echo " ============================================================" 19 | echo " GUNBOT 3.3.2 SETUP started" 20 | echo "" 21 | echo " This will take a few seconds" 22 | echo "" 23 | echo " ============================================================" 24 | echo "" 25 | 26 | logMessage "(1/6) Update the base system" 27 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 28 | apt-get -qq update > /dev/null 2>&1 29 | 30 | 31 | logMessage "(2/6) Install nodejs 6.x" 32 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 33 | curl -qsL https://deb.nodesource.com/setup_6.x | bash - > /dev/null 2>&1 34 | apt-get -y -qq install nodejs > /dev/null 2>&1 35 | 36 | 37 | logMessage "(3/6) Install tools" 38 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 39 | apt-get -y -qq install unzip > /dev/null 2>&1 40 | npm install -g pm2 yo@1.8.5 generator-gunbot gunbot-monitor > /dev/null 2>&1 41 | 42 | 43 | logMessage "(4/6) Install GUNBOT" 44 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 45 | wget -q https://github.com/GuntharDeNiro/BTCT/releases/download/${GUNBOT_GITHUB_FOLDER_NAME}/${GUNBOT_GITHUB_FILE_NAME}.zip -P /opt/ 46 | unzip -o -qq /opt/${GUNBOT_GITHUB_FILE_NAME}.zip -d /opt/unzip-tmp 47 | 48 | # create folder for the current version. 49 | mkdir /opt/${GUNBOT_GITHUB_FILE_NAME} -p 50 | 51 | # Copy only the executables. 52 | cp /opt/unzip-tmp/gunthy-* /opt/${GUNBOT_GITHUB_FILE_NAME} 53 | 54 | # creates a symbolic link to the gunbot folder. 55 | rm /opt/gunbot > /dev/null 2>&1 56 | ln -s /opt/${GUNBOT_GITHUB_FILE_NAME} /opt/gunbot 57 | 58 | # Cleanup 59 | rm /opt/${GUNBOT_GITHUB_FILE_NAME}.zip 60 | rm -R /opt/unzip-tmp 61 | 62 | # Set rights 63 | chmod +x /opt/gunbot/gunthy-* 64 | 65 | 66 | 67 | logMessage "(5/6) Add GUNBOT aliases" 68 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 69 | echo "" >> ~/.bashrc 70 | echo "# GUNBOT ALIASES" >> ~/.bashrc 71 | echo "alias gcd='cd /opt/gunbot'" >> ~/.bashrc 72 | echo "alias ginit='gcd && yo gunbot init'" >> ~/.bashrc 73 | echo "alias gadd='gcd && yo gunbot add'" >> ~/.bashrc 74 | echo "alias gl='pm2 l'" >> ~/.bashrc 75 | echo "alias glog='pm2 logs'" >> ~/.bashrc 76 | echo "alias gstart='pm2 start'" >> ~/.bashrc 77 | echo "alias gstop='pm2 stop'" >> ~/.bashrc 78 | 79 | 80 | 81 | logMessage "(6/6) Init generator" 82 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 83 | # Create folder for yeoman. 84 | chmod g+rwx /root 85 | chmod g+rwx /opt/gunbot 86 | 87 | # Yeoman write rights. 88 | mkdir /root/.config/configstore -p 89 | cat > /root/.config/configstore/insight-yo.json << EOM 90 | { 91 | "clientId": 1337, 92 | "optOut": true 93 | } 94 | EOM 95 | chmod g+rwx /root/.config 96 | chmod g+rwx /root/.config/configstore 97 | chmod g+rw /root/.config/configstore/* 98 | 99 | # pm2 write rights. 100 | mkdir /root/.pm2 -p 101 | echo "1337" > /root/.pm2/touch 102 | chmod g+rwx /root/.pm2 103 | chmod g+rw /root/.pm2/* 104 | 105 | 106 | echo "" 107 | echo " ============================================================" 108 | echo " GUNBOT SETUP complete!" 109 | echo "" 110 | echo " Please run this command to init the GUNBOT:" 111 | echo " gcd" 112 | echo " ginit" 113 | echo "" 114 | echo " ============================================================" 115 | echo "" 116 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "generator-gunbot", 3 | "version": "0.1.27", 4 | "description": "Setup and manage GUNBOT 3.3 on Linux", 5 | "homepage": "https://github.com/BeerK0in/generator-gunbot", 6 | "author": { 7 | "name": "BeerK0in", 8 | "email": "tbeerkoin@zant.one", 9 | "url": "https://github.com/BeerK0in" 10 | }, 11 | "files": [ 12 | "generators" 13 | ], 14 | "main": "generators/index.js", 15 | "keywords": [ 16 | "GUNBOT", 17 | "linux", 18 | "setup", 19 | "bitcoin", 20 | "yeoman-generator" 21 | ], 22 | "devDependencies": { 23 | "coveralls": "^2.12.0", 24 | "eslint": "^3.18.0", 25 | "eslint-config-xo-space": "^0.16.0", 26 | "jest": "^19.0.2", 27 | "jest-cli": "^19.0.1", 28 | "mock-spawn": "^0.2.6", 29 | "nsp": "^2.6.3", 30 | "yeoman-assert": "^3.0.0", 31 | "yeoman-test": "^1.6.0" 32 | }, 33 | "dependencies": { 34 | "yeoman-generator": "^1.0.0", 35 | "chalk": "^1.1.3" 36 | }, 37 | "jest": { 38 | "testEnvironment": "node", 39 | "collectCoverage": true, 40 | "coverageDirectory": "coverage", 41 | "timers": "real" 42 | }, 43 | "scripts": { 44 | "prepublish": "nsp check", 45 | "pretest": "eslint . --fix", 46 | "test": "jest" 47 | }, 48 | "eslintConfig": { 49 | "extends": "xo-space", 50 | "env": { 51 | "jest": true, 52 | "node": true 53 | } 54 | }, 55 | "repository": { 56 | "type": "git", 57 | "url": "git@github.com:BeerK0in/generator-gunbot.git" 58 | }, 59 | "bugs": { 60 | "url": "https://github.com/BeerK0in/generator-gunbot/issues" 61 | }, 62 | "license": "MIT" 63 | } 64 | -------------------------------------------------------------------------------- /update.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Set variables 4 | # ----------------------------------- 5 | GUNBOT_GITHUB_FOLDER_NAME="Gunbot3.3.2" 6 | GUNBOT_GITHUB_FILE_NAME="GUNBOT_v3.3.2_Poloniex_Bittrex_Patch" 7 | TIMESTAMP="$(date +"%s")" 8 | LATEST_PATCH="v3.3.2 Poloniex Bittrex" 9 | 10 | # Set functions 11 | # ----------------------------------- 12 | logMessage () { 13 | echo " $1" 14 | echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" 15 | } 16 | 17 | 18 | echo "" 19 | echo " ============================================================" 20 | echo " GUNBOT 3.3.2 UPDATE started" 21 | echo "" 22 | echo " Patch ${LATEST_PATCH}" 23 | echo "" 24 | echo " ============================================================" 25 | echo "" 26 | 27 | logMessage "(1/4) Stop all bots" 28 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 29 | pm2 stop all > /dev/null 2>&1 30 | 31 | 32 | logMessage "(2/4) Backup current version" 33 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 34 | cp /opt/gunbot/ /opt/gunbot-backup-${TIMESTAMP}/ -r > /dev/null 2>&1 35 | 36 | 37 | logMessage "(3/4) Update tools" 38 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 39 | npm install -g generator-gunbot > /dev/null 2>&1 40 | 41 | 42 | logMessage "(4/4) Update GUNBOT" 43 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 44 | # Install latest release as patch 45 | wget -q https://github.com/GuntharDeNiro/BTCT/releases/download/${GUNBOT_GITHUB_FOLDER_NAME}/${GUNBOT_GITHUB_FILE_NAME}.zip -P /opt/ 46 | unzip -o -qq /opt/${GUNBOT_GITHUB_FILE_NAME}.zip -d /opt/unzip-tmp 47 | 48 | # Remove all executables. 49 | rm -f /opt/gunbot/gunthy-* 50 | 51 | # Copy only the executables. 52 | cp /opt/unzip-tmp/gunthy-* /opt/gunbot 53 | 54 | # Cleanup 55 | rm /opt/${GUNBOT_GITHUB_FILE_NAME}.zip 56 | rm -Rf /opt/unzip-tmp 57 | 58 | # Set rights 59 | chmod +x /opt/gunbot/gunthy-* 60 | 61 | 62 | echo "" 63 | echo " ============================================================" 64 | echo " GUNBOT UPDATE complete!" 65 | echo "" 66 | echo " Please run this command to restart the GUNBOT:" 67 | echo " gcd" 68 | echo " ginit" 69 | echo "" 70 | echo " (allow overwrite of ALLPAIRS)" 71 | echo "" 72 | echo " ============================================================" 73 | echo "" 74 | --------------------------------------------------------------------------------