AI Prompts

Copy-paste prompts for ChatGPT, Claude, and other AI assistants. Hand one to the AI, swap in your API key and tickers, and let it do the download and analysis for you.

How to use this page

1
Get an API key
Register at the Download page. Your key looks like hfd_…. Free, instant, 100 downloads/minute.
2
Copy a prompt
Each card below has a Copy button in the top right. Pick the scenario closest to what you want and click it.
3
Replace the placeholders
Yellow-pill tokens like YOUR_API_KEY and AAPL are meant to be edited. Swap in your real values.
4
Paste into the AI
Use a model that can run code (Claude with computer use, ChatGPT Code Interpreter, Claude Code). Chat-only models will hand you a curl command — you run it.
Never paste your API key into a public or shared chat. Use a private session. If you suspect leakage, regenerate your key from your account page — old keys revoke instantly.

Prompts

1. Download one ticker, full history

Pulls the entire historical record (2002–present) for a single ticker as a parquet file, loads it with pandas, and prints a summary.

Download high-frequency stock data from the HF Data Library and give me a summary.

Configuration:
  ticker     = AAPL
  version    = clean        # "clean" = filtered, "raw" = as-received
  api_key    = YOUR_API_KEY

Step 1 — Download the parquet file (entire history, ~24 years, single request):

  curl -H "X-API-Key: YOUR_API_KEY" \
       "https://api.hfdatalibrary.com/v1/bars/AAPL?version=clean" \
       -o AAPL.parquet

Step 2 — Load with pandas:

  import pandas as pd
  df = pd.read_parquet("AAPL.parquet")

Columns: datetime (Eastern Time, tz-naive), open, high, low, close, volume, source.
"source" is "pitrading" for pre-2022-03-04 and "iex" for post-2022-03-07.

Step 3 — Report:
  - total bars
  - date range (first and last datetime)
  - mean / min / max close price
  - number of trading days with at least one bar
  - first 5 rows
Swap AAPL for any ticker (e.g. NVDA, MSFT, SPY). Use raw instead of clean to get the unfiltered version. See the tickers page for the full universe.

2. Download several tickers and combine them

Loops through a list of tickers, downloads each, and concatenates into a single long-format DataFrame.

Download one-minute OHLCV data from the HF Data Library for several tickers and combine them into a single DataFrame.

Configuration:
  tickers    = AAPL, MSFT, GOOG, NVDA, AMZN, META, TSLA
  version    = clean
  api_key    = YOUR_API_KEY

For each ticker, fetch the parquet:

  curl -H "X-API-Key: YOUR_API_KEY" \
       "https://api.hfdatalibrary.com/v1/bars/${TICKER}?version=clean" \
       -o "${TICKER}.parquet"

Combine in Python:

  import pandas as pd, glob, os
  dfs = []
  for path in sorted(glob.glob("*.parquet")):
      d = pd.read_parquet(path)
      d["ticker"] = os.path.basename(path).replace(".parquet", "")
      dfs.append(d)
  combined = pd.concat(dfs, ignore_index=True)
  combined = combined[["ticker", "datetime", "open", "high", "low", "close", "volume", "source"]]

Report:
  - bars per ticker
  - shared (overlapping) date range across all tickers
  - mean daily volume per ticker
  - total combined row count and memory footprint
Pace the loop — the per-user rate limit is 100 downloads/minute. For 50+ tickers, ask the AI to add a small sleep between requests.

3. Date-range analysis (e.g., realized volatility for one quarter)

Downloads a ticker, slices to a specific window client-side, and computes daily realized volatility from one-minute log returns.

Download HF Data Library data for one ticker, slice to a specific date range, and compute daily realized volatility.

Configuration:
  ticker     = NVDA
  version    = clean
  start_date = 2024-10-01
  end_date   = 2024-12-31
  api_key    = YOUR_API_KEY

Step 1 — Download (the API ships entire-ticker files; slice client-side):

  curl -H "X-API-Key: YOUR_API_KEY" \
       "https://api.hfdatalibrary.com/v1/bars/NVDA?version=clean" \
       -o NVDA.parquet

Step 2 — Slice and compute realized variance (sum of squared 1-min log returns per day):

  import numpy as np, pandas as pd
  df = pd.read_parquet("NVDA.parquet")
  df["datetime"] = pd.to_datetime(df["datetime"])
  window = df[(df.datetime >= "2024-10-01") & (df.datetime < "2025-01-01")].copy()
  window["date"] = window.datetime.dt.date
  window["log_ret"] = np.log(window.close).diff()
  daily_rv = window.groupby("date")["log_ret"].apply(lambda r: (r**2).sum())

