curl --request GET \
--url https://openapi-uat.dnse.com.vn/price/ohlc \
--header 'X-API-Key: <x-api-key>' \
--header 'X-Aux-Date: <x-aux-date>' \
--header 'X-Signature: <x-signature>'import requests
url = "https://openapi-uat.dnse.com.vn/price/ohlc"
headers = {
"X-API-Key": "<x-api-key>",
"X-Aux-Date": "<x-aux-date>",
"X-Signature": "<x-signature>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {
'X-API-Key': '<x-api-key>',
'X-Aux-Date': '<x-aux-date>',
'X-Signature': '<x-signature>'
}
};
fetch('https://openapi-uat.dnse.com.vn/price/ohlc', 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://openapi-uat.dnse.com.vn/price/ohlc",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <x-api-key>",
"X-Aux-Date: <x-aux-date>",
"X-Signature: <x-signature>"
],
]);
$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://openapi-uat.dnse.com.vn/price/ohlc"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<x-api-key>")
req.Header.Add("X-Aux-Date", "<x-aux-date>")
req.Header.Add("X-Signature", "<x-signature>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://openapi-uat.dnse.com.vn/price/ohlc")
.header("X-API-Key", "<x-api-key>")
.header("X-Aux-Date", "<x-aux-date>")
.header("X-Signature", "<x-signature>")
.asString();require 'uri'
require 'net/http'
url = URI("https://openapi-uat.dnse.com.vn/price/ohlc")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<x-api-key>'
request["X-Aux-Date"] = '<x-aux-date>'
request["X-Signature"] = '<x-signature>'
response = http.request(request)
puts response.read_body{
"t": [
1773715500,
1773716400,
1773800100,
1773801000,
1773801900,
1773802800,
1773803700,
1773804600,
1773805500,
1773806400
],
"o": [
23.8,
23.75,
23.75,
23.85,
23.8,
23.85,
23.9,
23.75,
23.8,
23.8
],
"h": [
23.8,
23.8,
23.9,
23.9,
23.85,
23.9,
23.9,
23.85,
23.8,
23.8
],
"l": [
23.7,
23.7,
23.7,
23.8,
23.75,
23.8,
23.7,
23.75,
23.7,
23.75
],
"c": [
23.75,
23.75,
23.8,
23.85,
23.8,
23.9,
23.85,
23.75,
23.75,
23.75
],
"v": [
2530900,
514100,
494000,
344400,
429000,
315300,
582100,
205300,
361300,
3040800
],
"nextTime": 0
}{
"code": "OA-003",
"message": "Thông tin nhập không hợp lệ",
"status": 400
}{
"code": "OA-009",
"message": "Lỗi hệ thống",
"status": 500
}Lịch sử OHLC
Truy vấn thông tin lịch sử nến (open, high, low, close, volume) cho Cổ phiếu, Phái sinh và Chỉ số thị trường theo khung thời gian và khoảng thời gian cụ thể.
curl --request GET \
--url https://openapi-uat.dnse.com.vn/price/ohlc \
--header 'X-API-Key: <x-api-key>' \
--header 'X-Aux-Date: <x-aux-date>' \
--header 'X-Signature: <x-signature>'import requests
url = "https://openapi-uat.dnse.com.vn/price/ohlc"
headers = {
"X-API-Key": "<x-api-key>",
"X-Aux-Date": "<x-aux-date>",
"X-Signature": "<x-signature>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {
'X-API-Key': '<x-api-key>',
'X-Aux-Date': '<x-aux-date>',
'X-Signature': '<x-signature>'
}
};
fetch('https://openapi-uat.dnse.com.vn/price/ohlc', 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://openapi-uat.dnse.com.vn/price/ohlc",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <x-api-key>",
"X-Aux-Date: <x-aux-date>",
"X-Signature: <x-signature>"
],
]);
$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://openapi-uat.dnse.com.vn/price/ohlc"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<x-api-key>")
req.Header.Add("X-Aux-Date", "<x-aux-date>")
req.Header.Add("X-Signature", "<x-signature>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://openapi-uat.dnse.com.vn/price/ohlc")
.header("X-API-Key", "<x-api-key>")
.header("X-Aux-Date", "<x-aux-date>")
.header("X-Signature", "<x-signature>")
.asString();require 'uri'
require 'net/http'
url = URI("https://openapi-uat.dnse.com.vn/price/ohlc")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<x-api-key>'
request["X-Aux-Date"] = '<x-aux-date>'
request["X-Signature"] = '<x-signature>'
response = http.request(request)
puts response.read_body{
"t": [
1773715500,
1773716400,
1773800100,
1773801000,
1773801900,
1773802800,
1773803700,
1773804600,
1773805500,
1773806400
],
"o": [
23.8,
23.75,
23.75,
23.85,
23.8,
23.85,
23.9,
23.75,
23.8,
23.8
],
"h": [
23.8,
23.8,
23.9,
23.9,
23.85,
23.9,
23.9,
23.85,
23.8,
23.8
],
"l": [
23.7,
23.7,
23.7,
23.8,
23.75,
23.8,
23.7,
23.75,
23.7,
23.75
],
"c": [
23.75,
23.75,
23.8,
23.85,
23.8,
23.9,
23.85,
23.75,
23.75,
23.75
],
"v": [
2530900,
514100,
494000,
344400,
429000,
315300,
582100,
205300,
361300,
3040800
],
"nextTime": 0
}{
"code": "OA-003",
"message": "Thông tin nhập không hợp lệ",
"status": 400
}{
"code": "OA-009",
"message": "Lỗi hệ thống",
"status": 500
}Tiêu đề
API Key được cấp khi đăng ký dịch vụ
Thời gian thực hiện yêu cầu
Chữ ký xác thực yêu cầu
Phiên bản API
Tham số truy vấn
Mã chứng khoán
Loại thị trường
- STOCK: Cổ phiếu
- DERIVATIVE: Phái sinh
- INDEX: Chỉ số thị trường
Khung thời gian nến
- 1,3,5,15,30,1h,1D,1W
Thời gian bắt đầu
Thời gian kết thúc
Phản hồi
OK
Danh sách thời gian nến
Thời gian nến (timestamp)
[1773715500]
Danh sách giá mở cửa của nến theo thời gian tương ứng
Giá mở cửa của nến
[23.8]
Danh sách giá cao nhất trong nến theo thời gian tương ứng
Giá cao nhất trong nến
[23.8]
Danh sách giá thấp nhất trong nến theo thời gian tương ứng
Giá thấp nhất trong nến
[23.7]
Danh sách giá đóng cửa của nến theo thời gian tương ứng
Giá đóng cửa của nến
[23.75]
Danh sách khối lượng giao dịch theo thời gian tương ứng
Khối lượng giao dịch
[2530900]
Timestamp của cây nến tiếp theo (nếu có), 0 nếu không còn
0