GetMarketSummary
curl --request POST \
--url https://api.fairground.fi/market_service.v1.MarketService/GetMarketSummary \
--header 'Authorization: Bearer <token>' \
--header 'Connect-Protocol-Version: <connect-protocol-version>' \
--header 'Content-Type: application/json' \
--data '
{
"market": {
"marketId": "<string>"
}
}
'import requests
url = "https://api.fairground.fi/market_service.v1.MarketService/GetMarketSummary"
payload = { "market": { "marketId": "<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>'}})
};
fetch('https://api.fairground.fi/market_service.v1.MarketService/GetMarketSummary', 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/market_service.v1.MarketService/GetMarketSummary",
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>'
]
]),
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/market_service.v1.MarketService/GetMarketSummary"
payload := strings.NewReader("{\n \"market\": {\n \"marketId\": \"<string>\"\n }\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/market_service.v1.MarketService/GetMarketSummary")
.header("Connect-Protocol-Version", "<connect-protocol-version>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"market\": {\n \"marketId\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fairground.fi/market_service.v1.MarketService/GetMarketSummary")
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}"
response = http.request(request)
puts response.read_body{
"marketSummary": {
"marketId": "1",
"marketName": "BTC-PERP",
"openInterest": 42.75,
"priceChange24h": 2.35,
"volume24h": 8500000,
"executableDepth": {
"short": 120000,
"long": 95000,
"shortDouble": 120000.5,
"longDouble": 95250.25
},
"marketType": "crypto",
"price": 65420,
"rebateIndicatorLong": 310.5,
"rebateIndicatorShort": 275.2,
"isOpen": true
}
}Markets
GetMarketSummary
Returns a live trading summary for one market: open interest, 24h price change and volume, executable order-book depth at the current price, rebate indicators, and whether the market is currently open for trading.
If computing executable depth fails internally, the
request still succeeds with executableDepth left at zero rather
than failing outright.
POST
/
market_service.v1.MarketService
/
GetMarketSummary
GetMarketSummary
curl --request POST \
--url https://api.fairground.fi/market_service.v1.MarketService/GetMarketSummary \
--header 'Authorization: Bearer <token>' \
--header 'Connect-Protocol-Version: <connect-protocol-version>' \
--header 'Content-Type: application/json' \
--data '
{
"market": {
"marketId": "<string>"
}
}
'import requests
url = "https://api.fairground.fi/market_service.v1.MarketService/GetMarketSummary"
payload = { "market": { "marketId": "<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>'}})
};
fetch('https://api.fairground.fi/market_service.v1.MarketService/GetMarketSummary', 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/market_service.v1.MarketService/GetMarketSummary",
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>'
]
]),
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/market_service.v1.MarketService/GetMarketSummary"
payload := strings.NewReader("{\n \"market\": {\n \"marketId\": \"<string>\"\n }\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/market_service.v1.MarketService/GetMarketSummary")
.header("Connect-Protocol-Version", "<connect-protocol-version>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"market\": {\n \"marketId\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fairground.fi/market_service.v1.MarketService/GetMarketSummary")
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}"
response = http.request(request)
puts response.read_body{
"marketSummary": {
"marketId": "1",
"marketName": "BTC-PERP",
"openInterest": 42.75,
"priceChange24h": 2.35,
"volume24h": 8500000,
"executableDepth": {
"short": 120000,
"long": 95000,
"shortDouble": 120000.5,
"longDouble": 95250.25
},
"marketType": "crypto",
"price": 65420,
"rebateIndicatorLong": 310.5,
"rebateIndicatorShort": 275.2,
"isOpen": true
}
}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.
Available options:
1 Define the timeout, in ms
Body
application/json
Market to summarize, by market_id or market_symbol.
- market_id
- market_symbol
Show child attributes
Show child attributes
Response
200 - application/json
Success
Live trading summary for the requested market.
Show child attributes
Show child attributes
⌘I