GetHistoricalPrices
curl --request POST \
--url https://api.fairground.fi/price_service.v2.PriceService/GetHistoricalPrices \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"market": {
"marketId": "<string>"
},
"startTime": "2023-01-15T01:30:15.01Z",
"endTime": "2023-01-15T01:30:15.01Z",
"limit": 123,
"offset": 123,
"chainId": "<string>"
}
'import requests
url = "https://api.fairground.fi/price_service.v2.PriceService/GetHistoricalPrices"
payload = {
"market": { "marketId": "<string>" },
"startTime": "2023-01-15T01:30:15.01Z",
"endTime": "2023-01-15T01:30:15.01Z",
"limit": 123,
"offset": 123,
"chainId": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
market: {marketId: '<string>'},
startTime: '2023-01-15T01:30:15.01Z',
endTime: '2023-01-15T01:30:15.01Z',
limit: 123,
offset: 123,
chainId: '<string>'
})
};
fetch('https://api.fairground.fi/price_service.v2.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.v2.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-01-15T01:30:15.01Z',
'endTime' => '2023-01-15T01:30:15.01Z',
'limit' => 123,
'offset' => 123,
'chainId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.v2.PriceService/GetHistoricalPrices"
payload := strings.NewReader("{\n \"market\": {\n \"marketId\": \"<string>\"\n },\n \"startTime\": \"2023-01-15T01:30:15.01Z\",\n \"endTime\": \"2023-01-15T01:30:15.01Z\",\n \"limit\": 123,\n \"offset\": 123,\n \"chainId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.v2.PriceService/GetHistoricalPrices")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"market\": {\n \"marketId\": \"<string>\"\n },\n \"startTime\": \"2023-01-15T01:30:15.01Z\",\n \"endTime\": \"2023-01-15T01:30:15.01Z\",\n \"limit\": 123,\n \"offset\": 123,\n \"chainId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fairground.fi/price_service.v2.PriceService/GetHistoricalPrices")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"market\": {\n \"marketId\": \"<string>\"\n },\n \"startTime\": \"2023-01-15T01:30:15.01Z\",\n \"endTime\": \"2023-01-15T01:30:15.01Z\",\n \"limit\": 123,\n \"offset\": 123,\n \"chainId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"marketId": "<string>",
"market": "<string>",
"priceCandleSticks": [
{
"timestamp": "2023-01-15T01:30:15.01Z",
"open": 123,
"high": 123,
"low": 123,
"close": 123
}
],
"pagination": {
"limit": 123,
"offset": 123,
"totalCount": 123,
"hasMore": true
}
}{
"code": "not_found",
"message": "<string>",
"details": [
{
"type": "<string>",
"value": "aSDinaTvuI8gbWludGxpZnk=",
"debug": {}
}
]
}Prices
GetHistoricalPrices
Returns oracle-price OHLC candles for one market from start_time (inclusive) to end_time (exclusive). interval sets the candle width and defaults to 1 hour. Supports limit/offset pagination. Only the market_id form of the market selector is supported.
POST
/
price_service.v2.PriceService
/
GetHistoricalPrices
GetHistoricalPrices
curl --request POST \
--url https://api.fairground.fi/price_service.v2.PriceService/GetHistoricalPrices \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"market": {
"marketId": "<string>"
},
"startTime": "2023-01-15T01:30:15.01Z",
"endTime": "2023-01-15T01:30:15.01Z",
"limit": 123,
"offset": 123,
"chainId": "<string>"
}
'import requests
url = "https://api.fairground.fi/price_service.v2.PriceService/GetHistoricalPrices"
payload = {
"market": { "marketId": "<string>" },
"startTime": "2023-01-15T01:30:15.01Z",
"endTime": "2023-01-15T01:30:15.01Z",
"limit": 123,
"offset": 123,
"chainId": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
market: {marketId: '<string>'},
startTime: '2023-01-15T01:30:15.01Z',
endTime: '2023-01-15T01:30:15.01Z',
limit: 123,
offset: 123,
chainId: '<string>'
})
};
fetch('https://api.fairground.fi/price_service.v2.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.v2.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-01-15T01:30:15.01Z',
'endTime' => '2023-01-15T01:30:15.01Z',
'limit' => 123,
'offset' => 123,
'chainId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.v2.PriceService/GetHistoricalPrices"
payload := strings.NewReader("{\n \"market\": {\n \"marketId\": \"<string>\"\n },\n \"startTime\": \"2023-01-15T01:30:15.01Z\",\n \"endTime\": \"2023-01-15T01:30:15.01Z\",\n \"limit\": 123,\n \"offset\": 123,\n \"chainId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.v2.PriceService/GetHistoricalPrices")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"market\": {\n \"marketId\": \"<string>\"\n },\n \"startTime\": \"2023-01-15T01:30:15.01Z\",\n \"endTime\": \"2023-01-15T01:30:15.01Z\",\n \"limit\": 123,\n \"offset\": 123,\n \"chainId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fairground.fi/price_service.v2.PriceService/GetHistoricalPrices")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"market\": {\n \"marketId\": \"<string>\"\n },\n \"startTime\": \"2023-01-15T01:30:15.01Z\",\n \"endTime\": \"2023-01-15T01:30:15.01Z\",\n \"limit\": 123,\n \"offset\": 123,\n \"chainId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"marketId": "<string>",
"market": "<string>",
"priceCandleSticks": [
{
"timestamp": "2023-01-15T01:30:15.01Z",
"open": 123,
"high": 123,
"low": 123,
"close": 123
}
],
"pagination": {
"limit": 123,
"offset": 123,
"totalCount": 123,
"hasMore": true
}
}{
"code": "not_found",
"message": "<string>",
"details": [
{
"type": "<string>",
"value": "aSDinaTvuI8gbWludGxpZnk=",
"debug": {}
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Define the version of the Connect protocol Define the version of the Connect protocol. If omitted, use 1.
Available options:
1 Define the timeout, in ms
Example:
1000
Body
application/json
Required
- market
- market
Show child attributes
Show child attributes
Inclusive
Example:
"2023-01-15T01:30:15.01Z"
Exclusive
Example:
"2023-01-15T01:30:15.01Z"
Candle bucket width. Omitted (UNSPECIFIED) defaults to 1 hour.
Available options:
CANDLE_INTERVAL_UNSPECIFIED, CANDLE_INTERVAL_1_MINUTE, CANDLE_INTERVAL_3_MINUTES, CANDLE_INTERVAL_5_MINUTES, CANDLE_INTERVAL_15_MINUTES, CANDLE_INTERVAL_30_MINUTES, CANDLE_INTERVAL_1_HOUR, CANDLE_INTERVAL_2_HOURS, CANDLE_INTERVAL_4_HOURS, CANDLE_INTERVAL_8_HOURS, CANDLE_INTERVAL_12_HOURS, CANDLE_INTERVAL_1_DAY, CANDLE_INTERVAL_3_DAYS, CANDLE_INTERVAL_1_WEEK, CANDLE_INTERVAL_1_MONTH Optional chain identifier for the market. During testnet, Fairground runs on Arbitrum Sepolia (421614).