Get compression history for a stock
curl --request GET \
--url https://api.example.com/api/graph/v1/stocks/{symbol}/compressionimport requests
url = "https://api.example.com/api/graph/v1/stocks/{symbol}/compression"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/graph/v1/stocks/{symbol}/compression', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/graph/v1/stocks/{symbol}/compression",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/graph/v1/stocks/{symbol}/compression"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/api/graph/v1/stocks/{symbol}/compression")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/graph/v1/stocks/{symbol}/compression")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"symbol": "<string>",
"stats": {
"symbol": "<string>",
"period_days": 123,
"nr7_count": 0,
"inside_day_count": 0,
"total_events": 0,
"avg_compression_ratio": 123,
"min_compression_ratio": 123,
"max_compression_ratio": 123,
"avg_compression_score": 123,
"trend_direction": "stable"
},
"detailed_vcp": {
"schema_version": "an01-v1",
"detector_version": "<string>",
"producer": {
"id": "pattern-detector:vcp",
"kind": "deterministic",
"version": "<string>"
},
"symbol": "<string>",
"interval": "1d",
"market_session": "regular",
"computed_at": "2023-11-07T05:31:56Z",
"finality": "finalized",
"status": "complete",
"confidence": 0.5,
"legs": [
{
"id": "<string>",
"ordinal": 2,
"start_pivot": {
"id": "<string>",
"role": "high",
"time": "2023-11-07T05:31:56Z",
"price": 123,
"source_revision": 2,
"evidence_id": "<string>"
},
"end_pivot": {
"id": "<string>",
"role": "high",
"time": "2023-11-07T05:31:56Z",
"price": 123,
"source_revision": 2,
"evidence_id": "<string>"
},
"volume": {
"ratio": 1,
"behavior": "dry_up"
},
"range": 1,
"contraction_ratio": 0.5,
"missing_fields": [
"end_pivot"
]
}
],
"breakout": {
"id": "<string>",
"kind": "breakout",
"price": 123,
"pivot_id": "<string>",
"evidence_id": "<string>"
},
"invalidation": {
"id": "<string>",
"kind": "breakout",
"price": 123,
"pivot_id": "<string>",
"evidence_id": "<string>"
},
"evidence": [
{
"id": "<string>",
"kind": "source_bar",
"time": "2023-11-07T05:31:56Z",
"source_revision": 2,
"pivot_id": "<string>"
}
],
"missing_fields": [
"<string>"
],
"unavailable_reason": {
"code": "detail_not_persisted",
"message": "<string>"
}
},
"events": [
{
"symbol": "<string>",
"trade_date": "2023-12-25",
"atr_3": 123,
"atr_14": 123,
"atr_compression_ratio": 123,
"range_vs_atr_14": 123,
"bb_width": 123,
"bb_width_percentile": 50,
"daily_range": 123,
"range_to_atr": 123,
"is_nr7": false,
"is_inside_day": false,
"vcp_contraction_count": 0,
"compression_score": 50,
"compression_level": "extreme",
"close_price": 123,
"volume": 123,
"relative_volume": 123,
"computed_at": "2023-11-07T05:31:56Z"
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Compression
Get compression history for a stock
Get historical volatility compression events for a stock.
## Response Data
Returns daily compression snapshots including:
- ATR compression ratio (ATR3/ATR14)
- Bollinger Band width percentile
- NR7 and Inside Day signals
- VCP contraction count
- Composite compression score (0-100)
- AN-01 `detailed_vcp`: versioned legs/pivots/levels when a detector provider supplies them,
otherwise an explicit `unavailable` object. Summary counts never synthesize geometry.
## Compression Score Calculation
Aligned with confluence_scorer.go volatility_setup:
- VCP Pattern (+4 points): ATR ratio < 0.50 AND contractions >= 2
- NR7 (+3 points): Narrowest range in 7 days
- BB Squeeze (+3 points): BB width percentile < 20
Max 10 points, scaled to 0-100.
## Query Parameters
- **days**: Number of days to look back (default: 30, max: 365)
## Performance Target
<300ms response time.
GET
/
api
/
graph
/
v1
/
stocks
/
{symbol}
/
compression
Get compression history for a stock
curl --request GET \
--url https://api.example.com/api/graph/v1/stocks/{symbol}/compressionimport requests
url = "https://api.example.com/api/graph/v1/stocks/{symbol}/compression"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/graph/v1/stocks/{symbol}/compression', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/graph/v1/stocks/{symbol}/compression",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/graph/v1/stocks/{symbol}/compression"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/api/graph/v1/stocks/{symbol}/compression")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/graph/v1/stocks/{symbol}/compression")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"symbol": "<string>",
"stats": {
"symbol": "<string>",
"period_days": 123,
"nr7_count": 0,
"inside_day_count": 0,
"total_events": 0,
"avg_compression_ratio": 123,
"min_compression_ratio": 123,
"max_compression_ratio": 123,
"avg_compression_score": 123,
"trend_direction": "stable"
},
"detailed_vcp": {
"schema_version": "an01-v1",
"detector_version": "<string>",
"producer": {
"id": "pattern-detector:vcp",
"kind": "deterministic",
"version": "<string>"
},
"symbol": "<string>",
"interval": "1d",
"market_session": "regular",
"computed_at": "2023-11-07T05:31:56Z",
"finality": "finalized",
"status": "complete",
"confidence": 0.5,
"legs": [
{
"id": "<string>",
"ordinal": 2,
"start_pivot": {
"id": "<string>",
"role": "high",
"time": "2023-11-07T05:31:56Z",
"price": 123,
"source_revision": 2,
"evidence_id": "<string>"
},
"end_pivot": {
"id": "<string>",
"role": "high",
"time": "2023-11-07T05:31:56Z",
"price": 123,
"source_revision": 2,
"evidence_id": "<string>"
},
"volume": {
"ratio": 1,
"behavior": "dry_up"
},
"range": 1,
"contraction_ratio": 0.5,
"missing_fields": [
"end_pivot"
]
}
],
"breakout": {
"id": "<string>",
"kind": "breakout",
"price": 123,
"pivot_id": "<string>",
"evidence_id": "<string>"
},
"invalidation": {
"id": "<string>",
"kind": "breakout",
"price": 123,
"pivot_id": "<string>",
"evidence_id": "<string>"
},
"evidence": [
{
"id": "<string>",
"kind": "source_bar",
"time": "2023-11-07T05:31:56Z",
"source_revision": 2,
"pivot_id": "<string>"
}
],
"missing_fields": [
"<string>"
],
"unavailable_reason": {
"code": "detail_not_persisted",
"message": "<string>"
}
},
"events": [
{
"symbol": "<string>",
"trade_date": "2023-12-25",
"atr_3": 123,
"atr_14": 123,
"atr_compression_ratio": 123,
"range_vs_atr_14": 123,
"bb_width": 123,
"bb_width_percentile": 50,
"daily_range": 123,
"range_to_atr": 123,
"is_nr7": false,
"is_inside_day": false,
"vcp_contraction_count": 0,
"compression_score": 50,
"compression_level": "extreme",
"close_price": 123,
"volume": 123,
"relative_volume": 123,
"computed_at": "2023-11-07T05:31:56Z"
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Path Parameters
Query Parameters
Lookback period in days
Required range:
1 <= x <= 365Response
Compression history with events and stats
Response for compression history endpoint.
Stock ticker symbol
Aggregated statistics for the period
Show child attributes
Show child attributes
AN-01 typed detector detail or explicit unavailable state
Show child attributes
Show child attributes
Historical compression events (newest first)
Show child attributes
Show child attributes