Get market sparkline
curl --request GET \
--url https://demo-api.mobula.io/api/1/market/sparklineimport requests
url = "https://demo-api.mobula.io/api/1/market/sparkline"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://demo-api.mobula.io/api/1/market/sparkline', 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://demo-api.mobula.io/api/1/market/sparkline",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://demo-api.mobula.io/api/1/market/sparkline"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://demo-api.mobula.io/api/1/market/sparkline")
.asString();require 'uri'
require 'net/http'
url = URI("https://demo-api.mobula.io/api/1/market/sparkline")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"url": "<string>"
}Misc
Get Sparkline
Retrieves the 24-hour sparkline chart for a given asset. The sparkline is returned as an SVG image by default. You can request a PNG version by adding the query parameter png=true.
GET
/
1
/
market
/
sparkline
Get market sparkline
curl --request GET \
--url https://demo-api.mobula.io/api/1/market/sparklineimport requests
url = "https://demo-api.mobula.io/api/1/market/sparkline"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://demo-api.mobula.io/api/1/market/sparkline', 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://demo-api.mobula.io/api/1/market/sparkline",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://demo-api.mobula.io/api/1/market/sparkline"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://demo-api.mobula.io/api/1/market/sparkline")
.asString();require 'uri'
require 'net/http'
url = URI("https://demo-api.mobula.io/api/1/market/sparkline")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"url": "<string>"
}Query details
Input in “asset” the name of the asset you want to query, or the contract address while adding the blockchain as a second parameter. The market data asset query pattern is explained in great details here, with blockchain format, etc. The default response is a SVG image, if you want a png you can just add a parampng=true to the query.
| Name | Type | Required | Description |
|---|---|---|---|
asset | string | No | The asset identifier to query. This can be the token’s name or the contract address |
blockchain | string | No | Blockchain name (e.g., "ethereum"). Required if using a contract address. |
symbol | string | No | Asset symbol (e.g., "BTC"). |
id | string | No | Mobula internal asset ID. |
timeFrame | string | No | Timeframe for the sparkline (e.g., "24h", "7d"). Default: "24h". |
png | string | No | If "true", returns the image in PNG format instead of SVG. |
Usage Examples
- Query by
Asset Address&BlockchainwithPNGoutput and7-daytimeframe:
curl -X GET "https://demo-api.mobula.io/api/1/market/sparkline?asset=0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf&blockchain=8453&png=true&timeFrame=7d"
- Query by
Asset Name&Blockchain:
curl -X GET "https://demo-api.mobula.io/api/1/market/sparkline?asset=Tether&blockchain=ethereum&png=true"
Query Response
Returns the 24h sparkline url for the given asset.