curl --request PUT \
--url https://api.ssi.com.vn/api/v3/trading/order \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: <content-type>' \
--header 'X-Signature: <x-signature>' \
--data '
{
"accountNo": "<string>",
"deviceId": "<string>",
"clientModifyId": "<string>",
"clientRequestId": "<string>",
"orderId": "<string>",
"symbol": "<string>",
"price": "<string>",
"quantity": 123,
"userAgent": "<string>",
"ipAddress": "<string>"
}
'import requests
url = "https://api.ssi.com.vn/api/v3/trading/order"
payload = {
"accountNo": "<string>",
"deviceId": "<string>",
"clientModifyId": "<string>",
"clientRequestId": "<string>",
"orderId": "<string>",
"symbol": "<string>",
"price": "<string>",
"quantity": 123,
"userAgent": "<string>",
"ipAddress": "<string>"
}
headers = {
"Content-Type": "<content-type>",
"X-Signature": "<x-signature>",
"Authorization": "Bearer <token>"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'Content-Type': '<content-type>',
'X-Signature': '<x-signature>',
Authorization: 'Bearer <token>'
},
body: JSON.stringify({
accountNo: '<string>',
deviceId: '<string>',
clientModifyId: '<string>',
clientRequestId: '<string>',
orderId: '<string>',
symbol: '<string>',
price: '<string>',
quantity: 123,
userAgent: '<string>',
ipAddress: '<string>'
})
};
fetch('https://api.ssi.com.vn/api/v3/trading/order', 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://api.ssi.com.vn/api/v3/trading/order",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'accountNo' => '<string>',
'deviceId' => '<string>',
'clientModifyId' => '<string>',
'clientRequestId' => '<string>',
'orderId' => '<string>',
'symbol' => '<string>',
'price' => '<string>',
'quantity' => 123,
'userAgent' => '<string>',
'ipAddress' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: <content-type>",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.ssi.com.vn/api/v3/trading/order"
payload := strings.NewReader("{\n \"accountNo\": \"<string>\",\n \"deviceId\": \"<string>\",\n \"clientModifyId\": \"<string>\",\n \"clientRequestId\": \"<string>\",\n \"orderId\": \"<string>\",\n \"symbol\": \"<string>\",\n \"price\": \"<string>\",\n \"quantity\": 123,\n \"userAgent\": \"<string>\",\n \"ipAddress\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("X-Signature", "<x-signature>")
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.ssi.com.vn/api/v3/trading/order")
.header("Content-Type", "<content-type>")
.header("X-Signature", "<x-signature>")
.header("Authorization", "Bearer <token>")
.body("{\n \"accountNo\": \"<string>\",\n \"deviceId\": \"<string>\",\n \"clientModifyId\": \"<string>\",\n \"clientRequestId\": \"<string>\",\n \"orderId\": \"<string>\",\n \"symbol\": \"<string>\",\n \"price\": \"<string>\",\n \"quantity\": 123,\n \"userAgent\": \"<string>\",\n \"ipAddress\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ssi.com.vn/api/v3/trading/order")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = '<content-type>'
request["X-Signature"] = '<x-signature>'
request["Authorization"] = 'Bearer <token>'
request.body = "{\n \"accountNo\": \"<string>\",\n \"deviceId\": \"<string>\",\n \"clientModifyId\": \"<string>\",\n \"clientRequestId\": \"<string>\",\n \"orderId\": \"<string>\",\n \"symbol\": \"<string>\",\n \"price\": \"<string>\",\n \"quantity\": 123,\n \"userAgent\": \"<string>\",\n \"ipAddress\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"clientRequestId": "<string>",
"orderId": "<string>",
"orderStatus": "<string>",
"clientModifyId": "<string>",
"clientCancelId": "<string>"
}{
"code": "<string>",
"msg": "<string>"
}{
"code": "<string>",
"msg": "<string>"
}{
"code": "<string>",
"msg": "<string>"
}Sửa lệnh
Sửa lệnh hiện có.
curl --request PUT \
--url https://api.ssi.com.vn/api/v3/trading/order \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: <content-type>' \
--header 'X-Signature: <x-signature>' \
--data '
{
"accountNo": "<string>",
"deviceId": "<string>",
"clientModifyId": "<string>",
"clientRequestId": "<string>",
"orderId": "<string>",
"symbol": "<string>",
"price": "<string>",
"quantity": 123,
"userAgent": "<string>",
"ipAddress": "<string>"
}
'import requests
url = "https://api.ssi.com.vn/api/v3/trading/order"
payload = {
"accountNo": "<string>",
"deviceId": "<string>",
"clientModifyId": "<string>",
"clientRequestId": "<string>",
"orderId": "<string>",
"symbol": "<string>",
"price": "<string>",
"quantity": 123,
"userAgent": "<string>",
"ipAddress": "<string>"
}
headers = {
"Content-Type": "<content-type>",
"X-Signature": "<x-signature>",
"Authorization": "Bearer <token>"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'Content-Type': '<content-type>',
'X-Signature': '<x-signature>',
Authorization: 'Bearer <token>'
},
body: JSON.stringify({
accountNo: '<string>',
deviceId: '<string>',
clientModifyId: '<string>',
clientRequestId: '<string>',
orderId: '<string>',
symbol: '<string>',
price: '<string>',
quantity: 123,
userAgent: '<string>',
ipAddress: '<string>'
})
};
fetch('https://api.ssi.com.vn/api/v3/trading/order', 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://api.ssi.com.vn/api/v3/trading/order",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'accountNo' => '<string>',
'deviceId' => '<string>',
'clientModifyId' => '<string>',
'clientRequestId' => '<string>',
'orderId' => '<string>',
'symbol' => '<string>',
'price' => '<string>',
'quantity' => 123,
'userAgent' => '<string>',
'ipAddress' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: <content-type>",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.ssi.com.vn/api/v3/trading/order"
payload := strings.NewReader("{\n \"accountNo\": \"<string>\",\n \"deviceId\": \"<string>\",\n \"clientModifyId\": \"<string>\",\n \"clientRequestId\": \"<string>\",\n \"orderId\": \"<string>\",\n \"symbol\": \"<string>\",\n \"price\": \"<string>\",\n \"quantity\": 123,\n \"userAgent\": \"<string>\",\n \"ipAddress\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("X-Signature", "<x-signature>")
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.ssi.com.vn/api/v3/trading/order")
.header("Content-Type", "<content-type>")
.header("X-Signature", "<x-signature>")
.header("Authorization", "Bearer <token>")
.body("{\n \"accountNo\": \"<string>\",\n \"deviceId\": \"<string>\",\n \"clientModifyId\": \"<string>\",\n \"clientRequestId\": \"<string>\",\n \"orderId\": \"<string>\",\n \"symbol\": \"<string>\",\n \"price\": \"<string>\",\n \"quantity\": 123,\n \"userAgent\": \"<string>\",\n \"ipAddress\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ssi.com.vn/api/v3/trading/order")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = '<content-type>'
request["X-Signature"] = '<x-signature>'
request["Authorization"] = 'Bearer <token>'
request.body = "{\n \"accountNo\": \"<string>\",\n \"deviceId\": \"<string>\",\n \"clientModifyId\": \"<string>\",\n \"clientRequestId\": \"<string>\",\n \"orderId\": \"<string>\",\n \"symbol\": \"<string>\",\n \"price\": \"<string>\",\n \"quantity\": 123,\n \"userAgent\": \"<string>\",\n \"ipAddress\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"clientRequestId": "<string>",
"orderId": "<string>",
"orderStatus": "<string>",
"clientModifyId": "<string>",
"clientCancelId": "<string>"
}{
"code": "<string>",
"msg": "<string>"
}{
"code": "<string>",
"msg": "<string>"
}{
"code": "<string>",
"msg": "<string>"
}Ủy quyền
Access token lấy từ endpoint /api/v3/auth/token hoặc /api/v3/auth/refresh.
Tiêu đề
Định dạng nội dung request body. Chủ yếu là application/json.
Thông tin client gửi request.
Ngôn ngữ phản hồi mong muốn. Nếu không có header này, hệ thống sẽ mặc định là en
Chữ ký RSA + SHA256 để xác thực tính toàn vẹn của request. Input bao gồm SecretKey + JSON body.
"sha256=abc123..."
Nội dung
Số tài khoản giao dịch.
Định danh thiết bị thực hiện gửi yêu cầu sửa lệnh. Thông thường dùng MAC address hoặc IMEI của thiết bị.
Định danh sửa lệnh do client tạo ra, dùng để đối chiếu trong các phản hồi sau này. Trường này không bắt buộc nhưng nếu có thì nên đảm bảo tính duy nhất để tránh nhầm lẫn khi xử lý phản hồi. Khi để trống thì hệ thống sẽ tự sinh định danh sửa lệnh cho khách hàng và trả về response & streaming.
Định danh lệnh gốc do client tạo ra khi đặt lệnh. Khi để trống thì hệ thống sẽ không đối chiếu dựa trên định danh lệnh gốc mà sẽ dựa vào orderId để xác định lệnh cần sửa.
Định danh lệnh gốc sinh ra bởi hệ thống SSI.
Mã chứng khoán.
Chiều mua hoặc bán của lệnh giao dịch. (B- Buy/Mua, S- Sell/Bán)
B, S Loại lệnh giao dịch. (LO - Limit Order/Lệnh giới hạn, ATO - At The Open/Lệnh mở cửa, ATC - At The Close/Lệnh đóng cửa, MP - Market Price/Giá thị trường)
LO, ATO, ATC, MP Giá thay đổi của lệnh. Trường này có thể không bắt buộc tùy theo loại lệnh và quy định sửa lệnh của sàn giao dịch. Ví dụ, đối với lệnh MP (Market Price), giá có thể không cần cung cấp khi sửa lệnh.
Khối lượng thay đổi của lệnh. Trường này có thể không bắt buộc tùy theo quy định sửa lệnh của sàn giao dịch. Ví dụ, một số sàn có thể chỉ cho phép sửa giá mà không cho phép sửa khối lượng, hoặc ngược lại.
Thông tin về trình duyệt hoặc ứng dụng gửi yêu cầu.
Địa chỉ IP của thiết bị gửi yêu cầu.