# Authorized Market Data

### API Access and Authorization

API Authentication is done using an API key and signature. User needs to associate the following information in the request header. View the [Authorization page](https://docs.aquanow.io/aquanow/legacy/integration-guide/authentication) for more detail.

### Orderbook

## Get client specific aggregated orderbook with fees included by symbol

<mark style="color:blue;">`GET`</mark> `https://market.aquanow.io/v2/orderbook`

Returns orderbook data after applying custom market data spread.

#### Query Parameters

| Name                                     | Type   | Description                                           |
| ---------------------------------------- | ------ | ----------------------------------------------------- |
| symbol<mark style="color:red;">\*</mark> | String | <p>e.g., <code>BTC-USD</code></p><p>Currency pair</p> |
| precision                                | Number | <p>e.g., <code>2</code></p><p>Precision level</p>     |
| depth                                    | Number | <p>e.g.,<code>200</code></p><p>Orderbook depth</p>    |

#### Headers

| Name                                           | Type   | Description                                                                                                                                                        |
| ---------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| x-api-key<mark style="color:red;">\*</mark>    | String | <p><code>{{x-api-key}}</code></p><p>Api Auth Key</p>                                                                                                               |
| x-signature <mark style="color:red;">\*</mark> | String | <p><code>32c92460f65cbb78d0eaf9a4361fb6b0a2bb8bb4c40f531e9974a0afc12d9a328b5ff621a544d242ee9ba1dfa799c85a</code></p><p>Signature created using your API secret</p> |
| x-nonce<mark style="color:red;">\*</mark>      | String | <p><code>1657731573930</code></p><p>Timestamp in millisecond</p>                                                                                                   |

{% tabs %}
{% tab title="200: OK " %}
Returns a [MarketDataObject](https://docs.aquanow.io/aquanow/legacy/data-objects-and-statuses/market-data-objects#marketdataobject).

```json
{
  "dataType": "aggOB",
  "lastUpdated": 1568927470001,
  "symbol": "BTC-USD",
  "precision": [
    1,
    2
  ],
  "bids": [
    {
      "quote": 10266.84,
      "quantity": 0.0072,
      "cumulativeQuantity": 0.0072
    },
    {
      "quote": 10266.5,
      "quantity": 1.948,
      "cumulativeQuantity": 1.9552
    },
    {
      "quote": 10266,
      "quantity": 0.06,
      "cumulativeQuantity": 2.0152
    },
    {
      "quote": 10263.93,
      "quantity": 0.06,
      "cumulativeQuantity": 2.0752
    },
    {
      "quote": 10263.7,
      "quantity": 0.1,
      "cumulativeQuantity": 2.1752
    },
    {
      "quote": 10262.2,
      "quantity": 0.25,
      "cumulativeQuantity": 2.4252
    },
    {
      "quote": 10261.71,
      "quantity": 0.1948,
      "cumulativeQuantity": 2.62
    },
    {
      "quote": 10261.7,
      "quantity": 0.399,
      "cumulativeQuantity": 3.019
    },
    {
      "quote": 10255.91,
      "quantity": 0.6246,
      "cumulativeQuantity": 3.6436
    },
    {
      "quote": 10255.89,
      "quantity": 0.1,
      "cumulativeQuantity": 3.7436
    },
    {
      "quote": 10253.79,
      "quantity": 0.0853,
      "cumulativeQuantity": 3.8289
    },
    {
      "quote": 10253.78,
      "quantity": 0.1,
      "cumulativeQuantity": 3.9289
    },
    {
      "quote": 10253.42,
      "quantity": 4,
      "cumulativeQuantity": 7.9289
    },
    {
      "quote": 10253.32,
      "quantity": 0.1,
      "cumulativeQuantity": 8.0289
    },
    {
      "quote": 10252.38,
      "quantity": 0.0158,
      "cumulativeQuantity": 8.0447
    },
    {
      "quote": 10250.81,
      "quantity": 0.0508,
      "cumulativeQuantity": 8.0955
    },
    {
      "quote": 10248.85,
      "quantity": 4.8,
      "cumulativeQuantity": 12.8955
    },
    {
      "quote": 10248.66,
      "quantity": 0.1016,
      "cumulativeQuantity": 12.9971
    },
    {
      "quote": 10247.23,
      "quantity": 0.1,
      "cumulativeQuantity": 13.0971
    },
    {
      "quote": 10247.12,
      "quantity": 0.1995,
      "cumulativeQuantity": 13.2966
    },
    {
      "quote": 10245.21,
      "quantity": 0.0507,
      "cumulativeQuantity": 13.3473
    },
    {
      "quote": 10244.26,
      "quantity": 2,
      "cumulativeQuantity": 15.3473
    },
    {
      "quote": 10242.39,
      "quantity": 0.1,
      "cumulativeQuantity": 15.4473
    },
    {
      "quote": 10242.29,
      "quantity": 0.0316,
      "cumulativeQuantity": 15.4789
    },
    {
      "quote": 10240.08,
      "quantity": 0.0474,
      "cumulativeQuantity": 15.5263
    },
    {
      "quote": 10239.29,
      "quantity": 0.6598,
      "cumulativeQuantity": 16.1861
    },
    {
      "quote": 10238.96,
      "quantity": 0.1,
      "cumulativeQuantity": 16.2861
    },
    {
      "quote": 10234,
      "quantity": 0.0021,
      "cumulativeQuantity": 16.2882
    },
    {
      "quote": 10228.23,
      "quantity": 0.1,
      "cumulativeQuantity": 16.3882
    },
    {
      "quote": 10226.19,
      "quantity": 0.2491,
      "cumulativeQuantity": 16.6373
    },
    {
      "quote": 10225.73,
      "quantity": 0.0019,
      "cumulativeQuantity": 16.6392
    },
    {
      "quote": 10222.5,
      "quantity": 0.1,
      "cumulativeQuantity": 16.7392
    },
    {
      "quote": 10218.67,
      "quantity": 0.001,
      "cumulativeQuantity": 16.7402
    },
    {
      "quote": 10216.33,
      "quantity": 0.0029,
      "cumulativeQuantity": 16.7431
    },
    {
      "quote": 10212.85,
      "quantity": 0.0014,
      "cumulativeQuantity": 16.7445
    },
    {
      "quote": 10200.01,
      "quantity": 0.0294,
      "cumulativeQuantity": 16.7739
    },
    {
      "quote": 10200,
      "quantity": 0.2628,
      "cumulativeQuantity": 17.0367
    },
    {
      "quote": 10196.46,
      "quantity": 6.4736,
      "cumulativeQuantity": 23.5103
    },
    {
      "quote": 10195,
      "quantity": 0.0021,
      "cumulativeQuantity": 23.5124
    },
    {
      "quote": 10182,
      "quantity": 0.1574,
      "cumulativeQuantity": 23.6698
    },
    {
      "quote": 10180,
      "quantity": 0.0155,
      "cumulativeQuantity": 23.6853
    },
    {
      "quote": 10173.38,
      "quantity": 0.0016,
      "cumulativeQuantity": 23.6869
    },
    {
      "quote": 10168.47,
      "quantity": 0.0019,
      "cumulativeQuantity": 23.6888
    },
    {
      "quote": 10163.12,
      "quantity": 0.012,
      "cumulativeQuantity": 23.7008
    },
    {
      "quote": 10156,
      "quantity": 0.0021,
      "cumulativeQuantity": 23.7029
    },
    {
      "quote": 10152.54,
      "quantity": 0.0045,
      "cumulativeQuantity": 23.7074
    },
    {
      "quote": 10137.69,
      "quantity": 0.02,
      "cumulativeQuantity": 23.7274
    },
    {
      "quote": 10131.48,
      "quantity": 0.0076,
      "cumulativeQuantity": 23.735
    },
    {
      "quote": 10125,
      "quantity": 0.0404,
      "cumulativeQuantity": 23.7754
    },
    {
      "quote": 10117,
      "quantity": 0.0021,
      "cumulativeQuantity": 23.7775
    }
  ],
  "asks": [
    {
      "quote": 10272.58,
      "quantity": 0.0061,
      "cumulativeQuantity": 0.0061
    },
    {
      "quote": 10272.78,
      "quantity": 0.0475,
      "cumulativeQuantity": 0.0536
    },
    {
      "quote": 10275.52,
      "quantity": 0.0632,
      "cumulativeQuantity": 0.1168
    },
    {
      "quote": 10277.44,
      "quantity": 0.0602,
      "cumulativeQuantity": 0.177
    },
    {
      "quote": 10277.45,
      "quantity": 0.1,
      "cumulativeQuantity": 0.277
    },
    {
      "quote": 10278.06,
      "quantity": 0.5,
      "cumulativeQuantity": 0.777
    },
    {
      "quote": 10278.56,
      "quantity": 0.25,
      "cumulativeQuantity": 1.027
    },
    {
      "quote": 10279.34,
      "quantity": 0.15,
      "cumulativeQuantity": 1.177
    },
    {
      "quote": 10280.15,
      "quantity": 0.1283,
      "cumulativeQuantity": 1.3053
    },
    {
      "quote": 10281.75,
      "quantity": 0.15,
      "cumulativeQuantity": 1.4553
    },
    {
      "quote": 10285.25,
      "quantity": 0.0508,
      "cumulativeQuantity": 1.5061
    },
    {
      "quote": 10286.3,
      "quantity": 2.02,
      "cumulativeQuantity": 3.5261
    },
    {
      "quote": 10286.8,
      "quantity": 0.1944,
      "cumulativeQuantity": 3.7205
    },
    {
      "quote": 10286.81,
      "quantity": 0.1016,
      "cumulativeQuantity": 3.8221
    },
    {
      "quote": 10289.44,
      "quantity": 0.0506,
      "cumulativeQuantity": 3.8727
    },
    {
      "quote": 10291.13,
      "quantity": 2,
      "cumulativeQuantity": 5.8727
    },
    {
      "quote": 10291.5,
      "quantity": 0.1013,
      "cumulativeQuantity": 5.974
    },
    {
      "quote": 10292.16,
      "quantity": 0.152,
      "cumulativeQuantity": 6.126
    },
    {
      "quote": 10293.12,
      "quantity": 0.0176,
      "cumulativeQuantity": 6.1436
    },
    {
      "quote": 10295.25,
      "quantity": 0.5828,
      "cumulativeQuantity": 6.7264
    },
    {
      "quote": 10295.8,
      "quantity": 4,
      "cumulativeQuantity": 10.7264
    },
    {
      "quote": 10300.5,
      "quantity": 0.583,
      "cumulativeQuantity": 11.3094
    },
    {
      "quote": 10302.61,
      "quantity": 0.0352,
      "cumulativeQuantity": 11.3446
    },
    {
      "quote": 10305.75,
      "quantity": 0.583,
      "cumulativeQuantity": 11.9276
    },
    {
      "quote": 10308.21,
      "quantity": 0.0529,
      "cumulativeQuantity": 11.9805
    },
    {
      "quote": 10310.42,
      "quantity": 0.0011,
      "cumulativeQuantity": 11.9816
    },
    {
      "quote": 10312,
      "quantity": 0.002,
      "cumulativeQuantity": 11.9836
    },
    {
      "quote": 10312.93,
      "quantity": 0.1994,
      "cumulativeQuantity": 12.183
    },
    {
      "quote": 10314,
      "quantity": 0.368,
      "cumulativeQuantity": 12.551
    },
    {
      "quote": 10316.12,
      "quantity": 0.012,
      "cumulativeQuantity": 12.563
    },
    {
      "quote": 10316.65,
      "quantity": 0.25,
      "cumulativeQuantity": 12.813
    },
    {
      "quote": 10319,
      "quantity": 0.001,
      "cumulativeQuantity": 12.814
    },
    {
      "quote": 10323.23,
      "quantity": 0.6596,
      "cumulativeQuantity": 13.4736
    },
    {
      "quote": 10332.96,
      "quantity": 0.8275,
      "cumulativeQuantity": 14.3011
    },
    {
      "quote": 10333,
      "quantity": 25,
      "cumulativeQuantity": 39.3011
    },
    {
      "quote": 10338,
      "quantity": 0.001,
      "cumulativeQuantity": 39.3021
    },
    {
      "quote": 10341.23,
      "quantity": 0.0019,
      "cumulativeQuantity": 39.304
    },
    {
      "quote": 10347.96,
      "quantity": 0.0292,
      "cumulativeQuantity": 39.3332
    },
    {
      "quote": 10348,
      "quantity": 0.0086,
      "cumulativeQuantity": 39.3418
    },
    {
      "quote": 10349.98,
      "quantity": 0.3901,
      "cumulativeQuantity": 39.7319
    },
    {
      "quote": 10349.99,
      "quantity": 0.0014,
      "cumulativeQuantity": 39.7333
    },
    {
      "quote": 10350,
      "quantity": 5,
      "cumulativeQuantity": 44.7333
    },
    {
      "quote": 10351,
      "quantity": 0.002,
      "cumulativeQuantity": 44.7353
    },
    {
      "quote": 10351.49,
      "quantity": 0.0175,
      "cumulativeQuantity": 44.7528
    },
    {
      "quote": 10355.93,
      "quantity": 0.0045,
      "cumulativeQuantity": 44.7573
    },
    {
      "quote": 10356.41,
      "quantity": 6.4734,
      "cumulativeQuantity": 51.2307
    },
    {
      "quote": 10356.58,
      "quantity": 0.02,
      "cumulativeQuantity": 51.2507
    },
    {
      "quote": 10357,
      "quantity": 0.001,
      "cumulativeQuantity": 51.2517
    },
    {
      "quote": 10369.85,
      "quantity": 0.0022,
      "cumulativeQuantity": 51.2539
    },
    {
      "quote": 10374.54,
      "quantity": 0.12,
      "cumulativeQuantity": 51.3739
    }
  ]
}
```

{% endtab %}

{% tab title="400: Bad Request v2/orderbook?symbol" %}
Returns:&#x20;

```json
{
    "message": "Error: Please provide a symbol"
}

```

{% endtab %}

{% tab title="400: Bad Request v2/orderbook?symbol=btx-usd" %}

```json
{
    "message": "Error: Undefined symbol"
}
```

{% endtab %}

{% tab title="401: Unauthorized Missing API Keys" %}
Returns:

```json
{
    "message": "Unauthorized"
}
```

{% endtab %}
{% endtabs %}

### Best Price

## Get the best price available by symbol

<mark style="color:blue;">`GET`</mark> `https://market.aquanow.io/v2/bestprice`

Returns best price data after applying custom market data spread.

#### Query Parameters

| Name                                     | Type   | Description                                           |
| ---------------------------------------- | ------ | ----------------------------------------------------- |
| symbol<mark style="color:red;">\*</mark> | String | <p>e.g., <code>BTC-USD</code></p><p>Currency pair</p> |
| precision                                | Number | <p>e.g., <code>2</code></p><p>Precision level</p>     |

#### Headers

| Name                                           | Type   | Description                                                                                                                                                        |
| ---------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| x-api-key<mark style="color:red;">\*</mark>    | String | <p><code>{{x-api-key}}</code></p><p>Api Auth Key</p>                                                                                                               |
| x-signature <mark style="color:red;">\*</mark> | String | <p><code>32c92460f65cbb78d0eaf9a4361fb6b0a2bb8bb4c40f531e9974a0afc12d9a328b5ff621a544d242ee9ba1dfa799c85a</code></p><p>Signature created using your API secret</p> |
| x-nonce<mark style="color:red;">\*</mark>      | String | <p><code>1657731573930</code></p><p>Timestamp in millisecond</p>                                                                                                   |

{% tabs %}
{% tab title="200: OK " %}
Returns a [MarketDataObject](https://docs.aquanow.io/aquanow/legacy/data-objects-and-statuses/market-data-objects#marketdataobject).

```json
{
    "dataType": "aggBBO",
    "lastUpdated": 1568927490001,
    "symbol": "BTC-USD",
    "precisions": [
        1,
        2
    ],
    "bestBid": 10266.59,
    "bestAsk": 10272.58,
    "spread": 5.99
}
```

{% endtab %}

{% tab title="400: Bad Request v2/bestprice?symbol" %}
Returns:

```json
{
    "message": "Error: Please provide a symbol"
}
```

{% endtab %}

{% tab title="400: Bad Request v2/bestprice?symbol=btx-usd" %}
Returns:

```json
{
    "message": "Error: Undefined symbol"
}
```

{% endtab %}

{% tab title="401: Unauthorized Missing API Keys" %}
Returns:

```json
{
    "message": "Unauthorized"
}
```

{% endtab %}
{% endtabs %}

### Pre trade Summary

## Get summary of pre-trade analysis

<mark style="color:blue;">`GET`</mark> `https://market.aquanow.io/v2/pretradesummary`

Returns pre-trade analysis data after applying custom market data spread.

#### Query Parameters

| Name                                     | Type   | Description                                           |
| ---------------------------------------- | ------ | ----------------------------------------------------- |
| symbol<mark style="color:red;">\*</mark> | String | <p>e.g., <code>BTC-USD</code></p><p>Currency pair</p> |
| side<mark style="color:red;">\*</mark>   | String | `"buy"` or `"sell"`                                   |
| size<mark style="color:red;">\*</mark>   | Number | <p>e.g., <code>10</code></p><p>Size of trade</p>      |

#### Headers

| Name                                          | Type   | Description                                                                                                                                                        |
| --------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| x-api-key<mark style="color:red;">\*</mark>   | String | <p><code>{{x-api-key}}</code></p><p>Api Auth Key</p>                                                                                                               |
| x-signature<mark style="color:red;">\*</mark> | String | <p><code>32c92460f65cbb78d0eaf9a4361fb6b0a2bb8bb4c40f531e9974a0afc12d9a328b5ff621a544d242ee9ba1dfa799c85a</code></p><p>Signature created using your API secret</p> |
| x-nonce<mark style="color:red;">\*</mark>     | String | <p><code>1657731573930</code></p><p>Timestamp in millisecond</p>                                                                                                   |

{% tabs %}
{% tab title="200: OK " %}
Returns a [PreTradeSummaryObject](https://docs.aquanow.io/aquanow/legacy/data-objects-and-statuses/market-data-objects#pretradesummaryobject).&#x20;

```json
{
  "summary": [
    "2019-09-10 22:33:08:413",
    "BTC-USD",
    "buy",
    10071,
    10087.5000000996,
    16.383676,
    10
  ]
}
```

{% endtab %}

{% tab title="400: Bad Request v2/pretradesummary?symbol" %}
Returns:

```json
{
    "message": "Error: Please provide a symbol"
}
```

{% endtab %}

{% tab title="400: Bad Request v2/pretradesummary?symbol=btx-usd" %}
Returns:

```json
{
    "message": "Error: Undefined symbol"
}
```

{% endtab %}

{% tab title="401: Unauthorized Missing API Key" %}
Return:

```json
{
    "message": "Unauthorized"
}
```

{% endtab %}

{% tab title="400: Bad Request v2/pretradesummary?symbol=BTC-USD\&side" %}
Returns:

```json
{
    "message": "Please provide a side"
}
```

{% endtab %}

{% tab title="400: Bad Request v2/pretradesummary?symbol=BTC-USD\&side=buy\&tradesize" %}
Returns:

```json
{
    "message": "Invalid tradeSize"
}
```

{% endtab %}
{% endtabs %}