Report:
  - highest-RV trading day and its value
  - the 5 trading days with the largest absolute close-to-close moves
  - mean RV across the window
  - a simple chart of daily RV over the window
For methodology, point the AI at the documentation page — cleaning rules and version trade-offs (raw vs clean, gap handling) are spelled out there.

4. Chat-only AI — just generate the curl command

For ChatGPT, Claude, etc. without code execution. The AI writes the curl; you paste it into your terminal.

I have an HF Data Library API key (https://hfdatalibrary.com) and need a shell command to download 1-minute OHLCV bars for a ticker.

Configuration:
  ticker  = AAPL
  version = clean
  api_key = YOUR_API_KEY

The endpoint is:
  GET https://api.hfdatalibrary.com/v1/bars/{TICKER}?version={VERSION}
  Header: X-API-Key: YOUR_API_KEY

Give me a single curl command that:
  1. authenticates with X-API-Key
  2. downloads the parquet file to ./AAPL_clean.parquet
  3. fails with a non-zero exit code on HTTP error (so the shell knows it broke)
  4. prints a short success message with the file size on completion

Also give me the equivalent commands in:
  - Python (using requests, save to disk)
  - R (using httr2 or curl, save to disk)

No explanation, just the four commands.
Useful when you're on a phone or shared machine and can't run scripts. The AI returns the commands; you copy and paste into your own terminal.

5. Build a sector or index bundle

Hand the AI a list of tickers (or ask it to fetch one), download each, and assemble a sector-level dataset.

Build a one-minute OHLCV dataset for a sector / index from the HF Data Library.

Configuration:
  bundle     = Magnificent 7        # or: S&P 500, Dow 30, sector-tech, sector-financials
  tickers    = AAPL, MSFT, GOOG, NVDA, AMZN, META, TSLA
  version    = clean
  api_key    = YOUR_API_KEY
  out_dir    = mag7_data/

If the bundle name is recognized but no tickers are supplied, look up the constituents (you can use https://hfdatalibrary.com/pages/tickers as a reference or a public source for index membership).

Download each ticker, throttled to ~1 request/second to stay under the 100/min rate limit:

  mkdir -p mag7_data
  for T in AAPL MSFT GOOG NVDA AMZN META TSLA; do
    curl -H "X-API-Key: YOUR_API_KEY" \
         "https://api.hfdatalibrary.com/v1/bars/${T}?version=clean" \
         -o "mag7_data/${T}.parquet"
    sleep 1
  done

Then in Python:
  import pandas as pd, glob, os
  files = sorted(glob.glob("mag7_data/*.parquet"))
  combined = pd.concat([
      pd.read_parquet(f).assign(ticker=os.path.basename(f).replace(".parquet",""))
      for f in files
  ], ignore_index=True)
  combined.to_parquet("mag7_combined.parquet")

Report total bars, ticker count, date range, and combined-file size.
For index constituents that change over time (S&P 500, etc.), tell the AI the date you want the membership snapshot from — otherwise it may use today's roster for a 2008 analysis.

6. Download a coarser timeframe (5-min, hourly, daily…)

The 1-minute endpoint is the simplest path. For other timeframes you use the two-step signed-URL flow.

Download HF Data Library data at a non-1-minute timeframe. The /v1/bars/{TICKER} endpoint only serves 1min — for other intervals, use the signed-URL flow.

Configuration:
  ticker     = SPY
  version    = clean
  timeframe  = 5min          # allowed: 1min, 5min, 15min, 30min, hourly, daily, weekly, monthly
  format     = parquet       # or csv
  api_key    = YOUR_API_KEY

Step 1 — Request a signed download URL (the token is valid 10 minutes):

  curl -H "Authorization: Bearer YOUR_API_KEY" \
       "https://api.hfdatalibrary.com/v1/download-token/SPY?version=clean&timeframe=5min&format=parquet"

Response (JSON):
  {
    "url": "https://api.hfdatalibrary.com/v1/download/SPY?token=...",
    "expires_at": "...",
    "version": "clean", "timeframe": "5min", "format": "parquet"
  }

Step 2 — Fetch the `url` value (no auth header needed; the token authorizes it):

  curl "" -o SPY_clean_5min.parquet

Then load with pandas as in prompt 1. Show me the first 5 rows and confirm the inter-bar spacing is 5 minutes.
The 1-minute version is the canonical dataset. Pre-aggregated 5/15/30-min and hourly/daily/weekly/monthly files are derived from it — same source, just coarser sampling.

Tips & limits

Want a prompt added? If you have a workflow that AI assistants keep getting wrong (or a frequent analysis pattern), email me and I'll add a vetted prompt to this page.