# assetContext

## Single coin

Request

<table><thead><tr><th width="115.50848388671875">Field</th><th width="177.66351318359375">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>type</code></td><td>string</td><td>Must be <code>"</code>assetContext<code>"</code></td></tr><tr><td><code>coin</code></td><td>string</td><td>symbol e.g. "BTC" or with dex prefix "xyz:XYZ100"</td></tr></tbody></table>

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

```bash
curl -X POST https://api.hydromancer.xyz/info \
  -H "Authorization: Bearer $HYDROMANCER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "assetContext",
    "coin": "BTC"
  }'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import os
import json

response = requests.post(
    'https://api.hydromancer.xyz/info',
    json={
        'type': 'assetContext',
        'coin': 'BTC'
    },
    headers={
        'Authorization': f'Bearer {os.environ["HYDROMANCER_API_KEY"]}',
        'Content-Type': 'application/json'
    }
)

print(json.dumps(response.json(), indent=2))
```

{% endtab %}

{% tab title="Javascript" %}

```javascript
import axios from 'axios';

const response = await axios.post('https://api.hydromancer.xyz/info', {
    type: 'assetContext',
    coin: 'BTC'
}, {
    headers: {
        'Authorization': `Bearer ${process.env.HYDROMANCER_API_KEY}`,
        'Content-Type': 'application/json'
    }
});

console.log(JSON.stringify(response.data, null, 2));
```

{% endtab %}
{% endtabs %}

<details>

<summary>Response</summary>

```json
{
  "oraclePx": "96500.50",
  "markPx": "96485.25",
  "midPx": "96490.50",
  "impactPxs": [ "96490", "96491" ],
  "openInterest": "25401.1214"
}
```

</details>

{% hint style="warning" %}
If the coin is not found (all prices are unavailable), the endpoint returns `HTTP 404 Not Found`.
{% endhint %}

***

## Multiple coins

Query up to 20 coins in a single request. Use `coins` instead of `coin`.

<table><thead><tr><th width="115.50848388671875">Field</th><th width="177.66351318359375">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>type</code></td><td>string</td><td>Must be <code>"assetContext"</code></td></tr><tr><td><code>coins</code></td><td>string[]</td><td>Array of symbols, max 20. e.g. <code>["BTC", "ETH"]</code></td></tr></tbody></table>

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

```bash
curl -X POST https://api.hydromancer.xyz/info \
  -H "Authorization: Bearer $HYDROMANCER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "assetContext",
    "coins": ["BTC", "ETH", "SOL"]
  }'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import os
import json

response = requests.post(
    'https://api.hydromancer.xyz/info',
    json={
        'type': 'assetContext',
        'coins': ['BTC', 'ETH', 'SOL']
    },
    headers={
        'Authorization': f'Bearer {os.environ["HYDROMANCER_API_KEY"]}',
        'Content-Type': 'application/json'
    }
)

print(json.dumps(response.json(), indent=2))
```

{% endtab %}

{% tab title="Javascript" %}

```javascript
import axios from 'axios';

const response = await axios.post('https://api.hydromancer.xyz/info', {
    type: 'assetContext',
    coins: ['BTC', 'ETH', 'SOL']
}, {
    headers: {
        'Authorization': `Bearer ${process.env.HYDROMANCER_API_KEY}`,
        'Content-Type': 'application/json'
    }
});

console.log(JSON.stringify(response.data, null, 2));
```

{% endtab %}
{% endtabs %}

<details>

<summary>Response</summary>

```json
{
  "BTC": {
    "oraclePx": "96500.50",
    "markPx": "96485.25",
    "midPx": "96490.50",
    "impactPxs": [ "96490", "96491" ],
    "openInterest": "25401.1214"
  },
  "ETH": {
    "oraclePx": "3450.10",
    "markPx": "3448.75",
    "midPx": "3449.50",
    "impactPxs": [ "3449", "3450" ],
    "openInterest": "192841.521"
  },
  "SOL": null
}
```

</details>

{% hint style="info" %}
Coins that are not found return `null` in the response map instead of causing a 404.
{% endhint %}

***

## Response Fields

| Field          | Type    | Description                                                                                                             |
| -------------- | ------- | ----------------------------------------------------------------------------------------------------------------------- |
| `oraclePx`     | string? | Oracle price (null if not available)                                                                                    |
| `markPx`       | string? | Mark price (null if not available)                                                                                      |
| `midPx`        | string? | Mid price (null if not available)                                                                                       |
| `impactPxs`    | array?  | Avg execution price to trade impact notional (20k$ BTC/ETH, 6k$ other coins) on the bid and ask (null if not available) |
| `openInterest` | string? | Number of outstanding contracts (null if not available)                                                                 |


---

# 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.hydromancer.xyz/readme/rest-api/asset-data/assetcontext.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.
