GetMarkets
curl --request POST \
--url https://api.fairground.fi/market_service.v1.MarketService/GetMarkets \
--header 'Authorization: Bearer <token>' \
--header 'Connect-Protocol-Version: <connect-protocol-version>' \
--header 'Content-Type: application/json' \
--data '{}'import requests
url = "https://api.fairground.fi/market_service.v1.MarketService/GetMarkets"
payload = {}
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({})
};
fetch('https://api.fairground.fi/market_service.v1.MarketService/GetMarkets', 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/GetMarkets",
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([
]),
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/GetMarkets"
payload := strings.NewReader("{}")
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/GetMarkets")
.header("Connect-Protocol-Version", "<connect-protocol-version>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fairground.fi/market_service.v1.MarketService/GetMarkets")
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 = "{}"
response = http.request(request)
puts response.read_body{
"markets": [
{
"marketId": "1",
"marketName": "BTC-PERP",
"minLeverage": 1,
"maxLeverage": 20,
"minTradeSize": 10,
"maxTradeSize": 500000,
"tickDecimals": 1,
"lotSize": 0.0001,
"sizeDecimals": 8,
"creator": "0x71c7656ec7ab88b098defb751b7401b5f6d8976",
"feeConfig": {
"marketId": "1",
"tradeFeePct": 45,
"maxEntitlement": 500,
"insuranceFundEntitlementPct": 20,
"maxImbalance": 100000
},
"adlConfig": {
"maintenanceMarginRatio": 50,
"seizureThreshold": 66,
"adlThreshold": 10,
"shockFactor": 1,
"maxIfFractionAllowed": 10
},
"maintenanceMarginRate": "50",
"tradeFeePct": 45,
"longRevenue": 1234.5,
"shortRevenue": 987.6
}
]
}Markets
GetMarkets
Returns the full configuration for every active market, ordered by
market_id ascending.
POST
/
market_service.v1.MarketService
/
GetMarkets
GetMarkets
curl --request POST \
--url https://api.fairground.fi/market_service.v1.MarketService/GetMarkets \
--header 'Authorization: Bearer <token>' \
--header 'Connect-Protocol-Version: <connect-protocol-version>' \
--header 'Content-Type: application/json' \
--data '{}'import requests
url = "https://api.fairground.fi/market_service.v1.MarketService/GetMarkets"
payload = {}
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({})
};
fetch('https://api.fairground.fi/market_service.v1.MarketService/GetMarkets', 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/GetMarkets",
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([
]),
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/GetMarkets"
payload := strings.NewReader("{}")
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/GetMarkets")
.header("Connect-Protocol-Version", "<connect-protocol-version>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fairground.fi/market_service.v1.MarketService/GetMarkets")
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 = "{}"
response = http.request(request)
puts response.read_body{
"markets": [
{
"marketId": "1",
"marketName": "BTC-PERP",
"minLeverage": 1,
"maxLeverage": 20,
"minTradeSize": 10,
"maxTradeSize": 500000,
"tickDecimals": 1,
"lotSize": 0.0001,
"sizeDecimals": 8,
"creator": "0x71c7656ec7ab88b098defb751b7401b5f6d8976",
"feeConfig": {
"marketId": "1",
"tradeFeePct": 45,
"maxEntitlement": 500,
"insuranceFundEntitlementPct": 20,
"maxImbalance": 100000
},
"adlConfig": {
"maintenanceMarginRatio": 50,
"seizureThreshold": 66,
"adlThreshold": 10,
"shockFactor": 1,
"maxIfFractionAllowed": 10
},
"maintenanceMarginRate": "50",
"tradeFeePct": 45,
"longRevenue": 1234.5,
"shortRevenue": 987.6
}
]
}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
A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
Response
200 - application/json
Success
Every active market's configuration, ordered by market_id ascending.
Show child attributes
Show child attributes
⌘I