Com este método, você pode acessar dados históricos de ações, FIIs, FIAgros, BDRs, moedas, índices e criptomoedas.
Os dados históricos são obtidos através do endpoint /v2/finance/historical com os seguintes parâmetros:
1m: 1 minuto;5m: 5 minutos;15m: 15 minutos;30m: 30 minutos;1h: 1 hora;2h: 2 horas;1d: 1 dia;1M: 1 mês.Somente um dos três tipos de filtros abaixo poderá ser escolhido em cada requisição:
yyyy-mm-dd.yyyy-mm-dd.yyyy-mm-dd.0 para obter dados de hoje.GEThttps://api.hgbrasil.com/v2/finance/historical?symbols=embr3,hglg11,usdbrl,bvsp&days_ago=3&sample_by=1d&key=suachave
curl -X GET "https://api.hgbrasil.com/v2/finance/historical?symbols=embr3%2Chglg11%2Cusdbrl%2Cbvsp&days_ago=3&sample_by=1d&key=suachave"
const url = new URL("/v2/finance/historical", "https://api.hgbrasil.com")
url.searchParams.set("symbols", "embr3,hglg11,usdbrl,bvsp")
url.searchParams.set("days_ago", "3")
url.searchParams.set("sample_by", "1d")
url.searchParams.set("key", "suachave")
const response = await fetch(url.href)
const data = await response.json()
$url = 'https://api.hgbrasil.com/v2/finance/historical';
$queryString = http_build_query([
'symbols' => 'embr3,hglg11,usdbrl,bvsp',
'days_ago' => '3',
'sample_by' => '1d',
'key' => 'suachave'
]);
$response = file_get_contents($url . '?' . $queryString);
$data = json_decode($response, true);
import requests
url = 'https://api.hgbrasil.com/v2/finance/historical'
params = {
'symbols': 'embr3,hglg11,usdbrl,bvsp',
'days_ago': '3',
'sample_by': '1d',
'key': 'suachave'
}
response = requests.get(url, params=params)
data = response.json()
require 'net/http'
require 'uri'
require 'json'
uri = URI('https://api.hgbrasil.com/v2/finance/historical')
uri.query = URI.encode_www_form({
symbols: 'embr3,hglg11,usdbrl,bvsp',
days_ago: '3',
sample_by: '1d',
key: 'suachave'
})
response = Net::HTTP.get(uri)
data = JSON.parse(response, symbolize_names: true)
import java.net.URI;
import java.net.http.*;
var url = "https://api.hgbrasil.com/v2/finance/historical?symbols=embr3%2Chglg11%2Cusdbrl%2Cbvsp&days_ago=3&sample_by=1d&key=suachave";
var client = HttpClient.newHttpClient();
var request = HttpRequest.newBuilder()
.uri(URI.create(url))
.GET()
.build();
var response = client.send(request, HttpResponse.BodyHandlers.ofString());
var data = response.body();
using System.Net.Http;
using System.Text.Json;
using System.Web;
var client = new HttpClient();
var baseUrl = "https://api.hgbrasil.com/v2/finance/historical";
var queryParams = HttpUtility.ParseQueryString(string.Empty);
queryParams["symbols"] = "embr3,hglg11,usdbrl,bvsp";
queryParams["days_ago"] = "3";
queryParams["sample_by"] = "1d";
queryParams["key"] = "suachave";
var url = $"{baseUrl}?{queryParams}";
var response = await client.GetStringAsync(url);
var data = JsonSerializer.Deserialize<dynamic>(response);
{
"by": "days_ago",
"sample_by": "1h",
"valid_key": true,
"results": {
"BVSP": {
"2025-12-04T13:00:00.000000Z": {
"open": 161759.78,
"close": 163594.09,
"high": 163780.45,
"low": 161759.13,
"volume": 0
},
"2025-12-04T14:00:00.000000Z": {
"open": 163601.16,
"close": 163696.98,
"high": 164057.63,
"low": 163570.81,
"volume": 0
},
"2025-12-04T15:00:00.000000Z": {
"open": 163710.44,
"close": 164069.59,
"high": 164435.04,
"low": 163648.83000000002,
"volume": 0
},
"2025-12-04T16:00:00.000000Z": {
"open": 164071.97,
"close": 163887.63,
"high": 164187.41,
"low": 163887.63,
"volume": 0
},
"2025-12-04T17:00:00.000000Z": {
"open": 163866.58000000002,
"close": 163633.58000000002,
"high": 163866.58000000002,
"low": 163550.38,
"volume": 0
},
"2025-12-04T18:00:00.000000Z": {
"open": 163688.33000000002,
"close": 164027.36000000002,
"high": 164051.04,
"low": 163618.04,
"volume": 0
},
"2025-12-04T19:00:00.000000Z": {
"open": 164035.59,
"close": 164288.63,
"high": 164317.25,
"low": 163822.88,
"volume": 0
},
"2025-12-04T20:00:00.000000Z": {
"open": 164279.54,
"close": 164341.76,
"high": 164550.76,
"low": 164151.23,
"volume": 0
},
"2025-12-05T13:00:00.000000Z": {
"open": 164460.59,
"close": 164366.13,
"high": 164723.79,
"low": 164309.97,
"volume": 0
},
"2025-12-05T14:00:00.000000Z": {
"open": 164427.29,
"close": 164673.66,
"high": 164783.26,
"low": 164081.34,
"volume": 0
},
"2025-12-05T15:00:00.000000Z": {
"open": 164642.69,
"close": 162988.39,
"high": 165035.97,
"low": 162923.48,
"volume": 0
},
"2025-12-05T16:00:00.000000Z": {
"open": 162967.89,
"close": 161406.72,
"high": 163474.28,
"low": 160672.86000000002,
"volume": 0
},
"2025-12-05T17:00:00.000000Z": {
"open": 161467.98,
"close": 160245.45,
"high": 162087.04,
"low": 159922.73,
"volume": 0
},
"2025-12-05T18:00:00.000000Z": {
"open": 160214.28,
"close": 157853.66,
"high": 160214.28,
"low": 157853.66,
"volume": 0
},
"2025-12-05T19:00:00.000000Z": {
"open": 157741.73,
"close": 158281.91,
"high": 158412.79,
"low": 157523.98,
"volume": 0
},
"2025-12-05T20:00:00.000000Z": {
"open": 158337.81,
"close": 157462.94,
"high": 158369.89,
"low": 157006.61000000002,
"volume": 0
},
"2025-12-08T13:00:00.000000Z": {
"open": 157369.36000000002,
"close": 158870.13,
"high": 159108.33000000002,
"low": 157369.36000000002,
"volume": 0
},
"2025-12-08T14:00:00.000000Z": {
"open": 158888.91,
"close": 158012.38,
"high": 159100.08000000002,
"low": 157879.14,
"volume": 0
},
"2025-12-08T15:00:00.000000Z": {
"open": 158010.88,
"close": 157794.19,
"high": 158034.16,
"low": 157492.73,
"volume": 0
},
"2025-12-08T16:00:00.000000Z": {
"open": 157809.61000000002,
"close": 158304.33000000002,
"high": 158466.83000000002,
"low": 157755.97,
"volume": 0
},
"2025-12-08T17:00:00.000000Z": {
"open": 158303.7,
"close": 158853.98,
"high": 159235.36000000002,
"low": 158206.29,
"volume": 0
},
"2025-12-08T18:00:00.000000Z": {
"open": 158854.67,
"close": 158674.03,
"high": 158985.23,
"low": 158460.83000000002,
"volume": 0
},
"2025-12-08T19:00:00.000000Z": {
"open": 158693.42,
"close": 158613.56,
"high": 158713.7,
"low": 158486.61000000002,
"volume": 0
},
"2025-12-08T20:00:00.000000Z": {
"open": 158639.19,
"close": 157985.81,
"high": 158750.39,
"low": 157769.7,
"volume": 0
}
},
"HGLG11": {
"2025-12-04T13:00:00.000000Z": {
"open": 158.81,
"close": 159.08,
"high": 159.15,
"low": 158.3,
"volume": 5933
},
"2025-12-04T14:00:00.000000Z": {
"open": 159.08,
"close": 159,
"high": 159.12,
"low": 158.8,
"volume": 6934
},
"2025-12-04T15:00:00.000000Z": {
"open": 159,
"close": 159.09,
"high": 159.13,
"low": 158.88,
"volume": 5681
},
"2025-12-04T16:00:00.000000Z": {
"open": 159.1,
"close": 159.17,
"high": 159.19,
"low": 159.04,
"volume": 5015
},
"2025-12-04T17:00:00.000000Z": {
"open": 159.17,
"close": 158.94,
"high": 159.17,
"low": 158.87,
"volume": 5071
},
"2025-12-04T18:00:00.000000Z": {
"open": 159.04,
"close": 159.13,
"high": 159.16,
"low": 158.9,
"volume": 3219
},
"2025-12-04T19:00:00.000000Z": {
"open": 159.13,
"close": 158.97,
"high": 159.13,
"low": 158.97,
"volume": 4600
},
"2025-12-04T20:00:00.000000Z": {
"open": 158.97,
"close": 159.09,
"high": 159.09,
"low": 158.9,
"volume": 3186
},
"2025-12-05T13:00:00.000000Z": {
"open": 159.09,
"close": 159.91,
"high": 159.97,
"low": 159.08,
"volume": 10362
},
"2025-12-05T14:00:00.000000Z": {
"open": 159.89,
"close": 159.74,
"high": 159.99,
"low": 159.65,
"volume": 9242
},
"2025-12-05T15:00:00.000000Z": {
"open": 159.83,
"close": 159.75,
"high": 159.88,
"low": 159.63,
"volume": 5602
},
"2025-12-05T16:00:00.000000Z": {
"open": 159.75,
"close": 159.49,
"high": 159.83,
"low": 159.37,
"volume": 6771
},
"2025-12-05T17:00:00.000000Z": {
"open": 159.49,
"close": 159.79,
"high": 159.85,
"low": 159.41,
"volume": 5302
},
"2025-12-05T18:00:00.000000Z": {
"open": 159.79,
"close": 159.51,
"high": 159.79,
"low": 159.49,
"volume": 6646
},
"2025-12-05T19:00:00.000000Z": {
"open": 159.49,
"close": 159.32,
"high": 159.6,
"low": 159.15,
"volume": 6168
},
"2025-12-05T20:00:00.000000Z": {
"open": 159.31,
"close": 159.1,
"high": 159.36,
"low": 158.81,
"volume": 4084
},
"2025-12-08T13:00:00.000000Z": {
"open": 159.89,
"close": 159.78,
"high": 159.91,
"low": 159.3,
"volume": 12540
},
"2025-12-08T14:00:00.000000Z": {
"open": 159.88,
"close": 161.5,
"high": 161.81,
"low": 159.69,
"volume": 21901
},
"2025-12-08T15:00:00.000000Z": {
"open": 161.44,
"close": 161.47,
"high": 161.99,
"low": 161.14,
"volume": 41718
},
"2025-12-08T16:00:00.000000Z": {
"open": 161.49,
"close": 160.65,
"high": 161.9,
"low": 160.37,
"volume": 31645
},
"2025-12-08T17:00:00.000000Z": {
"open": 160.69,
"close": 160.35,
"high": 160.91,
"low": 160.32,
"volume": 14766
},
"2025-12-08T18:00:00.000000Z": {
"open": 160.44,
"close": 160.59,
"high": 160.94,
"low": 160.35,
"volume": 11353
},
"2025-12-08T19:00:00.000000Z": {
"open": 160.59,
"close": 159.88,
"high": 160.6,
"low": 159.8,
"volume": 9752
},
"2025-12-08T20:00:00.000000Z": {
"open": 159.88,
"close": 160.21,
"high": 160.21,
"low": 159.65,
"volume": 7774
}
},
"USDBRL": {
"2025-12-04T04:00:00.000000Z": {
"open": 5.31,
"close": 5.31,
"high": 5.31,
"low": 5.31,
"volume": 0
},
"2025-12-04T07:00:00.000000Z": {
"open": 5.31,
"close": 5.32,
"high": 5.32,
"low": 5.31,
"volume": 0
},
"2025-12-04T10:00:00.000000Z": {
"open": 5.31,
"close": 5.31,
"high": 5.31,
"low": 5.31,
"volume": 0
},
"2025-12-04T11:00:00.000000Z": {
"open": 5.31,
"close": 5.31,
"high": 5.31,
"low": 5.31,
"volume": 0
},
"2025-12-04T12:00:00.000000Z": {
"open": 5.3,
"close": 5.3,
"high": 5.31,
"low": 5.3,
"volume": 0
},
"2025-12-04T13:00:00.000000Z": {
"open": 5.3,
"close": 5.29,
"high": 5.31,
"low": 5.29,
"volume": 0
},
"2025-12-04T14:00:00.000000Z": {
"open": 5.29,
"close": 5.3,
"high": 5.3,
"low": 5.29,
"volume": 0
},
"2025-12-04T15:00:00.000000Z": {
"open": 5.29,
"close": 5.29,
"high": 5.3,
"low": 5.29,
"volume": 0
},
"2025-12-04T16:00:00.000000Z": {
"open": 5.29,
"close": 5.3,
"high": 5.3,
"low": 5.29,
"volume": 0
},
"2025-12-04T17:00:00.000000Z": {
"open": 5.3,
"close": 5.31,
"high": 5.31,
"low": 5.3,
"volume": 0
},
"2025-12-04T18:00:00.000000Z": {
"open": 5.31,
"close": 5.31,
"high": 5.32,
"low": 5.31,
"volume": 0
},
"2025-12-04T19:00:00.000000Z": {
"open": 5.31,
"close": 5.31,
"high": 5.32,
"low": 5.3,
"volume": 0
},
"2025-12-04T20:00:00.000000Z": {
"open": 5.31,
"close": 5.31,
"high": 5.31,
"low": 5.31,
"volume": 0
},
"2025-12-05T01:00:00.000000Z": {
"open": 5.31,
"close": 5.31,
"high": 5.31,
"low": 5.31,
"volume": 0
},
"2025-12-05T02:00:00.000000Z": {
"open": 5.31,
"close": 5.31,
"high": 5.31,
"low": 5.31,
"volume": 0
},
"2025-12-05T03:00:00.000000Z": {
"open": 5.31,
"close": 5.31,
"high": 5.31,
"low": 5.31,
"volume": 0
},
"2025-12-05T04:00:00.000000Z": {
"open": 5.31,
"close": 5.31,
"high": 5.31,
"low": 5.31,
"volume": 0
},
"2025-12-05T07:00:00.000000Z": {
"open": 5.32,
"close": 5.32,
"high": 5.32,
"low": 5.32,
"volume": 0
},
"2025-12-05T09:00:00.000000Z": {
"open": 5.32,
"close": 5.32,
"high": 5.32,
"low": 5.32,
"volume": 0
},
"2025-12-05T10:00:00.000000Z": {
"open": 5.31,
"close": 5.31,
"high": 5.31,
"low": 5.31,
"volume": 0
},
"2025-12-05T12:00:00.000000Z": {
"open": 5.3,
"close": 5.31,
"high": 5.31,
"low": 5.3,
"volume": 0
},
"2025-12-05T13:00:00.000000Z": {
"open": 5.31,
"close": 5.32,
"high": 5.32,
"low": 5.31,
"volume": 0
},
"2025-12-05T14:00:00.000000Z": {
"open": 5.32,
"close": 5.34,
"high": 5.35,
"low": 5.32,
"volume": 0
},
"2025-12-05T15:00:00.000000Z": {
"open": 5.34,
"close": 5.37,
"high": 5.39,
"low": 5.33,
"volume": 0
},
"2025-12-05T16:00:00.000000Z": {
"open": 5.38,
"close": 5.41,
"high": 5.43,
"low": 5.37,
"volume": 0
},
"2025-12-05T17:00:00.000000Z": {
"open": 5.41,
"close": 5.42,
"high": 5.43,
"low": 5.37,
"volume": 0
},
"2025-12-05T18:00:00.000000Z": {
"open": 5.42,
"close": 5.48,
"high": 5.48,
"low": 5.41,
"volume": 0
},
"2025-12-05T19:00:00.000000Z": {
"open": 5.48,
"close": 5.43,
"high": 5.48,
"low": 5.43,
"volume": 0
},
"2025-12-05T20:00:00.000000Z": {
"open": 5.43,
"close": 5.45,
"high": 5.46,
"low": 5.43,
"volume": 0
},
"2025-12-08T00:00:00.000000Z": {
"open": 5.44,
"close": 5.44,
"high": 5.44,
"low": 5.44,
"volume": 0
},
"2025-12-08T02:00:00.000000Z": {
"open": 5.44,
"close": 5.44,
"high": 5.44,
"low": 5.44,
"volume": 0
},
"2025-12-08T07:00:00.000000Z": {
"open": 5.47,
"close": 5.47,
"high": 5.47,
"low": 5.47,
"volume": 0
},
"2025-12-08T10:00:00.000000Z": {
"open": 5.46,
"close": 5.46,
"high": 5.46,
"low": 5.46,
"volume": 0
},
"2025-12-08T11:00:00.000000Z": {
"open": 5.47,
"close": 5.47,
"high": 5.47,
"low": 5.47,
"volume": 0
},
"2025-12-08T12:00:00.000000Z": {
"open": 5.47,
"close": 5.42,
"high": 5.47,
"low": 5.39,
"volume": 0
},
"2025-12-08T13:00:00.000000Z": {
"open": 5.41,
"close": 5.39,
"high": 5.42,
"low": 5.39,
"volume": 0
},
"2025-12-08T14:00:00.000000Z": {
"open": 5.39,
"close": 5.43,
"high": 5.43,
"low": 5.39,
"volume": 0
},
"2025-12-08T15:00:00.000000Z": {
"open": 5.42,
"close": 5.45,
"high": 5.47,
"low": 5.42,
"volume": 0
},
"2025-12-08T16:00:00.000000Z": {
"open": 5.45,
"close": 5.44,
"high": 5.45,
"low": 5.43,
"volume": 0
},
"2025-12-08T17:00:00.000000Z": {
"open": 5.44,
"close": 5.43,
"high": 5.45,
"low": 5.43,
"volume": 0
},
"2025-12-08T18:00:00.000000Z": {
"open": 5.43,
"close": 5.42,
"high": 5.43,
"low": 5.42,
"volume": 0
},
"2025-12-08T19:00:00.000000Z": {
"open": 5.42,
"close": 5.42,
"high": 5.43,
"low": 5.42,
"volume": 0
},
"2025-12-08T20:00:00.000000Z": {
"open": 5.42,
"close": 5.43,
"high": 5.44,
"low": 5.42,
"volume": 0
}
}
},
"execution_time": 0.08,
"from_cache": false
}
GEThttps://api.hgbrasil.com/v2/finance/historical?symbols=petr4,vale3&start_date=2024-01-01&end_date=2024-01-31&sample_by=1d&key=suachave
curl -X GET "https://api.hgbrasil.com/v2/finance/historical?symbols=petr4%2Cvale3&start_date=2024-01-01&end_date=2024-01-31&sample_by=1d&key=suachave"
const url = new URL("/v2/finance/historical", "https://api.hgbrasil.com")
url.searchParams.set("symbols", "petr4,vale3")
url.searchParams.set("start_date", "2024-01-01")
url.searchParams.set("end_date", "2024-01-31")
url.searchParams.set("sample_by", "1d")
url.searchParams.set("key", "suachave")
const response = await fetch(url.href)
const data = await response.json()
$url = 'https://api.hgbrasil.com/v2/finance/historical';
$queryString = http_build_query([
'symbols' => 'petr4,vale3',
'start_date' => '2024-01-01',
'end_date' => '2024-01-31',
'sample_by' => '1d',
'key' => 'suachave'
]);
$response = file_get_contents($url . '?' . $queryString);
$data = json_decode($response, true);
import requests
url = 'https://api.hgbrasil.com/v2/finance/historical'
params = {
'symbols': 'petr4,vale3',
'start_date': '2024-01-01',
'end_date': '2024-01-31',
'sample_by': '1d',
'key': 'suachave'
}
response = requests.get(url, params=params)
data = response.json()
require 'net/http'
require 'uri'
require 'json'
uri = URI('https://api.hgbrasil.com/v2/finance/historical')
uri.query = URI.encode_www_form({
symbols: 'petr4,vale3',
start_date: '2024-01-01',
end_date: '2024-01-31',
sample_by: '1d',
key: 'suachave'
})
response = Net::HTTP.get(uri)
data = JSON.parse(response, symbolize_names: true)
import java.net.URI;
import java.net.http.*;
var url = "https://api.hgbrasil.com/v2/finance/historical?symbols=petr4%2Cvale3&start_date=2024-01-01&end_date=2024-01-31&sample_by=1d&key=suachave";
var client = HttpClient.newHttpClient();
var request = HttpRequest.newBuilder()
.uri(URI.create(url))
.GET()
.build();
var response = client.send(request, HttpResponse.BodyHandlers.ofString());
var data = response.body();
using System.Net.Http;
using System.Text.Json;
using System.Web;
var client = new HttpClient();
var baseUrl = "https://api.hgbrasil.com/v2/finance/historical";
var queryParams = HttpUtility.ParseQueryString(string.Empty);
queryParams["symbols"] = "petr4,vale3";
queryParams["start_date"] = "2024-01-01";
queryParams["end_date"] = "2024-01-31";
queryParams["sample_by"] = "1d";
queryParams["key"] = "suachave";
var url = $"{baseUrl}?{queryParams}";
var response = await client.GetStringAsync(url);
var data = JsonSerializer.Deserialize<dynamic>(response);
{
"by": "date_interval",
"sample_by": "1d",
"valid_key": true,
"results": {
"PETR4": {
"2024-01-02T00:00:00.000000Z": {
"open": 37.44,
"close": 37.78,
"high": 37.89,
"low": 37.4,
"volume": 24043800
},
"2024-01-03T00:00:00.000000Z": {
"open": 37.79,
"close": 38.96,
"high": 39.11,
"low": 37.67,
"volume": 52300200
},
"2024-01-04T00:00:00.000000Z": {
"open": 39.11,
"close": 38.63,
"high": 39.35,
"low": 38.51,
"volume": 45344900
},
"2024-01-05T00:00:00.000000Z": {
"open": 38.86,
"close": 38.72,
"high": 39.14,
"low": 38.41,
"volume": 35783700
},
"2024-01-08T00:00:00.000000Z": {
"open": 38.38,
"close": 38.43,
"high": 38.43,
"low": 37.61,
"volume": 35158100
},
"2024-01-09T00:00:00.000000Z": {
"open": 38.67,
"close": 38.1,
"high": 38.75,
"low": 38.03,
"volume": 27279000
},
"2024-01-10T00:00:00.000000Z": {
"open": 38.1,
"close": 37.75,
"high": 38.27,
"low": 37.51,
"volume": 27382000
},
"2024-01-11T00:00:00.000000Z": {
"open": 37.98,
"close": 38.07,
"high": 38.15,
"low": 37.7,
"volume": 26564400
},
"2024-01-12T00:00:00.000000Z": {
"open": 38.5,
"close": 38.17,
"high": 38.73,
"low": 38.17,
"volume": 24479500
},
"2024-01-15T00:00:00.000000Z": {
"open": 37.99,
"close": 38.58,
"high": 38.61,
"low": 37.86,
"volume": 13818300
},
"2024-01-16T00:00:00.000000Z": {
"open": 38.61,
"close": 38.1,
"high": 38.79,
"low": 38.08,
"volume": 31277700
},
"2024-01-17T00:00:00.000000Z": {
"open": 37.97,
"close": 37.88,
"high": 38.15,
"low": 37.82,
"volume": 27577300
},
"2024-01-18T00:00:00.000000Z": {
"open": 38.14,
"close": 37.73,
"high": 38.14,
"low": 37.56,
"volume": 22987200
},
"2024-01-19T00:00:00.000000Z": {
"open": 37.81,
"close": 37.53,
"high": 37.9,
"low": 37.23,
"volume": 30971400
},
"2024-01-22T00:00:00.000000Z": {
"open": 37.5,
"close": 37.7,
"high": 37.81,
"low": 37.23,
"volume": 22753700
},
"2024-01-23T00:00:00.000000Z": {
"open": 37.84,
"close": 38.17,
"high": 38.36,
"low": 37.43,
"volume": 32498500
},
"2024-01-24T00:00:00.000000Z": {
"open": 38.29,
"close": 37.88,
"high": 38.54,
"low": 37.77,
"volume": 25415300
},
"2024-01-25T00:00:00.000000Z": {
"open": 38.26,
"close": 39.28,
"high": 39.28,
"low": 38.13,
"volume": 48655300
},
"2024-01-26T00:00:00.000000Z": {
"open": 39.1,
"close": 39.96,
"high": 40.09,
"low": 38.91,
"volume": 41378200
},
"2024-01-29T00:00:00.000000Z": {
"open": 40,
"close": 40.57,
"high": 40.59,
"low": 39.83,
"volume": 30547500
},
"2024-01-30T00:00:00.000000Z": {
"open": 40.17,
"close": 40.32,
"high": 40.74,
"low": 40.04,
"volume": 34829000
},
"2024-01-31T00:00:00.000000Z": {
"open": 40.23,
"close": 40.45,
"high": 41.24,
"low": 40.18,
"volume": 58491900
}
},
"VALE3": {
"2024-01-02T00:00:00.000000Z": {
"open": 77.59,
"close": 77.05,
"high": 78.18,
"low": 76.59,
"volume": 18021800
},
"2024-01-03T00:00:00.000000Z": {
"open": 76.71,
"close": 76.65,
"high": 76.9,
"low": 75.84,
"volume": 25315100
},
"2024-01-04T00:00:00.000000Z": {
"open": 76.43,
"close": 75.62,
"high": 76.64,
"low": 75.36,
"volume": 18707000
},
"2024-01-05T00:00:00.000000Z": {
"open": 75.03,
"close": 74.65,
"high": 75.05,
"low": 74.12,
"volume": 21082500
},
"2024-01-08T00:00:00.000000Z": {
"open": 73.94,
"close": 74.27,
"high": 74.56,
"low": 73.51,
"volume": 23013300
},
"2024-01-09T00:00:00.000000Z": {
"open": 74.09,
"close": 73.33,
"high": 74.16,
"low": 73.15,
"volume": 15257400
},
"2024-01-10T00:00:00.000000Z": {
"open": 72.79,
"close": 72.23,
"high": 72.79,
"low": 71.95,
"volume": 21354600
},
"2024-01-11T00:00:00.000000Z": {
"open": 72.45,
"close": 72.61,
"high": 72.91,
"low": 71.84,
"volume": 20289100
},
"2024-01-12T00:00:00.000000Z": {
"open": 72.2,
"close": 71.69,
"high": 72.7,
"low": 71.64,
"volume": 16343400
},
"2024-01-15T00:00:00.000000Z": {
"open": 71.22,
"close": 71.55,
"high": 71.7,
"low": 70.7,
"volume": 12745700
},
"2024-01-16T00:00:00.000000Z": {
"open": 71.59,
"close": 70.62,
"high": 71.79,
"low": 70.26,
"volume": 22620300
},
"2024-01-17T00:00:00.000000Z": {
"open": 70.27,
"close": 69.45,
"high": 70.46,
"low": 69,
"volume": 43086400
},
"2024-01-18T00:00:00.000000Z": {
"open": 70.2,
"close": 69,
"high": 70.4,
"low": 69,
"volume": 30490600
},
"2024-01-19T00:00:00.000000Z": {
"open": 69.5,
"close": 68.09,
"high": 69.51,
"low": 68.05,
"volume": 60243300
},
"2024-01-22T00:00:00.000000Z": {
"open": 67.5,
"close": 67.8,
"high": 67.98,
"low": 67.11,
"volume": 23318900
},
"2024-01-23T00:00:00.000000Z": {
"open": 68.95,
"close": 69.2,
"high": 69.77,
"low": 68.45,
"volume": 33886800
},
"2024-01-24T00:00:00.000000Z": {
"open": 70.3,
"close": 69.9,
"high": 70.83,
"low": 69.75,
"volume": 36922100
},
"2024-01-25T00:00:00.000000Z": {
"open": 70,
"close": 68.36,
"high": 70.41,
"low": 67.36,
"volume": 47639700
},
"2024-01-26T00:00:00.000000Z": {
"open": 67.9,
"close": 69.5,
"high": 69.81,
"low": 67.5,
"volume": 27397200
},
"2024-01-29T00:00:00.000000Z": {
"open": 69.48,
"close": 69.17,
"high": 69.48,
"low": 68.23,
"volume": 15866100
},
"2024-01-30T00:00:00.000000Z": {
"open": 69.4,
"close": 68.78,
"high": 69.59,
"low": 67.89,
"volume": 34371300
},
"2024-01-31T00:00:00.000000Z": {
"open": 68.09,
"close": 67.76,
"high": 68.58,
"low": 67.76,
"volume": 34753400
}
}
},
"execution_time": 0.07,
"from_cache": false
}
GEThttps://api.hgbrasil.com/v2/finance/historical?symbols=usdbrl,eurbrl,bvsp&days_ago=7&sample_by=1d&key=suachave
curl -X GET "https://api.hgbrasil.com/v2/finance/historical?symbols=usdbrl%2Ceurbrl%2Cbvsp&days_ago=7&sample_by=1d&key=suachave"
const url = new URL("/v2/finance/historical", "https://api.hgbrasil.com")
url.searchParams.set("symbols", "usdbrl,eurbrl,bvsp")
url.searchParams.set("days_ago", "7")
url.searchParams.set("sample_by", "1d")
url.searchParams.set("key", "suachave")
const response = await fetch(url.href)
const data = await response.json()
$url = 'https://api.hgbrasil.com/v2/finance/historical';
$queryString = http_build_query([
'symbols' => 'usdbrl,eurbrl,bvsp',
'days_ago' => '7',
'sample_by' => '1d',
'key' => 'suachave'
]);
$response = file_get_contents($url . '?' . $queryString);
$data = json_decode($response, true);
import requests
url = 'https://api.hgbrasil.com/v2/finance/historical'
params = {
'symbols': 'usdbrl,eurbrl,bvsp',
'days_ago': '7',
'sample_by': '1d',
'key': 'suachave'
}
response = requests.get(url, params=params)
data = response.json()
require 'net/http'
require 'uri'
require 'json'
uri = URI('https://api.hgbrasil.com/v2/finance/historical')
uri.query = URI.encode_www_form({
symbols: 'usdbrl,eurbrl,bvsp',
days_ago: '7',
sample_by: '1d',
key: 'suachave'
})
response = Net::HTTP.get(uri)
data = JSON.parse(response, symbolize_names: true)
import java.net.URI;
import java.net.http.*;
var url = "https://api.hgbrasil.com/v2/finance/historical?symbols=usdbrl%2Ceurbrl%2Cbvsp&days_ago=7&sample_by=1d&key=suachave";
var client = HttpClient.newHttpClient();
var request = HttpRequest.newBuilder()
.uri(URI.create(url))
.GET()
.build();
var response = client.send(request, HttpResponse.BodyHandlers.ofString());
var data = response.body();
using System.Net.Http;
using System.Text.Json;
using System.Web;
var client = new HttpClient();
var baseUrl = "https://api.hgbrasil.com/v2/finance/historical";
var queryParams = HttpUtility.ParseQueryString(string.Empty);
queryParams["symbols"] = "usdbrl,eurbrl,bvsp";
queryParams["days_ago"] = "7";
queryParams["sample_by"] = "1d";
queryParams["key"] = "suachave";
var url = $"{baseUrl}?{queryParams}";
var response = await client.GetStringAsync(url);
var data = JsonSerializer.Deserialize<dynamic>(response);
{
"by": "days_ago",
"sample_by": "1d",
"valid_key": true,
"results": {
"BVSP": {
"2025-12-01T00:00:00.000000Z": {
"open": 159073.45,
"close": 158520.44,
"high": 159223.92,
"low": 158029.48,
"volume": 0
},
"2025-12-02T00:00:00.000000Z": {
"open": 158611.73,
"close": 160994.23,
"high": 161041.23,
"low": 158611.5,
"volume": 0
},
"2025-12-03T00:00:00.000000Z": {
"open": 161094.2,
"close": 161766.19,
"high": 161963.48,
"low": 161092.81,
"volume": 0
},
"2025-12-04T00:00:00.000000Z": {
"open": 161759.78,
"close": 164341.76,
"high": 164550.76,
"low": 161759.13,
"volume": 0
},
"2025-12-05T00:00:00.000000Z": {
"open": 164460.59,
"close": 157462.94,
"high": 165035.97,
"low": 157006.61000000002,
"volume": 0
},
"2025-12-08T00:00:00.000000Z": {
"open": 157369.36000000002,
"close": 157985.81,
"high": 159235.36000000002,
"low": 157369.36000000002,
"volume": 0
}
},
"EURBRL": {
"2025-12-01T00:00:00.000000Z": {
"open": 6.19,
"close": 6.22,
"high": 6.23,
"low": 6.19,
"volume": 0
},
"2025-12-02T00:00:00.000000Z": {
"open": 6.22,
"close": 6.19,
"high": 6.23,
"low": 6.18,
"volume": 0
},
"2025-12-03T00:00:00.000000Z": {
"open": 6.2,
"close": 6.2,
"high": 6.22,
"low": 6.18,
"volume": 0
},
"2025-12-04T00:00:00.000000Z": {
"open": 6.19,
"close": 6.18,
"high": 6.21,
"low": 6.17,
"volume": 0
},
"2025-12-05T00:00:00.000000Z": {
"open": 6.18,
"close": 6.35,
"high": 6.38,
"low": 6.17,
"volume": 0
},
"2025-12-08T00:00:00.000000Z": {
"open": 6.33,
"close": 6.32,
"high": 6.38,
"low": 6.28,
"volume": 0
}
},
"USDBRL": {
"2025-12-01T00:00:00.000000Z": {
"open": 5.34,
"close": 5.36,
"high": 5.37,
"low": 5.32,
"volume": 0
},
"2025-12-02T00:00:00.000000Z": {
"open": 5.36,
"close": 5.33,
"high": 5.37,
"low": 5.33,
"volume": 0
},
"2025-12-03T00:00:00.000000Z": {
"open": 5.33,
"close": 5.31,
"high": 5.34,
"low": 5.3,
"volume": 0
},
"2025-12-04T00:00:00.000000Z": {
"open": 5.31,
"close": 5.31,
"high": 5.32,
"low": 5.29,
"volume": 0
},
"2025-12-05T00:00:00.000000Z": {
"open": 5.31,
"close": 5.45,
"high": 5.48,
"low": 5.3,
"volume": 0
},
"2025-12-08T00:00:00.000000Z": {
"open": 5.44,
"close": 5.43,
"high": 5.47,
"low": 5.39,
"volume": 0
}
}
},
"execution_time": 0.09,
"from_cache": false
}