Put/Call Data API
Retrieve options market data including put/call ratios and volume. Track options positioning and sentiment.
Endpoint
Section titled “Endpoint”GET /v1/putcalldata/{market}/{ticker}Authentication
Section titled “Authentication”Requires API key via token query parameter.
Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
market | string | Yes | Market identifier (e.g., S&P 500, NASDAQ) |
ticker | string | Yes | Stock ticker symbol (e.g., AAPL, MSFT) |
Query Parameters
Section titled “Query Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
token | string | Yes | Your API key |
dateFrom | string | No | Start date (YYYY-MM-DD) |
dateTo | string | No | End date (YYYY-MM-DD) |
Request
Section titled “Request”curl "https://api.finbrain.tech/v1/putcalldata/S%26P%20500/AAPL?token=YOUR_API_KEY"from finbrain import FinBrainClient
fb = FinBrainClient(api_key="YOUR_API_KEY")
# Get as DataFrame (recommended)df = fb.options.put_call("S&P 500", "AAPL", as_dataframe=True)print(df.head())# ratio callCount putCount# date# 2024-03-19 0.40 788319 315327
# Get raw JSON responseputcall = fb.options.put_call("S&P 500", "AAPL")print(putcall)#include <iostream>#include <string>#include <curl/curl.h>#include <nlohmann/json.hpp>
using json = nlohmann::json;
size_t WriteCallback(void* contents, size_t size, size_t nmemb, std::string* userp) { userp->append((char*)contents, size * nmemb); return size * nmemb;}
json get_put_call_data(const std::string& market, const std::string& ticker, const std::string& api_key) { CURL* curl = curl_easy_init(); std::string response;
if (curl) { char* encoded_market = curl_easy_escape(curl, market.c_str(), 0); std::string url = "https://api.finbrain.tech/v1/putcalldata/" + std::string(encoded_market) + "/" + ticker + "?token=" + api_key; curl_free(encoded_market);
curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response); curl_easy_perform(curl); curl_easy_cleanup(curl); }
return json::parse(response);}
int main() { auto data = get_put_call_data("S&P 500", "AMZN", "YOUR_API_KEY");
for (auto& pc : data["putCallData"]) { std::cout << pc["date"].get<std::string>() << ": ratio " << pc["ratio"].get<double>() << " (calls: " << pc["callCount"].get<int64_t>() << ", puts: " << pc["putCount"].get<int64_t>() << ")" << std::endl; }
return 0;}use reqwest::blocking::Client;use serde::Deserialize;use std::error::Error;
#[derive(Debug, Deserialize)]struct PutCallEntry { date: String, ratio: f64, #[serde(rename = "callCount")] call_count: i64, #[serde(rename = "putCount")] put_count: i64,}
#[derive(Debug, Deserialize)]struct PutCallResponse { ticker: String, name: String, #[serde(rename = "putCallData")] put_call_data: Vec<PutCallEntry>,}
fn get_put_call_data(market: &str, ticker: &str, api_key: &str) -> Result<PutCallResponse, Box<dyn Error>> { let url = format!( "https://api.finbrain.tech/v1/putcalldata/{}/{}?token={}", urlencoding::encode(market), ticker, api_key );
let client = Client::new(); let response: PutCallResponse = client.get(&url).send()?.json()?;
Ok(response)}
fn main() -> Result<(), Box<dyn Error>> { let data = get_put_call_data("S&P 500", "AMZN", "YOUR_API_KEY")?;
for pc in &data.put_call_data { println!("{}: ratio {:.2} (calls: {}, puts: {})", pc.date, pc.ratio, pc.call_count, pc.put_count); }
Ok(())}const market = encodeURIComponent("S&P 500");const response = await fetch( `https://api.finbrain.tech/v1/putcalldata/${market}/AMZN?token=YOUR_API_KEY`);const data = await response.json();Response
Section titled “Response”Success Response (200 OK)
Section titled “Success Response (200 OK)”{ "ticker": "AMZN", "name": "Amazon.com Inc.", "putCallData": [ { "date": "2024-03-19", "ratio": 0.4, "callCount": 788319, "putCount": 315327 } ]}Response Fields
Section titled “Response Fields”| Field | Type | Description |
|---|---|---|
ticker | string | Stock ticker symbol |
name | string | Company name |
putCallData | array | Array of put/call data points |
Put/Call Object Fields
Section titled “Put/Call Object Fields”| Field | Type | Description |
|---|---|---|
date | string | Date (YYYY-MM-DD) |
ratio | number | Put/call ratio |
callCount | integer | Call options count |
putCount | integer | Put options count |
Interpretation
Section titled “Interpretation”| Ratio | Interpretation |
|---|---|
| > 1.2 | Heavy put activity (bearish/hedging) |
| 0.7 - 1.2 | Normal range |
| < 0.7 | Heavy call activity (bullish) |
Errors
Section titled “Errors”| Code | Error | Description |
|---|---|---|
| 400 | Bad Request | Invalid market or ticker |
| 401 | Unauthorized | Invalid or missing API key |
| 404 | Not Found | Ticker not found |
| 500 | Internal Server Error | Server-side error |
Related
Section titled “Related”- Put/Call Ratio Dataset - Use cases and analysis examples
- Sentiments - News sentiment
- Analyst Ratings - Wall Street ratings