README.md 3.43 KB
Newer Older
Melroy van den Berg's avatar
Melroy van den Berg committed
1
# Crypto Alert Bot
Melroy van den Berg's avatar
Melroy van den Berg committed
2

3
`crypto-bot` is an open-source bot that track some popular crypto tokens/coins (BTC, ETH, ADA, LINK, SOL, DOT, MATIC, ALGO, AVAX and VET). The bot gives you a notification when the trend is changing (up/down trend).
Melroy van den Berg's avatar
Melroy van den Berg committed
4

5
This bot will is already *running live* in the [following Telegram channel](https://t.me/crypto_exchange_updates), whenever there is an up- or downtrend you automatically get notified of each of the previously mentioned crypto coins. Technical analysis is applied to determine the up- or downtrends (based on MACD crosses of PPO indicator).
Melroy van den Berg's avatar
Melroy van den Berg committed
6

Melroy van den Berg's avatar
Melroy van den Berg committed
7
## Usage
Melroy van den Berg's avatar
Melroy van den Berg committed
8

Melroy van den Berg's avatar
Melroy van den Berg committed
9
You can join the public [Crypto Exchange Alert Telegram channel](https://t.me/crypto_exchange_updates), where this bot is present. And keeps you up-to-date!
Melroy van den Berg's avatar
Melroy van den Berg committed
10

Melroy van den Berg's avatar
Melroy van den Berg committed
11
*Or* since this project is open-source, you can setup your own `crypto-bot` as well as your own [Telegram Bot](https://core.telegram.org/bots). See below.
Melroy van den Berg's avatar
Melroy van den Berg committed
12

13
## Run it yourself
Melroy van den Berg's avatar
Melroy van den Berg committed
14

Melroy van den Berg's avatar
Melroy van den Berg committed
15
16
17
18
19
20
### Requirements

This bot is written in JavaScript and run on NodeJS.

* [NodeJS 14 or higher](https://nodejs.org/en/download/)

21
### Docker
Melroy van den Berg's avatar
Melroy van den Berg committed
22

Melroy van den Berg's avatar
Melroy van den Berg committed
23
Use the [DockerHub Docker image](https://hub.docker.com/repository/docker/danger89/crypto-bot) (see also: [Dockerfile](Dockerfile)).
Melroy van den Berg's avatar
Melroy van den Berg committed
24

Melroy van den Berg's avatar
Melroy van den Berg committed
25
1. Copy/rename the [config template file](configTemplate.yml) to `config.yml`, can be stored anywhere on your machine:
Melroy van den Berg's avatar
Melroy van den Berg committed
26

Melroy van den Berg's avatar
Melroy van den Berg committed
27
28
29
    ```sh
    cp configTemplate.yml config.yml
    ```
Melroy van den Berg's avatar
Melroy van den Berg committed
30

Melroy van den Berg's avatar
Melroy van den Berg committed
31
2. Now change the `config.yml` to your needs (see "Most important Settings" section below).
Melroy van den Berg's avatar
Melroy van den Berg committed
32
3. Start Docker container by providing the `config.yml` from outside the Docker container (by default using current working directory, `pwd`, on your host machine):
Melroy van den Berg's avatar
Melroy van den Berg committed
33

Melroy van den Berg's avatar
Melroy van den Berg committed
34
    ```sh
Melroy van den Berg's avatar
Melroy van den Berg committed
35
    docker run --restart always -p 127.0.0.1:3010:3010 -v $(pwd)/config.yml:/app/config.yml -d danger89/crypto-bot
Melroy van den Berg's avatar
Melroy van den Berg committed
36
    ```
Melroy van den Berg's avatar
Melroy van den Berg committed
37

Melroy van den Berg's avatar
Melroy van den Berg committed
38
*Note:* The command above should pull the image automatically from Docker Hub.
39

Melroy van den Berg's avatar
Melroy van den Berg committed
40
41
You can also use `docker-compose`, see [docker-compose.yml](docker-compose.yml).

42
### Plain terminal
Melroy van den Berg's avatar
Melroy van den Berg committed
43
44

Follow the steps:
Melroy van den Berg's avatar
Melroy van den Berg committed
45
46

1. Copy the config template to `config.yml`: `cp configTemplate.yml config.yml`
47
2. Change the configuration settings, webhook domain for Telegram bot and API keys for the stock data
48
3. Install depedencies via: `npm install` (once needed)
Melroy van den Berg's avatar
Melroy van den Berg committed
49
4. Start the bot using: `npm start`
Melroy van den Berg's avatar
Melroy van den Berg committed
50

51
52
During development you could use: `npm run start-fake`. Which will start the app, but **not** connect to the TwelveData API.

53
**Advice:** Run the bot 24/7 on some dedicated hardware. `cron_time` within the configuration will take care of the triggers when to look-up for data.
Melroy van den Berg's avatar
Melroy van den Berg committed
54
55
56

**Hidden feature:** Set `DEBUG` to `true` value in the [dataProcessor.js](src/dataProcessor.js) source file to dump the market data to a comma-seperated values (CSV) file. Useful for off-line verification/calculations.

Melroy van den Berg's avatar
Melroy van den Berg committed
57
### Most important Settings
58

Melroy van den Berg's avatar
Melroy van den Berg committed
59
The following settings require definitely some attention during setup:
60

61
* `exchange_settings -> use_cache` - Set to `False` to not use any local caching, needed for production!
Melroy van den Berg's avatar
Melroy van den Berg committed
62
* `exchange_settings -> api_token` - API token of twelvedata - [Create a free API token on their website](https://twelvedata.com/apikey)
Melroy van den Berg's avatar
Melroy van den Berg committed
63
* `telegram_settings -> bot_token` - Token from Telegram, created via [@BotFather](https://telegram.me/BotFather)
64
65
66
* `telegram_settings -> public_url` - Telegram public URL for Webhook
* `telegram_settings -> chat_id` - Telegram channel name including '@' or any other chat ID.

67
68
There are also 2 environment variables available to set:

69
* `HOST` (default: `0.0.0.0`)
Melroy van den Berg's avatar
Melroy van den Berg committed
70
* `PORT` (default: `3010`)
71
72

## License
Melroy van den Berg's avatar
Melroy van den Berg committed
73
74

[MIT License](LICENSE)