# TradingView Chart API

> Get recent OHLC bar data for a forex pair at the specified interval.

Source: https://www.sandbase.ai/apis/tradingview/chart
API reference: https://www.sandbase.ai/apis/tradingview/chart#api

## Facts

- Provider: TradingView
- Type: Data API
- Endpoint: `POST https://api.sandbase.ai/v1/api/tradingview/chart`
- Price: $0.03 per call
- Capabilities: api, tradingview, finance, forex
- Billing: pay per use from one SandBase balance; no provider account or subscription needed

## Call it

`POST https://api.sandbase.ai/v1/api/tradingview/chart` with `Authorization: Bearer $SANDBASE_API_KEY` and the parameters as a JSON body.

| Parameter | Type | Required | Allowed values |
| --- | --- | --- | --- |
| `bars` | integer | no |  |
| `symbol` | string | no |  |
| `exchange` | string | no | FX, OANDA, FX_IDC |
| `interval` | string | no | 1m, 5m, 15m, 1H, 4H, 1D, 1W |

## FAQ

### How do I use the TradingView Chart API?

Send a POST request to https://api.sandbase.ai/v1/api/tradingview/chart with your SandBase API key in the Authorization header (Bearer) and the parameters as a JSON body. You can also try it in the Playground on this page without writing code.

### How much does the TradingView Chart API cost?

$0.03 per call, billed from your SandBase balance. You are only charged for calls you make; there is no subscription.

### What parameters does the TradingView Chart API accept?

No parameters are required. Optional: bars (integer), symbol (string), exchange (one of FX, OANDA, FX_IDC) and interval (one of 1m, 5m, 15m, 1H, 4H, 1D, 1W). The Parameters table and the Playground on this page list every field.

### What does the TradingView Chart API return?

A JSON response returned in the same HTTP request (synchronous).

### Do I need a TradingView developer account or API key?

No. TradingView Chart runs through SandBase, so one SandBase API key covers this endpoint and every other API and model in the catalog. You do not need to apply for TradingView API access separately.

## README

### TradingView Chart API

Get recent OHLC bar data for a forex pair at the specified interval.

#### Request

```bash
curl -X POST "https://api.sandbase.ai/v1/run" \
  -H "Authorization: Bearer $SANDBASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "tradingview/chart", "bars": 10, "symbol": "EURUSD", "exchange": "FX", "interval": "1m"}'
```

The result is returned in `outputs[0].data`.

#### Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `bars` | integer | No | Maximum number of bars to return (1-30). Fewer bars may be returned depending on available data. |
| `exchange` | string | No | Exchange/data source (FX, OANDA, FX_IDC) One of: `FX`, `OANDA`, `FX_IDC`. |
| `interval` | string | No | Bar interval/timeframe One of: `1m`, `5m`, `15m`, `1H`, `4H`, `1D`, `1W`. |
| `symbol` | string | No | Forex pair symbol (e.g., EURUSD, GBPUSD, USDJPY, AUDUSD, USDCAD, NZDUSD, EURGBP, EURJPY) |

#### Pricing

Flat $0.03 per call. Failed calls are not charged.
