Skip to main content
GET
/
trading
/
v1
/
accounts
/
{subAccountId}
/
order-book
/
{orderId}
cURL
curl \
  -H "X-FH-APIKEY: $FINHAY_API_KEY" \
  -H "X-FH-TIMESTAMP: $TIMESTAMP_MS" \
  -H "X-FH-NONCE: $NONCE_UUID" \
  -H "X-FH-SIGNATURE: $SIGNATURE_HEX" \
  "https://open-api.fhsc.com.vn/trading/v1/accounts/$SUB_ACCOUNT_NORMAL/order-book/ORD123456"
{
  "error_code": "0",
  "message": "success",
  "data": {
    "custodycd": "0123456",
    "txdate": "2024-04-18",
    "custid": "123456",
    "afacctno": "0001234567",
    "orderid": "ORD123456",
    "odorderid": "0001",
    "txtime": "09:15:23",
    "symbol": "VNM",
    "allowcancel": "Y",
    "allowamend": "Y",
    "side_code": "NB",
    "side": "BUY",
    "price": 72000,
    "pricetype": "LO",
    "via_code": "WEB",
    "via": "Web",
    "qtty": 100,
    "execqtty": 0,
    "execamt": 0,
    "execprice": 0,
    "remainqtty": 100,
    "remainamt": 7200000,
    "status_code": "01",
    "status": "SENT",
    "tlname": "Finhay",
    "username": "cuong@finhay",
    "hosesession": "PROGRESS",
    "cancelqtty": 0,
    "adjustqtty": 0,
    "isdisposal": "N",
    "rootorderid": "ORD123456",
    "timetype": "0",
    "timetypevalue": "",
    "feedbackmsg": "",
    "quoteqtty": 0,
    "limitprice": 72000,
    "odtimestamp": "2024-04-18T09:15:23",
    "matchtype_code": "",
    "producttypename": "STOCK",
    "afacctno_ext": "0001234567.01",
    "side_": "BUY",
    "via_": "Web",
    "status_": "SENT",
    "matchtype_": "",
    "strategy_id": null
  }
}

Documentation Index

Fetch the complete documentation index at: https://developers.fhsc.com.vn/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

X-FH-APIKEY
string
header
required

API key dài hạn của client. Cấu hình 1 lần lúc khởi tạo; có thể wire thẳng vào static setter của SDK tự-gen. Đi kèm với FINHAY_API_SECRET — secret này chỉ dùng ở phía client để tính X-FH-SIGNATURE, không bao giờ gửi qua mạng.

X-FH-TIMESTAMP
string
header
required

Unix time hiện tại tính bằng milliseconds, đưới dạng chuỗi số thập phân.

Được tính per-request bởi signing middleware. Không set thủ công — dùng middleware mẫu trong README.

X-FH-NONCE
string
header
required

UUIDv4 duy nhất per-request (ví dụ crypto.randomUUID()). Server cache cặp (apiKey, nonce) trong 5 phút; nếu nonce được reuse với cùng apiKey trong window này, request sẽ bị từ chối với AUTH_NONCE_REUSED (401).

Server chấp nhận chuỗi opaque bất kỳ về mặt kỹ thuật, nhưng nên dùng UUIDv4 để đảm bảo tính unique.

Được tính per-request bởi signing middleware. Không set thủ công — xem middleware mẫu trong tài liệu Authentication.

X-FH-SIGNATURE
string
header
required

HMAC-SHA256 của canonical signing payload, encode hex (lowercase).

Signing payload:

{X-FH-TIMESTAMP}\n{METHOD}\n{REQUEST_PATH}[?{QUERY}]\n{BODYHASH}
  • ?{QUERY} chỉ nối vào path khi request có query string.
  • {BODYHASH} là chuỗi rỗng khi body rỗng (vẫn không có newline sau đó).

Được tính per-request bởi signing middleware. Không set thủ công — dùng middleware mẫu trong README.

Path Parameters

subAccountId
string
required

subAccountId được lấy từ bootstrap flow (GET /users/v1/users/{userId}/sub-accounts), chọn NORMAL hoặc MARGIN tuỳ mục đích.

Example:

"0001234567"

orderId
string
required

Mã lệnh trả về từ ordersGetOrderBook (orderid). Định dạng ORD\d+.

Example:

"ORD123456"

Response

Trả về data là object chứa toàn bộ field của lệnh — kích thước, giá, status, route, executed.

Các field chung của envelope trong mọi response của Finhay API.

  • error_code"0" (string) khi thành công, mã khác "0" khi lỗi.
  • message là thông điệp ngắn từ server.
data
object
required

1 row trong sổ lệnh của ngày. Dùng chung cho /trading/v1/accounts/{subAccountId}/order-book (array) và /trading/v1/accounts/{subAccountId}/order-book/{orderId} (đơn lẻ).

error_code
string

"0" khi thành công, khác "0" khi lỗi.

Example:

"0"

message
string

Thông điệp trạng thái dễ đọc.

Example:

"success"