Historical PJM West Day-Ahead Prices
You need reliable, queryable historical PJM West Day-Ahead power prices to backtest hedges, mark positions, and reconcile settlement risk. By the end of this guide, you will know exactly how to call the Energy API time series endpoint for the PJM West Day-Ahead symbol, handle authentication, parse responses for use in finance workflows, and implement robust error handling when a symbol is temporarily unavailable.
What you are pulling and why it matters in finance
The PJM West Day-Ahead series represents day-ahead power prices for the PJM West hub, with values in USD/MWh. Finance teams use this series to:
- Backtest structured products and virtual bids using historical day-ahead prices.
- Calibrate risk models and stress scenarios for merchant assets and load hedges.
- Compute PnL explains and reconcile differences across trade capture, ETRM, and settlement systems.
Your code should treat this as a daily time series. Values are priced in USD per megawatt-hour (USD/MWh). Treat weekends and holidays as regular calendar dates; do not assume equity-style trading calendars—power markets commonly price weekends and holidays.
Access, authentication, and pricing
The Energy API uses an api_key query parameter for authentication. Replace only the api_key value with YOUR_API_KEY. The entry plan is Starter at $19.99/month with a 7-day trial and 50 calls, which is sufficient to validate integration and build your first dashboard before scaling usage.
Important constraints for this symbol and endpoint:
- Symbol name: PJM West Day-Ahead
- Symbol code: PJM_WEST_DA
- Unit: USD/MWh
- Authentication: api_key query parameter
- Do not pass base=USD when you also need TTF_GAS or EUA_CO2 in the same request.
Register to obtain an API key and view usage in your account:
Timeseries endpoint and parameters
Use GET /api/v1/timeseries with start, end, symbols, and api_key. The API returns a JSON envelope that includes:
- success: boolean indicating whether the request succeeded
- date: server-side date stamp
- base: base currency context
- rates: a map keyed by symbol code to numeric values
- dates: a map keyed by symbol code to ISO date string
- currencies: a map keyed by symbol code to the currency code
- base_filter_note, missing_symbols: diagnostic fields
When you request PJM_WEST_DA, read rates.PJM_WEST_DA and currencies.PJM_WEST_DA. Do not assume other fields unless provided in the envelope.
Official cURL request you can paste
The following request structure is supported. Replace YOUR_API_KEY with your actual key and keep the same parameter names:
curl -G "https://energy-api.com/api/v1/timeseries" --data-urlencode "start=2026-01-01" --data-urlencode "end=2026-03-31" --data-urlencode "symbols=PJM_WEST_DA" --data-urlencode "api_key=YOUR_API_KEY"
The official sample response (field anatomy)
This sample illustrates the envelope and fields you will parse in your code. Use it to confirm your parsing logic:
{
"success": true,
"date": "2026-11-23",
"base": "EUR",
"rates": {
"OMIE_ES_DA": 205.1999
},
"dates": {
"OMIE_ES_DA": "2026-11-23"
},
"currencies": {
"OMIE_ES_DA": "EUR"
},
"base_filter_note": null,
"missing_symbols": null
}
How to read it for finance workflows:
- rates.SYMBOL holds the numeric observation (e.g., a day-ahead price). Use this for valuation and backtesting.
- dates.SYMBOL is the ISO date for the associated value. Use it as your as-of key in reconciliations.
- currencies.SYMBOL is the pricing currency. For PJM_WEST_DA this will be USD.
- base provides a currency context for the response. Do not change base when mixing certain symbols like TTF_GAS or EUA_CO2 in multi-symbol requests.
Current availability status for PJM_WEST_DA
At the time of the live check, calling the timeseries endpoint with PJM_WEST_DA did not succeed. Your integration must detect and gracefully handle this scenario:
{"success":false,"error":"Symbol PJM_WEST_DA is not currently available. See \/api\/v1\/symbols for the current catalog."}
When you receive this envelope, do not assume partial results. In finance integrations, propagate a data-quality flag, exclude the affected symbol from risk metrics, and surface an actionable message to users (e.g., “PJM West Day-Ahead temporarily unavailable; check symbol catalog”).
Field reference using the same official sample
Some teams prefer to validate their parsers twice—once at ingestion and again in post-processing. The same official envelope is shown here so you can test your JSON path references in isolation:
{
"success": true,
"date": "2026-11-23",
"base": "EUR",
"rates": {
"OMIE_ES_DA": 205.1999
},
"dates": {
"OMIE_ES_DA": "2026-11-23"
},
"currencies": {
"OMIE_ES_DA": "EUR"
},
"base_filter_note": null,
"missing_symbols": null
}
In your production code for PJM_WEST_DA, replace the key you read from rates/ dates/ currencies to PJM_WEST_DA and keep the rest of your parsing logic identical.
Error handling: Unavailable symbol logic you can ship
Because availability can change (e.g., maintenance windows or catalog updates), production code must branch on success and provide an explicit fallback path:
- If success is false, read error for display and set your data freshness flag to “stale” for the affected symbol.
- Do not persist null or zero values into your finance warehouse, as that pollutes PnL explains.
- Optionally, retry with exponential backoff if your scheduler allows, but cap attempts to prevent rate-limit waste.
Here is the exact error envelope you should expect and handle:
{"success":false,"error":"Symbol PJM_WEST_DA is not currently available. See \/api\/v1\/symbols for the current catalog."}
Python example: Pull, validate, and normalize PJM_WEST_DA
This Python snippet calls the official endpoint, checks for success, and then reads the fields your finance stack actually needs. If the symbol is unavailable, it raises a clear exception with the server-provided message.
import os
import sys
import urllib.parse
import urllib.request
import json
from datetime import date
API_URL = "https://energy-api.com/api/v1/timeseries"
API_KEY = os.environ.get("ENERGY_API_KEY", "YOUR_API_KEY")
def fetch_pjm_west_da(start, end):
params = {
"start": start,
"end": end,
"symbols": "PJM_WEST_DA",
"api_key": API_KEY
}
url = API_URL + "?" + urllib.parse.urlencode(params)
req = urllib.request.Request(url, method="GET")
with urllib.request.urlopen(req, timeout=30) as resp:
body = resp.read().decode("utf-8")
payload = json.loads(body)
# Branch on success and return a normalized record for finance.
if not payload.get("success"):
err = payload.get("error", "Unknown error")
raise RuntimeError(f"Energy API error for PJM_WEST_DA: {err}")
# Read required fields for PJM_WEST_DA without inventing missing data.
rates = payload.get("rates", {})
currencies = payload.get("currencies", {})
dates = payload.get("dates", {})
symbol = "PJM_WEST_DA"
if symbol not in rates or symbol not in currencies or symbol not in dates:
raise ValueError("PJM_WEST_DA not present in response maps; do not proceed with partial data.")
return {
"symbol": symbol,
"price": rates[symbol], # USD/MWh numeric
"currency": currencies[symbol], # 'USD' for PJM_WEST_DA when available
"as_of": dates[symbol] # ISO date
}
if __name__ == "__main__":
# Example window chosen to match the cURL sample structure.
try:
record = fetch_pjm_west_da("2026-01-01", "2026-03-31")
print(json.dumps(record, indent=2))
except Exception as e:
# In production: log and propagate a data-quality signal instead of exiting silently.
sys.stderr.write(str(e) + "\n")
sys.exit(1)
JavaScript example: Fetch and extract finance-ready fields
This Node.js example mirrors the Python logic. It fails fast on error and returns only the normalized fields you will persist downstream.
import fetch from "node-fetch";
const API_URL = "https://energy-api.com/api/v1/timeseries";
const API_KEY = process.env.ENERGY_API_KEY || "YOUR_API_KEY";
async function fetchPjmWestDA(start, end) {
const url = new URL(API_URL);
url.searchParams.set("start", start);
url.searchParams.set("end", end);
url.searchParams.set("symbols", "PJM_WEST_DA");
url.searchParams.set("api_key", API_KEY);
const res = await fetch(url.toString(), { method: "GET" });
const payload = await res.json();
if (!payload.success) {
const err = payload.error || "Unknown error";
throw new Error(`Energy API error for PJM_WEST_DA: ${err}`);
}
const symbol = "PJM_WEST_DA";
const price = payload.rates?.[symbol];
const ccy = payload.currencies?.[symbol];
const asOf = payload.dates?.[symbol];
if (price == null || !ccy || !asOf) {
throw new Error("Missing fields for PJM_WEST_DA; do not persist partial data.");
}
return {
symbol,
price, // USD/MWh
currency: ccy,
as_of: asOf,
};
}
(async () => {
try {
const record = await fetchPjmWestDA("2026-01-01", "2026-03-31");
console.log(record);
} catch (e) {
console.error(e.message);
process.exit(1);
}
})();
Finance integration notes: dates, currency, and units
Units: USD/MWh for PJM_WEST_DA. Do not convert unless you have a firm requirement and a vetted FX curve. If you do convert, record both the native unit and the conversion source in your audit columns to protect PnL explains.
Dates: Use the ISO date from the dates map as the canonical as-of key. When you back-fill history, load one as-of per row into your warehouse and maintain strict idempotency via a unique key on (symbol, as_of).
Currency: Read currencies.PJM_WEST_DA. Avoid hardcoding USD in your finance layer—even if you expect it—so that your code generalizes to multi-market portfolios.
Performance, retries, and caching
Batching: If you query multiple symbols, use a single call with a comma-separated symbols list. For this guide we focus on PJM_WEST_DA only, but the same approach generalizes.
Retries: If success is false for PJM_WEST_DA, retries usually will not help until the catalog is updated. Prefer surfacing the message and scheduling a recheck later.
Caching: Cache positive results by (symbol, as_of). Cache negative availability checks for a short TTL to limit redundant calls in UI-driven flows.
Operational validation with the official sample again
If you need one more reference block to validate your JSON path logic in test harnesses, use the official envelope below. It should be parsed without special-case code, then swap OMIE_ES_DA for PJM_WEST_DA in production:
{
"success": true,
"date": "2026-11-23",
"base": "EUR",
"rates": {
"OMIE_ES_DA": 205.1999
},
"dates": {
"OMIE_ES_DA": "2026-11-23"
},
"currencies": {
"OMIE_ES_DA": "EUR"
},
"base_filter_note": null,
"missing_symbols": null
}
This ensures your map-lookups and guards are correct before you hit production data for PJM_WEST_DA.
Troubleshooting checklist
- 401 or authentication errors: Confirm api_key is present and spelled api_key, not apiKey or Authorization.
- Empty maps or missing key errors: Always check that rates.PJM_WEST_DA, dates.PJM_WEST_DA, and currencies.PJM_WEST_DA exist before persisting.
- Unexpected currency: Read currencies.PJM_WEST_DA from the response rather than hardcoding.
- Symbol unavailable: Handle the exact error envelope and re-check the symbol catalog before retrying.
FAQ
How do I authenticate my calls?
Include your key as the api_key query parameter. Example: api_key=YOUR_API_KEY. Do not place it in a header unless the documentation explicitly says so.
What unit should I store for PJM West Day-Ahead?
USD/MWh. Do not convert unless required, and if you do, track both original and converted values to preserve auditability in finance workflows.
What should I do when the symbol is unavailable?
Branch on success. If false, read error, suppress downstream PnL updates for that symbol and as-of, alert the operator, and schedule a later recheck.
How should I key my warehouse rows?
Use a unique key on (symbol, as_of). Store price, currency, load timestamp, and a data-quality flag. This simplifies backfills and idempotent re-runs.
Can I request multiple symbols at once?
Yes, pass a comma-separated symbols list to the same endpoint. Do not pass base=USD when also requesting TTF_GAS or EUA_CO2.
Next step
Create your key, paste the cURL, and wire the Python or JavaScript snippet into your job runner. Once PJM_WEST_DA is available, your code will read rates.PJM_WEST_DA, currencies.PJM_WEST_DA, and dates.PJM_WEST_DA and persist them to your finance data store. If the symbol is temporarily unavailable, you now have robust error handling to protect your marks and PnL explains. To get started, visit the API docs and register:
Ready to get started?
Get your API key and start querying energy commodity prices in minutes.
Get API Key