get_open_orders
Retrieve a list of open orders for a specific trading pair on Binance using the MCP server. Input the symbol to access active orders for efficient trading management.
Instructions
Get open orders for a symbol.
Args: symbol: The trading pair.
Returns: List of open orders.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | Yes |
Implementation Reference
- binance.py:143-173 (handler)The handler function decorated with @mcp.tool() that implements the get_open_orders tool by querying the Binance API for open orders of a given symbol.@mcp.tool() def get_open_orders(symbol: str) -> Any: """ Get open orders for a symbol. Args: symbol: The trading pair. Returns: List of open orders. """ url = "https://api.binance.com/api/v3/openOrders" timestamp = int(time.time() * 1000) params = { "symbol": symbol, "timestamp": timestamp } query_string = "&".join([f"{k}={v}" for k, v in params.items()]) signature = hmac.new(BINANCE_SECRET_KEY.encode(), query_string.encode(), hashlib.sha256).hexdigest() params["signature"] = signature headers = {"X-MBX-APIKEY": BINANCE_API_KEY} response = requests.get(url, headers=headers, params=params) if response.status_code == 200: return [ { "side": order["side"], "quantity": order["origQty"], "price": order["price"] } for order in response.json() ] return {"error": response.text}