# Bot Client — Managing MoonTrader via Telegram

Bot Client is a MoonTrader extension that lets you manage trading accounts directly from Telegram. Open and close positions, stop algorithms, change leverage, and get reports — without opening the terminal. This guide covers the full setup from scratch: from creating a bot to executing your first commands.

> **Requirements:** a Telegram account, BotClient.exe installed, MoonTrader core running.

***

### 1. Creating a Telegram Bot

Before launching Bot Client, you need to create your own Telegram bot. This bot acts as the interface between you and MoonTrader.

1. Open Telegram and find **@BotFather**.
2. Send the command `/newbot`.
3. Enter a name for the bot (any name).
4. Enter the bot's username — it must end with `Bot` or `_bot`, e.g. `MyTraderBot`.
5. Save the **Token** that BotFather sends — you will need it when configuring BotClient.

> To view the token of an existing bot: `/mybots` → select the bot → "API Token".

***

### 2. Getting Your ChatID

ChatID is your Telegram identifier. Bot Client uses it to send notifications only to you.

1. Find the bot **@myidbot**.
2. Send the command `/getid`.
3. Save the ChatID you receive.

***

### 3. Configuring and Starting BotClient

1. Extract the BotClient archive to a convenient folder.
2. Launch **BotClient.exe**.
3. In the "Token" field, enter the token from step 1.
4. In the "ChatID" field, enter the identifier from step 2.
5. Click "Save" — Bot Client is ready to use.

After launching, find your bot in Telegram: `/mybots` → select the bot → "Go to chat" → click **Start**. All further commands are executed in this chat.

> The bot's interface language can be changed in "Telegram Settings" → "Telegram Layout".

***

### 4. Managing Profiles

A profile is a connection to one MoonTrader account. Bot Client supports multiple profiles simultaneously.

#### Add a Profile

1. Open "Profile" → "Add".
2. Enter the account details from the MoonTrader client.
3. Click "Execute" — the profile will be added if the core is available.

#### Edit a Profile

1. Open "Profile" → "Edit" or type `/edit_profile`.
2. Select the profile from the list.
3. Update the required parameters and click "Execute".

#### Set Default Profiles

Default profiles are automatically applied to all commands — no need to select them manually each time.

1. Open "Profile" → "Default".
2. Select the profiles from the list.
3. Click "Execute".

**Text command:**

```
#change def profile; pr: profile1, profile2;
```

#### Remove a Profile

1. Open "Profile" → "Remove" or type `/remove_profile`.
2. Select the profile from the list.
3. Click "Execute" to confirm.

**Text command:**

```
#remove profile; pr: profile1, profile2;
```

***

### 5. Orders and Positions

#### Add an Order

This command works with one profile at a time.

1. Open "Order" → "Add" or type `/add_order`.
2. Fill in the parameters: profile, market, side (buy/sell), order type, instrument, volume, price.
3. If needed, configure Take Profit and Stop Loss in the same menu.
4. Click "Execute".

> ⚠️ Make sure all parameters are correct — the order will be sent to the exchange immediately.

#### Cancel Orders

This command cancels only open (unfilled) orders.

1. Open "Order" → "Cancel" or type `/cancel_order`.
2. Select the profile, market, and instruments.
3. Click "Execute".

To abort mid-execution, click "Stop".

**Text commands:**

```
#cancel order; pr: profile1, profile2; market: spot; symbols: ethusdt;
#cancel order; pr: all; market: futures; cancel all: true;
```

#### Order List

1. Open "Order" → "List" or type `/get_order_list`.
2. Select the profile — current orders for each market will load.
3. From this menu you can also cancel selected orders or view their details.

#### Close Positions

This command works with open positions, not with open orders.

1. Open "Position" → "Close" or type `/close_positions`.
2. Select the profile, market, and instruments.
3. Click "Execute" and wait for the core response.

**Text commands:**

```
#get pos; pr: profile1, profile2;
#get pos; pr: all;
```

#### Panic Sell — Emergency Position Close

Panic Sell closes all open positions in the selected markets. Open orders are not affected.

1. Open "Panic" or type `/panic_sell`.
2. Select the profile — all open positions will appear, grouped by market.
3. Click "Execute".

> ⚠️ Use Panic Sell only when you need to exit all positions immediately — this action is irreversible.

**Text commands:**

```
#panic sell; pr: profile1; market: futures; symbols: btcusdt, ethusdt;
#panic sell; pr: all; market: spot; symbols: all;
```

***

### 6. Managing Algorithms

#### Stop All Algorithms

Stops all running algorithms on the selected account.

1. Open "Algorithms" → "Stop All" or type `/stop_all_algorithm`.
2. Select the profile and click "Execute".

**Text commands:**

```
#stop all algo; pr: all;
#stop all algo; pr: profile1, profile2;
```

#### Start All Algorithms

Starts all previously stopped algorithms.

1. Open "Algorithms" → "Start All" or type `/start_all_algorithm`.
2. Select the profile and click "Execute".

**Text command:**

```
#start all algo; pr: profile1, profile2;
```

