Skip to main content
Glama
VaishnaviK23

Trading MCP Server

by VaishnaviK23

pnl

Calculate Profit & Loss by combining realized and unrealized gains into a single financial summary for trading analysis.

Instructions

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}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The `pnl` tool is defined as an MCP tool using the `@mcp.tool()` decorator. It calculates the Profit & Loss summary by calling `realized_gains()` and summing the results of `unrealized_gains()`.
    @mcp.tool()
    def pnl() -> dict[str, float]:
        """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}
        """
        return {
            'realized': realized_gains(),
            'unrealized': sum(unrealized_gains().values())
        }

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