# Get Order Estimate

## Smart Routing Order Estimate

<mark style="color:blue;">`GET`</mark> `https://api.sfox.com/v1/offer/:side`

Get an estimated execution price for the specified quantity of a given asset using sFOX’s Smart Order Routing, as well as related information. **Only use this as an estimate – execution is not guaranteed.**

#### Path Parameters

| Name                                   | Type   | Description                                                                     |                       |
| -------------------------------------- | ------ | ------------------------------------------------------------------------------- | --------------------- |
| side<mark style="color:red;">\*</mark> | String | <p>Specifies your order side. </p><p><strong>Options</strong>: <code>buy</code> | <code>sell</code></p> |

#### Query Parameters

| Name                                       | Type   | Description                                                                                                                                  |                        |
| ------------------------------------------ | ------ | -------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------- |
| pair                                       | String | <p>The pair or product to trade in the format: (i.e. "btcusd", "ethbtc", "usdteth")</p><p><strong>Default</strong> = <code>btcusd</code></p> |                        |
| quantity<mark style="color:red;">\*</mark> | Number | The base currency quantity to buy or sell. `quantity` **OR** `maxspend` are required.                                                        |                        |
| maxspend                                   | Number | The quote currency amount to spend (side = buy) or receive (side = sell). `quantity` **OR** `maxspend` are required.                         |                        |
| routing\_type                              | String | <p>The sFOX order book used for the estimate</p><p><strong>Options</strong>: <code>NetPrice</code>                                           | <code>Smart</code></p> |

{% tabs %}
{% tab title="200: OK Success" %}

```json
{
    "price": 19203.23787426,
    "subtotal": 19202.05116807,
    "fees": 6.72071791, 
    "total": 19208.77188598,
    "quantity": 1,
    "vwap": 19202.05116807,
    "currency_pair": "btcusd",
    "routing_type": "NetPrice"
}
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
This response is an estimate, not a quote. Prices fluctuate often, therefore, it is possible that an order submitted after receiving this estimate will execute differently. Real-time order book and ticker data is available through SFOX’s [Websocket API](https://www.sfox.com/developers/#websocket-feeds).
{% endhint %}

### Response Body

{% hint style="info" %}
VWAP, Price, Fees, and Total are in the quote currency (e.g. USD for a btcusd pair).
{% endhint %}

<table><thead><tr><th width="184">Key</th><th>Description</th><th width="167.1732854288847">Example</th></tr></thead><tbody><tr><td><code>price</code></td><td>Estimated order limit price to specify when placing this order to receive the estimated fill price at the time of this request. (Quote Currency)</td><td>19203.23787426</td></tr><tr><td><code>subtotal</code></td><td>If <code>side</code> = <code>buy</code>: Estimated cost before fees.<br>If <code>side</code> = <code>sell</code>: Estimated proceeds before fees.</td><td>19202.05116807</td></tr><tr><td><code>fees</code></td><td>Estimated fees you would pay in quote currency terms for this order. <strong>Note: Authentication required to receive a fees estimate</strong></td><td>6.72071791</td></tr><tr><td><code>total</code></td><td>If <code>side</code> = <code>buy</code>: Estimated cost net fees.<br>If <code>side</code> = <code>sell</code>: Estimated proceeds net fees.</td><td>19208.77188598</td></tr><tr><td><code>quantity</code></td><td>The base currency quantity applicable to the estimate. Equal to the <code>quantity</code> parameter in the request.</td><td>1</td></tr><tr><td><code>vwap</code></td><td>Estimated fill price you would receive at the time of this request. (Quote currency terms)</td><td>19202.05116807</td></tr><tr><td><code>currency_pair</code></td><td>Trading pair / symbol</td><td>"btcusd"</td></tr><tr><td><code>routing_type</code></td><td>sFOX order book used for this estimate</td><td>"NetPrice"</td></tr></tbody></table>

### Example Request

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

```bash
curl 'https://api.sfox.com/v1/offer/buy?quantity=1&pair=btcusd'
```

{% endtab %}

{% tab title="NodeJS" %}

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

axios({
  method: 'get',
  url: 'https://api.sfox.com/v1/offer/buy',
  params: {
    quantity: 1,
    pair: 'btcusd' 
  }
}).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/offer/buy",
  headers={
    "Authorization": "Bearer <API_KEY>",
  },
  params={
    "quantity": 1,
    "pair": "btcusd"
  }
)
print(data)
```

{% endtab %}
{% endtabs %}
