INNER CODE UNIT · Python

get_tick

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

async def get_tick(symbol: str):
    if not ensure_connected():
        return mt5_response(False, error="MT5 not connected")
    tick = mt5.symbol_info_tick(symbol)
    if tick is None:
        return mt5_response(False, error=f"No tick data for {symbol}")
    return mt5_response(True, data={
        "bid": tick.bid,
        "ask": tick.ask,
        "spread": round(tick.ask - tick.bid, 5),
        "time": datetime.fromtimestamp(tick.time).isoformat(),
    })


@app.get("/symbol-spec/{symbol}", dependencies=[Depends(verify_api_key)])
async def get_symbol_spec(symbol: str):
    """Return broker-side spec for a symbol (used by Symbol Config UI to validate + auto-fill)."""
    if not ensure_connected():

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…