# oraclePriceHistoryByTime

<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>"oraclePriceHistoryByTime"</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><tr><td><code>startTime</code></td><td>int</td><td>ms unix timestamp</td></tr><tr><td><code>endTime</code></td><td>int</td><td>ms unix timestamp (optional)</td></tr><tr><td><code>limit</code></td><td>int</td><td>max 2000</td></tr><tr><td><code>dex</code></td><td>string</td><td>DEX identifier e.g. "hyna", "xyz" (optional, returns all if omitted)</td></tr></tbody></table>

Request

{% 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": "oraclePriceHistoryByTime",
      "coin": "BTC",
      "startTime": 1765641292010,
      "endTime": 1765641295024
    }'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import os
import json

response = requests.post(
 'https://api.hydromancer.xyz/info',
 json={
        'type': 'oraclePriceHistoryByTime',
        'coin': 'BTC',
        'startTime': 1765641292010,
        'endTime': 1765641295024
 },
 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: 'oraclePriceHistoryByTime',
    coin: 'BTC',
    limit: 100,
    startTime: 1765641292010,
    endTime: 1765641295024
  },
  {
    headers: {
      'Authorization': `Bearer ${process.env.HYDROMANCER_API_KEY}`,
      'Content-Type': 'application/json'
    }
  }
);

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

{% endtab %}
{% endtabs %}

***

## Response Fields

| Field       | Type    | Description                                                                                      |
| ----------- | ------- | ------------------------------------------------------------------------------------------------ |
| `time`      | int     | Timestamp (ms)                                                                                   |
| `dex`       | string  | DEX identifier                                                                                   |
| `coin`      | string  | Trading pair                                                                                     |
| `oraclePx`  | string? | Oracle price                                                                                     |
| `markPx`    | string? | Mark price (first input)                                                                         |
| `markPx2`   | string? | Mark price (second input) — added from 2026-01-12, only present if hip3 dex pushes 2 mark prices |
| `extPerpPx` | string? | External perp price                                                                              |

<details>

<summary>Response (HIP-3 dex with 2 mark prices)</summary>

```json
[
  {
    "time": 1767965552339,
    "dex": "xyz",
    "coin": "xyz:XYZ100",
    "oraclePx": "25546.00",
    "markPx": "25546.00",
    "markPx2": "25545.00",
    "extPerpPx": "25546.00"
  },
  {
    "time": 1767965555526,
    "dex": "xyz",
    "coin": "xyz:XYZ100",
    "oraclePx": "25555.00",
    "markPx": "25555.00",
    "markPx2": "25554.00",
    "extPerpPx": "25555.00"
  }
]
```

</details>

<details>

<summary>Response (HIP-3 dex with 1 mark price)</summary>

```json
[
  {
    "time": 1767965617506,
    "dex": "hyna",
    "coin": "hyna:BTC",
    "oraclePx": "90527.00",
    "markPx": "90508.27",
    "extPerpPx": "90473.25"
  },
  {
    "time": 1767965620725,
    "dex": "hyna",
    "coin": "hyna:BTC",
    "oraclePx": "90528.00",
    "markPx": "90502.00",
    "extPerpPx": "90473.25"
  }
]
```

</details>


---

# 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/oraclepricehistorybytime.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.
