Capacity (beta)
UPDATED Thursday July 15, 10:08 PM PST
HTTP Request for wind
GET https://wprice.io/api/v1/present/auctioninfo/auctionCapacity
This endpoint returns various metrics, where available, of a zone"s Capacity market.
Requires an API Key
This feature is only available to WattPricer Account-holders.
#
Query ParametersParameter | Description | Examples |
---|---|---|
zone_key | A string representing the zone identifier. We use a combination of ISO 3166-1 alpha-2 country codes, ISO 3166-2 country subdivision code, and where applicable, ISO 639-1 language codes for our locale codes. See the /zones endpoint for a list of valid zones. | US-MISO |
metric | Statistic regarding the capacity market of the zone in question (see below) | OFFSUB |
as_csv (OPTIONAL) | Boolean indicating whether to return the data in CSV format. | true |
The metric
parameter is a string corresponding to one of the following fields:
Metric Name | Metric Description | Units |
---|---|---|
PRMR | PRMR (Planning Reserve Margin Requirement) | MW |
OFFSUB | Offer Submitted (Including FRAP) | MW |
FRAP | Fixed Resource Adequacy Plan (FRAP) | MW |
SS | Self Scheduled (SS) | MW |
NSSOC | Non-SS Offer Cleared | MW |
COMIT | Committed (Offer Cleared + FRAP) | MW |
LCR | Local Clearing Requirement (LCR) | MW |
CIL | Capacity Import Limit (CIL) | MW |
ZIA | Zonal Import Ability (ZIA) | MW |
IMPORT | Import | MW |
CEL | Capacity Export Limit (CEL) | MW |
export | Export | MW |
ACP | Auction Clearing Price | currency/MWDay |
UCAPT | Unforced Capacity (UCAP) Total | MW |
UCAPC | Unforced Capacity (UCAP) (Confirmed) | MW |
UCAPU | Unforced Capacity (UCAP) (Unconfirmed) | MW |
CUC | Converted Unforced Capacity (Zonal Resource Credit) | MW |
UCAP | Unconverted Unforced Capacity (UCAP) | MW |
FRAMZRC | FRAP + ZRC Offer | MW |
ZRCNO | ZRC Not Offered/FRAP | MW |
ZRCNP | MW/ZRC not participating in PRA | MW |
CPDF | CPDF (Coincident Peak Demand Forecast) | MW |
CPDFTL | CPDF + Transmission Losses | MW |
PRM | Planning Reserve Margin (PRM) | percentage |
ZCPDF | ZCPDF (Zonal Coincident Peak Demand Forecast) | MW |
ZCPDFZTL | ZCPDF + Zonal Trans. Losses | MW |
LRRF | LRR (Local Reliability Requirement) Factor | unitless |
LRR | LRR | MW |
NPTE | Non-Pseudo Tied Exports | MW |
LCRP | LCR as a % of PRMR | percentage |
#
Code samples- cURL
- C#
- Java
- JS
- Node
- ObjC
- PHP
- Python
- R
- Ruby
- Rust
- Scala
- TS
cURL command
@ECHO OFF
curl -v -X GET "https://wprice.io/api/v1/present/auctioninfo/auctionCapacity?zone_key={string}&metric={string}&as_csv={boolean}"-H "x-api-key: {subscription key}"
--data-ascii "{body}"
C-sharp code
using System;using System.Net.Http.Headers;using System.Text;using System.Net.Http;using System.Web;
namespace CSHttpClientSample{ static class Program { static void Main() { MakeRequest(); Console.WriteLine("Hit ENTER to exit..."); Console.ReadLine(); } static async void MakeRequest() { var client = new HttpClient(); var queryString = HttpUtility.ParseQueryString(string.Empty);
// Request headers client.DefaultRequestHeaders.Add("x-api-key", "{subscription key}");
// Request parameters queryString["zone_key"] = "{string}"; queryString["metric"] = "{string}"; queryString["as_csv"] = "{boolean}"; var uri = "https://wprice.io/api/v1/present/auctioninfo/auctionCapacity?" + queryString;
var response = await client.GetAsync(uri); } }}
Java code
// // This sample uses the Apache HTTP client from HTTP Components (http://hc.apache.org/httpcomponents-client-ga/)import java.net.URI;import org.apache.http.HttpEntity;import org.apache.http.HttpResponse;import org.apache.http.client.HttpClient;import org.apache.http.client.methods.HttpGet;import org.apache.http.client.utils.URIBuilder;import org.apache.http.impl.client.HttpClients;import org.apache.http.util.EntityUtils;
public class JavaSample { public static void main(String[] args) { HttpClient httpclient = HttpClients.createDefault();
try { URIBuilder builder = new URIBuilder("https://wprice.io/api/v1/present/auctioninfo/auctionCapacity");
builder.setParameter("zone_key", "{string}"); builder.setParameter("metric", "{string}"); builder.setParameter("as_csv", "{boolean}");
URI uri = builder.build(); HttpGet request = new HttpGet(uri); request.setHeader("x-api-key", "{subscription key}");
// Request body StringEntity reqEntity = new StringEntity("{body}"); request.setEntity(reqEntity);
HttpResponse response = httpclient.execute(request); HttpEntity entity = response.getEntity();
if (entity != null) { System.out.println(EntityUtils.toString(entity)); } } catch (Exception e) { System.out.println(e.getMessage()); } }}
JavaScript code
<!DOCTYPE html><html><head> <title>JSSample</title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script></head><body>
<script type="text/javascript"> $(function() { var params = { // Request parameters "zone_key": "{string}", "metric": "{string}", "as_csv": "{boolean}", }; $.ajax({ url: "https://wprice.io/api/v1/present/auctioninfo/auctionCapacity?" + $.param(params), beforeSend: function(xhrObj){ // Request headers xhrObj.setRequestHeader("x-api-key","{subscription key}"); }, type: "GET", // Request body data: "{body}", }) .done(function(data) { alert("success"); }) .fail(function() { alert("error"); }); });</script></body></html>
Node wattpricer.js code
const axios = require("axios");const BASE_URL = `https://wprice.io`
module.exports = { getCapacityMarketData: (zoneKeyString, asCSVBool) => axios({ method:"GET", url : BASE_URL + `/api/v1/present/auctioninfo/auctionCapacity?`, headers: { "content-type": "application/json", "x-api-key": "{subscription key}" }, params: { zone_key: zoneKeyString, as_csv: asCSVBool } })}
Node app.js code
const WattPricerAPI = require('./wattpricer')const asyncApiCall = async () => { const response = await WattPricerAPI.getCapacityMarketData('{string}', '{boolean}') console.log(response.data)}asyncApiCall()
Objective C code
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[]){ NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSString* path = @"https://wprice.io/api/v1/present/auctioninfo/auctionCapacity"; NSArray* array = @[ // Request parameters @"zone_key={string}", @"metric={string}", @"as_csv={boolean}", ]; NSString* string = [array componentsJoinedByString:@"&"]; path = [path stringByAppendingFormat:@"?%@", string];
NSLog(@"%@", path);
NSMutableURLRequest* _request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:path]]; [_request setHTTPMethod:@"GET"]; // Request headers [_request setValue:@"{subscription key}" forHTTPHeaderField:@"x-api-key"]; // Request body [_request setHTTPBody:[@"{body}" dataUsingEncoding:NSUTF8StringEncoding]]; NSURLResponse *response = nil; NSError *error = nil; NSData* _connectionData = [NSURLConnection sendSynchronousRequest:_request returningResponse:&response error:&error];
if (nil != error) { NSLog(@"Error: %@", error); } else { NSError* error = nil; NSMutableDictionary* json = nil; NSString* dataString = [[NSString alloc] initWithData:_connectionData encoding:NSUTF8StringEncoding]; NSLog(@"%@", dataString); if (nil != _connectionData) { json = [NSJSONSerialization JSONObjectWithData:_connectionData options:NSJSONReadingMutableContainers error:&error]; } if (error || !json) { NSLog(@"Could not parse loaded json with error:%@", error); } NSLog(@"%@", json); _connectionData = nil; } [pool drain];
return 0;}
PHP code
<?php// This sample uses the Apache HTTP client from HTTP Components (http://hc.apache.org/httpcomponents-client-ga/)require_once 'HTTP/Request2.php';
$request = new Http_Request2('https://wprice.io/api/v1/present/auctioninfo/auctionCapacity');$url = $request->getUrl();
$headers = array( // Request headers 'x-api-key' => '{subscription key}',);
$request->setHeader($headers);
$parameters = array( // Request parameters 'zone_key' => '{string}', 'metric': '{string}', 'as_csv' => '{boolean}',);
$url->setQueryVariables($parameters);
$request->setMethod(HTTP_Request2::METHOD_GET);
// Request body$request->setBody("{body}");
try{ $response = $request->send(); echo $response->getBody();}catch (HttpException $ex){ echo $ex;}
?>
Python 3.X code
import http.client, urllib.request, urllib.parse, urllib.error, base64
headers = { # Request headers 'x-api-key': '{subscription key}',}
params = urllib.parse.urlencode({ # Request parameters 'zone_key': '{string}', 'metric': '{string}', 'as_csv': '{boolean}',})
try: conn = http.client.HTTPSConnection('wprice.io') conn.request("GET", "/api/v1/present/auctioninfo/auctionCapacity?%s" % params, "{body}", headers) response = conn.getresponse() data = response.read() print(data) conn.close()except Exception as e: print("[Errno {0}] {1}".format(e.errno, e.strerror))
Python 2.X reached EOL in 2020. For legacy systems that still use it, you can use the following code:
Python 2.7 code
import httplib, urllib, base64
headers = { # Request headers 'x-api-key': '{subscription key}',}
params = urllib.urlencode({ # Request parameters 'zone_key': '{string}', 'as_csv': '{boolean}',})
try: conn = httplib.HTTPSConnection('api.pjm.com') conn.request("GET", "/api/v1/present/auctioninfo/auctionCapacity?%s" % params, "{body}", headers) response = conn.getresponse() data = response.read() print(data) conn.close()except Exception as e: print("[Errno {0}] {1}".format(e.errno, e.strerror))
R code
#NOTE: if you have problems with ggmap, try to install both ggplot and ggmap from github#devtools::install_github("dkahle/ggmap")#devtools::install_github("hadley/ggplot2")library(ggmap)library(ggplot2)library(dplyr)library(rjson)library(jsonlite)library(RCurl)
# Base URL pathbase_url = "https://wprice.io/api/v1/present/auctioninfo/auctionCapacity?"full_url = paste0(base_url, "zone_key={string}", "&{as_csv}={boolean}")# encode the URL with characters for each space.full_url <- URLencode(full_url)
# Convert JSON to data framepop_proj_data_df <- fromJSON(getURL(full_url))head(pop_proj_data_df, n = 2)
Ruby code
require 'net/http'
uri = URI('https://wprice.io/api/v1/present/auctioninfo/auctionCapacity')
query = URI.encode_www_form({ # Request parameters 'zone_key' => '{string}', 'metric' => '{string}', 'as_csv' => '{boolean}',})if query.length > 0 if uri.query && uri.query.length > 0 uri.query += '&' + query else uri.query = query endend
request = Net::HTTP::Get.new(uri.request_uri)# Request headersrequest['x-api-key'] = '{subscription key}'# Request bodyrequest.body = "{body}"
response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http| http.request(request)end
puts response.body
Rust code (synchronous)
use error_chain::error_chain;use std::io::Read;use exitfailure::ExitFailure;use reqwest::Url;use serde_derive::{Deserialize, Serialize};use std::env;
error_chain! { foreign_links { Io(std::io::Error); HttpRequest(reqwest::Error); }}
fn main() -> Result<()> { let mut res = reqwest::blocking::get("https://wprice.io/api/v1/present/auctioninfo/auctionCapacity?zone_key={string}&as_csv={boolean}")?; let mut body = String::new(); res.read_to_string(&mut body)?;
println!("Status: {}", res.status()); println!("Headers:\n{:#?}", res.headers()); println!("Body:\n{}", body);
Ok(())}
Rust code (async)
use error_chain::error_chain;use exitfailure::ExitFailure;use reqwest::Url;use serde_derive::{Deserialize, Serialize};use std::env;
error_chain! { foreign_links { Io(std::io::Error); HttpRequest(reqwest::Error); }}
#[tokio::main]async fn main() -> Result<()> { let res = reqwest::get("https://wprice.io/api/v1/present/auctioninfo/auctionCapacity?zone_key={string}&as_csv={boolean}").await?; println!("Status: {}", res.status()); println!("Headers:\n{:#?}", res.headers());
let body = res.text().await?; println!("Body:\n{}", body); Ok(())}
Scala code
//Imports for Dispatchimport dispatch._import Defaults._
object Places {
def main(args: Array[String]) {
//Prepare the request object
//even though its a https . doing a .secure is not required val request = url("https://wprice.io/api/v1/present/auctioninfo/auctionCapacity") val requestAsGet = request.GET //not required but lets be explicit
//Set the required parameters val builtRequest = requestAsGet.addQueryParameter("x-api-key", "{subscription key}") .addQueryParameter("zone_key", "{string}") .addQueryParameter("as_csv", "{boolean}")
//Make the request (method is already set above) val content = Http(builtRequest)
//Once the response is available //response completed successfully content onSuccess {
//Request was successful & response was OK case x if x.getStatusCode() == 200 => //Response was OK, read the contents handleJsonOutput(x.getResponseBody) case y => //Step 7 : Response is not OK, read the error println("Failed with status code" + y.getStatusCode()) }
//Request did not complete successfully, read the error content onFailure { case x => println("Failed but"); println(x.getMessage) }
println("ENTER TO EXIT") readLine() }
//CASE CLASSES case class Node(nodeName: String, LMP: Double, MLC: Double, MCC: Double) case class Results(billingUnit: String, currency: String, datetime: String, node: Node, source: String, updated: String, zoneKey: String) case class RootJsonObject(results: List[Results])
//JSON imports import org.json4s.jackson.Serialization import org.json4s.jackson.Serialization.{ read } import org.json4s.NoTypeHints
private def handleJsonOutput(body: String): Unit = { //required to set implicit here for JSON serialization to work properly implicit val formats = Serialization.formats(NoTypeHints)
//read the output as a RootJsonObject instance //the read call does the trick of mapping JSon to the case classes val output = read[RootJsonObject](body) println(s"Total Results: ${output.results.size}")
for (each <- output.results) println(s"${each.name.get} at ${each.vicinity.get}") }}
TypeScript code
async function getCapacityMarketData ( query: object ): Promise<object> { const url = new URL('https://wprice.io/api/v1/present/auctioninfo/auctionCapacity'); url.search = new URLSearchParams( query ).toString(); const headers = { "x-api-key": "{subscription key}", "content-type":"application/json", }; const response = await fetch( url.toString(), {headers} ); return await response.json();};const query = { zone_key: "{string}", as_csv: "{boolean}",};(async () => { const data = await getCapacityMarketData( query ); console.log(data)})()
#
Successful Response Samples#
HTTP 200 OKThe above command returns the following, with zone_key=US-MISO
and metric=OFFSUB
- JSON
- XML
- CSV
response for media types 'application/json' and 'text/json'
{ "updated": "2021-4-20T05:08:49+04:00", "metricCode": "OFFSUB", "metricName": "Offer Submitted (Including FRAP)", "localResourceZones": { "Z1": 20296.4, "Z2": 14056.10, "Z3": 10822, "Z4": 10281.4, "Z5": 7952.8, "Z6": 17134.6, "Z7": 21727.5, "Z8": 10573.5, "Z9": 21800.7, "Z10": 5300.2, "ERZ": 1629, "System": 141574.2 }, "units":"MW", "zoneKey": "US-MISO", "source": "misoenergy.org"}
response for media types 'application/xml' and 'text/xml'
<?xml version="1.0" encoding="UTF-8"?><root> <updated type="str">2021-4-20T05:08:49+04:00</updated> <metricCode type="str">OFFSUB</metricCode> <metricName type="str">Offer Submitted (Including FRAP)</metricName> <localResourceZones type="dict"> <Z1 type="float">20296.4</Z1> <Z2 type="float">14056.1</Z2> <Z3 type="int">10822</Z3> <Z4 type="float">10281.4</Z4> <Z5 type="float">7952.8</Z5> <Z6 type="float">17134.6</Z6> <Z7 type="float">21727.5</Z7> <Z8 type="float">10573.5</Z8> <Z9 type="float">21800.7</Z9> <Z10 type="float">5300.2</Z10> <ERZ type="int">1629</ERZ> <System type="float">141574.2</System> </localResourceZones> <units type="str">MW</units> <zoneKey type="str">US-MISO</zoneKey> <source type="str">misoenergy.org</source></root>
response for media types 'text/csv'
,updated,metricCode,metricName,units,zoneKey,source,localResourceZones_Z1,localResourceZones_Z2,localResourceZones_Z3,localResourceZones_Z4,localResourceZones_Z5,localResourceZones_Z6,localResourceZones_Z7,localResourceZones_Z8,localResourceZones_Z9,localResourceZones_Z10,localResourceZones_ERZ,localResourceZones_System0,2021-4-20T05:08:49+04:00,OFFSUB,Offer Submitted (Including FRAP),MW,US-MISO,misoenergy.org,20296.4,14056.1,10822,10281.4,7952.8,17134.6,21727.5,10573.5,21800.7,5300.2,1629,141574.2
#
Error Response Samples(Click to expand ๐ )
- HTTP 400
- HTTP 404
- HTTP 406
- HTTP 422
- HTTP 451
- HTTP 500
#
HTTP 400 BAD REQUEST- JSON
- XML
- CSV
response for media types 'application/json' and 'text/json'
{ "code": 400, "message": "BAD REQUEST", "timestamp": "2021-07-13T09:20:33+00:00", "detailedMessage": "The server could not understand the request due to invalid syntax."}
response for media types 'application/xml' and 'text/xml'
?xml version="1.0" encoding="UTF-8"?><root> <code type="int">400</code> <message type="str">BAD REQUEST</message> <timestamp type="str">2021-07-13T09:20:33+00:00</timestamp> <detailedMessage type="str">The server could not understand the request due to invalid syntax.</detailedMessage></root>
response for media types 'text/csv'
,code,message,timestamp,detailedMessage0,400,BAD REQUEST,2021-07-13T09:20:33+00:00,The server could not understand the request due to invalid syntax.
#
HTTP 404 NOT FOUND- JSON
- XML
- CSV
response for media types 'application/json' and 'text/json'
{ "code": 404, "message": "NOT FOUND", "timestamp": "2021-07-13T09:20:33+00:00", "detailedMessage": "The server can not find the requested resource. The endpoint is valid but the resource itself does not exist."}
response for media types 'application/xml' and 'text/xml'
<?xml version="1.0" encoding="UTF-8"?><root> <code type="int">404</code> <message type="str">NOT FOUND</message> <timestamp type="str">2021-07-13T09:20:33+00:00</timestamp> <detailedMessage type="str">The server can not find the requested resource. The endpoint is valid but the resource itself does not exist.</detailedMessage></root>
response for media types 'text/csv'
,code,message,timestamp,detailedMessage0,404,NOT FOUND,2021-07-13T09:20:33+00:00,The server can not find the requested resource. The endpoint is valid but the resource itself does not exist.
#
HTTP 406 NOT ACCEPTABLE- JSON
- XML
- CSV
response for media types 'application/json' and 'text/json'
{ "code": 406, "message": "NOT ACCEPTABLE", "timestamp": "2021-07-13T09:20:33+00:00", "detailedMessage": "The server, after performing server-driven content negotiation, didn't find any content that conforms to the criteria given by the user agent."}
response for media types 'application/xml' and 'text/xml'
<?xml version="1.0" encoding="UTF-8"?><root> <code type="int">406</code> <message type="str">NOT ACCEPTABLE</message> <timestamp type="str">2021-07-13T09:20:33+00:00</timestamp> <detailedMessage type="str">The server, after performing server-driven content negotiation, didn't find any content that conforms to the criteria given by the user agent.</detailedMessage></root>
response for media types 'text/csv'
,code,message,timestamp,detailedMessage0,406,NOT ACCEPTABLE,2021-07-13T09:20:33+00:00,"The server, after performing server-driven content negotiation, didn't find any content that conforms to the criteria given by the user agent."
#
HTTP 422 UNPROCESSABLE ENTITY- JSON
- XML
- CSV
response for media types 'application/json' and 'text/json'
{ "code": 422, "message": "UNPROCESSABLE ENTITY", "timestamp": "2021-07-13T09:20:33+00:00", "detailedMessage": "The request was well-formed but was unable to be followed due to semantic errors."}
response for media types 'application/xml' and 'text/xml'
<?xml version="1.0" encoding="UTF-8"?><root> <code type="int">422</code> <message type="str">UNPROCESSABLE ENTITY</message> <timestamp type="str">2021-07-13T09:20:33+00:00</timestamp> <detailedMessage type="str">The request was well-formed but was unable to be followed due to semantic errors.</detailedMessage></root>
response for media types 'text/csv'
,code,message,timestamp,detailedMessage0,422,UNPROCESSABLE ENTITY,2021-07-13T09:20:33+00:00,The request was well-formed but was unable to be followed due to semantic errors.
#
HTTP 451 UNAVAILABLE FOR LEGAL REASONS- JSON
- XML
- CSV
response for media types 'application/json' and 'text/json'
{ "code": 451, "message": "UNAVAILABLE FOR LEGAL REASONS", "timestamp": "2021-07-13T09:20:33+00:00", "detailedMessage": "The user-agent requested a resource that cannot legally be provided."}
response for media types 'application/xml' and 'text/xml'
<?xml version="1.0" encoding="UTF-8"?><root> <code type="int">451</code> <message type="str">UNAVAILABLE FOR LEGAL REASONS</message> <timestamp type="str">2021-07-13T09:20:33+00:00</timestamp> <detailedMessage type="str">The user-agent requested a resource that cannot legally be provided.</detailedMessage></root>
response for media types 'text/csv'
,code,message,timestamp,detailedMessage0,451,UNAVAILABLE FOR LEGAL REASONS,2021-07-13T09:20:33+00:00,The user-agent requested a resource that cannot legally be provided.
#
HTTP 500 INTERNAL SERVER ERROR- JSON
- XML
- CSV
response for media types 'application/json' and 'text/json'
{ "code": 500, "message": "INTERNAL SERVER ERROR", "timestamp": "2021-07-13T09:20:33+00:00", "detailedMessage": "The server has encountered a situation it doesn't know how to handle."}
response for media types 'application/xml' and 'text/xml'
<?xml version="1.0" encoding="UTF-8"?><root> <code type="int">500</code> <message type="str">INTERNAL SERVER ERROR</message> <timestamp type="str">2021-07-13T09:20:33+00:00</timestamp> <detailedMessage type="str">The server has encountered a situation it doesn't know how to handle.</detailedMessage></root>
response for media types 'text/csv'
,code,message,timestamp,detailedMessage0,500,INTERNAL SERVER ERROR,2021-07-13T09:20:33+00:00,The server has encountered a situation it doesn't know how to handle.