Skip to main content
Glama
nadavgb-atom

ib-async-mcp

by nadavgb-atom

run_scanner

Execute market scans to identify stocks matching specific criteria like top gainers or most active, using Interactive Brokers data for trading analysis.

Instructions

Run a market scanner.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scan_codeYesScanner code (e.g., TOP_PERC_GAIN, MOST_ACTIVE)
instrumentNoInstrument typeSTK
location_codeNoLocation codeSTK.US.MAJOR
num_rowsNoNumber of results

Implementation Reference

  • The handler implementation for the 'run_scanner' tool, which constructs a ScannerSubscription and executes it using ib.reqScannerDataAsync.
    if name == "run_scanner":
        from ib_async import ScannerSubscription
        subscription = ScannerSubscription(
            scanCode=args["scan_code"],
            instrument=args.get("instrument", "STK"),
            locationCode=args.get("location_code", "STK.US.MAJOR"),
            numberOfRows=args.get("num_rows", 10),
        )
        results = await ib.reqScannerDataAsync(subscription)
        return [{
            "rank": r.rank,
            "symbol": r.contractDetails.contract.symbol if r.contractDetails.contract else None,
            "sec_type": r.contractDetails.contract.secType if r.contractDetails.contract else None,
        } for r in results]
  • The Tool registration and input schema definition for 'run_scanner'.
    Tool(
        name="run_scanner",
        description="Run a market scanner.",
        inputSchema={
            "type": "object",
            "properties": {
                "scan_code": {"type": "string", "description": "Scanner code (e.g., TOP_PERC_GAIN, MOST_ACTIVE)"},
                "instrument": {"type": "string", "default": "STK", "description": "Instrument type"},
                "location_code": {"type": "string", "default": "STK.US.MAJOR", "description": "Location code"},
                "num_rows": {"type": "integer", "default": 10, "description": "Number of results"},
            },
            "required": ["scan_code"],
        },
    ),

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/nadavgb-atom/ib-async-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server