#### Manage Individual Algorithms

1. Open "Algorithms" → "Manage".
2. The list of algorithms on the selected core will load.
3. For each algorithm, the following actions are available: start, stop, delete.

***

### 7. Market Settings

#### Change Leverage

This command only works on markets with no open positions or orders.

1. Open "Market" → "Change Leverage" or type `/modify_leverage`.
2. Select the profile, market, and instruments.
3. Enter the new leverage value.
4. Click "Execute".

> If leverage is not specified, the exchange's maximum allowed value will be set.

**Text command:**

```
#modify leverage; pr: profile1; market: futures; symbols: bnbusdt; leverage: 23;
```

#### Change Margin Type

This command only works on markets with no open positions or orders.

1. Open "Market" → "Change Margin" or type `/modify_margin`.
2. Select the profile, market, instruments, and margin type (Cross or Isolated).
3. Click "Execute".

**Text command:**

```
#modify margin; pr: profile1; market: futures; margin type: cross; symbols: bnbusdt;
```

#### Balance

To view the balance for selected profiles:

1. Open "Balance" → "Info" or type `/get_balance`.
2. Select the profile and market.

**Text command:**

```
#get balance; pr: profile1; market: futures;
```

To transfer assets between markets:

1. Open "Balance" → "Transfer".
2. Enter the profile, source market, target market, asset, and amount.
3. Click "Execute".

**Text command:**

```
#transfer balance; pr: profile1; from market: futures; to market: spot; symbol: USDT; amount: 100;
```

***

### 8. Core and Reports

#### Core Management

The "Core" menu offers four actions:

| Action            | Description                     | Text command                        |
| ----------------- | ------------------------------- | ----------------------------------- |
| Status            | Shows the current account state | `#core status; pr: all;`            |
| Restart           | Restarts the core with update   | `#core restart; pr: all;`           |
| Restart No Update | Restarts without update         | `#core restart no update; pr: all;` |
| Shutdown          | Shuts down the core             | `#core shutdown; pr: all;`          |

Select an action in the "Core" menu and click "Execute", or send a text command.

#### Reports

Loads algorithm reports filtered by market and instrument.

* Single profile → detailed report per algorithm (number of filled orders, average order size, result).
* Multiple profiles → summary report without per-algorithm details.

The "Markets", "Quote/Symbol", and "Information" fields can be left empty.

#### Positions

Loads information on all open positions across the selected accounts.

**Text command:**

```
#get pos; pr: all;
```

***

### 9. Signals from Telegram Channels

Bot Client can parse trading signals from Telegram channels and automatically forward them to connected cores.

> **Supported platforms:** Windows, Ubuntu/Linux 20.04.

#### Step 1 — Connect a Telegram Account

