Skip to main content
Glama
VaishnaviK23

Trading MCP Server

by VaishnaviK23

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault

No arguments

Capabilities

Features and capabilities supported by this server

CapabilityDetails
tools
{
  "listChanged": false
}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}
experimental
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
portfolio

Show current portfolio holdings.

This tool calculates the net number of shares held for each stock symbol by summing all buy and sell trades in the trade history CSV.

Returns: A dictionary mapping stock symbols to their current number of held shares. Only symbols with a positive balance are included.

Example: portfolio() -> {"AAPL": 120, "GOOG": 60}

realized_gains

Calculate total realized gains using FIFO method.

This tool goes through the trade history and tracks all buy transactions in a FIFO queue. For each sell, it matches shares with the earliest buys and calculates the realized profit or loss accordingly.

Returns: A float representing the total realized gain or loss (in dollars), rounded to two decimal places.

Example: realized_gains() -> 352.75

unrealized_gains

Calculate unrealized gains for current holdings.

This tool calculates unrealized profit or loss by comparing the average buy price for currently held shares against the current market price fetched live using yfinance.

Returns: A dictionary mapping each stock symbol to its unrealized gain or loss in dollars.

Example: unrealized_gains() -> {"AAPL": 125.50, "GOOG": -22.15}

current_price

Fetch the live price of a stock symbol.

Args: symbol: Stock ticker symbol (e.g. AAPL, TSLA) - This should be a valid symbol supported by Yahoo Finance.

Returns: The current market price as a float, or -1.0 if the price could not be fetched.

Example: get_live_price("AAPL") -> 193.45

validate_trades

Validate that no trades sell more shares than have been bought.

Parses the trade history sequentially to ensure all sell transactions occur only after a corresponding quantity of shares has been bought.

Returns: A list of error messages for invalid trades, if any.

Example: validate_trades() -> ["Invalid sell on 2024-02-10: 20 shares of AAPL (owned: 10)"]

pnl

Generate a Profit & Loss (P&L) summary.

Combines realized and unrealized gains into a single financial overview.

Returns: A dictionary with keys 'realized' and 'unrealized' representing the total gains.

Example: pnl() -> {"realized": 320.75, "unrealized": 145.60}

trade_history

Return the trade history for a specific stock symbol.

Args: symbol: The stock ticker symbol (e.g., AMZN, MSFT)

Returns: A list of dictionaries containing all trade records for that symbol.

Example: trade_history("GOOG") -> [{"date": "2024-01-01", "type": "Buy", ...}, ...]

simulate_sell

Simulate selling a number of shares of a stock and estimate the profit or loss.

Args: symbol: The stock ticker symbol to simulate the sale for (e.g., TSLA) shares: The number of shares to simulate selling.

Returns: The estimated profit/loss from the simulated sale using FIFO matching, in dollars.

Example: simulate_sell("AAPL", 50) -> 123.45

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

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/VaishnaviK23/Trading-MCP-Server'

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