GetMarketIdByName
curl --request POST \
--url https://api.fairground.fi/market_service.v1.MarketService/GetMarketIdByName \
--header 'Authorization: Bearer <token>' \
--header 'Connect-Protocol-Version: <connect-protocol-version>' \
--header 'Content-Type: application/json' \
--data '
{
"assetSymbol": "<string>",
"quoteSymbol": "<string>"
}
'import requests
url = "https://api.fairground.fi/market_service.v1.MarketService/GetMarketIdByName"
payload = {
"assetSymbol": "<string>",
"quoteSymbol": "<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({assetSymbol: '<string>', quoteSymbol: '<string>'})
};
fetch('https://api.fairground.fi/market_service.v1.MarketService/GetMarketIdByName', 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/GetMarketIdByName",
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([
'assetSymbol' => '<string>',
'quoteSymbol' => '<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/GetMarketIdByName"
payload := strings.NewReader("{\n \"assetSymbol\": \"<string>\",\n \"quoteSymbol\": \"<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/market_service.v1.MarketService/GetMarketIdByName")
.header("Connect-Protocol-Version", "<connect-protocol-version>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"assetSymbol\": \"<string>\",\n \"quoteSymbol\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fairground.fi/market_service.v1.MarketService/GetMarketIdByName")
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 \"assetSymbol\": \"<string>\",\n \"quoteSymbol\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"marketId": "1"
}Markets
GetMarketIdByName
Resolves an asset/quote symbol pair to its numeric market ID.
asset_symbol is required and fails with INVALID_ARGUMENT if
blank; an unknown asset/quote combination returns NOT_FOUND.
POST
/
market_service.v1.MarketService
/
GetMarketIdByName
GetMarketIdByName
curl --request POST \
--url https://api.fairground.fi/market_service.v1.MarketService/GetMarketIdByName \
--header 'Authorization: Bearer <token>' \
--header 'Connect-Protocol-Version: <connect-protocol-version>' \
--header 'Content-Type: application/json' \
--data '
{
"assetSymbol": "<string>",
"quoteSymbol": "<string>"
}
'import requests
url = "https://api.fairground.fi/market_service.v1.MarketService/GetMarketIdByName"
payload = {
"assetSymbol": "<string>",
"quoteSymbol": "<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({assetSymbol: '<string>', quoteSymbol: '<string>'})
};
fetch('https://api.fairground.fi/market_service.v1.MarketService/GetMarketIdByName', 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/GetMarketIdByName",
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([
'assetSymbol' => '<string>',
'quoteSymbol' => '<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/GetMarketIdByName"
payload := strings.NewReader("{\n \"assetSymbol\": \"<string>\",\n \"quoteSymbol\": \"<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/market_service.v1.MarketService/GetMarketIdByName")
.header("Connect-Protocol-Version", "<connect-protocol-version>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"assetSymbol\": \"<string>\",\n \"quoteSymbol\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fairground.fi/market_service.v1.MarketService/GetMarketIdByName")
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 \"assetSymbol\": \"<string>\",\n \"quoteSymbol\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"marketId": "1"
}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
Underlying asset symbol, e.g. "BTC". Matched case-insensitively and trimmed.
Quote symbol, e.g. "PERP". Optional, but omitting
it looks up a market named exactly by assetSymbol alone (e.g.
"BTC") rather than "BTC-PERP", which may not resolve to any
real market.
Response
200 - application/json
Success
Resolved on-chain market identifier.
⌘I