Client Reference¶
Client implementations for the COT Bias Terminal API.
Provides both synchronous (:class:CotClient) and asynchronous
(:class:AsyncCotClient) clients configured with automatic retry logic,
HTTP/2 connection pooling, and resource-oriented API access.
CotClient ¶
CotClient(api_key: str | None = None, base_url: str = DEFAULT_BASE_URL, timeout: float = DEFAULT_TIMEOUT_SEC, max_retries: int = DEFAULT_MAX_RETRIES, transport: BaseTransport | None = None)
Synchronous client for the COT Bias Terminal Quant API.
Designed for analytical workflows, quantitative backtesting scripts, Jupyter notebooks, and standard synchronous Python applications.
Attributes:
| Name | Type | Description |
|---|---|---|
timeseries |
Access to historical weekly CFTC positioning timeseries. |
|
inference |
Access to current week AI positioning regimes and attribution. |
|
screener |
Cross-asset filtering across tracked commodities, equities, FX, and rates. |
|
markets |
Catalog of supported contracts, CFTC codes, and metadata. |
Example
Initialize the synchronous COT Bias client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
api_key
|
str | None
|
Quant tier API key. If not provided, resolves from the
|
None
|
base_url
|
str
|
API root endpoint URL. Defaults to the production API. |
DEFAULT_BASE_URL
|
timeout
|
float
|
Request timeout in seconds. Defaults to 30.0s. |
DEFAULT_TIMEOUT_SEC
|
max_retries
|
int
|
Number of retry attempts on transient network errors or HTTP 5xx responses. Defaults to 3. |
DEFAULT_MAX_RETRIES
|
transport
|
BaseTransport | None
|
Optional custom HTTPX transport for proxies or custom SSL. |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If no API key was provided or found in |
Source code in src/cotbias/client.py
AsyncCotClient ¶
AsyncCotClient(api_key: str | None = None, base_url: str = DEFAULT_BASE_URL, timeout: float = DEFAULT_TIMEOUT_SEC, max_retries: int = DEFAULT_MAX_RETRIES, transport: AsyncBaseTransport | None = None)
Asynchronous client for the COT Bias Terminal Quant API.
Designed for high-throughput asynchronous services, FastAPI backends, async trading engines, and event-driven screeners.
Attributes:
| Name | Type | Description |
|---|---|---|
timeseries |
Access to historical weekly CFTC positioning timeseries. |
|
inference |
Access to current week AI positioning regimes and attribution. |
|
screener |
Cross-asset filtering across tracked commodities, equities, FX, and rates. |
|
markets |
Catalog of supported contracts, CFTC codes, and metadata. |
Example
Initialize the asynchronous COT Bias client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
api_key
|
str | None
|
Quant tier API key. If not provided, resolves from the
|
None
|
base_url
|
str
|
API root endpoint URL. Defaults to the production API. |
DEFAULT_BASE_URL
|
timeout
|
float
|
Request timeout in seconds. Defaults to 30.0s. |
DEFAULT_TIMEOUT_SEC
|
max_retries
|
int
|
Number of retry attempts on transient network errors or HTTP 5xx responses. Defaults to 3. |
DEFAULT_MAX_RETRIES
|
transport
|
AsyncBaseTransport | None
|
Optional custom HTTPX async transport for proxies or testing. |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If no API key was provided or found in |