curl --request POST \
--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>",
"symbol": "<string>",
"quantity": 123,
"price": "<string>",
"deviceId": "<string>",
"clientRequestId": "<string>",
"userAgent": "<string>",
"ipAddress": "<string>"
}
'import requests
url = "https://api.ssi.com.vn/api/v3/trading/order"
payload = {
"accountNo": "<string>",
"symbol": "<string>",
"quantity": 123,
"price": "<string>",
"deviceId": "<string>",
"clientRequestId": "<string>",
"userAgent": "<string>",
"ipAddress": "<string>"
}
headers = {
"Content-Type": "<content-type>",
"X-Signature": "<x-signature>",
"Authorization": "Bearer <token>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Content-Type': '<content-type>',
'X-Signature': '<x-signature>',
Authorization: 'Bearer <token>'
},
body: JSON.stringify({
accountNo: '<string>',
symbol: '<string>',
quantity: 123,
price: '<string>',
deviceId: '<string>',
clientRequestId: '<string>',
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 => "POST",
CURLOPT_POSTFIELDS => json_encode([
'accountNo' => '<string>',
'symbol' => '<string>',
'quantity' => 123,
'price' => '<string>',
'deviceId' => '<string>',
'clientRequestId' => '<string>',
'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 \"symbol\": \"<string>\",\n \"quantity\": 123,\n \"price\": \"<string>\",\n \"deviceId\": \"<string>\",\n \"clientRequestId\": \"<string>\",\n \"userAgent\": \"<string>\",\n \"ipAddress\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", 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.post("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 \"symbol\": \"<string>\",\n \"quantity\": 123,\n \"price\": \"<string>\",\n \"deviceId\": \"<string>\",\n \"clientRequestId\": \"<string>\",\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::Post.new(url)
request["Content-Type"] = '<content-type>'
request["X-Signature"] = '<x-signature>'
request["Authorization"] = 'Bearer <token>'
request.body = "{\n \"accountNo\": \"<string>\",\n \"symbol\": \"<string>\",\n \"quantity\": 123,\n \"price\": \"<string>\",\n \"deviceId\": \"<string>\",\n \"clientRequestId\": \"<string>\",\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>"
}Đặt lệnh
Đặt lệnh mới.
curl --request POST \
--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>",
"symbol": "<string>",
"quantity": 123,
"price": "<string>",
"deviceId": "<string>",
"clientRequestId": "<string>",
"userAgent": "<string>",
"ipAddress": "<string>"
}
'import requests
url = "https://api.ssi.com.vn/api/v3/trading/order"
payload = {
"accountNo": "<string>",
"symbol": "<string>",
"quantity": 123,
"price": "<string>",
"deviceId": "<string>",
"clientRequestId": "<string>",
"userAgent": "<string>",
"ipAddress": "<string>"
}
headers = {
"Content-Type": "<content-type>",
"X-Signature": "<x-signature>",
"Authorization": "Bearer <token>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Content-Type': '<content-type>',
'X-Signature': '<x-signature>',
Authorization: 'Bearer <token>'
},
body: JSON.stringify({
accountNo: '<string>',
symbol: '<string>',
quantity: 123,
price: '<string>',
deviceId: '<string>',
clientRequestId: '<string>',
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 => "POST",
CURLOPT_POSTFIELDS => json_encode([
'accountNo' => '<string>',
'symbol' => '<string>',
'quantity' => 123,
'price' => '<string>',
'deviceId' => '<string>',
'clientRequestId' => '<string>',
'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 \"symbol\": \"<string>\",\n \"quantity\": 123,\n \"price\": \"<string>\",\n \"deviceId\": \"<string>\",\n \"clientRequestId\": \"<string>\",\n \"userAgent\": \"<string>\",\n \"ipAddress\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", 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.post("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 \"symbol\": \"<string>\",\n \"quantity\": 123,\n \"price\": \"<string>\",\n \"deviceId\": \"<string>\",\n \"clientRequestId\": \"<string>\",\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::Post.new(url)
request["Content-Type"] = '<content-type>'
request["X-Signature"] = '<x-signature>'
request["Authorization"] = 'Bearer <token>'
request.body = "{\n \"accountNo\": \"<string>\",\n \"symbol\": \"<string>\",\n \"quantity\": 123,\n \"price\": \"<string>\",\n \"deviceId\": \"<string>\",\n \"clientRequestId\": \"<string>\",\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.
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 Khối lượng đặt lệnh.
Giá đặt lệnh. Bắt buộc khi orderType là LO (Lệnh giới hạn); không bắt buộc với các loại lệnh khác (ATO, ATC, MP).
Định danh thiết bị thực hiện gửi yêu cầu đặt lệnh. Thông thường dùng MAC address hoặc IMEI của thiết bị.
Định danh 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 lệnh cho khách hàng và trả về response & streaming.
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.