INNER CODE UNIT · Python

startup

flukelaster/ai-trading-agent · mt5_bridge/main.py:90

async def startup():
    logger.info("Initializing MT5...")
    if not mt5.initialize(MT5_PATH):
        logger.error(f"MT5 init failed: {mt5.last_error()}")
        return
    logger.info("MT5 terminal connected, logging in...")
    if MT5_LOGIN and not mt5.login(MT5_LOGIN, password=MT5_PASSWORD, server=MT5_SERVER):
        logger.error(f"MT5 login failed: {mt5.last_error()}")
        return
    info = mt5.account_info()
    if info:
        logger.info(f"MT5 connected: {info.login} @ {info.server}")
    else:
        logger.warning(f"MT5 initialized but no account info: {mt5.last_error()}")


@app.on_event("shutdown")
async def shutdown():

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…