1. Open "Profile" → "Telegram Profile".
2. Click "Login".
3. Authorization fields will appear in the chat (if they don't — press Enter).
4. Enter your phone number.
5. Enter the code from Telegram.
6. Enter your password if two-factor authentication is enabled.

After successful authorization, the connected account status will appear in "Profile" → "Telegram Profile".

#### Step 2 — Select Channels to Monitor

1. Open "Algorithms" → "Signals" → "Channels".
2. Select the channels you want to receive signals from.
3. Click "Execute".

Parsing rules for each channel are configured separately: "Algorithms" → "Signals" → "Channel Settings".

Once configured, Bot Client will monitor the selected channels and forward any signals to all connected cores.

```
Binance USDT-M sell galausdt tp 3% sl 4%
```

***

### Text Command Syntax

A text command must start with `#`. Any other message is treated as menu navigation.

**Rules:**

* Parameters are separated by `;` or a line break — both are equivalent.
* Parameters can be abbreviated: `pr` instead of `profiles`, `m` instead of `margin`, etc.
* Parameter order does not matter.
* If all parameters are valid — the command executes immediately. Otherwise, a pre-filled form opens.
* Multiple profiles are listed with commas: `pr: profile1, profile2`. To apply to all — `pr: all`.
* Any character (including a space) can separate a parameter from its value: `pr: all` and `pr all` are equivalent.

**Market codes:** `f` — futures, `m` — margin, `s` — spot, `d` — delivery.

**Order side:** `buy`, `sell`.

**Order type:** `Limit`, `Market`, `StopLimit`, `StopMarket`, `LimitMarket`, `PostOnly`.

**Margin type:** `Cross`, `Isolated`.

***

### Text Command Cheatsheet

#### Commands

| Command                   | Description              | Example                                                                                 |
| ------------------------- | ------------------------ | --------------------------------------------------------------------------------------- |
| `#core status`            | Core status              | `#core status; pr: all;`                                                                |
| `#core restart`           | Restart core with update | `#core restart; pr: main;`                                                              |
| `#core restart no update` | Restart without update   | `#core restart no update; pr: main;`                                                    |
| `#core shutdown`          | Shut down core           | `#core shutdown; pr: all;`                                                              |
| `#get pos`                | List open positions      | `#get pos; pr: main, backup;`                                                           |
| `#get balance`            | Balance by market        | `#get balance; pr: main; market: f;`                                                    |
| `#transfer balance`       | Transfer between markets | `#transfer balance; pr: main; from market: f; to market: s; symbol: USDT; amount: 500;` |
| `#start all algo`         | Start all algorithms     | `#start all algo; pr: all;`                                                             |
| `#stop all algo`          | Stop all algorithms      | `#stop all algo; pr: main;`                                                             |
| `#panic sell`             | Emergency position close | `#panic sell; pr: main; market: f; symbols: btcusdt, ethusdt;`                          |
| `#add order`              | Place an order           | see below                                                                               |
| `#cancel order`           | Cancel orders            | `#cancel order; pr: main; market: f; symbols: btcusdt;`                                 |
| `#modify leverage`        | Change leverage          | `#modify leverage; pr: main; market: f; symbols: btcusdt; leverage: 10;`                |
| `#modify margin`          | Change margin type       | `#modify margin; pr: main; market: f; margin type: cross; symbols: btcusdt;`            |
| `#remove profile`         | Remove a profile         | `#remove profile; pr: old_account;`                                                     |
| `#change def profile`     | Set default profiles     | `#change def profile; pr: main, backup;`                                                |

***

#### `#add order` — Full Syntax

Minimal example (no TP/SL):

{% code overflow="wrap" %}

```
#add order; pr: main; market: f; side: buy; order type: Limit; symbol: btcusdt; order size: 100; price: 65000;
```

{% endcode %}

With Take Profit and Stop Loss:

```
#add order
pr: main
market: f
side: buy
order type: Limit
symbol: btcusdt
order size: 100
price: 65000
tp percentage: 2
tp order type: Limit
sl percentage: 1
sl order type: Market
sl trailing spread: 0.1
```

> If `tp percentage` is not set — all other `tp *` parameters are ignored. Same applies to `sl percentage`.
>
> If `sl trailing spread` is set — trailing is enabled automatically.
>
> If `leverage` is not set in `#modify leverage` — the exchange maximum is applied.

***

#### Parameters

#### General

| Parameter     | Abbreviation | Allowed values                                                               | Example                     |
| ------------- | ------------ | ---------------------------------------------------------------------------- | --------------------------- |
| `profiles`    | `pr`         | Names separated by commas, or `all`                                          | `pr: main, backup`          |
| `market`      | `m`          | `f` / `m` / `s` / `d`                                                        | `market: f`                 |
| `symbols`     | —            | Tickers separated by commas, or `all`                                        | `symbols: btcusdt, ethusdt` |
| `side`        | —            | `buy` / `sell`                                                               | `side: buy`                 |
| `order type`  | —            | `Limit` / `Market` / `StopLimit` / `StopMarket` / `LimitMarket` / `PostOnly` | `order type: Limit`         |
| `order size`  | —            | Number                                                                       | `order size: 100`           |
| `price`       | —            | Number                                                                       | `price: 65000`              |
| `cancel all`  | —            | `true` / `false`                                                             | `cancel all: true`          |
| `leverage`    | —            | Number (if not set — exchange maximum)                                       | `leverage: 10`              |
| `margin type` | —            | `Cross` / `Isolated`                                                         | `margin type: cross`        |
| `amount`      | —            | Number                                                                       | `amount: 500`               |
| `symbol`      | —            | Asset ticker                                                                 | `symbol: USDT`              |
| `from market` | —            | `f` / `m` / `s` / `d`                                                        | `from market: f`            |
| `to market`   | —            | `f` / `m` / `s` / `d`                                                        | `to market: s`              |

#### Take Profit (`#add order`)

| Parameter                  | Description                                  | Example                        |
| -------------------------- | -------------------------------------------- | ------------------------------ |
| `tp percentage`            | TP % from entry price. Required to enable TP | `tp percentage: 2`             |
| `tp order type`            | TP order type                                | `tp order type: Limit`         |
| `tp is iceberg`            | Iceberg order                                | `tp is iceberg: true`          |
| `tp auto price down time`  | Time before auto price reduction (sec)       | `tp auto price down time: 60`  |
| `tp auto price down step`  | Auto price reduction step                    | `tp auto price down step: 0.1` |
| `tp auto price down limit` | Auto price reduction limit                   | `tp auto price down limit: 1`  |

#### Stop Loss (`#add order`)

| Parameter            | Description                                                 | Example                   |
| -------------------- | ----------------------------------------------------------- | ------------------------- |
| `sl percentage`      | SL % from entry price. Required to enable SL                | `sl percentage: 1`        |
| `sl order type`      | SL order type                                               | `sl order type: Market`   |
| `sl spread`          | SL spread                                                   | `sl spread: 0.05`         |
| `sl delay`           | Delay before triggering (sec)                               | `sl delay: 5`             |
| `sl trailing spread` | Trailing spread. If set — trailing is enabled automatically | `sl trailing spread: 0.1` |

***

#### Market Codes

| Code | Market   |
| ---- | -------- |
| `f`  | Futures  |
| `m`  | Margin   |
| `s`  | Spot     |
| `d`  | Delivery |
