Orderbook
Retrieve the orderbook data for a specific symbol.
Endpoint
GET /orderbook
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
symbol_name | string | Yes | The trading pair symbol (e.g., BTC_USDT ). |
Response
JSON Object
Response Fields
Field | Type | Description |
---|---|---|
i | string | The version of the orderbook. |
s | string | Symbol name (e.g., ETH_USDT ). |
b | array | List of bid prices. Each price at index x corresponds to the size at the same index in d . |
d | array | List of bid sizes corresponding to the bid prices in b . |
a | array | List of ask prices. Each price at index x corresponds to the size at the same index in c . |
c | array | List of ask sizes corresponding to the ask prices in a . |
Example Usage
- cURL
- ReactJS
- React Native
- Node.js
- Java
- C#
- Python
- Go
- Rust
curl --location 'https://spot-markets.goonus.io/orderbook?symbol_name=BTC_USDT'
import React, { useEffect, useState } from 'react';
function Orderbook() {
const [data, setData] = useState(null);
useEffect(() => {
fetch('https://spot-markets.goonus.io/orderbook?symbol_name=BTC_USDT')
.then(response => response.json())
.then(setData)
.catch(error => console.error('Error:', error));
}, []);
return (
<div>
<h1>Orderbook</h1>
<pre>{data ? JSON.stringify(data, null, 2) : 'Loading...'}</pre>
</div>
);
}
export default Orderbook;
import { useEffect } from 'react';
import { Text, View } from 'react-native';
const fetchData = async () => {
try {
const response = await fetch('https://spot-markets.goonus.io/orderbook?symbol_name=BTC_USDT');
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
};
export default function App() {
useEffect(() => {
fetchData();
}, []);
return (
<View>
<Text>Check console for API data.</Text>
</View>
);
}
const axios = require('axios');
axios.get('https://spot-markets.goonus.io/orderbook', {
params: {
symbol_name: 'BTC_USDT'
}
})
.then(response => console.log(response.data))
.catch(error => console.error('Error:', error));
import java.net.http.*;
import java.net.URI;
public class Orderbook {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://spot-markets.goonus.io/orderbook?symbol_name=BTC_USDT"))
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program {
static async Task Main(string[] args) {
var client = new HttpClient();
var response = await client.GetStringAsync("https://spot-markets.goonus.io/orderbook?symbol_name=BTC_USDT");
Console.WriteLine(response);
}
}
import requests
url = "https://spot-markets.goonus.io/orderbook?symbol_name=BTC_USDT"
response = requests.get(url)
print(response.json())
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func main() {
url := "https://spot-markets.goonus.io/orderbook?symbol_name=BTC_USDT"
resp, err := http.Get(url)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
panic(err)
}
fmt.Println(string(body))
}
use reqwest;
use tokio;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let resp = reqwest::get("https://spot-markets.goonus.io/orderbook?symbol_name=BTC_USDT").await?.text().await?;
println!("{}", resp);
Ok(())
}
Response Example
{
"i": "7",
"s": "ETH_USDT",
"b": ["1.0000000"],
"d": ["0.170"],
"a": ["4.0000000", "5.0000000"],
"c": ["0.010", "0.130"]
}
note
- Orderbook Data: Includes lists of bid/ask prices and their corresponding sizes.
- Mapping: Each price in
b
(bids) corresponds to the size at the same index ind
, and each price ina
(asks) corresponds to the size at the same index inc
.