#!/usr/bin/env python3 """ NewBot — RSI Trend Pullback forex bot entry point. Usage ----- python main.py # paper trading (default) PAPER_TRADING=false python main.py # live MT5 Keyboard interrupt stops the bot cleanly. """ import asyncio import logging import sys from pathlib import Path logging.basicConfig( level=logging.INFO, format="%(asctime)s %(name)-24s %(levelname)-8s %(message)s", handlers=[ logging.StreamHandler(sys.stdout), logging.FileHandler(Path(__file__).parent / "bot.log"), ], ) # suppress noisy third-party loggers for _noisy in ("httpx", "telegram", "asyncio"): logging.getLogger(_noisy).setLevel(logging.WARNING) from bot import broker, loop, alerts, config async def main() -> None: mode = "PAPER" if config.PAPER_TRADING else "LIVE (MT5)" logging.getLogger(__name__).info("Starting NewBot in %s mode", mode) if not broker.connect(): await alerts.notify_error("Broker connection failed at startup") return try: await loop.run() except KeyboardInterrupt: pass finally: broker.disconnect() logging.getLogger(__name__).info("Bot stopped.") if __name__ == "__main__": asyncio.run(main())