get_open_orders
Retrieve active trading orders for a specific cryptocurrency pair on Binance to monitor positions and manage trades.
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 for the 'get_open_orders' MCP tool. It is decorated with @mcp.tool() which registers it with the FastMCP server. The function retrieves open orders for a specified trading pair (symbol) from the Binance API by signing the request and parsing the response into a list of order details (side, quantity, price).@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}