Đóng vị thế
curl --request POST \
--url https://openapi-uat.dnse.com.vn/positions/{positionId}/close \
--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-uat.dnse.com.vn/positions/{positionId}/close"
headers = {
"X-API-Key": "<x-api-key>",
"X-Signature": "<x-signature>",
"X-Aux-Date": "<x-aux-date>",
"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-Signature': '<x-signature>',
'X-Aux-Date': '<x-aux-date>',
'trading-token': '<trading-token>'
}
};
fetch('https://openapi-uat.dnse.com.vn/positions/{positionId}/close', 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/positions/{positionId}/close",
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-uat.dnse.com.vn/positions/{positionId}/close"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("X-API-Key", "<x-api-key>")
req.Header.Add("X-Signature", "<x-signature>")
req.Header.Add("X-Aux-Date", "<x-aux-date>")
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-uat.dnse.com.vn/positions/{positionId}/close")
.header("X-API-Key", "<x-api-key>")
.header("X-Signature", "<x-signature>")
.header("X-Aux-Date", "<x-aux-date>")
.header("trading-token", "<trading-token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://openapi-uat.dnse.com.vn/positions/{positionId}/close")
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-Signature"] = '<x-signature>'
request["X-Aux-Date"] = '<x-aux-date>'
request["trading-token"] = '<trading-token>'
response = http.request(request)
puts response.read_body{
"id": 1636,
"side": "NS",
"accountNo": "0001179019",
"symbol": "41I1G4000",
"price": 1618.2,
"quantity": 1,
"orderType": "LO",
"fillQuantity": 0,
"leaveQuantity": 0,
"canceledQuantity": 0,
"loanPackageId": 2278,
"createdDate": "2026-03-24T04:20:55.63",
"modifiedDate": "2026-03-24T04:20:55.63"
}{
"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
}trading
Đóng vị thế
POST
/
positions
/
{positionId}
/
close
Đóng vị thế
curl --request POST \
--url https://openapi-uat.dnse.com.vn/positions/{positionId}/close \
--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-uat.dnse.com.vn/positions/{positionId}/close"
headers = {
"X-API-Key": "<x-api-key>",
"X-Signature": "<x-signature>",
"X-Aux-Date": "<x-aux-date>",
"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-Signature': '<x-signature>',
'X-Aux-Date': '<x-aux-date>',
'trading-token': '<trading-token>'
}
};
fetch('https://openapi-uat.dnse.com.vn/positions/{positionId}/close', 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/positions/{positionId}/close",
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-uat.dnse.com.vn/positions/{positionId}/close"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("X-API-Key", "<x-api-key>")
req.Header.Add("X-Signature", "<x-signature>")
req.Header.Add("X-Aux-Date", "<x-aux-date>")
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-uat.dnse.com.vn/positions/{positionId}/close")
.header("X-API-Key", "<x-api-key>")
.header("X-Signature", "<x-signature>")
.header("X-Aux-Date", "<x-aux-date>")
.header("trading-token", "<trading-token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://openapi-uat.dnse.com.vn/positions/{positionId}/close")
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-Signature"] = '<x-signature>'
request["X-Aux-Date"] = '<x-aux-date>'
request["trading-token"] = '<trading-token>'
response = http.request(request)
puts response.read_body{
"id": 1636,
"side": "NS",
"accountNo": "0001179019",
"symbol": "41I1G4000",
"price": 1618.2,
"quantity": 1,
"orderType": "LO",
"fillQuantity": 0,
"leaveQuantity": 0,
"canceledQuantity": 0,
"loanPackageId": 2278,
"createdDate": "2026-03-24T04:20:55.63",
"modifiedDate": "2026-03-24T04:20:55.63"
}{
"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ụ
Chữ ký xác thực yêu cầu
Thời gian thực hiện yêu cầu
Token đặt lệnh
API version (YYYY-MM-DD)
Tham số đường dẫn
Id vị thế
Tham số truy vấn
Loại thị trường
- DERIVATIVE: Deal phái sinh (chỉ hỗ trợ phái sinh)
Phản hồi
OK
Id lệnh giao dịch
Ví dụ:
1636
Chiều đặt lệnh
- NB: Mua
- NS: Bán
Ví dụ:
"NS"
Số tiểu khoản
Ví dụ:
"0001179019"
Mã chứng khoán
Ví dụ:
"41I1G4000"
Giá đặt
Ví dụ:
1618.2
Khối lượng đặt
Ví dụ:
1
Loại lệnh
- LO: Lệnh giới hạn
- MOK/MAK/MTL: Lệnh thị trường
- ATO/ATC: Lệnh phiên định kỳ mở cửa/đóng cửa
- PLO: Lệnh khớp lệnh sau giờ
Ví dụ:
"LO"
Khối lượng khớp
Ví dụ:
0
Khối lượng còn lại
Ví dụ:
0
Khối lượng đã hủy
Ví dụ:
0
Mã gói vay
Ví dụ:
2278
Thời điểm tạo
Ví dụ:
"2026-03-24T04:20:55.63"
Thời điểm cập nhật
Ví dụ:
"2026-03-24T04:20:55.63"