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!