Đặt lệnh thường
curl --request POST \
--url https://openapi.tcbs.com.vn/akhlys/v1/accounts/{accountNo}/orders \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"execType": "NB",
"symbol": "VNM",
"priceType": "LO",
"price": 10000,
"quantity": 100
}
'import requests
url = "https://openapi.tcbs.com.vn/akhlys/v1/accounts/{accountNo}/orders"
payload = {
"execType": "NB",
"symbol": "VNM",
"priceType": "LO",
"price": 10000,
"quantity": 100
}
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({execType: 'NB', symbol: 'VNM', priceType: 'LO', price: 10000, quantity: 100})
};
fetch('https://openapi.tcbs.com.vn/akhlys/v1/accounts/{accountNo}/orders', 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/akhlys/v1/accounts/{accountNo}/orders",
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([
'execType' => 'NB',
'symbol' => 'VNM',
'priceType' => 'LO',
'price' => 10000,
'quantity' => 100
]),
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/akhlys/v1/accounts/{accountNo}/orders"
payload := strings.NewReader("{\n \"execType\": \"NB\",\n \"symbol\": \"VNM\",\n \"priceType\": \"LO\",\n \"price\": 10000,\n \"quantity\": 100\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/akhlys/v1/accounts/{accountNo}/orders")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"execType\": \"NB\",\n \"symbol\": \"VNM\",\n \"priceType\": \"LO\",\n \"price\": 10000,\n \"quantity\": 100\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://openapi.tcbs.com.vn/akhlys/v1/accounts/{accountNo}/orders")
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 \"execType\": \"NB\",\n \"symbol\": \"VNM\",\n \"priceType\": \"LO\",\n \"price\": 10000,\n \"quantity\": 100\n}"
response = http.request(request)
puts response.read_body{
"error": "0",
"message": "Đặt lệnh thành công!",
"orderId": "9202205230000324355"
}Lệnh cổ phiếu
Đặt lệnh thường
Đặt lệnh thường trên thị trường cơ sở.
POST
/
akhlys
/
v1
/
accounts
/
{accountNo}
/
orders
Đặt lệnh thường
curl --request POST \
--url https://openapi.tcbs.com.vn/akhlys/v1/accounts/{accountNo}/orders \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"execType": "NB",
"symbol": "VNM",
"priceType": "LO",
"price": 10000,
"quantity": 100
}
'import requests
url = "https://openapi.tcbs.com.vn/akhlys/v1/accounts/{accountNo}/orders"
payload = {
"execType": "NB",
"symbol": "VNM",
"priceType": "LO",
"price": 10000,
"quantity": 100
}
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({execType: 'NB', symbol: 'VNM', priceType: 'LO', price: 10000, quantity: 100})
};
fetch('https://openapi.tcbs.com.vn/akhlys/v1/accounts/{accountNo}/orders', 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/akhlys/v1/accounts/{accountNo}/orders",
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([
'execType' => 'NB',
'symbol' => 'VNM',
'priceType' => 'LO',
'price' => 10000,
'quantity' => 100
]),
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/akhlys/v1/accounts/{accountNo}/orders"
payload := strings.NewReader("{\n \"execType\": \"NB\",\n \"symbol\": \"VNM\",\n \"priceType\": \"LO\",\n \"price\": 10000,\n \"quantity\": 100\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/akhlys/v1/accounts/{accountNo}/orders")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"execType\": \"NB\",\n \"symbol\": \"VNM\",\n \"priceType\": \"LO\",\n \"price\": 10000,\n \"quantity\": 100\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://openapi.tcbs.com.vn/akhlys/v1/accounts/{accountNo}/orders")
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 \"execType\": \"NB\",\n \"symbol\": \"VNM\",\n \"priceType\": \"LO\",\n \"price\": 10000,\n \"quantity\": 100\n}"
response = http.request(request)
puts response.read_body{
"error": "0",
"message": "Đặt lệnh thành công!",
"orderId": "9202205230000324355"
}Ủy quyền
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Tham số đường dẫn
Số tiểu khoản, ví dụ 0001170730.
Nội dung
application/json
Chiều giao dịch: NS = bán, NB = mua.
Tùy chọn có sẵn:
NS, NB Mã chứng khoán, ví dụ VNM.
Loại giá: LO, ATO, ATC, PLO, MP, MTL, MOK, MAK.
Tùy chọn có sẵn:
LO, ATO, ATC, PLO, MP, MTL, MOK, MAK Giá giao dịch.
Khối lượng giao dịch.