TradeMaster is a high-performance, production-ready Spring Boot application that powers a Telegram-first trading simulation bot. It offers a seamless bridge between real-time market data and automated trading strategies.
You can interact with the bot directly on Telegram: @TradeMasterFintechBot
- Production Hardening: Built with structured logging (MDC), input validation, and secure webhook handling.
- Multi-Asset Support: Real-time price tracking for Crypto, Stocks, and Fiat currencies.
- Persistent Alert System:
- Price-based (Above/Below) and Percentage-based (+5%, -10%) alerts.
- Alarms survive application restarts (PostgreSQL backed).
- Automated Trading: Set /autobuy or /autosell rules to execute trades at specific price targets automatically.
- Portfolio Management: Real-time balance tracking, PnL calculations, and transaction history.
- Rich UI: Interactive Telegram menus with structured HTML formatting.
- Backend: Java 21, Spring Boot 3.2
- Data Persistence: PostgreSQL (JPA/Hibernate)
- Caching: Redis
- APIs: CoinGecko (Crypto), Alpha Vantage (Stocks), Frankfurter (Fiat)
- Deployment: Docker & Docker Compose
- Docker & Docker Compose
- A Telegram Bot Token (from @BotFather)
Clone the repository and create a .env file from the template:
cp .env.example .envEdit the .env file with your API keys and Bot token.
Launch the entire stack (App, PostgreSQL, Redis) with a single command:
docker-compose up -d --buildIf you are running this in GitHub Codespaces:
- Go to the Ports tab in your terminal area.
- Find port
8080, right-click on "Visibility", and change it to Public. - Copy the Forwarded Address (e.g.,
https://abc-8080.preview.app.github.dev). - Use this URL to set your Telegram Webhook:
https://<YOUR_CODESPACE_URL>/api/v1/telegram/webhook
| Command | Description |
|---|---|
/start |
Link your account and open the main menu |
/price <symbol> |
Get current price (e.g., /price BTC) |
/portfolio |
View your holdings and balance |
/buy <sym> <qty> |
Purchase an asset |
/sell <sym> <qty> |
Sell an asset |
/alert <sym> <target> |
Set price (e.g., 80000) or % (e.g., +5%) alert |
/alerts |
List all active alerts |
/delalert <id> |
Delete an alert by ID |
/rules |
View all active trade rules |
/help |
Show all available commands |
The project follows a modular and clean architecture:
- TelegramBotService: Routing layer for incoming updates.
- CommandDispatcher: Extensible command processing logic.
- MarketDataService: Smart routing for multiple data providers.
- AlertService: Background scheduler for rule evaluation and notification.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
