Module 4: Claude Desktop & Code

MGMT 675: Generative AI for Finance

Kerry Back, Rice University

Outline

  1. Claude Desktop Install
  2. Building Small Web Apps
  3. Working with Files

Claude Desktop Overview

Three Tabs: Chat, Cowork, Code

Chat (Analysis)

  • Sandboxed Python in the browser
  • No local file access
  • Must upload data manually

Cowork

  • Runs in a local VM
  • Files synced to/from VM
  • No internet access

Code

  • Runs on your machine
  • Full local file access
  • Full internet access

Code mode gives Claude direct access to your machine — no sandbox, no VM, no upload step.

Which Tool When?

  • Chat for questions, explanations, and brainstorming
  • Artifacts for quick interactive tools (e.g., a DCF calculator with sliders)
  • Code can do everything Cowork can do, plus it has full internet access and direct access to your local files
  • Code can also build and deploy interactive tools (like Artifacts)
  • Cowork’s advantage is that it requires no local software setup and runs in an isolated sandbox

Class Installers

The class installer sets up everything you need in one step:

  • Python — language Claude Code uses to execute analysis
  • Git for Windows (Windows only) — required by the terminal Claude Code
  • Claude Desktop — the application with built-in Claude Code
  • Claude Code (terminal) — run claude from any terminal or VS Code

Running the Installers

Windows

  1. Download Windows Installer
  2. Extract the zip file
  3. Double-click INSTALL.bat
  4. Click Yes when the permission prompt appears

Mac

  1. Download Mac Installer to Downloads
  2. Open Terminal
  3. Run: cd ~/Downloads && bash install.sh

Getting Started

  1. Open Claude Desktop → Code tab
  2. Select a working folder for your project
  3. Choose a model: use Sonnet to conserve tokens; Opus is more thorough but uses tokens much faster
  4. I would set permission mode to auto-accept, but do what you feel comfortable with.

Copy and Paste into Claude Code

Create an Excel workbook with a loan amortization table for a $300,000 mortgage at 6.5% annual interest with a 30-year term and monthly payments. Use formulas so I can change the loan amount, rate, and term. Include columns for payment number, payment, principal, interest, and remaining balance.

Terminal Alternative

The Code tab in Claude Desktop and the terminal command claude use the same engine.

Claude Desktop (Code tab)

  • Visual interface with file browser
  • Click to select working folder
  • Good for getting started

Terminal (claude)

  • Type claude in any terminal
  • Same skills, same config
  • Integrates with VS Code

Both approaches share the same skills, MCP servers, and configuration files.

Building Small Web Apps

Running Python in the Browser

Pyodide is a full Python runtime compiled to WebAssembly. It runs inside a browser tab — no server, no installation.

What Pyodide Provides

  • Full CPython interpreter in the browser
  • NumPy, pandas, and other scientific packages
  • Bidirectional JavaScript ↔︎ Python interop

What You Can Build

  • Calculators and financial models
  • Interactive charts and dashboards
  • Any tool that runs entirely in the browser

This is the same technology Claude uses under the hood for artifacts — a self-contained HTML file with Pyodide embedded in it.

Example: NPV Web App

Ask Claude Code:

“Create an HTML file called npv.html that uses Pyodide to compute NPV. Provide input cells for cash flows at dates 0 through 5 and a discount rate. Compute and display the NPV when the user clicks a button.”

Then:

  1. Find npv.html in your project folder
  2. Double-click it — it opens in your browser
  3. Enter cash flows and a discount rate, click the button, and see the NPV

The HTML file is self-contained. Anyone can open it — no Python installation needed.

Example: Bar Chart Race

Download marketcap.xlsx — end-of-year market cap by sector, 2000–2025.

Upload it to Claude and ask:

“Build a web app with a bar chart race to show how the sizes of different sectors have changed over time.”

Claude reads the data and writes the Plotly code — you get an interactive animated chart without writing a line of code.

Working with Files

Download the Example Files

Download module4.zip and extract it to a folder on your computer.

Point Claude Code to that folder. It contains three subfolders:

  • Example1/ — portfolio holdings spreadsheet
  • Example2/ — loan terms document and payment history spreadsheet
  • Example3/ — earnings PDF report and stock prices spreadsheet

Copy and Paste into Claude Code

Read the file Example1/portfolio.xlsx, which contains holdings with columns for ticker, asset class, sector, and market value. Create a pivot table showing total market value by asset class and sector. Save the pivot table to a new file called summary.xlsx.

Merging Data from Different Sources

Real financial data rarely lives in a single file or format. Claude Code can read Excel, PDF, and Word files, then combine, filter, and aggregate.

%%{init: {'theme': 'base', 'themeVariables': {'fontSize': '28px'}, 'flowchart': {'nodeSpacing': 80, 'rankSpacing': 120, 'padding': 24, 'useMaxWidth': true}}}%%
flowchart LR
  WRD["<b>Word</b>"] --> CC["<b>Claude Code</b><br>Merge, Filter, Aggregate"]
  XLS["<b>Excel</b>"] --> CC
  PDF["<b>PDF</b>"] --> CC
  CC --> UT["<b>Unified Table</b>"]

  style WRD fill:#eff6ff,stroke:#3b82f6,stroke-width:2px,color:#0f172a,font-size:28px,padding:20px
  style XLS fill:#eff6ff,stroke:#3b82f6,stroke-width:2px,color:#0f172a,font-size:28px,padding:20px
  style PDF fill:#eff6ff,stroke:#3b82f6,stroke-width:2px,color:#0f172a,font-size:28px,padding:20px
  style CC fill:#dbeafe,stroke:#3b82f6,stroke-width:2px,color:#0f172a,font-size:28px,padding:20px
  style UT fill:#fff7ed,stroke:#ea580c,stroke-width:2px,color:#0f172a,font-size:28px,padding:20px

Copy and Paste into Claude Code

The file Example2/loan_terms.docx contains a table with columns for borrower, loan type, origination date, principal, and interest rate. The file Example2/payments.xlsx contains monthly payment records with columns for borrower, date, and payment amount. Combine the two files on borrower name. Filter to loans with original principal above $500,000. Compute average interest rate and total original principal by loan type and save the results to summary.xlsx.

Copy and Paste into Claude Code

The file Example3/earnings.pdf contains a table of Q4 2024 earnings results with columns for ticker, company, revenue, EPS, and guidance. The file Example3/prices.xlsx contains closing stock prices. Read both files, merge on ticker, and compute the price-to-earnings ratio for each company. Save the results sorted by P/E ratio to pe_analysis.xlsx.