| 1 | # Telegram usage |
| 2 | |
| 3 | ## Setup your Telegram bot |
| 4 | |
| 5 | Below we explain how to create your Telegram Bot, and how to get your |
| 6 | Telegram user id. |
| 7 | |
| 8 | ### 1. Create your Telegram bot |
| 9 | |
| 10 | Start a chat with the [Telegram BotFather](https://telegram.me/BotFather) |
| 11 | |
| 12 | Send the message `/newbot`. |
| 13 | |
| 14 | *BotFather response:* |
| 15 | |
| 16 | > Alright, a new bot. How are we going to call it? Please choose a name for your bot. |
| 17 | |
| 18 | Choose the public name of your bot (e.x. `Freqtrade bot`) |
| 19 | |
| 20 | *BotFather response:* |
| 21 | |
| 22 | > Good. Now let's choose a username for your bot. It must end in `bot`. Like this, for example: TetrisBot or tetris_bot. |
| 23 | |
| 24 | Choose the name id of your bot and send it to the BotFather (e.g. "`My_own_freqtrade_bot`") |
| 25 | |
| 26 | *BotFather response:* |
| 27 | |
| 28 | > Done! Congratulations on your new bot. You will find it at `t.me/yourbots_name_bot`. You can now add a description, about section and profile picture for your bot, see /help for a list of commands. By the way, when you've finished creating your cool bot, ping our Bot Support if you want a better username for it. Just make sure the bot is fully operational before you do this. |
| 29 | |
| 30 | > Use this token to access the HTTP API: `22222222:APITOKEN` |
| 31 | |
| 32 | > For a description of the Bot API, see this page: https://core.telegram.org/bots/api Father bot will return you the token (API key) |
| 33 | |
| 34 | Copy the API Token (`22222222:APITOKEN` in the above example) and keep use it for the config parameter `token`. |
| 35 | |
| 36 | Don't forget to start the conversation with your bot, by clicking `/START` button |
| 37 | |
| 38 | ### 2. Telegram user_id |
| 39 | |
| 40 | #### Get your user id |
| 41 | |
| 42 | Talk to the [userinfobot](https://telegram.me/userinfobot) |
| 43 | |
| 44 | Get your "Id", you will use it for the config parameter `chat_id`. |
| 45 | |
| 46 | #### Use Group id |
| 47 | |
| 48 | You can use bots in telegram groups by just adding them to the group. You can find the group id by first adding a [RawDataBot](https://telegram.me/rawdatabot) to your group. The Group id is shown as id in the `"chat"` section, which the RawDataBot will send to you: |
| 49 | |
| 50 | ``` json |
| 51 | "chat":{ |
| 52 | "id":-1001332619709 |
| 53 | } |
| 54 | ``` |
| 55 | |
| 56 | For the Freqtrade configuration, you can then use the the full value (including `-` if it's there) as string: |
| 57 | |
| 58 | ```json |
| 59 | "chat_id": "-1001332619709" |
| 60 | ``` |
| 61 | |
| 62 | ## Control telegram noise |
| 63 | |
| 64 | Freqtrade provides means to control the verbosity of your telegram bot. |
| 65 | Each setting has the following possible values: |
| 66 | |
| 67 | * `on` - Messages will be sent, and user will be notified. |
| 68 | * `silent` - Message will be sent, Notification will be without sound / vibration. |
| 69 | * `off` - Skip sending a message-type all together. |
| 70 | |
| 71 | Example configuration showing the different settings: |
| 72 | |
| 73 | ``` json |
| 74 | "telegram": { |
| 75 | "enabled": true, |
| 76 | "token": "your_telegram_token", |
| 77 | "chat_id": "your_telegram_chat_id", |
| 78 | "notification_settings": { |
| 79 | "status": "silent", |
| 80 | "warning": "on", |
| 81 | "startup": "off", |
| 82 | "buy": "silent", |
| 83 | "sell": "on", |
| 84 | "buy_cancel": "silent", |
| 85 | "sell_cancel": "on", |
| 86 | "buy_fill": "off", |
| 87 | "sell_fill": "off" |
| 88 | }, |
| 89 | "balance_dust_level": 0.01 |
| 90 | }, |
| 91 | ``` |
| 92 | |
| 93 | `buy` notifications are sent when the order is placed, while `buy_fill` notifications are sent when the order is filled on the exchange. |
| 94 | `sell` notifications are sent when the order is placed, while `sell_fill` notifications are sent when the order is filled on the exchange. |
| 95 | `*_fill` notifications are off by default and must be explicitly enabled. |
| 96 | |
| 97 | |
| 98 | `balance_dust_level` will define what the `/balance` command takes as "dust" - Currencies with a balance below this will be shown. |
| 99 | |
| 100 | ## Create a custom keyboard (command shortcut buttons) |
| 101 | |
| 102 | Telegram allows us to create a custom keyboard with buttons for commands. |
| 103 | The default custom keyboard looks like this. |
| 104 | |
| 105 | ```python |
| 106 | [ |
| 107 | ["/daily", "/profit", "/balance"], # row 1, 3 commands |
| 108 | ["/status", "/status table", "/performance"], # row 2, 3 commands |
| 109 | ["/count", "/start", "/stop", "/help"] # row 3, 4 commands |
| 110 | ] |
| 111 | ``` |
| 112 | |
| 113 | ### Usage |
| 114 | |
| 115 | You can create your own keyboard in `config.json`: |
| 116 | |
| 117 | ``` json |
| 118 | "telegram": { |
| 119 | "enabled": true, |
| 120 | "token": "your_telegram_token", |
| 121 | "chat_id": "your_telegram_chat_id", |
| 122 | "keyboard": [ |
| 123 | ["/daily", "/stats", "/balance", "/profit"], |
| 124 | ["/status table", "/performance"], |
| 125 | ["/reload_config", "/count", "/logs"] |
| 126 | ] |
| 127 | }, |
| 128 | ``` |
| 129 | |
| 130 | !!! Note "Supported Commands" |
| 131 | Only the following commands are allowed. Command arguments are not supported! |
| 132 | |
| 133 | `/start`, `/stop`, `/status`, `/status table`, `/trades`, `/profit`, `/performance`, `/daily`, `/stats`, `/count`, `/locks`, `/balance`, `/stopbuy`, `/reload_config`, `/show_config`, `/logs`, `/whitelist`, `/blacklist`, `/edge`, `/help`, `/version` |
| 134 | |
| 135 | ## Telegram commands |
| 136 | |
| 137 | Per default, the Telegram bot shows predefined commands. Some commands |
| 138 | are only available by sending them to the bot. The table below list the |
| 139 | official commands. You can ask at any moment for help with `/help`. |
| 140 | |
| 141 | | Command | Description | |
| 142 | |----------|-------------| |
| 143 | | `/start` | Starts the trader |
| 144 | | `/stop` | Stops the trader |
| 145 | | `/stopbuy` | Stops the trader from opening new trades. Gracefully closes open trades according to their rules. |
| 146 | | `/reload_config` | Reloads the configuration file |
| 147 | | `/show_config` | Shows part of the current configuration with relevant settings to operation |
| 148 | | `/logs [limit]` | Show last log messages. |
| 149 | | `/status` | Lists all open trades |
| 150 | | `/status <trade_id>` | Lists one or more specific trade. Separate multiple <trade_id> with a blank space. |
| 151 | | `/status table` | List all open trades in a table format. Pending buy orders are marked with an asterisk (*) Pending sell orders are marked with a double asterisk (**) |
| 152 | | `/trades [limit]` | List all recently closed trades in a table format. |
| 153 | | `/delete <trade_id>` | Delete a specific trade from the Database. Tries to close open orders. Requires manual handling of this trade on the exchange. |
| 154 | | `/count` | Displays number of trades used and available |
| 155 | | `/locks` | Show currently locked pairs. |
| 156 | | `/unlock <pair or lock_id>` | Remove the lock for this pair (or for this lock id). |
| 157 | | `/profit` | Display a summary of your profit/loss from close trades and some stats about your performance |
| 158 | | `/forcesell <trade_id>` | Instantly sells the given trade (Ignoring `minimum_roi`). |
| 159 | | `/forcesell all` | Instantly sells all open trades (Ignoring `minimum_roi`). |
| 160 | | `/forcebuy <pair> [rate]` | Instantly buys the given pair. Rate is optional. (`forcebuy_enable` must be set to True) |
| 161 | | `/performance` | Show performance of each finished trade grouped by pair |
| 162 | | `/balance` | Show account balance per currency |
| 163 | | `/daily <n>` | Shows profit or loss per day, over the last n days (n defaults to 7) |
| 164 | | `/stats` | Shows Wins / losses by Sell reason as well as Avg. holding durations for buys and sells |
| 165 | | `/whitelist` | Show the current whitelist |
| 166 | | `/blacklist [pair]` | Show the current blacklist, or adds a pair to the blacklist. |
| 167 | | `/edge` | Show validated pairs by Edge if it is enabled. |
| 168 | | `/help` | Show help message |
| 169 | | `/version` | Show version |
| 170 | |
| 171 | ## Telegram commands in action |
| 172 | |
| 173 | Below, example of Telegram message you will receive for each command. |
| 174 | |
| 175 | ### /start |
| 176 | |
| 177 | > **Status:** `running` |
| 178 | |
| 179 | ### /stop |
| 180 | |
| 181 | > `Stopping trader ...` |
| 182 | > **Status:** `stopped` |
| 183 | |
| 184 | ### /stopbuy |
| 185 | |
| 186 | > **status:** `Setting max_open_trades to 0. Run /reload_config to reset.` |
| 187 | |
| 188 | Prevents the bot from opening new trades by temporarily setting "max_open_trades" to 0. Open trades will be handled via their regular rules (ROI / Sell-signal, stoploss, ...). |
| 189 | |
| 190 | After this, give the bot time to close off open trades (can be checked via `/status table`). |
| 191 | Once all positions are sold, run `/stop` to completely stop the bot. |
| 192 | |
| 193 | `/reload_config` resets "max_open_trades" to the value set in the configuration and resets this command. |
| 194 | |
| 195 | !!! Warning |
| 196 | The stop-buy signal is ONLY active while the bot is running, and is not persisted anyway, so restarting the bot will cause this to reset. |
| 197 | |
| 198 | ### /status |
| 199 | |
| 200 | For each open trade, the bot will send you the following message. |
| 201 | |
| 202 | > **Trade ID:** `123` `(since 1 days ago)` |
| 203 | > **Current Pair:** CVC/BTC |
| 204 | > **Open Since:** `1 days ago` |
| 205 | > **Amount:** `26.64180098` |
| 206 | > **Open Rate:** `0.00007489` |
| 207 | > **Current Rate:** `0.00007489` |
| 208 | > **Current Profit:** `12.95%` |
| 209 | > **Stoploss:** `0.00007389 (-0.02%)` |
| 210 | |
| 211 | ### /status table |
| 212 | |
| 213 | Return the status of all open trades in a table format. |
| 214 | |
| 215 | ``` |
| 216 | ID Pair Since Profit |
| 217 | ---- -------- ------- -------- |
| 218 | 67 SC/BTC 1 d 13.33% |
| 219 | 123 CVC/BTC 1 h 12.95% |
| 220 | ``` |
| 221 | |
| 222 | ### /count |
| 223 | |
| 224 | Return the number of trades used and available. |
| 225 | |
| 226 | ``` |
| 227 | current max |
| 228 | --------- ----- |
| 229 | 2 10 |
| 230 | ``` |
| 231 | |
| 232 | ### /profit |
| 233 | |
| 234 | Return a summary of your profit/loss and performance. |
| 235 | |
| 236 | > **ROI:** Close trades |
| 237 | > ∙ `0.00485701 BTC (258.45%)` |
| 238 | > ∙ `62.968 USD` |
| 239 | > **ROI:** All trades |
| 240 | > ∙ `0.00255280 BTC (143.43%)` |
| 241 | > ∙ `33.095 EUR` |
| 242 | > |
| 243 | > **Total Trade Count:** `138` |
| 244 | > **First Trade opened:** `3 days ago` |
| 245 | > **Latest Trade opened:** `2 minutes ago` |
| 246 | > **Avg. Duration:** `2:33:45` |
| 247 | > **Best Performing:** `PAY/BTC: 50.23%` |
| 248 | |
| 249 | ### /forcesell <trade_id> |
| 250 | |
| 251 | > **BITTREX:** Selling BTC/LTC with limit `0.01650000 (profit: ~-4.07%, -0.00008168)` |
| 252 | |
| 253 | ### /forcebuy <pair> |
| 254 | |
| 255 | > **BITTREX:** Buying ETH/BTC with limit `0.03400000` (`1.000000 ETH`, `225.290 USD`) |
| 256 | |
| 257 | Note that for this to work, `forcebuy_enable` needs to be set to true. |
| 258 | |
| 259 | [More details](configuration.md#understand-forcebuy_enable) |
| 260 | |
| 261 | ### /performance |
| 262 | |
| 263 | Return the performance of each crypto-currency the bot has sold. |
| 264 | > Performance: |
| 265 | > 1. `RCN/BTC 57.77%` |
| 266 | > 2. `PAY/BTC 56.91%` |
| 267 | > 3. `VIB/BTC 47.07%` |
| 268 | > 4. `SALT/BTC 30.24%` |
| 269 | > 5. `STORJ/BTC 27.24%` |
| 270 | > ... |
| 271 | |
| 272 | ### /balance |
| 273 | |
| 274 | Return the balance of all crypto-currency your have on the exchange. |
| 275 | |
| 276 | > **Currency:** BTC |
| 277 | > **Available:** 3.05890234 |
| 278 | > **Balance:** 3.05890234 |
| 279 | > **Pending:** 0.0 |
| 280 | |
| 281 | > **Currency:** CVC |
| 282 | > **Available:** 86.64180098 |
| 283 | > **Balance:** 86.64180098 |
| 284 | > **Pending:** 0.0 |
| 285 | |
| 286 | ### /daily <n> |
| 287 | |
| 288 | Per default `/daily` will return the 7 last days. |
| 289 | The example below if for `/daily 3`: |
| 290 | |
| 291 | > **Daily Profit over the last 3 days:** |
| 292 | ``` |
| 293 | Day Profit BTC Profit USD |
| 294 | ---------- -------------- ------------ |
| 295 | 2018-01-03 0.00224175 BTC 29,142 USD |
| 296 | 2018-01-02 0.00033131 BTC 4,307 USD |
| 297 | 2018-01-01 0.00269130 BTC 34.986 USD |
| 298 | ``` |
| 299 | |
| 300 | ### /whitelist |
| 301 | |
| 302 | Shows the current whitelist |
| 303 | |
| 304 | > Using whitelist `StaticPairList` with 22 pairs |
| 305 | > `IOTA/BTC, NEO/BTC, TRX/BTC, VET/BTC, ADA/BTC, ETC/BTC, NCASH/BTC, DASH/BTC, XRP/BTC, XVG/BTC, EOS/BTC, LTC/BTC, OMG/BTC, BTG/BTC, LSK/BTC, ZEC/BTC, HOT/BTC, IOTX/BTC, XMR/BTC, AST/BTC, XLM/BTC, NANO/BTC` |
| 306 | |
| 307 | ### /blacklist [pair] |
| 308 | |
| 309 | Shows the current blacklist. |
| 310 | If Pair is set, then this pair will be added to the pairlist. |
| 311 | Also supports multiple pairs, separated by a space. |
| 312 | Use `/reload_config` to reset the blacklist. |
| 313 | |
| 314 | > Using blacklist `StaticPairList` with 2 pairs |
| 315 | >`DODGE/BTC`, `HOT/BTC`. |
| 316 | |
| 317 | ### /edge |
| 318 | |
| 319 | Shows pairs validated by Edge along with their corresponding win-rate, expectancy and stoploss values. |
| 320 | |
| 321 | > **Edge only validated following pairs:** |
| 322 | ``` |
| 323 | Pair Winrate Expectancy Stoploss |
| 324 | -------- --------- ------------ ---------- |
| 325 | DOCK/ETH 0.522727 0.881821 -0.03 |
| 326 | PHX/ETH 0.677419 0.560488 -0.03 |
| 327 | HOT/ETH 0.733333 0.490492 -0.03 |
| 328 | HC/ETH 0.588235 0.280988 -0.02 |
| 329 | ARDR/ETH 0.366667 0.143059 -0.01 |
| 330 | ``` |
| 331 | |
| 332 | ### /version |
| 333 | |
| 334 | > **Version:** `0.14.3` |