Đặt lệnh điều kiện phái sinh
curl --request POST \
--url https://openapi.tcbs.com.vn/khronos/v1/order/condition/place \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"accountId": "<string>",
"subAccountId": "<string>",
"symbol": "<string>",
"price": 123,
"volume": 123,
"soPrice": 123,
"callbackPoint": 123,
"activationPrice": 123,
"refId": "<string>"
}
'import requests
url = "https://openapi.tcbs.com.vn/khronos/v1/order/condition/place"
payload = {
"accountId": "<string>",
"subAccountId": "<string>",
"symbol": "<string>",
"price": 123,
"volume": 123,
"soPrice": 123,
"callbackPoint": 123,
"activationPrice": 123,
"refId": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
accountId: '<string>',
subAccountId: '<string>',
symbol: '<string>',
price: 123,
volume: 123,
soPrice: 123,
callbackPoint: 123,
activationPrice: 123,
refId: '<string>'
})
};
fetch('https://openapi.tcbs.com.vn/khronos/v1/order/condition/place', 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.tcbs.com.vn/khronos/v1/order/condition/place",
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([
'accountId' => '<string>',
'subAccountId' => '<string>',
'symbol' => '<string>',
'price' => 123,
'volume' => 123,
'soPrice' => 123,
'callbackPoint' => 123,
'activationPrice' => 123,
'refId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.tcbs.com.vn/khronos/v1/order/condition/place"
payload := strings.NewReader("{\n \"accountId\": \"<string>\",\n \"subAccountId\": \"<string>\",\n \"symbol\": \"<string>\",\n \"price\": 123,\n \"volume\": 123,\n \"soPrice\": 123,\n \"callbackPoint\": 123,\n \"activationPrice\": 123,\n \"refId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <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.post("https://openapi.tcbs.com.vn/khronos/v1/order/condition/place")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"accountId\": \"<string>\",\n \"subAccountId\": \"<string>\",\n \"symbol\": \"<string>\",\n \"price\": 123,\n \"volume\": 123,\n \"soPrice\": 123,\n \"callbackPoint\": 123,\n \"activationPrice\": 123,\n \"refId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://openapi.tcbs.com.vn/khronos/v1/order/condition/place")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"accountId\": \"<string>\",\n \"subAccountId\": \"<string>\",\n \"symbol\": \"<string>\",\n \"price\": 123,\n \"volume\": 123,\n \"soPrice\": 123,\n \"callbackPoint\": 123,\n \"activationPrice\": 123,\n \"refId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"cmd": "Web.newOrder",
"rc": "1",
"data": [
{
"symbol": "VN30F2110",
"status": "P",
"msg_type": "1I",
"showPrice": "1504.4",
"orderTime": "20:16:57",
"accountCode": "100159A",
"orderNo": 1,
"matchVolume": 0,
"side": "B",
"volume": "1",
"pk_orderNo": "7843961",
"channel": "D",
"group": "FU",
"quote": "G"
}
]
}Lệnh phái sinh
Đặt lệnh điều kiện phái sinh
Đặt lệnh điều kiện trên thị trường phái sinh.
POST
/
khronos
/
v1
/
order
/
condition
/
place
Đặt lệnh điều kiện phái sinh
curl --request POST \
--url https://openapi.tcbs.com.vn/khronos/v1/order/condition/place \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"accountId": "<string>",
"subAccountId": "<string>",
"symbol": "<string>",
"price": 123,
"volume": 123,
"soPrice": 123,
"callbackPoint": 123,
"activationPrice": 123,
"refId": "<string>"
}
'import requests
url = "https://openapi.tcbs.com.vn/khronos/v1/order/condition/place"
payload = {
"accountId": "<string>",
"subAccountId": "<string>",
"symbol": "<string>",
"price": 123,
"volume": 123,
"soPrice": 123,
"callbackPoint": 123,
"activationPrice": 123,
"refId": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
accountId: '<string>',
subAccountId: '<string>',
symbol: '<string>',
price: 123,
volume: 123,
soPrice: 123,
callbackPoint: 123,
activationPrice: 123,
refId: '<string>'
})
};
fetch('https://openapi.tcbs.com.vn/khronos/v1/order/condition/place', 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.tcbs.com.vn/khronos/v1/order/condition/place",
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([
'accountId' => '<string>',
'subAccountId' => '<string>',
'symbol' => '<string>',
'price' => 123,
'volume' => 123,
'soPrice' => 123,
'callbackPoint' => 123,
'activationPrice' => 123,
'refId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.tcbs.com.vn/khronos/v1/order/condition/place"
payload := strings.NewReader("{\n \"accountId\": \"<string>\",\n \"subAccountId\": \"<string>\",\n \"symbol\": \"<string>\",\n \"price\": 123,\n \"volume\": 123,\n \"soPrice\": 123,\n \"callbackPoint\": 123,\n \"activationPrice\": 123,\n \"refId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <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.post("https://openapi.tcbs.com.vn/khronos/v1/order/condition/place")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"accountId\": \"<string>\",\n \"subAccountId\": \"<string>\",\n \"symbol\": \"<string>\",\n \"price\": 123,\n \"volume\": 123,\n \"soPrice\": 123,\n \"callbackPoint\": 123,\n \"activationPrice\": 123,\n \"refId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://openapi.tcbs.com.vn/khronos/v1/order/condition/place")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"accountId\": \"<string>\",\n \"subAccountId\": \"<string>\",\n \"symbol\": \"<string>\",\n \"price\": 123,\n \"volume\": 123,\n \"soPrice\": 123,\n \"callbackPoint\": 123,\n \"activationPrice\": 123,\n \"refId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"cmd": "Web.newOrder",
"rc": "1",
"data": [
{
"symbol": "VN30F2110",
"status": "P",
"msg_type": "1I",
"showPrice": "1504.4",
"orderTime": "20:16:57",
"accountCode": "100159A",
"orderNo": 1,
"matchVolume": 0,
"side": "B",
"volume": "1",
"pk_orderNo": "7843961",
"channel": "D",
"group": "FU",
"quote": "G"
}
]
}Ủy quyền
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Nội dung
application/json
Mã tài khoản lưu ký.
Số tiểu khoản phái sinh.
B = Mua, S = Bán.
Tùy chọn có sẵn:
B, S Mã phái sinh, ví dụ VN30F2101.
Giá đặt lệnh.
Số lượng, lớn hơn 0.
SOL = giá TT >= soPrice, SOU = giá TT <= soPrice, TSO = Trailing Stop.
Tùy chọn có sẵn:
SOL, SOU, TSO Giá kích hoạt.
Biên trượt (chỉ dùng khi orderType = TSO).
Giá kích hoạt (chỉ dùng khi orderType = TSO).
Số chống trùng theo từng lệnh.