0PricingLogin
AI Prompt Engineering · Lesson

Financial and Quantitative Prompts

Earnings analysis, risk scoring, SEC filing extraction prompts.

Financial Prompting Context

Financial domain prompting extracts structured data from unstructured documents — earnings reports, SEC filings, analyst notes. Precision matters: a misread revenue figure or inverted growth direction can cause serious downstream errors.

Earnings Report Extraction Prompt

Earnings reports follow a semi-standard structure. A targeted extraction prompt pulls the key financial metrics precisely, handling both GAAP and non-GAAP variants.

EARNINGS_EXTRACTION_PROMPT = '''Extract the following financial metrics from the earnings report below.
Return ONLY a JSON object with these exact keys.
If a value is not stated, use null.
Do not calculate or derive values — only extract explicitly stated figures.

Required fields:
- revenue_usd_millions: total net revenue (GAAP)
- revenue_yoy_pct: year-over-year revenue growth percentage
- gross_margin_pct: gross margin percentage (GAAP)
- operating_income_usd_millions: GAAP operating income/loss
- ebitda_usd_millions: Adjusted EBITDA (non-GAAP, if reported)
- net_income_usd_millions: GAAP net income/loss
- eps_diluted: diluted EPS (GAAP)
- eps_adj_diluted: adjusted diluted EPS (non-GAAP, if reported)
- guidance_next_quarter_revenue_low: low end of next quarter revenue guidance
- guidance_next_quarter_revenue_high: high end of next quarter revenue guidance
- fiscal_period: e.g. "Q3 FY2024"

Earnings Report:
{report_text}'''

import anthropic, json
client = anthropic.Anthropic(api_key='YOUR_API_KEY')

def extract_earnings(report_text):
    response = client.messages.create(
        model='claude-opus-4-5', max_tokens=1000,
        messages=[{'role': 'user', 'content':
            EARNINGS_EXTRACTION_PROMPT.format(report_text=report_text)}]
    )
    return json.loads(response.content[0].text)

All lessons in this course

  1. Legal Domain Prompt Patterns
  2. Medical and Clinical Prompting
  3. Financial and Quantitative Prompts
  4. Domain Glossary and Ontology Injection
← Back to AI Prompt Engineering