|
1 |
| -# coin-signals-trader |
2 |
| -A automatic trading bot for cryptocurrencies |
| 1 | +# :money_with_wings: Coin Signals Trader |
| 2 | +The Coin Signals trader is meant to allow anyone to quickly and easily set up an automated trading bot. This bot relies on __Signals__ which are supplied via Slack in the __Universal Signal Format__. This project doesn't generate it's own signals, it only acts on ones that it receives. |
| 3 | + |
| 4 | +## Donate |
| 5 | +This is a free project, so if you're like to thank me for my work, I'd really appreciate that. |
| 6 | + |
| 7 | +BTC - __1E6Vyh84pTEP9v6Sh8Yzm693pBZLvguX3m__ |
| 8 | +ETH - __0xb2921b476838c8DB9a29d708B3cA8c11959D7c7D__ |
| 9 | +LTC - __LfkD8jcgv4E2rDta4hA2CUHNMiPGdZL1yr__ |
| 10 | + |
| 11 | +## Prerequisites |
| 12 | +* [Node.js](https://nodejs.org/en/) (Version 6 and up recommended) |
| 13 | +* [Bittrex API Key](https://bittrex.com/Manage#sectionApi) |
| 14 | +* [Slack](https://slack.com) |
| 15 | + |
| 16 | +### Installation |
| 17 | + |
| 18 | +* Clone down the repository. |
| 19 | +``` |
| 20 | +git clone https://github.com/snollygolly/coin-signals-trader.git |
| 21 | +``` |
| 22 | + |
| 23 | +* Install packages (from inside the coin-signals-trader folder). |
| 24 | +``` |
| 25 | +npm install |
| 26 | +``` |
| 27 | + |
| 28 | +* Create your config. There's a `config.json.example` file in the root. Edit it to include all your values. Refer to the configuration breakdown for more information about what does what. Save it as `config.json` and leave it in the root. |
| 29 | + |
| 30 | +* Run the bot! |
| 31 | +``` |
| 32 | +npm start |
| 33 | +``` |
| 34 | + |
| 35 | +* Private message the bot in slack to get started |
| 36 | + |
| 37 | +## Universal Signal Format |
| 38 | +Signals are sent via Slack and are expected to be in the correct format: |
| 39 | + |
| 40 | +ACTION*PAIR*QUANTITY*PRICE*META |
| 41 | + |
| 42 | +- Action _(Required)_ |
| 43 | +This is the action you want the trader to take |
| 44 | + - BUY |
| 45 | + - SELL |
| 46 | + |
| 47 | +- Pair _(Required)_ |
| 48 | +This is pair you want to trade _(like BTC-LTC)_ |
| 49 | + |
| 50 | +- Quantity |
| 51 | +This is how many coins you want to affect in this signal. If you'd like the trader bot to use it's defaults, you can pass "A" |
| 52 | + |
| 53 | +- Price |
| 54 | +This is the per coin price you want to use for this signal. If you'd like the trader bot to use it's default, you can pass "A" |
| 55 | + |
| 56 | +- Meta |
| 57 | +If you'd like to attach addition information to your signal, you may do it here. The symbol * may not be used in meta information though. |
| 58 | + |
| 59 | +### Example |
| 60 | + |
| 61 | +``` |
| 62 | +BUY*BTC-LTC*1*0.01*0001 |
| 63 | +``` |
| 64 | + |
| 65 | +This signal would buy 1 Litecoin (BTC-LTC) for 0.01 BTC. It would also includes some meta information (0001). |
| 66 | + |
| 67 | +``` |
| 68 | +SELL*BTC-LTC*A*A*0002 |
| 69 | +``` |
| 70 | + |
| 71 | +This signal would sell the default amount of Litecoins at the default price. It also includes meta information (0002) |
| 72 | + |
| 73 | +### Folder Structure (some files omitted) |
| 74 | + |
| 75 | +``` |
| 76 | +|-- coin-signals |
| 77 | + |-- config |
| 78 | + (contains all the settings for customizing the bot's behavior) |
| 79 | + |-- services |
| 80 | + |-- config.json |
| 81 | + (contains all configuration values, more on that later, it must be created) |
| 82 | + |-- seed.js |
| 83 | + (creates all the needed files [will overwrite your portfolio]) |
| 84 | + |-- index.js |
| 85 | + (this is what you run to actually start auto-trading) |
| 86 | +``` |
| 87 | + |
| 88 | +### Configuration breakdown |
| 89 | + |
| 90 | +The configuration file for the `bot` project is fairly simple and consists mainly of settings for Slack and Bittrex: |
| 91 | + |
| 92 | +``` |
| 93 | +{ |
| 94 | + "name": "Coin Signals Trader", |
| 95 | + "bittrex": { |
| 96 | + "api_key": "XXX", |
| 97 | + "api_secret": "XXX" |
| 98 | + }, |
| 99 | + "slack": { |
| 100 | + "url": "XXX", |
| 101 | + [the webhook url] |
| 102 | + "name": "Coin Trader", |
| 103 | + [the name of the bot] |
| 104 | + "secret": "XXX", |
| 105 | + [from your slack app] |
| 106 | + "channel": "signals", |
| 107 | + [what channel in slack to join] |
| 108 | + "bot": "XXX", |
| 109 | + [the id of the bot who's signals you are consuming] |
| 110 | + "admin": "XXX" |
| 111 | + [the id of the user who can execute commands] |
| 112 | + }, |
| 113 | + "trading": { |
| 114 | + "api_key": "XXX", |
| 115 | + [your bittrex key for trading] |
| 116 | + "api_secret": "XXX" |
| 117 | + [your bittrex secret for trading] |
| 118 | + } |
| 119 | +} |
| 120 | +``` |
| 121 | + |
| 122 | +### Trading configuration |
| 123 | + |
| 124 | +This configuration lives in `config/trading.js` |
| 125 | + |
| 126 | +``` |
| 127 | +live: false, |
| 128 | +[real money or not] |
| 129 | +balance: 0.125, |
| 130 | +fee: 0.0025, |
| 131 | +[how much is the fee each way] |
| 132 | +limits: { |
| 133 | + fresh: { |
| 134 | + loss: 0.08, |
| 135 | + [what amount of loss you will accept at this stage] |
| 136 | + profit: 0.05, |
| 137 | + [what amount of profit you will target at this stage] |
| 138 | + time: 1800000 |
| 139 | + [how much time (in ms) needs to elapse before this position isn considered fresh] |
| 140 | + }, |
| 141 | + stale: { |
| 142 | + loss: 0.06, |
| 143 | + [what amount of loss you will accept at this stage] |
| 144 | + profit: 0.03, |
| 145 | + [what amount of profit you will target at this stage] |
| 146 | + time: 3600000 |
| 147 | + [how much time (in ms) needs to elapse before this position is considered stale] |
| 148 | + }, |
| 149 | + old: { |
| 150 | + loss: 0.05, |
| 151 | + [what amount of loss you will accept at this stage] |
| 152 | + profit: 0.02, |
| 153 | + [what amount of profit you will target at this stage] |
| 154 | + time: 7200000 |
| 155 | + [how much time (in ms) needs to elapse before this position is considered old] |
| 156 | + } |
| 157 | +}, |
| 158 | +order_parsing: false, |
| 159 | +[do we want orderbook parsing enabled or not] |
| 160 | +orders: { |
| 161 | + spread_ask: 0.01, |
| 162 | + [what percentage should the "ask" spread be below for a sell signal to be generated] |
| 163 | + spread_ask_insta: 0.001, |
| 164 | + [what percentage should the "ask" spread be below to instantly sell] |
| 165 | + spread_avg: 0.015, |
| 166 | + [what percentage should the "avg" spread be above for a sell signal to be generated] |
| 167 | + spread_avg_insta: 0.03 |
| 168 | + [what percentage should the "avg" spread be above to instantly sell] |
| 169 | +}, |
| 170 | +profit_increase: 0.001, |
| 171 | +[when we attempt to lock in profit, how much should our target be above the current price (in percentage)] |
| 172 | +profit_slip: 0.001, |
| 173 | +[when we attempt to lock in profit, how much should our target be below the current price (in percentage)] |
| 174 | +profit_increase_override: 0.01, |
| 175 | +[when the profit increases this percent or may over a single tick, sell regardless] |
| 176 | +initial_sell_delay: 300000, |
| 177 | +[prevents sells if they happen before this many ms has passed] |
| 178 | +spread_to_sell: 0.00000001, |
| 179 | +[what spread amount (in BTC) to auto sell at] |
| 180 | +min_balance: 0.00001, |
| 181 | +[minimum balance] |
| 182 | +max_position_price: 0.0115, |
| 183 | +[maximum price per position] |
| 184 | +max_points: 95, |
| 185 | +[this many points gets the max position price, lower signals get less of the max position price] |
| 186 | +max_positions: 10, |
| 187 | +[maximum positions at a time] |
| 188 | +max_volitility: -0.02, |
| 189 | +[how much volitility to accept from USD/BTC before trading halts] |
| 190 | +volitility_timeout: 45 * 60 * 1000, |
| 191 | +[how long to halt trading for] |
| 192 | +toxic_asset_backoff: 180000 |
| 193 | +[how long (in ms) to blacklist losing assets for (per point lost)] |
| 194 | +``` |
0 commit comments