Get market history
curl --request GET \
--url https://demo-api.mobula.io/api/1/market/historyimport requests
url = "https://demo-api.mobula.io/api/1/market/history"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://demo-api.mobula.io/api/1/market/history', 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/history",
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/history"
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/history")
.asString();require 'uri'
require 'net/http'
url = URI("https://demo-api.mobula.io/api/1/market/history")
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{
"data": {
"price_history": [
[
123
]
],
"volume_history": [
[
123
]
],
"market_cap_history": [
[
123
]
],
"market_cap_diluted_history": [
[
123
]
],
"name": "<string>",
"symbol": "<string>",
"blockchain": "<string>",
"address": "<string>"
}
}Get Historical Market Data (Legacy)
Retrieve historical price and volume data for an asset, with customizable time granularity for precise market analysis.
GET
/
1
/
market
/
history
Get market history
curl --request GET \
--url https://demo-api.mobula.io/api/1/market/historyimport requests
url = "https://demo-api.mobula.io/api/1/market/history"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://demo-api.mobula.io/api/1/market/history', 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/history",
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/history"
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/history")
.asString();require 'uri'
require 'net/http'
url = URI("https://demo-api.mobula.io/api/1/market/history")
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{
"data": {
"price_history": [
[
123
]
],
"volume_history": [
[
123
]
],
"market_cap_history": [
[
123
]
],
"market_cap_diluted_history": [
[
123
]
],
"name": "<string>",
"symbol": "<string>",
"blockchain": "<string>",
"address": "<string>"
}
}Legacy EndpointThis endpoint is deprecated. Please use the new /api/2/asset/price-history endpoint instead, which provides the same functionality with a cleaner camelCase response format.
Timestamps are in MS, it’s JS timestamps.
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.| Parameter | Type | Description |
|---|---|---|
asset | string | Asset name or contract address. If an address is provided, you must also provide blockchain. |
blockchain | string | Blockchain identifier (e.g., "ethereum", "base"). Required when asset is an address. |
symbol | string | Token ticker symbol (e.g., "ETH"). Optional alternative to asset. |
id | number | Mobula’s internal asset ID (numeric identifier). |
period | string | Candle resolution. Supported: 5m, 15m, 1h, 6h, 1d. Defaults to auto-granularity. |
from | number | Start timestamp (ms). Defaults to 0 (epoch). |
to | number | End timestamp (ms). Defaults to current time. |
Data details
Price data is computed using Octopus, Mobula’s market data engine. You can have a high-level overview of how it’s computing DeFi prices here. Data granularity is designed as follows:- 5 minutes for the last 7 days
- 6 hours for the last 30 days
- 1 day for the remaining of history
Granularity settings
You can set the granularity of the data by adding theperiod parameter.
5mfor 5 minutes15mfor 15 minutes1hfor 1 hour6hfor 6 hours1dfor 1 day
Usage Example:
- Query by Asset and Time Range
curl -X GET "https://api.mobula.io/api/1/market/history?from=1754337900000&to=1754721284970&asset=0x0000000000c5dc95539589fbd24be07c6c14eca4"
- Query by Asset and Period
curl -X GET "https://api.mobula.io/api/1/market/history?to=1754721284970&period=1h&asset=0xc4ce8e63921b8b6cbdb8fcb6bd64cc701fb926f2&blockchain=ethereum"