Candlesticks
Retrieve candlestick data for specified symbols and intervals.
Endpoint
GET /candlesticks
Parameters
note
- A maximum of 500 candlesticks can be retrieved per request.
Parameter | Type | Required | Description |
---|---|---|---|
symbol_name | string | Yes | The trading pair symbol (e.g., ONX_USDT ). |
interval | string | Yes | The time interval for candlesticks (Interval Name). |
from | int64 | Yes | Start time in milliseconds since epoch. |
to | int64 | Yes | End time in milliseconds since epoch. |
Response
JSON Array of Objects
Response Fields
Field | Type | Description |
---|---|---|
s | string | Symbol name (e.g., ETH_USDT ). |
i | string | Interval. |
o | string | Open price. |
h | string | High price. |
l | string | Low price. |
c | string | Close price. |
b | string | Base volume (e.g., total volume of ETH for ETH_USDT ). |
q | string | Quote volume (e.g., total volume of USDT for ETH_USDT ). |
t | string | Start time of the candlestick (timestamp in milliseconds). |
u | string | Last updated time of the candlestick (timestamp in milliseconds). |
Example Usage
- cURL
- ReactJS
- React Native
- Node.js
- Java
- C#
- Python
- Go
- Rust
curl --location 'https://spot-markets-dev.goonus.io/candlesticks?symbol_name=ONX_USDT&interval=5m&from=1725937488000&to=1837403913011'
import React, { useEffect, useState } from 'react';
function Candlesticks() {
const [data, setData] = useState(null);
useEffect(() => {
fetch('https://spot-markets-dev.goonus.io/candlesticks?symbol_name=ONX_USDT&interval=5m&from=1725937488000&to=1837403913011')
.then(response => response.json())
.then(setData)
.catch(error => console.error('Error:', error));
}, []);
return (
<div>
<h1>Candlestick Data</h1>
<pre>{data ? JSON.stringify(data, null, 2) : 'Loading...'}</pre>
</div>
);
}
export default Candlesticks;
import { useEffect } from 'react';
import { Text, View } from 'react-native';
const fetchData = async () => {
try {
const response = await fetch('https://spot-markets-dev.goonus.io/candlesticks?symbol_name=ONX_USDT&interval=5m&from=1725937488000&to=1837403913011');
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-dev.goonus.io/candlesticks', {
params: {
symbol_name: 'ONX_USDT',
interval: '5m',
from: 1725937488000,
to: 1837403913011
}
})
.then(response => console.log(response.data))
.catch(error => console.error('Error:', error));
import java.net.http.*;
import java.net.URI;
public class Candlesticks {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://spot-markets-dev.goonus.io/candlesticks?symbol_name=ONX_USDT&interval=5m&from=1725937488000&to=1837403913011"))
.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-dev.goonus.io/candlesticks?symbol_name=ONX_USDT&interval=5m&from=1725937488000&to=1837403913011");
Console.WriteLine(response);
}
}
import requests
url = "https://spot-markets-dev.goonus.io/candlesticks?symbol_name=ONX_USDT&interval=5m&from=1725937488000&to=1837403913011"
response = requests.get(url)
print(response.json())
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func main() {
url := "https://spot-markets-dev.goonus.io/candlesticks?symbol_name=ONX_USDT&interval=5m&from=1725937488000&to=1837403913011"
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-dev.goonus.io/candlesticks?symbol_name=ONX_USDT&interval=5m&from=1725937488000&to=1837403913011").await?.text().await?;
println!("{}", resp);
Ok(())
}
Response Example
[
{
"s": "ETH_USDT",
"i": "1m",
"o": "2.0000000",
"h": "2.0000000",
"l": "2.0000000",
"c": "2.0000000",
"b": "0.000",
"q": "0.00000000",
"t": "1720754160000",
"u": "1720754160000"
},
{
"s": "ETH_USDT",
"i": "1m",
"o": "2.0000000",
"h": "2.0000000",
"l": "2.0000000",
"c": "2.0000000",
"b": "0.000",
"q": "0.00000000",
"t": "1720754100000",
"u": "1720754100000"
}
]