• CODE
  • MAPPING
  • LOGIC
  • HUMAN

How to generate portfolio analysis scripts with your AI

Connect your broker exports to your agent. It learns your data structure so it can write the Python code you need for custom math.

Ask AI about this page

Short answer

How do I get my AI to write custom portfolio scripts?

The AI uses the connector to read your broker's CSV headers and sample rows. Once it understands the column names and data types, it writes Python code to calculate your specific metrics. You get ready-to-run scripts for P&L, dividends, or tax reporting.

The results of the analysis

What you get from the analysis

The AI turns raw CSV data into actionable code.

CODE

Custom Python scripts

The agent writes scripts tailored to your specific CSV layout. You can run these locally to calculate returns or dividends.

MAPPING

Column identification

The AI identifies which columns represent tickers, quantities, and prices. This prevents errors in your math.

LOGIC

Custom math formulas

You define the logic, like weighted average cost or yield on cost. The AI translates that logic into code.

HUMAN

Manual code review

You must check the generated Python code before running it against your real financial data. The AI provides the logic, but you provide the final approval.

The workflow

What your AI does when the CSV arrives.

The agent handles the tedious work of reading file structures so you can focus on the math.

  1. Read the file

    The agent looks at your exported CSV to see how your broker labels its data.

    parse_portfolio_csv
  2. Map the columns

    It matches your broker's headers to standard financial terms like 'Ticker' or 'Cost Basis'.

    parse_portfolio_csv
  3. Write the script

    The agent uses the mapped structure to write Python code that performs your requested calculations.

    parse_portfolio_csv
  4. Verify the logic

    The agent explains how the code works so you can confirm the math is correct.

    parse_portfolio_csv

Try it

Copy these to start.

Use these prompts once you have connected the MCP.

Starting points

Swap the bracketed text for your specific broker name or the specific metric you want to calculate.

papaparse Connector

You're all set. Choose your MCP client and follow the setup instructions.

Connector linkhttps://edge.vinkius.com/vk_preview_UXTNF7rAXxtPhyKSsuqvjd7wl2jy9r8H1MHscdNL/mcp

Claude Desktop

Follow the steps below to connect in seconds.

  1. 1In Claude Desktop, open Settings → Connectors.
  2. 2Click “Add custom connector” and paste the connector link above as the remote MCP server URL.
  3. 3Click Add and start a new chat — papaparse capabilities are ready to use.
Configuration · claude_desktop_config.jsonCopy
{
  "mcpServers": {
    "portfolio-csv-analyzer-mcp": {
      "url": "https://edge.vinkius.com/vk_preview_UXTNF7rAXxtPhyKSsuqvjd7wl2jy9r8H1MHscdNL/mcp"
    }
  }
}
Copy into chat04
  • Read my [Broker Name] CSV and write a Python script to calculate my total realized P&L.

  • Map the columns in this portfolio export so I can write a script for dividend yield on cost.

  • Analyze this CSV structure and write a script to find my largest losers by percentage.

  • Based on this CSV, write a Python function that calculates the weighted average cost for each ticker.

  • Claude
  • ChatGPT
  • Cursor
  • VS Code
  • Windsurf
  • Claude Code
  • JetBrains
  • Cline

Start here

Connect Portfolio CSV Analyzer once, then ask.

One connection gives your agent access to your files. Your credentials stay encrypted and secure.

Connect Portfolio CSV Analyzer to your AI

FAQ

How this task behaves

  • 01

    Can the AI execute the Python code for me?

    No. The AI writes the code based on your CSV structure, but you must run the script in your own local environment.

  • 02

    Does the AI change my original CSV files?

    No. The tool only reads the files to understand the structure. It cannot modify or delete your original data.

  • 03

    Will it work with any broker export?

    Yes, as long as the export is in a CSV format. The AI maps the headers regardless of what your broker calls them.

  • 04

    Can it calculate taxes?

    It can write the Python code to perform tax calculations, but you are responsible for verifying the accuracy of the logic.

  • 05

    Do I need to upload my files to a website?

    No. You provide the files to your AI client, and the agent uses the connector to read them locally.

  • More questions about Portfolio CSV Analyzer? The Connector page answers them. See everything the Portfolio CSV Analyzer Connector can do

Connect papaparse to Claude, Cursor, ChatGPT & more