get_account_info
Retrieve Alpaca account details such as equity, buying power, and day trade status for portfolio management and trading strategy development.
Instructions
Get detailed Alpaca account information including equity, buying power, and day trade status.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- server.py:37-56 (handler)The MCP tool handler implementation for 'get_account_info'. It fetches the Alpaca account details using get_broker() and formats them into a readable string. Registered via @mcp.tool() decorator.@mcp.tool() def get_account_info() -> str: """ Get detailed Alpaca account information including equity, buying power, and day trade status. """ try: broker = get_broker() account = broker.get_account() return f""" === ALPACA ACCOUNT INFO === Cash: ${account['cash']:,.2f} Equity: ${account['equity']:,.2f} Buying Power: ${account['buying_power']:,.2f} Portfolio Value: ${account['portfolio_value']:,.2f} Pattern Day Trader: {account['pattern_day_trader']} Day Trade Count: {account['daytrade_count']} """ except Exception as e: return f"ERROR: Failed to get account info - {str(e)}"
- server.py:37-56 (registration)The @mcp.tool() decorator registers get_account_info as an MCP tool.@mcp.tool() def get_account_info() -> str: """ Get detailed Alpaca account information including equity, buying power, and day trade status. """ try: broker = get_broker() account = broker.get_account() return f""" === ALPACA ACCOUNT INFO === Cash: ${account['cash']:,.2f} Equity: ${account['equity']:,.2f} Buying Power: ${account['buying_power']:,.2f} Portfolio Value: ${account['portfolio_value']:,.2f} Pattern Day Trader: {account['pattern_day_trader']} Day Trade Count: {account['daytrade_count']} """ except Exception as e: return f"ERROR: Failed to get account info - {str(e)}"
- app.py:104-118 (helper)Duplicate implementation used in the Gradio UI dashboard.def get_account_info() -> str: try: broker = get_broker() account = broker.get_account() return f""" === ALPACA ACCOUNT INFO === Cash: ${account['cash']:,.2f} Equity: ${account['equity']:,.2f} Buying Power: ${account['buying_power']:,.2f} Portfolio Value: ${account['portfolio_value']:,.2f} Pattern Day Trader: {account['pattern_day_trader']} Day Trade Count: {account['daytrade_count']} """ except Exception as e: return f"ERROR: Failed to get account info - {str(e)}"