curl --request PATCH \
--url https://openapi.dnse.com.vn/accounts/{accountNo}/pnl-configs \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <x-api-key>' \
--header 'X-Aux-Date: <x-aux-date>' \
--header 'X-Signature: <x-signature>' \
--header 'trading-token: <trading-token>' \
--data '
{
"takeProfit": {
"enabled": true,
"strategy": "DELTA_PRICE",
"rate": 0.52,
"deltaPrice": 162.8,
"orderMethod": "FASTEST",
"orderDeltaPrice": 2
},
"stopLoss": {
"enabled": true,
"strategy": "PNL_RATE",
"rate": -0.34,
"deltaPrice": 50.3,
"orderMethod": "DELTA_PRICE",
"orderDeltaPrice": 10.5,
"trailingEnabled": true
}
}
'import requests
url = "https://openapi.dnse.com.vn/accounts/{accountNo}/pnl-configs"
payload = {
"takeProfit": {
"enabled": True,
"strategy": "DELTA_PRICE",
"rate": 0.52,
"deltaPrice": 162.8,
"orderMethod": "FASTEST",
"orderDeltaPrice": 2
},
"stopLoss": {
"enabled": True,
"strategy": "PNL_RATE",
"rate": -0.34,
"deltaPrice": 50.3,
"orderMethod": "DELTA_PRICE",
"orderDeltaPrice": 10.5,
"trailingEnabled": True
}
}
headers = {
"X-Api-Key": "<x-api-key>",
"X-Aux-Date": "<x-aux-date>",
"X-Signature": "<x-signature>",
"trading-token": "<trading-token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {
'X-Api-Key': '<x-api-key>',
'X-Aux-Date': '<x-aux-date>',
'X-Signature': '<x-signature>',
'trading-token': '<trading-token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
takeProfit: {
enabled: true,
strategy: 'DELTA_PRICE',
rate: 0.52,
deltaPrice: 162.8,
orderMethod: 'FASTEST',
orderDeltaPrice: 2
},
stopLoss: {
enabled: true,
strategy: 'PNL_RATE',
rate: -0.34,
deltaPrice: 50.3,
orderMethod: 'DELTA_PRICE',
orderDeltaPrice: 10.5,
trailingEnabled: true
}
})
};
fetch('https://openapi.dnse.com.vn/accounts/{accountNo}/pnl-configs', 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/accounts/{accountNo}/pnl-configs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'takeProfit' => [
'enabled' => true,
'strategy' => 'DELTA_PRICE',
'rate' => 0.52,
'deltaPrice' => 162.8,
'orderMethod' => 'FASTEST',
'orderDeltaPrice' => 2
],
'stopLoss' => [
'enabled' => true,
'strategy' => 'PNL_RATE',
'rate' => -0.34,
'deltaPrice' => 50.3,
'orderMethod' => 'DELTA_PRICE',
'orderDeltaPrice' => 10.5,
'trailingEnabled' => true
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://openapi.dnse.com.vn/accounts/{accountNo}/pnl-configs"
payload := strings.NewReader("{\n \"takeProfit\": {\n \"enabled\": true,\n \"strategy\": \"DELTA_PRICE\",\n \"rate\": 0.52,\n \"deltaPrice\": 162.8,\n \"orderMethod\": \"FASTEST\",\n \"orderDeltaPrice\": 2\n },\n \"stopLoss\": {\n \"enabled\": true,\n \"strategy\": \"PNL_RATE\",\n \"rate\": -0.34,\n \"deltaPrice\": 50.3,\n \"orderMethod\": \"DELTA_PRICE\",\n \"orderDeltaPrice\": 10.5,\n \"trailingEnabled\": true\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
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>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://openapi.dnse.com.vn/accounts/{accountNo}/pnl-configs")
.header("X-Api-Key", "<x-api-key>")
.header("X-Aux-Date", "<x-aux-date>")
.header("X-Signature", "<x-signature>")
.header("trading-token", "<trading-token>")
.header("Content-Type", "application/json")
.body("{\n \"takeProfit\": {\n \"enabled\": true,\n \"strategy\": \"DELTA_PRICE\",\n \"rate\": 0.52,\n \"deltaPrice\": 162.8,\n \"orderMethod\": \"FASTEST\",\n \"orderDeltaPrice\": 2\n },\n \"stopLoss\": {\n \"enabled\": true,\n \"strategy\": \"PNL_RATE\",\n \"rate\": -0.34,\n \"deltaPrice\": 50.3,\n \"orderMethod\": \"DELTA_PRICE\",\n \"orderDeltaPrice\": 10.5,\n \"trailingEnabled\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://openapi.dnse.com.vn/accounts/{accountNo}/pnl-configs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.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>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"takeProfit\": {\n \"enabled\": true,\n \"strategy\": \"DELTA_PRICE\",\n \"rate\": 0.52,\n \"deltaPrice\": 162.8,\n \"orderMethod\": \"FASTEST\",\n \"orderDeltaPrice\": 2\n },\n \"stopLoss\": {\n \"enabled\": true,\n \"strategy\": \"PNL_RATE\",\n \"rate\": -0.34,\n \"deltaPrice\": 50.3,\n \"orderMethod\": \"DELTA_PRICE\",\n \"orderDeltaPrice\": 10.5,\n \"trailingEnabled\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"accountNo": "0001179019",
"configs": {
"takeProfit": {
"enabled": true,
"strategy": "DELTA_PRICE",
"rate": 0.52,
"deltaPrice": 162.8,
"orderMethod": "FASTEST",
"orderDeltaPrice": 2
},
"stopLoss": {
"enabled": true,
"strategy": "PNL_RATE",
"rate": -0.34,
"deltaPrice": 50.3,
"orderMethod": "DELTA_PRICE",
"orderDeltaPrice": 10.5,
"trailingEnabled": true
}
},
"createdDate": "2026-09-10T02:47:36.384761Z",
"modifiedDate": "2026-09-10T07:44:44.235941815Z"
}{
"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"
}Cài đặt chốt lời, cắt lỗ cho tiểu khoản
Cài đặt cấu hình chốt lời, cắt lỗ cho tiểu khoản giao dịch, chỉ áp dụng cho phái sinh và các vị thế mới mở sau khi cài đặt thành công.
curl --request PATCH \
--url https://openapi.dnse.com.vn/accounts/{accountNo}/pnl-configs \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <x-api-key>' \
--header 'X-Aux-Date: <x-aux-date>' \
--header 'X-Signature: <x-signature>' \
--header 'trading-token: <trading-token>' \
--data '
{
"takeProfit": {
"enabled": true,
"strategy": "DELTA_PRICE",
"rate": 0.52,
"deltaPrice": 162.8,
"orderMethod": "FASTEST",
"orderDeltaPrice": 2
},
"stopLoss": {
"enabled": true,
"strategy": "PNL_RATE",
"rate": -0.34,
"deltaPrice": 50.3,
"orderMethod": "DELTA_PRICE",
"orderDeltaPrice": 10.5,
"trailingEnabled": true
}
}
'import requests
url = "https://openapi.dnse.com.vn/accounts/{accountNo}/pnl-configs"
payload = {
"takeProfit": {
"enabled": True,
"strategy": "DELTA_PRICE",
"rate": 0.52,
"deltaPrice": 162.8,
"orderMethod": "FASTEST",
"orderDeltaPrice": 2
},
"stopLoss": {
"enabled": True,
"strategy": "PNL_RATE",
"rate": -0.34,
"deltaPrice": 50.3,
"orderMethod": "DELTA_PRICE",
"orderDeltaPrice": 10.5,
"trailingEnabled": True
}
}
headers = {
"X-Api-Key": "<x-api-key>",
"X-Aux-Date": "<x-aux-date>",
"X-Signature": "<x-signature>",
"trading-token": "<trading-token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {
'X-Api-Key': '<x-api-key>',
'X-Aux-Date': '<x-aux-date>',
'X-Signature': '<x-signature>',
'trading-token': '<trading-token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
takeProfit: {
enabled: true,
strategy: 'DELTA_PRICE',
rate: 0.52,
deltaPrice: 162.8,
orderMethod: 'FASTEST',
orderDeltaPrice: 2
},
stopLoss: {
enabled: true,
strategy: 'PNL_RATE',
rate: -0.34,
deltaPrice: 50.3,
orderMethod: 'DELTA_PRICE',
orderDeltaPrice: 10.5,
trailingEnabled: true
}
})
};
fetch('https://openapi.dnse.com.vn/accounts/{accountNo}/pnl-configs', 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/accounts/{accountNo}/pnl-configs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'takeProfit' => [
'enabled' => true,
'strategy' => 'DELTA_PRICE',
'rate' => 0.52,
'deltaPrice' => 162.8,
'orderMethod' => 'FASTEST',
'orderDeltaPrice' => 2
],
'stopLoss' => [
'enabled' => true,
'strategy' => 'PNL_RATE',
'rate' => -0.34,
'deltaPrice' => 50.3,
'orderMethod' => 'DELTA_PRICE',
'orderDeltaPrice' => 10.5,
'trailingEnabled' => true
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://openapi.dnse.com.vn/accounts/{accountNo}/pnl-configs"
payload := strings.NewReader("{\n \"takeProfit\": {\n \"enabled\": true,\n \"strategy\": \"DELTA_PRICE\",\n \"rate\": 0.52,\n \"deltaPrice\": 162.8,\n \"orderMethod\": \"FASTEST\",\n \"orderDeltaPrice\": 2\n },\n \"stopLoss\": {\n \"enabled\": true,\n \"strategy\": \"PNL_RATE\",\n \"rate\": -0.34,\n \"deltaPrice\": 50.3,\n \"orderMethod\": \"DELTA_PRICE\",\n \"orderDeltaPrice\": 10.5,\n \"trailingEnabled\": true\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
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>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://openapi.dnse.com.vn/accounts/{accountNo}/pnl-configs")
.header("X-Api-Key", "<x-api-key>")
.header("X-Aux-Date", "<x-aux-date>")
.header("X-Signature", "<x-signature>")
.header("trading-token", "<trading-token>")
.header("Content-Type", "application/json")
.body("{\n \"takeProfit\": {\n \"enabled\": true,\n \"strategy\": \"DELTA_PRICE\",\n \"rate\": 0.52,\n \"deltaPrice\": 162.8,\n \"orderMethod\": \"FASTEST\",\n \"orderDeltaPrice\": 2\n },\n \"stopLoss\": {\n \"enabled\": true,\n \"strategy\": \"PNL_RATE\",\n \"rate\": -0.34,\n \"deltaPrice\": 50.3,\n \"orderMethod\": \"DELTA_PRICE\",\n \"orderDeltaPrice\": 10.5,\n \"trailingEnabled\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://openapi.dnse.com.vn/accounts/{accountNo}/pnl-configs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.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>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"takeProfit\": {\n \"enabled\": true,\n \"strategy\": \"DELTA_PRICE\",\n \"rate\": 0.52,\n \"deltaPrice\": 162.8,\n \"orderMethod\": \"FASTEST\",\n \"orderDeltaPrice\": 2\n },\n \"stopLoss\": {\n \"enabled\": true,\n \"strategy\": \"PNL_RATE\",\n \"rate\": -0.34,\n \"deltaPrice\": 50.3,\n \"orderMethod\": \"DELTA_PRICE\",\n \"orderDeltaPrice\": 10.5,\n \"trailingEnabled\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"accountNo": "0001179019",
"configs": {
"takeProfit": {
"enabled": true,
"strategy": "DELTA_PRICE",
"rate": 0.52,
"deltaPrice": 162.8,
"orderMethod": "FASTEST",
"orderDeltaPrice": 2
},
"stopLoss": {
"enabled": true,
"strategy": "PNL_RATE",
"rate": -0.34,
"deltaPrice": 50.3,
"orderMethod": "DELTA_PRICE",
"orderDeltaPrice": 10.5,
"trailingEnabled": true
}
},
"createdDate": "2026-09-10T02:47:36.384761Z",
"modifiedDate": "2026-09-10T07:44:44.235941815Z"
}{
"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
Tham số đường dẫn
Số tiểu khoản
Tham số truy vấn
Loại thị trường, hiện chỉ hỗ trợ DERIVATIVE.
DERIVATIVE Nội dung
Phản hồi
OK
Cấu hình chốt lời, cắt lỗ của tiểu khoản.
Số tiểu khoản chứng khoán.
"0001179019"
Cấu hình chốt lời và cắt lỗ của tiểu khoản.
Show child attributes
Show child attributes
Thời điểm cấu hình được tạo.
"2026-09-10T02:47:36.384761Z"
Thời điểm cập nhật cấu hình gần nhất.
"2026-09-10T07:44:44.235941815Z"