# Get Volume Analytics

<mark style="color:green;">**`GET`**</mark> `https://api.sfox.com/v1/analytics/volume`

Retrieve historical exchange volume analytics by currency.

{% hint style="info" %}
Data is not forward-filled and, therefore, may be incomplete. e.g. no data will be returned for an interval during which 0 trades were recorded.
{% endhint %}

{% hint style="warning" %}
**Responses are limited to 500 results.** If the requested `start_time` , `end_time` , and `interval` will result in more than 500 results, your request will be rejected. To retrieve data over a larger time range, you will need to make multiple requests with new `start_time` / `end_time` ranges. Results may precede your specified `start_time` value.
{% endhint %}

### Query Parameters

<table><thead><tr><th width="271">Name</th><th width="139">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong><code>start_time</code></strong> <mark style="color:red;">required</mark></td><td>timestamp</td><td>Unix timestamp (ms) of the first datapoint to return</td></tr><tr><td><strong><code>end_time</code></strong></td><td>timestamp</td><td>Unix timestamp (ms) of the last datapoint to return</td></tr><tr><td><strong><code>interval</code></strong> <mark style="color:red;">required</mark></td><td>int</td><td><p>Duration of each datapoint in seconds (i.e. <code>interval</code> = <code>86400</code> = daily volume data)</p><p>(<code>60</code> | <code>3600</code> | <code>86400</code>)</p></td></tr><tr><td><strong><code>currency</code></strong> <mark style="color:red;">required</mark></td><td>string</td><td>The currency to retrieve data for (i.e. <code>eth</code>)</td></tr><tr><td><strong><code>net</code></strong></td><td>boolean</td><td><p>Retrieve "net volume" (net buy/sell volume) or "gross volume" (total traded volume)</p><p>(<code>true</code> | <code>false</code>)</p><p>default = <code>false</code></p></td></tr><tr><td><strong><code>by_exchange</code></strong></td><td>boolean</td><td><p>Retrieve total market volume or volume by exchange</p><p>(<code>true</code> | <code>false</code>)<br>default = <code>false</code></p></td></tr></tbody></table>

### Response Body

<table><thead><tr><th width="182">Key</th><th>Description</th></tr></thead><tbody><tr><td><strong><code>timstamp</code></strong></td><td>The Unix timestamp (ms) of the beginning of the interval</td></tr><tr><td><strong><code>exchange</code></strong></td><td>The exchange associated with the volume data (only returned if <code>by_exchange</code> = <code>true</code> in the request)</td></tr><tr><td><strong><code>volume</code></strong></td><td>The quantity of the specified currency traded during this interval</td></tr><tr><td><strong><code>usd_notional</code></strong></td><td>The USD value of the quantity of the specified currency traded during this interval</td></tr></tbody></table>

### Responses

<details>

<summary><mark style="color:green;">200</mark>: Gross Volume</summary>

<pre class="language-json"><code class="lang-json"><strong>//interval=86400&#x26;net=false&#x26;by_exchange=false
</strong><strong>{
</strong>    "data": [
        {
            "timestamp": 1689206400000,
            "volume": 324557.08579094,
            "usd_notional": 633266040.1379151
        },
        {
            "timestamp": 1689292800000,
            "volume": 244525.03601467,
            "usd_notional": 482590637.1359154
        },
        {
            "timestamp": 1689379200000,
            "volume": 54552.86708131,
            "usd_notional": 105565737.85291174
        },
        {
            "timestamp": 1689465600000,
            "volume": 59350.88216805,
            "usd_notional": 114595675.74899396
        },
        {
            "timestamp": 1689552000000,
            "volume": 174930.26792864,
            "usd_notional": 333229267.7529286
        }
    ]
}
</code></pre>

</details>

<details>

<summary><mark style="color:green;">200</mark>: Net Volume</summary>

```json
//interval=86400&net=true&by_exchange=false
{
    "data": [
        {
            "timestamp": 1689206400000,
            "volume": 23385.45910848,
            "usd_notional": 45629005.60418967
        },
        {
            "timestamp": 1689292800000,
            "volume": 487.77127065,
            "usd_notional": 962657.4526522362
        },
        {
            "timestamp": 1689379200000,
            "volume": 541.72807017,
            "usd_notional": 1048302.8024520231
        }
    ]
}
```

</details>

<details>

<summary><mark style="color:green;">200</mark>: Gross Volume by Exchange</summary>

