Midprice History
curl --request GET \
--url https://api.hadron.fi/pools/{address}/midprice/historyimport requests
url = "https://api.hadron.fi/pools/{address}/midprice/history"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.hadron.fi/pools/{address}/midprice/history', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.hadron.fi/pools/{address}/midprice/history",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.hadron.fi/pools/{address}/midprice/history"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.hadron.fi/pools/{address}/midprice/history")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hadron.fi/pools/{address}/midprice/history")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"start_time": 1773164464,
"end_time": 1773250864,
"timeframe": "1h",
"data": [
{
"timestamp": 1773164464,
"slot": 410333466,
"midprice": 0.08771598688326776,
"base_spread_factor": 0.9994999999180436,
"signature": "E6cGjfbdRs4ShbmZc1AHeLZg7vN79PYHFWe4..."
},
{
"timestamp": 1773168065,
"slot": 410342211,
"midprice": 0.08653769129887223,
"base_spread_factor": 0.9994999999180436,
"signature": "3Ni7GhiHoPmnUxcgpPMYW61qPkxUunj4WwB9..."
}
]
}
{
"start_time": 1710000000,
"end_time": 1710086400,
"timeframe": "raw",
"next_cursor": 1710003600,
"data": [
{
"timestamp": 1710000000,
"slot": 409267135,
"midprice": 145.23,
"base_spread_factor": 0.9997,
"signature": "44txvmp2QQJa9XLkG8Gj2zHnBScRkXxL5dHd..."
},
{
"timestamp": 1710000400,
"slot": 409268012,
"midprice": 145.45,
"base_spread_factor": 0.9997,
"signature": "5AUySbnZ8qjk1Zr7VqTW8tPKJ9Gm3CfWgJ7x..."
},
{
"timestamp": 1710003600,
"slot": 409275890,
"midprice": 145.12,
"base_spread_factor": 0.9995,
"signature": null
}
]
}
Pools
Midprice History
Returns sampled midprice history for a pool over a time range.
GET
/
pools
/
{address}
/
midprice
/
history
Midprice History
curl --request GET \
--url https://api.hadron.fi/pools/{address}/midprice/historyimport requests
url = "https://api.hadron.fi/pools/{address}/midprice/history"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.hadron.fi/pools/{address}/midprice/history', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.hadron.fi/pools/{address}/midprice/history",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.hadron.fi/pools/{address}/midprice/history"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.hadron.fi/pools/{address}/midprice/history")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hadron.fi/pools/{address}/midprice/history")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"start_time": 1773164464,
"end_time": 1773250864,
"timeframe": "1h",
"data": [
{
"timestamp": 1773164464,
"slot": 410333466,
"midprice": 0.08771598688326776,
"base_spread_factor": 0.9994999999180436,
"signature": "E6cGjfbdRs4ShbmZc1AHeLZg7vN79PYHFWe4..."
},
{
"timestamp": 1773168065,
"slot": 410342211,
"midprice": 0.08653769129887223,
"base_spread_factor": 0.9994999999180436,
"signature": "3Ni7GhiHoPmnUxcgpPMYW61qPkxUunj4WwB9..."
}
]
}
{
"start_time": 1710000000,
"end_time": 1710086400,
"timeframe": "raw",
"next_cursor": 1710003600,
"data": [
{
"timestamp": 1710000000,
"slot": 409267135,
"midprice": 145.23,
"base_spread_factor": 0.9997,
"signature": "44txvmp2QQJa9XLkG8Gj2zHnBScRkXxL5dHd..."
},
{
"timestamp": 1710000400,
"slot": 409268012,
"midprice": 145.45,
"base_spread_factor": 0.9997,
"signature": "5AUySbnZ8qjk1Zr7VqTW8tPKJ9Gm3CfWgJ7x..."
},
{
"timestamp": 1710003600,
"slot": 409275890,
"midprice": 145.12,
"base_spread_factor": 0.9995,
"signature": null
}
]
}
Path Parameters
string
required
The pool config PDA address.
Query Parameters
string
default:"1h"
Sample interval. One of:
1m, 5m, 30m, 1h, 2h, 4h, 12h, 24h, raw.When set to raw, every recorded midprice point is returned without bucketing/sampling. Results are paginated via cursor.integer
Start of the time range as a Unix timestamp in seconds (inclusive). Defaults to
end_time - 86400 (24 hours ago).integer
End of the time range as a Unix timestamp in seconds (inclusive). Defaults to current time.
integer
default:"200"
Number of records per page (1–1000). Only applicable when
timeframe=raw.integer
Unix timestamp in seconds. Fetch records before this timestamp (newest first). Use the
next_cursor value from a previous response to paginate backwards through history. Only applicable when timeframe=raw.string
default:"mainnet-beta"
Solana cluster —
mainnet-beta or devnet.Response
integer
Start of the requested range (Unix seconds).
integer
End of the requested range (Unix seconds).
string
The sample interval used.
integer | null
Timestamp of the oldest record in the current page (Unix seconds). Pass as
cursor to fetch the next (older) page. null when there are no more records. Only present when timeframe=raw.array
Array of midprice samples. One entry per time bucket that contains data (sampled modes), or every recorded point (
raw mode).Show Midprice sample
Show Midprice sample
integer
Sample timestamp (Unix seconds).
integer
Solana slot number when this midprice update was confirmed on-chain.
number
Raw midprice value. This is the on-chain Q32-decoded midprice representing
token_y per token_x in raw units. To get a human-readable price, multiply by 10^(decimals_x - decimals_y).number
Base spread factor (Q32-decoded). A value near
1.0 means minimal spread. The spread in basis points is (1 - base_spread_factor) * 10000.string | null
Base58 transaction signature of the
UpdateMidprice or UpdateMidpriceAndSpreadFactor instruction that produced this update. null for historical records ingested before signature tracking was added.{
"start_time": 1773164464,
"end_time": 1773250864,
"timeframe": "1h",
"data": [
{
"timestamp": 1773164464,
"slot": 410333466,
"midprice": 0.08771598688326776,
"base_spread_factor": 0.9994999999180436,
"signature": "E6cGjfbdRs4ShbmZc1AHeLZg7vN79PYHFWe4..."
},
{
"timestamp": 1773168065,
"slot": 410342211,
"midprice": 0.08653769129887223,
"base_spread_factor": 0.9994999999180436,
"signature": "3Ni7GhiHoPmnUxcgpPMYW61qPkxUunj4WwB9..."
}
]
}
{
"start_time": 1710000000,
"end_time": 1710086400,
"timeframe": "raw",
"next_cursor": 1710003600,
"data": [
{
"timestamp": 1710000000,
"slot": 409267135,
"midprice": 145.23,
"base_spread_factor": 0.9997,
"signature": "44txvmp2QQJa9XLkG8Gj2zHnBScRkXxL5dHd..."
},
{
"timestamp": 1710000400,
"slot": 409268012,
"midprice": 145.45,
"base_spread_factor": 0.9997,
"signature": "5AUySbnZ8qjk1Zr7VqTW8tPKJ9Gm3CfWgJ7x..."
},
{
"timestamp": 1710003600,
"slot": 409275890,
"midprice": 145.12,
"base_spread_factor": 0.9995,
"signature": null
}
]
}
Errors
| Status | Message |
|---|---|
400 | Invalid timeframe |
400 | start_time and end_time must be valid unix timestamps in seconds |
400 | cursor must be a valid unix timestamp in seconds |