curl --request POST \
--url https://api.fairground.fi/price_service.v1.PriceService/GetHistoricalPrices \
--header 'Authorization: Bearer <token>' \
--header 'Connect-Protocol-Version: <connect-protocol-version>' \
--header 'Content-Type: application/json' \
--data '
{
"market": {
"marketId": "<string>"
},
"startTime": "2023-11-07T05:31:56Z",
"endTime": "2023-11-07T05:31:56Z",
"limit": 123,
"interval": "<string>"
}
'import requests
url = "https://api.fairground.fi/price_service.v1.PriceService/GetHistoricalPrices"
payload = {
"market": { "marketId": "<string>" },
"startTime": "2023-11-07T05:31:56Z",
"endTime": "2023-11-07T05:31:56Z",
"limit": 123,
"interval": "<string>"
}
headers = {
"Connect-Protocol-Version": "<connect-protocol-version>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Connect-Protocol-Version': '<connect-protocol-version>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
market: {marketId: '<string>'},
startTime: '2023-11-07T05:31:56Z',
endTime: '2023-11-07T05:31:56Z',
limit: 123,
interval: '<string>'
})
};
fetch('https://api.fairground.fi/price_service.v1.PriceService/GetHistoricalPrices', 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.fairground.fi/price_service.v1.PriceService/GetHistoricalPrices",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'market' => [
'marketId' => '<string>'
],
'startTime' => '2023-11-07T05:31:56Z',
'endTime' => '2023-11-07T05:31:56Z',
'limit' => 123,
'interval' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Connect-Protocol-Version: <connect-protocol-version>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.fairground.fi/price_service.v1.PriceService/GetHistoricalPrices"
payload := strings.NewReader("{\n \"market\": {\n \"marketId\": \"<string>\"\n },\n \"startTime\": \"2023-11-07T05:31:56Z\",\n \"endTime\": \"2023-11-07T05:31:56Z\",\n \"limit\": 123,\n \"interval\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Connect-Protocol-Version", "<connect-protocol-version>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.fairground.fi/price_service.v1.PriceService/GetHistoricalPrices")
.header("Connect-Protocol-Version", "<connect-protocol-version>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"market\": {\n \"marketId\": \"<string>\"\n },\n \"startTime\": \"2023-11-07T05:31:56Z\",\n \"endTime\": \"2023-11-07T05:31:56Z\",\n \"limit\": 123,\n \"interval\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fairground.fi/price_service.v1.PriceService/GetHistoricalPrices")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Connect-Protocol-Version"] = '<connect-protocol-version>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"market\": {\n \"marketId\": \"<string>\"\n },\n \"startTime\": \"2023-11-07T05:31:56Z\",\n \"endTime\": \"2023-11-07T05:31:56Z\",\n \"limit\": 123,\n \"interval\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"prices": [],
"totalCount": 0,
"priceCandleSticks": [
{
"timestamp": "2026-07-11T14:00:00Z",
"open": 65200,
"high": 65550,
"low": 65100,
"close": 65420,
"mid": 0,
"volume": 0
}
]
}GetHistoricalPrices
Returns OHLC candlestick data for one market over a time range.
Unlike most other endpoints, market only accepts the numeric
market_id form of MarketSelector.
curl --request POST \
--url https://api.fairground.fi/price_service.v1.PriceService/GetHistoricalPrices \
--header 'Authorization: Bearer <token>' \
--header 'Connect-Protocol-Version: <connect-protocol-version>' \
--header 'Content-Type: application/json' \
--data '
{
"market": {
"marketId": "<string>"
},
"startTime": "2023-11-07T05:31:56Z",
"endTime": "2023-11-07T05:31:56Z",
"limit": 123,
"interval": "<string>"
}
'import requests
url = "https://api.fairground.fi/price_service.v1.PriceService/GetHistoricalPrices"
payload = {
"market": { "marketId": "<string>" },
"startTime": "2023-11-07T05:31:56Z",
"endTime": "2023-11-07T05:31:56Z",
"limit": 123,
"interval": "<string>"
}
headers = {
"Connect-Protocol-Version": "<connect-protocol-version>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Connect-Protocol-Version': '<connect-protocol-version>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
market: {marketId: '<string>'},
startTime: '2023-11-07T05:31:56Z',
endTime: '2023-11-07T05:31:56Z',
limit: 123,
interval: '<string>'
})
};
fetch('https://api.fairground.fi/price_service.v1.PriceService/GetHistoricalPrices', 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.fairground.fi/price_service.v1.PriceService/GetHistoricalPrices",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'market' => [
'marketId' => '<string>'
],
'startTime' => '2023-11-07T05:31:56Z',
'endTime' => '2023-11-07T05:31:56Z',
'limit' => 123,
'interval' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Connect-Protocol-Version: <connect-protocol-version>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.fairground.fi/price_service.v1.PriceService/GetHistoricalPrices"
payload := strings.NewReader("{\n \"market\": {\n \"marketId\": \"<string>\"\n },\n \"startTime\": \"2023-11-07T05:31:56Z\",\n \"endTime\": \"2023-11-07T05:31:56Z\",\n \"limit\": 123,\n \"interval\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Connect-Protocol-Version", "<connect-protocol-version>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.fairground.fi/price_service.v1.PriceService/GetHistoricalPrices")
.header("Connect-Protocol-Version", "<connect-protocol-version>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"market\": {\n \"marketId\": \"<string>\"\n },\n \"startTime\": \"2023-11-07T05:31:56Z\",\n \"endTime\": \"2023-11-07T05:31:56Z\",\n \"limit\": 123,\n \"interval\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fairground.fi/price_service.v1.PriceService/GetHistoricalPrices")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Connect-Protocol-Version"] = '<connect-protocol-version>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"market\": {\n \"marketId\": \"<string>\"\n },\n \"startTime\": \"2023-11-07T05:31:56Z\",\n \"endTime\": \"2023-11-07T05:31:56Z\",\n \"limit\": 123,\n \"interval\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"prices": [],
"totalCount": 0,
"priceCandleSticks": [
{
"timestamp": "2026-07-11T14:00:00Z",
"open": 65200,
"high": 65550,
"low": 65100,
"close": 65420,
"mid": 0,
"volume": 0
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Define the version of the Connect protocol. If omitted, use 1.
1 Define the timeout, in ms
Body
Market to fetch history for. Only the market_id form is
supported. market_symbol selector is not resolved and is
treated as unset. Must be non-zero.
- market_id
- market_symbol
Show child attributes
Show child attributes
Start of the requested time range.
"2023-01-15T01:30:15.01Z"
"2024-12-25T12:00:00Z"
End of the requested time range.
"2023-01-15T01:30:15.01Z"
"2024-12-25T12:00:00Z"
Accepted but currently ignored by the server; no limit is applied.
Candle interval. Supported values: 1S, 1, 60, 1D, 1W, 1M.
Response
Success