```json
//interval=86400&net=false&by_exchange=true
{
    "data": [
        {
            "timestamp": 1689206400000,
            "volumes": [
                {
                    "exchange": "bitfinex",
                    "volume": 22064.11327313,
                    "usd_notional": 43050835.2870461
                },
                {
                    "exchange": "bitflyer",
                    "volume": 675.3754941,
                    "usd_notional": 1317772.3842097484
                },
                {
                    "exchange": "bitstamp",
                    "volume": 20403.74974212,
                    "usd_notional": 39811183.82200494
                },
                {
                    "exchange": "coinbase",
                    "volume": 256084.73824809,
                    "usd_notional": 499664851.6698304
                },
                {
                    "exchange": "gemini",
                    "volume": 2893.597955,
                    "usd_notional": 5645901.442109791
                },
                {
                    "exchange": "kraken",
                    "volume": 22435.5110785,
                    "usd_notional": 43775495.53271416
                }
            ]
        },
        {
            "timestamp": 1689292800000,
            "volumes": [
                {
                    "exchange": "bitfinex",
                    "volume": 16438.39032122,
                    "usd_notional": 32442539.986500576
                },
                {
                    "exchange": "bitflyer",
                    "volume": 282.4740891,
                    "usd_notional": 557486.2715692556
                },
                {
                    "exchange": "bitstamp",
                    "volume": 11499.07793533,
                    "usd_notional": 22694393.333832387
                },
                {
                    "exchange": "coinbase",
                    "volume": 194042.96600292,
                    "usd_notional": 382960044.1791732
                },
                {
                    "exchange": "gemini",
                    "volume": 1941.224533,
                    "usd_notional": 3831169.1901688813
                },
                {
                    "exchange": "kraken",
                    "volume": 20320.9031331,
                    "usd_notional": 40105004.17467113
                }
            ]
        }
    ]
}
```

</details>

<details>

<summary><mark style="color:green;">200</mark>: Net Volume by Exchange</summary>

```json
//interval=86400&net=true&by_exchange=true
{
    "data": [
        {
            "timestamp": 1689206400000,
            "volumes": [
                {
                    "exchange": "bitfinex",
                    "volume": -6825.69751025,
                    "usd_notional": -13318096.02295827
                },
                {
                    "exchange": "bitflyer",
                    "volume": 405.5878231,
                    "usd_notional": 791370.7816200266
                },
                {
                    "exchange": "bitstamp",
                    "volume": 2621.19358698,
                    "usd_notional": 5114394.218867672
                },
                {
                    "exchange": "coinbase",
                    "volume": 25602.95423207,
                    "usd_notional": 49955715.503370605
                },
                {
                    "exchange": "gemini",
                    "volume": 278.054287,
                    "usd_notional": 542531.1755026139
                },
                {
                    "exchange": "kraken",
                    "volume": 1303.36668958,
                    "usd_notional": 2543089.9477870227
                }
            ]
        },
        {
            "timestamp": 1689292800000,
            "volumes": [
                {
                    "exchange": "bitfinex",
                    "volume": -3128.46017994,
                    "usd_notional": -6174278.168395847
                },
                {
                    "exchange": "bitflyer",
                    "volume": 81.1377265,
                    "usd_notional": 160132.098396033
                },
                {
                    "exchange": "bitstamp",
                    "volume": 211.54172883,
                    "usd_notional": 417495.3181104044
                },
                {
                    "exchange": "coinbase",
                    "volume": 4753.17507186,
                    "usd_notional": 9380789.074742645
                },
                {
                    "exchange": "gemini",
                    "volume": -341.430339,
                    "usd_notional": -673841.3682337883
                },
                {
                    "exchange": "kraken",
                    "volume": -1088.1927376,
                    "usd_notional": -2147639.5019672103
                }
            ]
        }
    ]
}
```

</details>

<details>

<summary><mark style="color:red;">401</mark>: Unauthorized</summary>

```json
{
    "error": "invalid token. check authorization header."
}
```

</details>

<details>

<summary><mark style="color:red;">422</mark>: Unprocessable Entity</summary>

```json
{
    "error": "currency must be a non-blank string"
}
```

</details>

### Example Request

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

```bash
curl -H 'Authorization: Bearer <API_TOKEN>'
'https://api.sfox.com/v1/analytics/volume?currency=btc&interval=86400&start_time=1689279127000&end_time=1689624727000&net=true'
```

{% endtab %}

{% tab title="NodeJS" %}

```javascript
const axios = require('axios');

axios({
  method: 'get',
  url: 'https://api.sfox.com/v1/analytics/volume?currency=btc&interval=86400&start_time=1689279127000&end_time=1689624727000&net=true',
  headers: {
    'Authorization': 'Bearer <API_KEY>'
  }
}).then(response => {
  console.log(response)
}).catch(err => {
  console.error(err)
});
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

data = requests.get(
  "https://api.sfox.com/v1/analytics/volume?currency=btc&interval=86400&start_time=1689279127000&end_time=1689624727000&net=true",
  headers={
    "Authorization": "Bearer <API_KEY>",
  }
)
print(data)
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sfox.com/rest-api/market-data/get-volume-analytics.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
