# Predictions Latest

```
GET /v2/prediction/latest
```

## Parameters

| Parameter        | Type        | Required | Description                                                   |
| ---------------- | ----------- | -------- | ------------------------------------------------------------- |
| `miner`          | array\[int] | Yes      | Miner UIDs to fetch (use repeated params: `miner=2&miner=82`) |
| `asset`          | string      | Yes      | `BTC`, `ETH`, `SOL`, `XAU`, `SPYX`, `NVDAX`                   |
| `time_increment` | integer     | Yes      | `300` (5min intervals)                                        |
| `time_length`    | integer     | Yes      | `86400` (24h forecast)                                        |

{% hint style="info" %}
To discover miner UIDs, first call `/v2/leaderboard/latest` to get top-performing miners.
{% endhint %}

## Request Example

{% code title="curl (get leaderboard)" %}

```bash
# First, get top miner UIDs from leaderboard
curl "https://api.synthdata.co/v2/leaderboard/latest?asset=BTC&days=14&limit=5" \
  -H "Authorization: Apikey YOUR_API_KEY"
```

{% endcode %}

{% code title="curl (predictions)" %}

```bash
# Then fetch predictions for those miners
curl "https://api.synthdata.co/v2/prediction/latest?asset=BTC&time_increment=300&time_length=86400&miner=2&miner=82" \
  -H "Authorization: Apikey YOUR_API_KEY"
```

{% endcode %}

## Response

```json
[
  {
    "miner_uid": 2,
    "start_time": 1769097780,
    "predictions": [
      [88975.00, 89012.45, 88934.21, ..., 87633.98],
      [88975.00, 89102.33, 89245.67, ..., 90256.12],
      ...
    ]
  },
  {
    "miner_uid": 82,
    "start_time": 1769097780,
    "predictions": [...]
  }
]
```

| Field         | Description                                                               |
| ------------- | ------------------------------------------------------------------------- |
| `miner_uid`   | Miner identifier                                                          |
| `start_time`  | Unix timestamp when prediction was generated                              |
| `predictions` | Array of 1,000 price paths, each with 289 points (24h at 5-min intervals) |

## Example: Aggregate and Compute Statistics

{% stepper %}
{% step %}

### Get top miner UIDs

Use the leaderboard endpoint to identify top miners and extract their UIDs.

{% code title="python: get leaderboard" %}

```python
import requests

headers = {"Authorization": "Apikey YOUR_API_KEY"}

leaderboard = requests.get(
    "https://api.synthdata.co/v2/leaderboard/latest",
    headers=headers,
    params={"asset": "BTC", "days": 14, "limit": 5}
).json()

miner_uids = [m['neuron_uid'] for m in leaderboard[:5]]
```

{% endcode %}
{% endstep %}

{% step %}

### Fetch predictions and compute statistics

Request predictions for the selected miners, aggregate paths, and compute summary statistics.

{% code title="python: fetch predictions & stats" %}

```python
import requests
import numpy as np

headers = {"Authorization": "Apikey YOUR_API_KEY"}

response = requests.get(
    "https://api.synthdata.co/v2/prediction/latest",
    headers=headers,
    params={
        "asset": "BTC",
        "time_increment": 300,
        "time_length": 86400,
        "miner": miner_uids  # requests library handles array params
    }
)

predictions = response.json()

# Aggregate paths from all miners
all_paths = []
for miner in predictions:
    all_paths.extend(miner['predictions'])

# Calculate statistics
final_prices = [path[-1] for path in all_paths]
current_price = all_paths[0][0]

print(f"Paths aggregated: {len(all_paths)}")
print(f"Current price: ${current_price:,.2f}")
print(f"Median forecast: ${np.median(final_prices):,.2f}")
print(f"Prob up: {sum(1 for p in final_prices if p > current_price) / len(final_prices):.1%}")
```

{% endcode %}
{% endstep %}
{% endstepper %}


---

# 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.synthdata.co/endpoints-overview-1/predictions-latest.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.
