# OHCLV (Candles)

## Get OHCLV

<mark style="color:blue;">`GET`</mark> `https://api.swivel.exchange/v2/samples?underlying=x&maturity=y&start=z&end=e&interval=f&type=g`

This endpoint allows you to request OHLCV points for the given period.\
\
Returns OHLCV points with each containing its OHLCV data at the given timestamp.

#### Query Parameters

| Name                                         | Type   | Description                                                                    |
| -------------------------------------------- | ------ | ------------------------------------------------------------------------------ |
| interval<mark style="color:red;">\*</mark>   | string | The time between datapoints in minutes dividable by 5. E.g. 5, 15, 30, 60, ... |
| maturity<mark style="color:red;">\*</mark>   | string | The maturity of market in unix seconds.                                        |
| underlying<mark style="color:red;">\*</mark> | string | The underlying token contract being transacted. E.g. USDC, DAI, etc.,          |
| start<mark style="color:red;">\*</mark>      | number | Start of of the period in seconds                                              |
| end<mark style="color:red;">\*</mark>        | number | End of the period in seconds                                                   |
| type<mark style="color:red;">\*</mark>       | string | Sampling type e.g. OHLCV                                                       |

{% tabs %}
{% tab title="200 " %}

```
[
    {
        "timestamp": 1638472500,
        "data": {
            "open": "0.0499",
            "high": "0.0499",
            "low": "0.0499",
            "close": "0.0499",
            "volume": "252275019238957087498"
        }
    },
    {
        "timestamp": 1638473400,
        "data": {
            "open": "0.0499",
            "high": "0.05",
            "low": "0.0499",
            "close": "0.05",
            "volume": "170000000000000000000"
        }
    },
...
]
```

{% endtab %}

{% tab title="400: Bad Request E.g. Invalid maturity" %}

```javascript
{
    "error": {
        "message": "invalid maturity"
    }
}
```

{% endtab %}
{% endtabs %}
