curl --request POST \
--url https://openapi.dnse.com.vn/positions/{positionId}/reverse \
--header 'X-Api-Key: <x-api-key>' \
--header 'X-Aux-Date: <x-aux-date>' \
--header 'X-Signature: <x-signature>' \
--header 'trading-token: <trading-token>'import requests
url = "https://openapi.dnse.com.vn/positions/{positionId}/reverse"
headers = {
"X-Api-Key": "<x-api-key>",
"X-Aux-Date": "<x-aux-date>",
"X-Signature": "<x-signature>",
"trading-token": "<trading-token>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Api-Key': '<x-api-key>',
'X-Aux-Date': '<x-aux-date>',
'X-Signature': '<x-signature>',
'trading-token': '<trading-token>'
}
};
fetch('https://openapi.dnse.com.vn/positions/{positionId}/reverse', 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.dnse.com.vn/positions/{positionId}/reverse",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"X-Api-Key: <x-api-key>",
"X-Aux-Date: <x-aux-date>",
"X-Signature: <x-signature>",
"trading-token: <trading-token>"
],
]);
$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.dnse.com.vn/positions/{positionId}/reverse"
req, _ := http.NewRequest("POST", 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>")
req.Header.Add("trading-token", "<trading-token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://openapi.dnse.com.vn/positions/{positionId}/reverse")
.header("X-Api-Key", "<x-api-key>")
.header("X-Aux-Date", "<x-aux-date>")
.header("X-Signature", "<x-signature>")
.header("trading-token", "<trading-token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://openapi.dnse.com.vn/positions/{positionId}/reverse")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Api-Key"] = '<x-api-key>'
request["X-Aux-Date"] = '<x-aux-date>'
request["X-Signature"] = '<x-signature>'
request["trading-token"] = '<trading-token>'
response = http.request(request)
puts response.read_body{
"id": 446,
"side": "NS",
"accountNo": "0001179019",
"symbol": "41I1G9000",
"price": 1804.2,
"quantity": 46,
"orderType": "LO",
"loanPackageId": 2279,
"createdDate": "2026-09-14T03:07:16.806Z",
"modifiedDate": "2026-09-14T03:07:16.806Z"
}{
"status": 400,
"code": "OA-003",
"message": "Thông tin nhập không hợp lệ"
}{
"status": 500,
"code": "OA-009",
"message": "Lỗi hệ thống"
}Đảo vị thế
Đóng toàn bộ vị thế phái sinh hiện tại và mở ngay vị thế mới theo hướng ngược lại. Lệnh LO ngược chiều, khối lượng đặt gấp đôi khối lượng mở của vị thế hiện tại, giá đặt bằng giá sàn (đảo Mua→Bán) hoặc giá trần (đảo Bán→Mua).
Chỉ áp dụng cho giao dịch phái sinh. Hỗ trợ các vị thế có khối lượng mở tối đa 250 HĐ. Không áp dụng cho các vị thế trong trường hợp: đang bị bán xử lý (force sell), đang chờ đóng hoặc đang chờ đảo vị thế.
curl --request POST \
--url https://openapi.dnse.com.vn/positions/{positionId}/reverse \
--header 'X-Api-Key: <x-api-key>' \
--header 'X-Aux-Date: <x-aux-date>' \
--header 'X-Signature: <x-signature>' \
--header 'trading-token: <trading-token>'import requests
url = "https://openapi.dnse.com.vn/positions/{positionId}/reverse"
headers = {
"X-Api-Key": "<x-api-key>",
"X-Aux-Date": "<x-aux-date>",
"X-Signature": "<x-signature>",
"trading-token": "<trading-token>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Api-Key': '<x-api-key>',
'X-Aux-Date': '<x-aux-date>',
'X-Signature': '<x-signature>',
'trading-token': '<trading-token>'
}
};
fetch('https://openapi.dnse.com.vn/positions/{positionId}/reverse', 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.dnse.com.vn/positions/{positionId}/reverse",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"X-Api-Key: <x-api-key>",
"X-Aux-Date: <x-aux-date>",
"X-Signature: <x-signature>",
"trading-token: <trading-token>"
],
]);
$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.dnse.com.vn/positions/{positionId}/reverse"
req, _ := http.NewRequest("POST", 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>")
req.Header.Add("trading-token", "<trading-token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://openapi.dnse.com.vn/positions/{positionId}/reverse")
.header("X-Api-Key", "<x-api-key>")
.header("X-Aux-Date", "<x-aux-date>")
.header("X-Signature", "<x-signature>")
.header("trading-token", "<trading-token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://openapi.dnse.com.vn/positions/{positionId}/reverse")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Api-Key"] = '<x-api-key>'
request["X-Aux-Date"] = '<x-aux-date>'
request["X-Signature"] = '<x-signature>'
request["trading-token"] = '<trading-token>'
response = http.request(request)
puts response.read_body{
"id": 446,
"side": "NS",
"accountNo": "0001179019",
"symbol": "41I1G9000",
"price": 1804.2,
"quantity": 46,
"orderType": "LO",
"loanPackageId": 2279,
"createdDate": "2026-09-14T03:07:16.806Z",
"modifiedDate": "2026-09-14T03:07:16.806Z"
}{
"status": 400,
"code": "OA-003",
"message": "Thông tin nhập không hợp lệ"
}{
"status": 500,
"code": "OA-009",
"message": "Lỗi hệ thống"
}Tiêu đề
API key được cấp khi đăng ký dịch vụ DNSE OpenAPI.
Ví dụ: b3JnOmRuc2UgaWQ6MjdlZTc1MzcxZGFkNTY0NmYzYTM2NDk1ZGE3OGNiOGQgaDptdXJtdXIxMjg=
Thời gian thực hiện request, dùng trong cơ chế ký request của DNSE.
Ví dụ: Sat, 01 May 2026 14:24:23 +0000
Chữ ký xác thực request được tạo từ API key secret và X-Aux-Date.
Ví dụ: Signature keyId="b3JnOmRuc2UgaWQ6MjdlZTc1MzcxZGFkNTY0NmYzYTM2NDk1ZGE3OGNiOGQgaDptdXJtdXIxMjg=",algorithm="hmac-sha256",headers="(request-target) x-aux-date",signature="rfbVXHDUi%2B%2FsOkLXle7O17Qm%2F05cbISSR%2BDcFrBHfqQ%3D",nonce="4add8c3264e4492b9f8ecde0cf26b523"
Trading token dùng cho các operation đặt, sửa, hủy lệnh hoặc đóng vị thế.
Ví dụ: 9ab81e9c-8a81-45aa-8190-b69a1c179d52
API version (YYYY-MM-DD)
Tham số đường dẫn
Id vị thế
Tham số truy vấn
Loại thị trường
-
STOCK: Danh sách Deal cơ sở
-
DERIVATIVE: Danh sách Deal phái sinh Hiện tại chỉ hỗ trợ phái sinh Loại thị trường.
-
STOCK: Giao dịch cơ sở -
DERIVATIVE: Giao dịch phái sinh -
BOND: Giao dịch trái phiếu
STOCK, DERIVATIVE, BOND "STOCK"
Phản hồi
OK
Id lệnh giao dịch
446
Chiều đặt lệnh
- NB: Mua
- NS: Bán
NB, NS "NS"
Số tiểu khoản
"0001179019"
Mã chứng khoán
"41I1G9000"
Giá đặt
1804.2
Khối lượng đặt
46
Loại lệnh
- LO: Lệnh giới hạn
LO, MOK, MAK, MTL, ATO, ATC, PLO "LO"
Mã gói vay
2279
Thời điểm tạo
"2026-09-14T03:07:16.806Z"
Thời điểm cập nhật
"2026-09-14T03:07:16.806Z"