# TradeSonar dYdX Candlesticks API

> TradeSonar dYdX Candlesticks API is a paid API for AI agents from api.tradesonar.io, paid per call via x402, $0.001/call, status unknown (last checked 2026-10-10).

Returns OHLCV candlestick data for a dYdX perpetual market at configurable resolutions from 1-minute to 1-day

## Facts

- Endpoint: GET https://api.tradesonar.io/v1/markets/%7Bticker%7D/candles?utm_source=zero.xyz
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-10
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/tradesonar-dydx-candlesticks-api-9be2a8d9
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_ad5V4C_SCaTPGHR2XSGlD

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability tradesonar-dydx-candlesticks-api-9be2a8d9
```

Example prompt: Pull the last 100 hourly candles for ETH-USD on dYdX — I need the open, high, low, close, and volume for each so I can run a momentum backtest.

## When to prefer this

Use this endpoint when you need historical OHLCV candlestick data specifically from dYdX perpetuals, especially when you want to combine price history with TradeSonar's companion signals (funding, crowding, smart-money) for the same market. Prefer this over generic crypto OHLCV APIs when dYdX-specific on-chain provenance and freshness stamping (block height + replica lag) matter, such as for systematic strategies or signal validation on dYdX.

## Known failure modes

- Invalid ticker symbol (not found in /v1/markets) returns an error — ticker must be in ETH-USD format, not ETH-USDT
- Resolution value outside allowed enum (e.g. sub-minute) returns a validation error
- from/to timestamps in wrong format (non-ISO8601) cause a parse error
- limit exceeding 1000 or below 1 returns a validation error
- Payment not provided or insufficient USDC (x402 protocol) returns 402 Payment Required
- Time range too large for the requested resolution may return partial data or timeout

## How this service works

TradeSonar: dYdX on-chain smart-money, funding and crowding signals. Every response is stamped with data_as_of freshness (block height + replica lag).

## Output

Returns a JSON object with an array of candles, each containing open, high, low, close prices as strings, USD volume, base token volume, trade count, and a startedAt ISO8601 timestamp. Data freshness is indicated by a data_as_of field with block height and replica lag.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET",
      "HEAD",
      "DELETE"
     ],
     "type": "string"
    },
    "pathParams": {
     "type": "object",
     "required": [
      "ticker"
     ],
     "properties": {
      "ticker": {
       "type": "string",
       "description": "Market ticker, e.g. ETH-USD (NOT ETH-USDT). See /v1/markets for valid tickers."
      }
     }
    },
    "queryParams": {
     "type": "object",
     "properties": {
      "to": {
       "type": "string",
       "description": "End time, ISO8601 (optional)"
      },
      "from": {
       "type": "string",
       "description": "Start time, ISO8601 e.g. 2026-10-01T00:00:00Z (optional)"
      },
      "limit": {
       "type": "integer",
       "default": 200,
       "maximum": 1000,
       "minimum": 1,
       "description": "Max candles to return, 1-1000"
      },
      "resolution": {
       "type": "string",
       "default": "1MIN",
       "description": "Candle size: 1MIN/5MINS/15MINS/30MINS/1HOUR/4HOURS/1DAY (no sub-minute)"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "data": {
   "candles": [
    {
     "low": "...",
     "high": "...",
     "open": "...",
     "close": "...",
     "trades": 0,
     "startedAt": "...",
     "usdVolume": "...",
     "baseTokenVolume": "..."
    }
   ]
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/tradesonar-dydx-candlesticks-api-9be2a8d9/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.tradesonar.io](https://www.zero.xyz/host/api.tradesonar.io/llms.txt)
