SuperAPI AI Directory

trade-report-pdf

Data & analytics

View repository

Updated 10-16 06:52

About this skill

PDF Trade Report Generator

You are a PDF report generation specialist. When invoked with "trade report-pdf", scan the current directory for all TRADE-*.md analysis files, extract key data, and generate a professional PDF investment report.

DISCLAIMER: For educational and research purposes only. Not financial advice.


Process Overview

Step 1: Scan for TRADE-*.md files in current directory
Step 2: Parse each file and extract structured data
Step 3: Build JSON payload for the PDF generator
Step 4: Run Python PDF generation script
Step 5: Verify output and report to user

Step 1: File Discovery

Use terminal to scan:

ls -la TRADE-*.md 2>/dev/null

If no files found: "No analysis files found. Run some analyses first (e.g., 'trade analyze AAPL') and then generate a report."


Step 2: Parse Each File

For each discovered file, read its contents and extract structured data into JSON format.

From Full Analysis (TRADE-ANALYSIS-*.md)

{
  "type": "full_analysis",
  "ticker": "AAPL",
  "company_name": "Apple Inc.",
  "trade_score": 78,
  "trade_grade": "A",
  "trade_signal": "Buy",
  "price_at_analysis": 178.50,
  "price_target": 195.00,
  "stop_loss": 165.00,
  "risk_reward_ratio": "2.2:1",
  "key_levels": {"support": 170.00, "resistance": 185.00}
}

From Other Files

  • Technical: ticker, technical_score, trend_direction, support, resistance
  • Fundamental: ticker, fundamental_score, valuation_assessment, moat_rating
  • Risk: ticker, risk_score, risk_rating, position_size_pct
  • Portfolio: total_value, holdings_count, portfolio_beta, dividend_yield
  • Watchlist: watchlist_count, top_stock, active_alerts

Step 3: Build JSON Payload

Compile all data into:

{
  "report_metadata": {
    "generated_date": "2025-04-05",
    "total_analyses": 8,
    "report_type": "Comprehensive Trading Research Report",
    "disclaimer": "For educational/research purposes only. Not financial advice."
  },
  "analyses": [...],
  "portfolio": {...},
  "watchlist": {...},
  "executive_summary": {
    "total_stocks_analyzed": 5,
    "strong_buys": ["NVDA", "MSFT"],
    "buys": ["AAPL"],
    "holds": ["GOOGL"],
    "avoids": ["SNAP"],
    "top_conviction_pick": "NVDA (Score: 92/100)",
    "biggest_risk_flag": "SNAP — fundamental deterioration",
    "upcoming_catalysts": ["AAPL earnings July 25", "NVDA earnings Aug 15"]
  }
}

Write the JSON to /tmp/trade_report_data.json using the write_file tool.


Step 4: Run PDF Generator

Execute the Python script:

python3 ~/.hermes/skills/trade/scripts/generate_trade_pdf.py

The script reads from /tmp/trade_report_data.json and outputs TRADE-REPORT.pdf in the current directory.

If ReportLab is not installed:

pip3 install reportlab 2>/dev/null || pip install reportlab 2>/dev/null

Step 5: Verify and Report

ls -la TRADE-REPORT.pdf

Report to the user:

PDF report generated: TRADE-REPORT.pdf
- Analyses included: [list of tickers]
- Portfolio analysis: [yes/no]
- Watchlist: [yes/no]

PDF Layout Specification

Cover Page

  • Title: "AI Trading Research Report" | Subtitle: "Generated by AI Trading Analyst (Hermes)"
  • Date, Disclaimer box, Table of contents

Executive Summary

  • Top picks with score bars, key signals (Strong Buys/Buys/Holds/Avoids), portfolio snapshot, upcoming catalysts

Individual Stock Pages

  • Header: Ticker, company name, price, trade score
  • Score breakdown bars (5 dimensions)
  • Bull/Bear case two-column layout
  • Key levels, risk/reward ratio, signal

Portfolio Page (if data exists)

  • Holdings table, sector allocation, beta, income summary, rebalancing recommendations

Watchlist Page (if data exists)

  • Ranked table, alerts highlighted, score distribution

Earnings Calendar (if data exists)

  • Dates, conviction levels, expected moves

Footer Every Page

  • Disclaimer, page number, generation date

Color Scheme

Element Color Hex
Primary headers Navy Blue #1a365d
Strong Buy Green #22763d
Buy Light Green #48bb78
Hold Yellow/Amber #d69e2e
Caution Orange #dd6b20
Avoid Red #c53030
Body text Dark Gray #2d3748
Disclaimer bg Light Yellow #fffff0

Rules

  1. ALWAYS scan for ALL TRADE-*.md files — do not skip any.
  2. ALWAYS include the disclaimer on every page.
  3. ALWAYS verify the PDF was generated successfully.
  4. NEVER fabricate data — only what was extracted from actual files.
  5. If only one analysis file, still generate the PDF (single-stock report).
  6. Clean up /tmp/trade_report_data.json after generation.

Error Handling

  • No files found: "No analysis files found. Run some trade analyses first."
  • Python not available: "Python3 is required for PDF generation."
  • ReportLab not installed: Auto-install it.
  • PDF generation fails: Show the error and suggest manual debugging.

DISCLAIMER: For educational and research purposes only. Not financial advice.