# VWAP

## What is this endpoint for? <a href="#what-is-this-endpoint-for" id="what-is-this-endpoint-for"></a>

This endpoint delivers VWAP (volume-weighted average price) for an instrument on an exchange in real time.

## Endpoints

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

```url
gateway-v0-grpc.kaiko.ovh
```

{% endtab %}

{% tab title="http" %}

```url
gateway-v0-http.kaiko.ovh
```

{% endtab %}

{% tab title="API (testing)" %}

```url
https://gateway-v0-http.kaiko.ovh/api/stream/aggregates_vwap_v1
```

{% endtab %}
{% endtabs %}

## Request parameters

<table><thead><tr><th width="184">Parameter</th><th width="387">Description</th><th>Examples</th></tr></thead><tbody><tr><td><code>aggregate</code></td><td>The period you would like the VWAP aggregation to be calculated over.</td><td><code>1m</code></td></tr><tr><td><code>instrumentCriteria</code></td><td><p>A <strong>nested object</strong> to configure following properties for your stream: </p><ul><li><code>exchange</code> (String) - The code(s) for the exchange(s)</li><li><code>instrument_class</code> (String) - The class(es) of the instrument(s) .</li><li><code>code (String) -</code> The Kaiko code for the instrument.</li></ul><p>Explore instruments, codes and exchanges in the <a href="https://instruments.kaiko.com/#/instruments">Instrument Explorer</a> or <a data-mention href="https://app.gitbook.com/s/ltAbhvgBfrAWlpUnC7ys/data-feeds/reference-data">Reference Data</a>. </p></td><td><p><code>cbse</code></p><p></p><p><code>spot</code></p><p></p><p><code>btc-usd</code><br><br></p></td></tr></tbody></table>

{% hint style="info" %}
**Configuring a wildcard**

A wildcard allows you to request all information we have on a specific instrument, class, or exchange in the same stream.\
\
Use a `*` in place of the relevant `exchange`, `instrument`, or `class` parameter. <br>

For example, the configuration below would deliver trades for BTC/USD across all exchanges where it’s supported:

`exchange: *`\
`class: spot`\
`instrument: btc-usd`
{% endhint %}

## Response fields

<table><thead><tr><th width="223">Field</th><th width="537">Description</th></tr></thead><tbody><tr><td><code>aggregate</code></td><td>The period of calculation.</td></tr><tr><td><code>class</code></td><td>The class of instrument.</td></tr><tr><td><code>code</code></td><td>The instrument code.</td></tr><tr><td><code>price</code></td><td>The price for the peirod (USD).</td></tr><tr><td><code>exchange</code></td><td>The exchange the VWAP is referencing.</td></tr><tr><td><code>tsEvent</code></td><td>The timestamp for the interval.</td></tr><tr><td><code>uid</code></td><td>The unique ID for this delivery.</td></tr><tr><td><code>volume</code></td><td>Volume traded in interval. 0 when no trades reported.</td></tr><tr><td><code>sequenceId</code></td><td>Not applicable. <code>Null</code></td></tr></tbody></table>

## Request examples

{% tabs %}
{% tab title="Python" %}
{% @github-files/github-code-block url="<https://github.com/kaikodata/kaiko-sdk-examples/blob/master/python/code-example/vwap_request.py>" visible="false" %}
{% endtab %}

{% tab title="cURL" %}
**cURL requests are intended for testing purposes only.**

{% code overflow="wrap" %}

```url
curl -X POST "https://gateway-v0-http.kaiko.ovh/api/stream/aggregates_vwap_v1" -H "accept: application/json" -H "X-Api-Key: $KAIKO_API_KEY" -H "Content-Type: application/json" -d "{ \"instrumentCriteria\": {  \"exchange\": \"binc\",  \"instrumentClass\": \"spot\",  \"code\": \"eth-usdt\" }, \"aggregate\": \"1m\"}"
```

{% endcode %}
{% endtab %}

{% tab title="BigQuery" %}
Information from this endpoint can be accessed through Google BigQuery. \
\
To get started, read our [guide](https://docs.kaiko.com/stream/data-feeds/level-1-and-level-2-data/level-1-aggregations/broken-reference).
{% endtab %}

{% tab title="Other examples" %}
For more advanced users, you can access our full SDK [here](https://github.com/kaikodata/kaiko-sdk-examples/tree/master), where you'll find more coding languages, examples and guidance.
{% endtab %}
{% endtabs %}

## Response Example

```json
"aggregate": "1s",
  "class": "spot",
  "code": "eth-usdt",
  "exchange": "binc",
  "price": 2591.3221372276307,
  "tsEvent": "2024-08-09T13:47:20.689338450Z",
  "uid": "2024-08-09T13:47:19Z",
  "sequenceId": ""

```
