curl --request POST \
--url https://api.ssi.com.vn/api/v3/trading/fco/order \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: <content-type>' \
--header 'X-Signature: <x-signature>' \
--data '
{
"accountNo": "<string>",
"deviceId": "<string>",
"symbol": "<string>",
"price": "<string>",
"quantity": 123,
"userAgent": "<string>",
"clientRequestId": "<string>",
"ipAddress": "<string>",
"from": "<string>",
"to": "<string>",
"code": "<string>",
"priceSlip": 123,
"stopPrice": 123,
"activePrice": 123,
"trailingAmount": 123,
"tpActivePrice": 123,
"slActivePrice": 123,
"tpPrice": "<string>",
"slPrice": "<string>",
"tpSlip": 123,
"slSlip": 123,
"operator": "<string>"
}
'import requests
url = "https://api.ssi.com.vn/api/v3/trading/fco/order"
payload = {
"accountNo": "<string>",
"deviceId": "<string>",
"symbol": "<string>",
"price": "<string>",
"quantity": 123,
"userAgent": "<string>",
"clientRequestId": "<string>",
"ipAddress": "<string>",
"from": "<string>",
"to": "<string>",
"code": "<string>",
"priceSlip": 123,
"stopPrice": 123,
"activePrice": 123,
"trailingAmount": 123,
"tpActivePrice": 123,
"slActivePrice": 123,
"tpPrice": "<string>",
"slPrice": "<string>",
"tpSlip": 123,
"slSlip": 123,
"operator": "<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>',
deviceId: '<string>',
symbol: '<string>',
price: '<string>',
quantity: 123,
userAgent: '<string>',
clientRequestId: '<string>',
ipAddress: '<string>',
from: '<string>',
to: '<string>',
code: '<string>',
priceSlip: 123,
stopPrice: 123,
activePrice: 123,
trailingAmount: 123,
tpActivePrice: 123,
slActivePrice: 123,
tpPrice: '<string>',
slPrice: '<string>',
tpSlip: 123,
slSlip: 123,
operator: '<string>'
})
};
fetch('https://api.ssi.com.vn/api/v3/trading/fco/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/fco/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>',
'deviceId' => '<string>',
'symbol' => '<string>',
'price' => '<string>',
'quantity' => 123,
'userAgent' => '<string>',
'clientRequestId' => '<string>',
'ipAddress' => '<string>',
'from' => '<string>',
'to' => '<string>',
'code' => '<string>',
'priceSlip' => 123,
'stopPrice' => 123,
'activePrice' => 123,
'trailingAmount' => 123,
'tpActivePrice' => 123,
'slActivePrice' => 123,
'tpPrice' => '<string>',
'slPrice' => '<string>',
'tpSlip' => 123,
'slSlip' => 123,
'operator' => '<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/fco/order"
payload := strings.NewReader("{\n \"accountNo\": \"<string>\",\n \"deviceId\": \"<string>\",\n \"symbol\": \"<string>\",\n \"price\": \"<string>\",\n \"quantity\": 123,\n \"userAgent\": \"<string>\",\n \"clientRequestId\": \"<string>\",\n \"ipAddress\": \"<string>\",\n \"from\": \"<string>\",\n \"to\": \"<string>\",\n \"code\": \"<string>\",\n \"priceSlip\": 123,\n \"stopPrice\": 123,\n \"activePrice\": 123,\n \"trailingAmount\": 123,\n \"tpActivePrice\": 123,\n \"slActivePrice\": 123,\n \"tpPrice\": \"<string>\",\n \"slPrice\": \"<string>\",\n \"tpSlip\": 123,\n \"slSlip\": 123,\n \"operator\": \"<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/fco/order")
.header("Content-Type", "<content-type>")
.header("X-Signature", "<x-signature>")
.header("Authorization", "Bearer <token>")
.body("{\n \"accountNo\": \"<string>\",\n \"deviceId\": \"<string>\",\n \"symbol\": \"<string>\",\n \"price\": \"<string>\",\n \"quantity\": 123,\n \"userAgent\": \"<string>\",\n \"clientRequestId\": \"<string>\",\n \"ipAddress\": \"<string>\",\n \"from\": \"<string>\",\n \"to\": \"<string>\",\n \"code\": \"<string>\",\n \"priceSlip\": 123,\n \"stopPrice\": 123,\n \"activePrice\": 123,\n \"trailingAmount\": 123,\n \"tpActivePrice\": 123,\n \"slActivePrice\": 123,\n \"tpPrice\": \"<string>\",\n \"slPrice\": \"<string>\",\n \"tpSlip\": 123,\n \"slSlip\": 123,\n \"operator\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ssi.com.vn/api/v3/trading/fco/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 \"deviceId\": \"<string>\",\n \"symbol\": \"<string>\",\n \"price\": \"<string>\",\n \"quantity\": 123,\n \"userAgent\": \"<string>\",\n \"clientRequestId\": \"<string>\",\n \"ipAddress\": \"<string>\",\n \"from\": \"<string>\",\n \"to\": \"<string>\",\n \"code\": \"<string>\",\n \"priceSlip\": 123,\n \"stopPrice\": 123,\n \"activePrice\": 123,\n \"trailingAmount\": 123,\n \"tpActivePrice\": 123,\n \"slActivePrice\": 123,\n \"tpPrice\": \"<string>\",\n \"slPrice\": \"<string>\",\n \"tpSlip\": 123,\n \"slSlip\": 123,\n \"operator\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"fcoId": "2e667ae3-934a-4548-be9a-de983a29fe5b"
}{
"code": "<string>",
"msg": "<string>"
}{
"code": "<string>",
"msg": "<string>"
}{
"code": "<string>",
"msg": "<string>"
}Đặt lệnh điều kiện
Đặt lệnh điều kiện mới. Hỗ trợ các loại lệnh điều kiện bao gồm stop, stop_limit, gtd, bullbear, oco, trailing_stop, trailing_stop_limit.
curl --request POST \
--url https://api.ssi.com.vn/api/v3/trading/fco/order \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: <content-type>' \
--header 'X-Signature: <x-signature>' \
--data '
{
"accountNo": "<string>",
"deviceId": "<string>",
"symbol": "<string>",
"price": "<string>",
"quantity": 123,
"userAgent": "<string>",
"clientRequestId": "<string>",
"ipAddress": "<string>",
"from": "<string>",
"to": "<string>",
"code": "<string>",
"priceSlip": 123,
"stopPrice": 123,
"activePrice": 123,
"trailingAmount": 123,
"tpActivePrice": 123,
"slActivePrice": 123,
"tpPrice": "<string>",
"slPrice": "<string>",
"tpSlip": 123,
"slSlip": 123,
"operator": "<string>"
}
'import requests
url = "https://api.ssi.com.vn/api/v3/trading/fco/order"
payload = {
"accountNo": "<string>",
"deviceId": "<string>",
"symbol": "<string>",
"price": "<string>",
"quantity": 123,
"userAgent": "<string>",
"clientRequestId": "<string>",
"ipAddress": "<string>",
"from": "<string>",
"to": "<string>",
"code": "<string>",
"priceSlip": 123,
"stopPrice": 123,
"activePrice": 123,
"trailingAmount": 123,
"tpActivePrice": 123,
"slActivePrice": 123,
"tpPrice": "<string>",
"slPrice": "<string>",
"tpSlip": 123,
"slSlip": 123,
"operator": "<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>',
deviceId: '<string>',
symbol: '<string>',
price: '<string>',
quantity: 123,
userAgent: '<string>',
clientRequestId: '<string>',
ipAddress: '<string>',
from: '<string>',
to: '<string>',
code: '<string>',
priceSlip: 123,
stopPrice: 123,
activePrice: 123,
trailingAmount: 123,
tpActivePrice: 123,
slActivePrice: 123,
tpPrice: '<string>',
slPrice: '<string>',
tpSlip: 123,
slSlip: 123,
operator: '<string>'
})
};
fetch('https://api.ssi.com.vn/api/v3/trading/fco/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/fco/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>',
'deviceId' => '<string>',
'symbol' => '<string>',
'price' => '<string>',
'quantity' => 123,
'userAgent' => '<string>',
'clientRequestId' => '<string>',
'ipAddress' => '<string>',
'from' => '<string>',
'to' => '<string>',
'code' => '<string>',
'priceSlip' => 123,
'stopPrice' => 123,
'activePrice' => 123,
'trailingAmount' => 123,
'tpActivePrice' => 123,
'slActivePrice' => 123,
'tpPrice' => '<string>',
'slPrice' => '<string>',
'tpSlip' => 123,
'slSlip' => 123,
'operator' => '<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/fco/order"
payload := strings.NewReader("{\n \"accountNo\": \"<string>\",\n \"deviceId\": \"<string>\",\n \"symbol\": \"<string>\",\n \"price\": \"<string>\",\n \"quantity\": 123,\n \"userAgent\": \"<string>\",\n \"clientRequestId\": \"<string>\",\n \"ipAddress\": \"<string>\",\n \"from\": \"<string>\",\n \"to\": \"<string>\",\n \"code\": \"<string>\",\n \"priceSlip\": 123,\n \"stopPrice\": 123,\n \"activePrice\": 123,\n \"trailingAmount\": 123,\n \"tpActivePrice\": 123,\n \"slActivePrice\": 123,\n \"tpPrice\": \"<string>\",\n \"slPrice\": \"<string>\",\n \"tpSlip\": 123,\n \"slSlip\": 123,\n \"operator\": \"<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/fco/order")
.header("Content-Type", "<content-type>")
.header("X-Signature", "<x-signature>")
.header("Authorization", "Bearer <token>")
.body("{\n \"accountNo\": \"<string>\",\n \"deviceId\": \"<string>\",\n \"symbol\": \"<string>\",\n \"price\": \"<string>\",\n \"quantity\": 123,\n \"userAgent\": \"<string>\",\n \"clientRequestId\": \"<string>\",\n \"ipAddress\": \"<string>\",\n \"from\": \"<string>\",\n \"to\": \"<string>\",\n \"code\": \"<string>\",\n \"priceSlip\": 123,\n \"stopPrice\": 123,\n \"activePrice\": 123,\n \"trailingAmount\": 123,\n \"tpActivePrice\": 123,\n \"slActivePrice\": 123,\n \"tpPrice\": \"<string>\",\n \"slPrice\": \"<string>\",\n \"tpSlip\": 123,\n \"slSlip\": 123,\n \"operator\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ssi.com.vn/api/v3/trading/fco/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 \"deviceId\": \"<string>\",\n \"symbol\": \"<string>\",\n \"price\": \"<string>\",\n \"quantity\": 123,\n \"userAgent\": \"<string>\",\n \"clientRequestId\": \"<string>\",\n \"ipAddress\": \"<string>\",\n \"from\": \"<string>\",\n \"to\": \"<string>\",\n \"code\": \"<string>\",\n \"priceSlip\": 123,\n \"stopPrice\": 123,\n \"activePrice\": 123,\n \"trailingAmount\": 123,\n \"tpActivePrice\": 123,\n \"slActivePrice\": 123,\n \"tpPrice\": \"<string>\",\n \"slPrice\": \"<string>\",\n \"tpSlip\": 123,\n \"slSlip\": 123,\n \"operator\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"fcoId": "2e667ae3-934a-4548-be9a-de983a29fe5b"
}{
"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
Tài khoản đặt lệnh (tài khoản cơ sở hoặc phái sinh).
Định danh thiết bị thực hiện gửi yêu cầu. Thông thường dùng MAC address hoặc IMEI của thiết bị.
Mã chứng khoán hoặc mã hợp đồng phái sinh cần đặt lệnh điều kiện.
Chiều mua hoặc bán của lệnh. B (Buy/Mua) hoặc S (Sell/Bán).
B, S Loại lệnh điều kiện.
stop, stop_limit, gtd, bullbear, oco, trailing_stop, trailing_stop_limit Giá đặt lệnh. Hỗ trợ giá số hoặc loại lệnh đặc biệt (MP, MOK, MTL).
Khối lượng muốn đặt lệnh.
Thông tin về trình duyệt hoặc ứng dụng gửi yêu cầu.
Đị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.
Địa chỉ IP của thiết bị gửi yêu cầu.
Ngày bắt đầu hiệu lực của lệnh điều kiện, định dạng YYYY/MM/DD hh:mm:ss. Mặc định là thời điểm tạo lệnh.
Ngày kết thúc hiệu lực của lệnh điều kiện, định dạng YYYY/MM/DD hh:mm:ss. Mặc định là 24h kể từ thời điểm tạo, tối đa 31 ngày kể từ ngày bắt đầu.
Mã xác thực OTP hoặc mã PIN dùng để xác thực giao dịch (cần điền nếu token chưa được xác thực kèm với OTP)
Khoảng trượt giá (price slippage) cho phép khi thực hiện lệnh.
Giá dừng lỗ. Khi giá thị trường đạt đến mức này, lệnh sẽ được kích hoạt.
Giá kích hoạt ban đầu của lệnh điều kiện.
Khoảng giá trailing. Dùng cho loại lệnh trailing_stop và trailing_stop_limit.
Giá kích hoạt lệnh chốt lời (Take Profit). Khi giá thị trường đạt đến mức này, lệnh chốt lời sẽ được kích hoạt.
Giá kích hoạt lệnh dừng lỗ (Stop Loss). Khi giá thị trường đạt đến mức này, lệnh dừng lỗ sẽ được kích hoạt.
Giá chốt lời. Hỗ trợ giá số hoặc loại lệnh đặc biệt (MP, MOK, MTL).
Giá dừng lỗ. Hỗ trợ giá số hoặc loại lệnh đặc biệt (MP, MOK, MTL).
Biên trượt giá chốt lời.
Biên trượt giá dừng lỗ.
Toán tử so sánh giá để kích hoạt lệnh điều kiện.