IBKR-Telegram

IBKR-Telegram

Docker CI License Docker Pulls Codecov

Self-hosted Telegram bot for Interactive Brokers, run with Docker Compose next to IB Gateway. Manage your portfolio, execute trades and monitor positions from Telegram.

## Disclaimer This software is provided "as is" under the [GPL-3.0 license](https://github.com/GeiserX/IBKR-Telegram/blob/main/LICENSE). **Use at your own risk.** The author(s) accept no liability for financial losses. This is not financial advice — test thoroughly with paper trading accounts before using real money. ## Features - Several IBKR accounts from one bot, each on its own IB Gateway container, with per-account limits and margin modes. - Any instrument IBKR supports (stocks, options, futures), chosen with `asset_types` in `config.yaml`. - An option chain wizard for LEAPS: deep ITM strike matching and automatic contract resolution. - Checks before every trade: market hours, duplicate signals, position limits, and a Telegram confirmation. - Periodic position snapshots, P&L tracking, and deposit/withdrawal history through the IBKR Flex Web Service. - Soft (alert) or hard (auto-sell) margin enforcement per account. - An optional webhook API for signals from TradingView or your own parsers, behind the same confirmation step. ## Quick start You need an IBKR account with API access, a bot token from [@BotFather](https://t.me/BotFather), and Docker Compose. ```bash git clone https://github.com/GeiserX/IBKR-Telegram.git && cd IBKR-Telegram cp .env.example .env && cp config.example.yaml config.yaml && cp docker-compose.example.yml docker-compose.yml docker compose up -d ``` Fill in `.env` and `config.yaml` before starting, complete the IB Gateway 2FA on first start, then send `/status` to the bot. [Getting started](https://github.com/GeiserX/IBKR-Telegram/blob/main/docs/getting-started.md) has every step. ## Documentation - [Getting started](https://github.com/GeiserX/IBKR-Telegram/blob/main/docs/getting-started.md): prerequisites and first start - [Configuration](https://github.com/GeiserX/IBKR-Telegram/blob/main/docs/configuration.md): `config.yaml`, environment variables, margin modes, IB Gateway - [Usage](https://github.com/GeiserX/IBKR-Telegram/blob/main/docs/usage.md): every Telegram command - [Webhook API](https://github.com/GeiserX/IBKR-Telegram/blob/main/docs/webhook.md): sending trade signals over HTTP - [How it works](https://github.com/GeiserX/IBKR-Telegram/blob/main/docs/how-it-works.md): how the pieces fit - [Troubleshooting](https://github.com/GeiserX/IBKR-Telegram/blob/main/docs/troubleshooting.md) - [Development](https://github.com/GeiserX/IBKR-Telegram/blob/main/docs/development.md): tests, linting and contributing ## License [GPL-3.0-or-later](https://github.com/GeiserX/IBKR-Telegram/blob/main/LICENSE)