-
Notifications
You must be signed in to change notification settings - Fork 28
/
bot18.config-sample.js.hbs
373 lines (253 loc) · 11.4 KB
/
bot18.config-sample.js.hbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
/*
Bot18 Configuration (copied from {{{copied_from}}})
https://bot18.net/
-------
WARNING REGARDING EXCHANGE API KEYS
Bot18 will communicate directly with crypto exchanges
using API keys that you add here. Bot18 will not be
able to perform trades on your behalf unless you give
the "trade" permission (or equivalent) to your API key.
For full functionality, give the "view" permission to
the key, to access account balance and historical orders
and fills.
DO NOT give the "transfer" or "withdraw" permission to
your API keys for use with Bot18, unless you really,
really, really know what you're doing. You DON'T WANT
un-authorized people transferring funds out of your
exchange account if your config.js gets intercepted!!!
-------
The file bot18.config-sample.js represents the defaults.
These are copied to ~/.bot18/config.js when you invoke
Bot18 for the first time.
Extend/override these variables by (in order of importance):
1. "custom": An arbitrary-location copy of this file, with
`npx bot18 --conf /path/to/my/bot18.config.js`
2. "local": Copying this file to `bot18.config.js` in the same
folder that your run the `npx bot18` command from
3. "home": Editing your account-wide config at `~/.bot18/config.js`
Bot18 will attempt to load configuration from all 3 locations,
and merge the results in order of importance.
Additionally, you can save your current setup to
a new configuration file, by adding the `--save` argument:
npx bot18 --save my-custom.config.js
This will copy bot18.config-sample.js to my-custom.config.js, replace
the defaults with your merged settings from all 3 possible config locations,
and chmod it 0600 all in one command. Pretty handy!
*/
// Export a hash-map of configuration variables.
var c = module.exports = {}
/*
Section 1: Paths And Startup Options.
Engine version to use. This takes effect only if you leave out the
`--channel <channel>` argument. Defaults to "stable".
Valid options:
- `stable` -- The latest stable release. This is only available
to ZalgoNet users who purchase a Bot18 Unlock Code.
See: https://bot18.net/beta
- `unstable` -- The latest dev build. You will need a `TEST` License
in your ZalgoNet account to select this option.
- `trial` -- A free 15-minute trial of Bot18, paper-trading mode only.
Available to everyone, also by entering "guest" at the ZalgoNet
login prompt.
*/
c.channel = {{{channel}}}
// Directory for storing persistent settings, etc.
// Files written here will be chmod'ed 0600, subdirectories 0700.
// "~/" will be expanded to your home directory's absolute path,
// or a tmp directory, as a fallback.
c.home = {{{home}}}
// Display ZalgoNet MOTD at startup. (Usually a news bulletin from @carlos8f)
c.motd = {{{motd}}}
/*
Section 2.1: Exchange-Pair selection.
Under the hood, Bot18 uses the CCXT project for exchange abstraction.
For a list of Exchange IDs and Symbols supported by CCXT, see this page:
https://github.com/ccxt/ccxt/wiki/Manual
Configuration in this file will follow the naming conventions set forth
by the CCXT project for the following:
- Exchange ID (a short lowercased, one-word identifier)
- Symbol (an asset-currency pair identifer, such as `BTC/USD`)
- API Configuration (variables such as `apiKey`, `secret`, `uid`,
and `password`)
In this config file, you will select exchange/asset/currency "pairs" to
run tasks on. These are selected using a hash-map defined in c.pairs:
c.pairs = {
<exchange-pair-selector>: <comma-separated-task-list>
}
An "exchange-pair-selector" is a string in the form:
"<ccxt_exchange_id>.<lowercased_ccxt_dashed_symbol>"
A "lowercase_ccxt_dashed_symbol" is a string in the form:
"{asset_id}-{currency_id}" (the CCXT Symbol with "/" replaced with "-")
A "comma-separated-task-list" is a string in the form:
"{bot18_task_id}[?optional&urlencoded=true&querystring=toinclude]"
Valid tasks include:
(daemon tasks)
watch: Monitor public trade streams, candles, and stats.
ob: Keep a realtime orderbook mirror.
record: Record trades and orderbook snapshots to mongodb.
paper: Keep a simulated account balance. Do not perform real trades.
trade: Keep track of your real account balance/portfolio,
personal orders/fills,
and enable REAL (manual or auto) trading.
auto: Perform trades recommended by the strategy, without human input.
Turn on with "A" (capitalized) during `trade` task.
Turn off with "m" (any case) during `auto` task.
Note that "out of the box", Bot18 only enables the `watch` and `ob` tasks,
for only Bitfinex and Coinbase Pro (GDAX) exchanges. It's UP TO YOU to add
`trade` and `auto` tasks to your chosen exchange-pair selection to tell
the bot to perform automatic real trades recommended by your
selected strategy(s).
(utility tasks)
list: List available selectors/strategies and exit.
balance: Output balances and exit.
sim: Run simulations and exit.
train: Train machine-learning models and exit.
export: Export data and exit.
Both keys and values here can use glob patterns. See:
https://npmjs.org/package/minimatch
Examples
For example, to watch all USD pairs on Kraken and GDAX, and record data
streams from all GDAX pairs to MongoDB, use something like:
c.pairs = {
"{kraken,gdax}.*-usd": "watch",
"gdax.*": "+record"
}
These pair selections can be overriden by CLI args (called "pair-specs",
keys separated from values with a ":"). The above can be specified with
the same effect by starting with:
npx bot18 '{kraken,gdax}.*-usd:watch' 'gdax.*:+record'
For each exchange/asset/currency combo selected, a worker
subprocess will be spawned to perform actions in the task-list
relating to the target exchange.
Valid selector examples:
bitfinex2.btc-* (all Bitcoin-base pairs on Bitfinex)
*.*-jpy (Japanese Yen-quoted pairs on all exchanges)
*.* (or just "*", selects all supported pairs and exchanges)
Tips:
- Task IDs can also have URL-encoded variables attached to them,
e.g.'*:trade?auto_short=true&buy_volume=1.5'
- Task IDs can also be strategy IDs (info on those below), to enable that
strategy on the selected pair(s), e.g. '*:+macd?crossover=0.235'
- Putting "+" before a task_id adds it to the task-list, "-" removes it.
- Wildcards "*" are valid in both keys and values.
Examples:
Auto-trade LTC/USD and ETH/USD on Kraken using the macd strategy:
npx bot18 kraken.{ltc,eth}/usd:+trade,auto,macd?crossover=0.235
*/
c.pairs = {{{pairs}}}
/**
Section 2.2: Exchange API Keys and Pair-specific Config.
You can pass configuration variables targeted at specific
exchange-pair selectors. Incidentally, this is how you configure your
exchange API keys.
You can even configure multiple API keys for a given exchange,
if you specify a specific asset/currency in
the exchange-pair-selector.
For example:
c.pair_config = {
'bitfinex2.*-eur': {
'bitfinex2.apiKey': 'my-EUR-api-key',
'bitfinex2.secret': 'my-EUR-api-secret'
}
}
..which will use a specific API key for EUR pairs on Bitfinex.
Define your exchange-pair configurations below, including
all exchange API keys Bot18 needs below (replace "YOUR-API-KEY"
with your actual API key, etc.)
*/
c.pair_config = {{{pair_config}}}
/*
Section 3: Strategy Selection And Configuration.
A "strat" or Strategy in Bot18 slang, is a combination of
JavaScript code and JSON files, bundled into a directory
(and sometimes packaged as a git repository, npm package,
or tarball). This code tells the Bot18 engine, through the
Engine API, when to trade, and the specifics of those trades.
- Each strat has a machine-readable ID (`strat_id`),
consisting of lowercased alpha-numeric characters
and underscores.
- Each strat can define its own configuration variables,
which can be configured below in `c.strat_config`.
Bot18 runs can run multiple strategies at once, mapped
arbitrarily to your exchange-pair selections.
Strategies are selected using a hash-map defined in c.strats:
"<exchange-pair-selector>" -> "<comma-separated-strat-id-list>"
For example, to run the Parabolic SAR and MACD strategies on
the Bitfinex BCH/USDT pair, use something like:
c.strats = {
"bitfinex2.bch-usd": "sar,macd?crossover=0.18181818"
}
NOTE:
Bot18 will NOT perform trades automatically, unless you specify
the task `auto` in the exchange-pair selector's task-list,
or enter "A" (capitalized) in your console during the `trade` task.
*/
c.strats = {{{strats}}}
/**
You can also pass configurations to each strategy.
For example:
c.strat_config = {
'macd': {
'crossover': 1.352,
'rsi_overbought': 85
}
}
..which will customize the `macd` strategy's configuration.
*/
//Define your strat-specific config below:
c.strat_config = {{{strat_config}}}
/*
Section 4: MongoDB Configuration.
Bot18 can optionally stream data to MongoDB if you
set c.mongo.enabled=true, and specify your mongod connection details.
For information on MongoDB, visit https://www.mongodb.com/
*/
c.mongo = {}
c.mongo.enabled = {{{mongo.enabled}}}
c.mongo.db = {{{mongo.db}}}
c.mongo.host = process.env.MONGODB_PORT_27017_TCP_ADDR || {{{mongo.host}}}
c.mongo.port = {{{mongo.port}}}
c.mongo.username = {{{mongo.username}}}
c.mongo.password = {{{mongo.password}}}
// Or to use a specific connection string,
// customize and uncomment the following line:
//c.mongo.server_uri = "mongodb://user@password:host/db?params"
c.mongo.replica_set = {{{mongo.replica_set}}}
c.mongo.auth_mechanism = {{{mongo.auth_mechanism}}}
/*
Section 5: Internationalization and Localization
Bot18 can display in the language and locality of your
choosing, if there is a translation available.
c.locality is an ISO 639-1 2-letter lowercased language code,
and optionally, a dash and a 2-letter uppercased country code.
Currently, there are no translations other than English.
*/
c.locality = {{{locality}}}
/*
Section 6: Notifiers.
Bot18 can trigger notifications via 3rd party services,
if you enter your API keys here.
*/
// Pushover.net
c.pushover = {{{pushover}}}
/*
Section 7: Internal Configuration.
These variables don't usually need changing,
but they are here in case you want to have a custom setup.
*/
// Increment this number to display a whole new palette of colors.
c.color_scheme = {{{color_scheme}}}
// Internal port mapping.
c.port_mapping = {{{port_mapping}}}
// Timeout durations.
c.launch_timeout = {{{launch_timeout}}}
c.graceful_exit_timeout = {{{graceful_exit_timeout}}}
/*
Verify engine downloads from code.bot18.net against this "master"
Salty pubkey.
This should ALWAYS match the "Salty ID" displayed at the bottom
of https://bot18.net -- See: https://github.com/carlos8f/salty
*/
c.master_pubkey = {{{master_pubkey}}}
// Overrides or additional variables can be defined on `c` below this point.
// -------------------------------------------------------------------------