Get market history pair
curl --request GET \
--url https://demo-api.mobula.io/api/1/market/history/pairimport requests
url = "https://demo-api.mobula.io/api/1/market/history/pair"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://demo-api.mobula.io/api/1/market/history/pair', 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/pair",
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/pair"
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/pair")
.asString();require 'uri'
require 'net/http'
url = URI("https://demo-api.mobula.io/api/1/market/history/pair")
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": [
{
"volume": 123,
"open": 123,
"high": 123,
"low": 123,
"close": 123,
"time": 123
}
]
}Get Historical Pair Data (OHLCV) (Legacy)
Provides historical OHLCV data for trading pairs or assets with flexible time ranges and price formats for market analysis.
GET
/
1
/
market
/
history
/
pair
Get market history pair
curl --request GET \
--url https://demo-api.mobula.io/api/1/market/history/pairimport requests
url = "https://demo-api.mobula.io/api/1/market/history/pair"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://demo-api.mobula.io/api/1/market/history/pair', 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/pair",
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/pair"
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/pair")
.asString();require 'uri'
require 'net/http'
url = URI("https://demo-api.mobula.io/api/1/market/history/pair")
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": [
{
"volume": 123,
"open": 123,
"high": 123,
"low": 123,
"close": 123,
"time": 123
}
]
}Legacy EndpointThis endpoint is deprecated. Please use the new v2 endpoints instead:
- /api/2/market/ohlcv-history - For pool/market queries by address
- /api/2/token/ohlcv-history - For token/asset queries by name, symbol, or token address
Query Details
Input in “address” field the contract address of the pair/pool you want to query. You can also query via asset explained in great details here and it will return the largest pair’s data for this asset (the input is the “asset” input, you cannot use symbol here). By default, MEV data is not included in the response. By default, the currency is USD. You can set it to base token by setting “usd” param to false.| Parameter | Type | Description |
|---|---|---|
blockchain | string | Blockchain identifier (e.g., "ethereum", "bsc", "solana"). Automatically normalized. |
asset | string | Asset name or identifier. Returns data for the most liquid pair of the asset. |
symbol | string | Token ticker symbol (e.g., "ETH"). Optional, not used when querying by asset. |
address | string | Contract address of the pair or pool. Takes priority over asset and symbol. |
baseToken | string | Contract address of the base token in the pair. Normalized automatically. |
from | number | Start of the timeframe (Unix timestamp in ms). Defaults to 0. |
to | number | End of the timeframe (Unix timestamp in ms). Defaults to current time. |
period | string | Candle resolution. Options: 1s, 5s, 15s, 30s, 1min, 5min, 15min, 1h, 4h, 1d, 7d, 30d. Default: 5m. |
amount | number | Number of candles to return. Defaults to 1000. Overrides from/to if both are set. |
usd | boolean | Price reference mode. true = USD (default), false = base token pricing. |
mode | enum | Data source mode. "pool" (default) returns pool-specific data, "asset" aggregates by asset. |
Data details
Available resolutions:- 1s
- 5s
- 15s
- 30s
- 1min
- 5min
- 15min
- 1h
- 4h
- 1d
- 7d
- 30d
Troubleshoot
By default, the amount param is set to 1000, and has priority over from/to params - which means if you set a very large timeframe, which low granularity, and don’t adapt the amount parameter, it will be capped at 1000 entries. You can increase the amount parameter to get more data points.Get a specific timeframe
The current endpoint is designed to serve TradingView user interface, which isn’t thinking with timeframes but with candle amounts. If no trades are happening in a given timeframe, the amount of candles will be reduced to the amount of intervals where trades happened. To get a specific timeframe, you can use thefrom and to parameters, coupled with “amount” being set to : to - from / resolution - and filter out manually the data points that are not in the timeframe you want.
Usage Example:
- Query by Address, Period, USD, and Time Range
curl -X GET "https://api.mobula.io/api/1/market/history/pair?period=15min&blockchain=ethereum&to=1754313334939&from=1754310600000&amount=3&address=0xefb47fcfcad4f96c83d4ca676842fb03ef20a477&usd=true"
Query Parameters
Blockchain name or chain ID
Token contract address
Token symbol
Pool/pair address
Base token address
Start date (timestamp or ISO string)
End date (timestamp or ISO string)
Candle period (e.g., "5m", "1h", "24h")
Token amount for price calculation
Response
200 - application/json
Market history response
Show child attributes
Show child attributes