fx-bot

byGlitch Samson

Build a **demo-only educational trading automation app** that receives signals from a Telegram channel, parses them, schedules trades, records results, and displays analytics. ### Tech Stack * **Backend:** Python 3.11+, FastAPI, SQLAlchemy, SQLite/PostgreSQL * **Telegram:** Telethon * **Frontend:** React + Vite + TypeScript + Tailwind CSS + Recharts * **Testing:** Pytest ### Signal Format The Telegram channel sends signals like: ```text ๐Ÿ”” NEW SIGNAL! ๐ŸŽซ Trade: ๐Ÿ‡จ๐Ÿ‡ญ CHF/JPY ๐Ÿ‡ฏ๐Ÿ‡ต (OTC) โณ Timer: 1 minutes โžก๏ธ Entry: 7:26 PM ๐Ÿ“ˆ Direction: SELL ๐ŸŸฅ โ†ช๏ธ Martingale Levels: Level 1 โ†’ 7:27 PM Level 2 โ†’ 7:28 PM Level 3 โ†’ 7:29 PM ``` Parse this into: ```json { "asset": "CHF/JPY", "market": "OTC", "direction": "SELL", "expiry_minutes": 1, "entry_time": "19:26", "martingale_levels": ["19:27", "19:28", "19:29"] } ``` ### Core Workflow ```text Telegram Channel โ†“ Telegram Listener โ†“ Signal Parser โ†“ Signal Validator โ†“ Entry-Time Scheduler โ†“ Demo/Simulation Engine โ†“ Result Tracker โ†“ Database โ†“ React Dashboard ``` ### Telegram Listener Use Telethon to: * Monitor the configured channel. * Receive new messages. * Ignore unrelated messages. * Prevent duplicate processing. * Handle disconnections gracefully. Credentials must be stored in `.env`, never in source code. ### Signal Parser Extract: * Asset * OTC status * BUY/SELL direction * Entry time * Expiry * MG1/MG2/MG3 times Handle emojis, spacing and minor formatting variations. Reject incomplete or ambiguous signals rather than guessing. ### Time Handling * Store timestamps internally in UTC. * Default display timezone: `Africa/Lagos`. * Correctly convert `7:26 PM โ†’ 19:26`. * Handle midnight and expired signals. * Execute/simulate at the specified entry time, not when the Telegram message arrives. ### Simulation Build the simulator **before any platform execution**. Record: * Signal * Entry * Direction * Stake * Expiry * Result * Profit/loss * Martingale level Collect at least 100+ signals for analysis before relying on the system. ### Martingale Support: ```text Initial โ†’ MG1 โ†’ MG2 โ†’ MG3 ``` But: ```text MARTINGALE_ENABLED=false ``` by default. Track how many signals win initially, require MG1/MG2/MG3, or fail completely. ### Risk Controls Default configuration: ```text DEMO_MODE=true BASE_STAKE=1 MAX_MARTINGALE_LEVEL=3 MAX_DAILY_TRADES=20 MAX_CONSECUTIVE_LOSSES=5 MARTINGALE_ENABLED=false ``` Automatically pause when safety limits are reached. ### IQ Option Create an isolated `iq_option_adapter.py`. The application must be **demo-only** and must not bypass CAPTCHA, anti-bot systems, authentication protections, or other platform security. If no legitimate supported API/access method is available, keep the IQ Option adapter disabled and use simulation instead. Never implement automatic real-money trading. ### Database Store signals and trades with fields such as: ```text signal_id telegram_message_id asset market direction entry_time expiry martingale_level stake result profit created_at closed_at ``` ### Dashboard Create a modern dark trading analytics dashboard showing: * Demo Mode status * Bot status * Total signals * Total trades * Wins/losses * Win rate * Profit/loss * Current streak * Latest signal * Entry countdown * Trade history * Asset performance * Martingale statistics * Daily performance charts Include **START, PAUSE and STOP** controls. ### Project Structure ```text telegram-trading-bot/ โ”œโ”€โ”€ backend/ โ”‚ โ”œโ”€โ”€ app/ โ”‚ โ”‚ โ”œโ”€โ”€ main.py โ”‚ โ”‚ โ”œโ”€โ”€ config.py โ”‚ โ”‚ โ”œโ”€โ”€ database.py โ”‚ โ”‚ โ”œโ”€โ”€ models/ โ”‚ โ”‚ โ”œโ”€โ”€ schemas/ โ”‚ โ”‚ โ”œโ”€โ”€ api/ โ”‚ โ”‚ โ””โ”€โ”€ services/ โ”‚ โ”‚ โ”œโ”€โ”€ telegram_listener.py โ”‚ โ”‚ โ”œโ”€โ”€ signal_parser.py โ”‚ โ”‚ โ”œโ”€โ”€ signal_validator.py โ”‚ โ”‚ โ”œโ”€โ”€ scheduler.py โ”‚ โ”‚ โ”œโ”€โ”€ simulator.py โ”‚ โ”‚ โ”œโ”€โ”€ risk_manager.py โ”‚ โ”‚ โ””โ”€โ”€ iq_option_adapter.py โ”‚ โ””โ”€โ”€ tests/ โ”œโ”€โ”€ frontend/ โ”œโ”€โ”€ .env.example โ”œโ”€โ”€ .gitignore โ””โ”€โ”€ README.md ``` ### Development Order Build and test sequentially: 1. Telegram listener 2. Signal parser 3. Signal validator 4. Time scheduler 5. Simulation engine 6. Database 7. Risk management 8. Analytics/dashboard 9. IQ Option **demo adapter** Do not move to the next stage until the previous stage works. The final application must clearly display **DEMO ONLY**, never expose credentials, prevent duplicate signals, handle errors gracefully, and never place real-money trades.

LandingLoginSign Up
Landing

Comments (0)

No comments yet. Be the first!

Project Tasks

No tasks generated yet.

Tasks will appear here as requirements are defined.

Landing design preview
Landing: View product overview
Sign Up: Enroll for access
Login: Verify identity
Settings: Configure Telegram channel
Dashboard: View real-time analytics
Dashboard: Control bot lifecycle
Signals: Review parsed signals
Trades: Review trade outcomes
Landing design preview
Landing: View product overview
Sign Up: Enroll for access
Login: Verify identity
Settings: Configure Telegram channel
Dashboard: View real-time analytics
Dashboard: Control bot lifecycle
Signals: Review parsed signals
Trades: Review trade outcomes