Đặt lệnh điều kiện
curl --request POST \
--url https://services-staging.entrade.com.vn/papertrade-smart-order/orders \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"investorId": 123,
"investorAccountId": 123,
"bankMarginPortfolioId": 123,
"symbol": "<string>",
"condition": "<string>",
"targetPrice": 123,
"targetSide": "<string>",
"targetQuantity": 123,
"type": "<string>",
"expiredTime": "<string>"
}
'import requests
url = "https://services-staging.entrade.com.vn/papertrade-smart-order/orders"
payload = {
"investorId": 123,
"investorAccountId": 123,
"bankMarginPortfolioId": 123,
"symbol": "<string>",
"condition": "<string>",
"targetPrice": 123,
"targetSide": "<string>",
"targetQuantity": 123,
"type": "<string>",
"expiredTime": "<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({
investorId: 123,
investorAccountId: 123,
bankMarginPortfolioId: 123,
symbol: '<string>',
condition: '<string>',
targetPrice: 123,
targetSide: '<string>',
targetQuantity: 123,
type: '<string>',
expiredTime: '<string>'
})
};
fetch('https://services-staging.entrade.com.vn/papertrade-smart-order/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://services-staging.entrade.com.vn/papertrade-smart-order/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([
'investorId' => 123,
'investorAccountId' => 123,
'bankMarginPortfolioId' => 123,
'symbol' => '<string>',
'condition' => '<string>',
'targetPrice' => 123,
'targetSide' => '<string>',
'targetQuantity' => 123,
'type' => '<string>',
'expiredTime' => '<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://services-staging.entrade.com.vn/papertrade-smart-order/orders"
payload := strings.NewReader("{\n \"investorId\": 123,\n \"investorAccountId\": 123,\n \"bankMarginPortfolioId\": 123,\n \"symbol\": \"<string>\",\n \"condition\": \"<string>\",\n \"targetPrice\": 123,\n \"targetSide\": \"<string>\",\n \"targetQuantity\": 123,\n \"type\": \"<string>\",\n \"expiredTime\": \"<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://services-staging.entrade.com.vn/papertrade-smart-order/orders")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"investorId\": 123,\n \"investorAccountId\": 123,\n \"bankMarginPortfolioId\": 123,\n \"symbol\": \"<string>\",\n \"condition\": \"<string>\",\n \"targetPrice\": 123,\n \"targetSide\": \"<string>\",\n \"targetQuantity\": 123,\n \"type\": \"<string>\",\n \"expiredTime\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://services-staging.entrade.com.vn/papertrade-smart-order/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 \"investorId\": 123,\n \"investorAccountId\": 123,\n \"bankMarginPortfolioId\": 123,\n \"symbol\": \"<string>\",\n \"condition\": \"<string>\",\n \"targetPrice\": 123,\n \"targetSide\": \"<string>\",\n \"targetQuantity\": 123,\n \"type\": \"<string>\",\n \"expiredTime\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"status": "<string>",
"investorId": "<string>",
"investorAccountId": 123,
"bankMarginPortfolioId": 123,
"symbol": "<string>",
"condition": "<string>",
"targetPrice": 123,
"targetSide": "<string>",
"targetQuantity": 123,
"type": "<string>",
"expiredTime": "<string>",
"createdDate": "<string>",
"modifiedDate": "<string>",
"metadata": {}
}{
"code": "<string>",
"message": "<string>",
"status": 123
}{
"code": "<string>",
"message": "<string>",
"status": 123
}Smart Order
Đặt lệnh điều kiện
Đặt lệnh điều kiện (Smart Order).
POST
/
orders
Đặt lệnh điều kiện
curl --request POST \
--url https://services-staging.entrade.com.vn/papertrade-smart-order/orders \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"investorId": 123,
"investorAccountId": 123,
"bankMarginPortfolioId": 123,
"symbol": "<string>",
"condition": "<string>",
"targetPrice": 123,
"targetSide": "<string>",
"targetQuantity": 123,
"type": "<string>",
"expiredTime": "<string>"
}
'import requests
url = "https://services-staging.entrade.com.vn/papertrade-smart-order/orders"
payload = {
"investorId": 123,
"investorAccountId": 123,
"bankMarginPortfolioId": 123,
"symbol": "<string>",
"condition": "<string>",
"targetPrice": 123,
"targetSide": "<string>",
"targetQuantity": 123,
"type": "<string>",
"expiredTime": "<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({
investorId: 123,
investorAccountId: 123,
bankMarginPortfolioId: 123,
symbol: '<string>',
condition: '<string>',
targetPrice: 123,
targetSide: '<string>',
targetQuantity: 123,
type: '<string>',
expiredTime: '<string>'
})
};
fetch('https://services-staging.entrade.com.vn/papertrade-smart-order/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://services-staging.entrade.com.vn/papertrade-smart-order/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([
'investorId' => 123,
'investorAccountId' => 123,
'bankMarginPortfolioId' => 123,
'symbol' => '<string>',
'condition' => '<string>',
'targetPrice' => 123,
'targetSide' => '<string>',
'targetQuantity' => 123,
'type' => '<string>',
'expiredTime' => '<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://services-staging.entrade.com.vn/papertrade-smart-order/orders"
payload := strings.NewReader("{\n \"investorId\": 123,\n \"investorAccountId\": 123,\n \"bankMarginPortfolioId\": 123,\n \"symbol\": \"<string>\",\n \"condition\": \"<string>\",\n \"targetPrice\": 123,\n \"targetSide\": \"<string>\",\n \"targetQuantity\": 123,\n \"type\": \"<string>\",\n \"expiredTime\": \"<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://services-staging.entrade.com.vn/papertrade-smart-order/orders")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"investorId\": 123,\n \"investorAccountId\": 123,\n \"bankMarginPortfolioId\": 123,\n \"symbol\": \"<string>\",\n \"condition\": \"<string>\",\n \"targetPrice\": 123,\n \"targetSide\": \"<string>\",\n \"targetQuantity\": 123,\n \"type\": \"<string>\",\n \"expiredTime\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://services-staging.entrade.com.vn/papertrade-smart-order/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 \"investorId\": 123,\n \"investorAccountId\": 123,\n \"bankMarginPortfolioId\": 123,\n \"symbol\": \"<string>\",\n \"condition\": \"<string>\",\n \"targetPrice\": 123,\n \"targetSide\": \"<string>\",\n \"targetQuantity\": 123,\n \"type\": \"<string>\",\n \"expiredTime\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"status": "<string>",
"investorId": "<string>",
"investorAccountId": 123,
"bankMarginPortfolioId": 123,
"symbol": "<string>",
"condition": "<string>",
"targetPrice": 123,
"targetSide": "<string>",
"targetQuantity": 123,
"type": "<string>",
"expiredTime": "<string>",
"createdDate": "<string>",
"modifiedDate": "<string>",
"metadata": {}
}{
"code": "<string>",
"message": "<string>",
"status": 123
}{
"code": "<string>",
"message": "<string>",
"status": 123
}Ủy quyền
JWT token lấy từ API đăng nhập.
Nội dung
application/json
Mã khách hàng
Mã tài khoản
Mã gói vay
Mã phái sinh (ví dụ "VN30F2504")
Điều kiện đặt lệnh (ví dụ ">= 1369", "<= 1396")
Giá đặt
"NB" (Mua) hoặc "NS" (Bán)
Khối lượng đặt
Chỉ nhận giá trị "STOP"
Thời gian đóng lệnh
Phản hồi
Thành công – đặt lệnh điều kiện
Số hiệu lệnh
“PendingTrigger”, “Canceled” hoặc “Triggered”
Mã khách hàng
Mã tài khoản
Mã gói vay
Mã phái sinh (ví dụ "VN30F2504")
Điều kiện đặt lệnh (ví dụ ">= 1369", "<= 1396")
Giá đặt
"NB" (Mua) hoặc "NS" (Bán)
Khối lượng đặt
Chỉ nhận giá trị "STOP"
Thời gian đóng lệnh
Thời điểm (ngày giờ) đặt lệnh, theo định dạng ISO UTC 8601 format datetime. Ví dụ: 2022-07-15T10:00:00.111+07:00
Thời điểm (ngày giờ) thay đổi cuối cùng của lệnh