Dữ liệu streaming

Cập nhật trạng thái lệnh/vị thế phái sinh thời gian thực

1. Order Event

Thông tin streaming cập nhật trạng thái lệnh về đặt/ hủy/ sửa lệnh bao gồm những thông tin sau:

Tên trườngKiểu dữ liệuMô tả

type

string

Tên event: orderEvent

uniqueID

string

prefix

string

ipAddress

string

Được xác định yêu cầu từ Client

notifyID

string

Số serrial của msg

orderID

string

instrumentID

string

Mã chứng khoán

buySell

string

buy (B): mua/Sell (S): bán đã đặt theo orderID của lệnh

B: Buy

S: Sell

orderType

string

Loại lệnh:

LO|ATO|ATC|MP|MTL|MOK|MAK|PLO

price

number

Giá

quantity

number

Khối lượng

marketID

string

Sàn:

VN: thị trường cơ sở

VNFE: thị trường phái sinh

origRequestID

string

account

string

Số tài khoản

cancelQty

number

Tổng khối lượng đã hủy

osqty

number

Tổng khối lượng chưa khớp

filledQty

number

Tổng khối lượng khớp

avgPrice

number

Giá trung bình

channel

string

Kênh đặt lệnh

inputTime

string

Unixtime

modifiedTime

string

Unixtime

isForceSell

Boolean

orderStatus

Boolean

Trạng thái lệnh: WA: Chờ duyệt

RS: Chờ gửi

SD: Đã gửi

QU: Chờ khớp

FF: Đã khớp

PF: Khớp 1 phần

FFPC: Khớp 1 phần hủy phần còn lại

WM: Chờ sửa

WC: Chờ hủy

CL: Đã hủy

RJ: Từ chối

EX: Hết hiệu lực

SOR: Chờ kích hoạt

SOS: Đã kích hoạt

IAV: Lệnh trước phiên

SOI: Lệnh điều kiện trước phiên

origOrderID

string

rejectReason

string

stopOrder

string

Loại lệnh:

True: Đối với lệnh điều kiện

False: Đối với lệnh thường

stopType

string

Loại điều kiện. Bắt buộc nhập nếu stopType = true

- D: Down

- U: Up

- V: Trailling Up

- E: Trailing Down

- O: OCO

- B: BullBear

stopStep

number

stopPrice

number

profitPrice

number

Ví dụ:

Streaming đặt lệnh thành công

{ 
instrumentID: "SSI",
market: "VN",
buySell: "B",
orderType: "LO",
channelID: "IW",
price: 21000,
quantity: 300,
account: "0901351",
stopOrder: false,
stopPrice: 0,
stopType: "string",
stopStep: 0,
lossStep: 0,
profitStep: 0
requestID: "1678195",
code:123456789,
deviceID: "MAC Address",
userAgent: “FCTrading”
 }

Streaming đặt lệnh không thành công

{ 
instrumentID: "SSI",
market: "VN",
buySell: "B",
orderType: "LO",
channelID: "IW",
price: 1600,
quantity: 300,
account: "0901351",
stopOrder: false,
stopPrice: 0,
stopType: "string",
stopStep: 0,
lossStep: 0,
profitStep: 0
requestID: "1678195",
code:123456789,
deviceID: "MAC Address",
userAgent: “FCTrading”
 }

Streaming về sửa lệnh thành công

{
requestID: "93235974",
orderID: "12658867",
price: 1410,
quantity: 2,
account: "0901358",
instrumentID: "VN30F2106",
marketID: "VNFE",
buySell: "B",
orderType: "LO"
code:”123456789,
deviceID: "MAC Address",
userAgent: “FCTrading”
}son

Streaming sửa lệnh không thành công

{
requestID: "93235974",
orderID: "12658867",
price: 1000,
quantity: 2,
account: "0901358",
instrumentID: "VN30F2106",
marketID: "VNFE",
buySell: "B",
orderType: "LO"
code:”123456789,
deviceID: "MAC Address",
userAgent: “FCTrading”
}

Streaming hủy lệnh thành công

{
orderID: "12658867",
account: "0901358",
marketID: "VNFE",
instrumentID: "VN30F2106",
buySell: "B",
requestID: "52513603"
code:”123456789,
deviceID: "MAC Address",
userAgent: “FCTrading”
}

Streaming hủy lệnh không thành công

{
orderID: "12658867",
account: "0901358",
marketID: "VNFE",
instrumentID: "VN30F2106",
buySell: "B",
requestID: "52513603"
code:”123456789,
deviceID: "MAC Address",
userAgent: “FCTrading”
}

2. OrderError

Khi yêu cầu đặt/hủy/sửa bị lỗi, hệ thống sẽ cập nhật qua streaming các thông tin như sau:

Tên trườngKiểu dữ liệuMô tả

type

string

Tên event: orderError

data

Thông tin dữ liệu

Detail of data

uniqueid

string

ipaddress

string

notifyID

string

errorCode

string

Mã code lỗi trả ra

message

string

Thông tin lệnh lỗi

orderID

string

Số hiệu lệnh

instrumentID

string

Mã CK

buySell

string

Chiều mua/ bán B: Buy

S: Sell

prefix

string

orderType

string

Loại lệnh:

LO|ATO|ATC|MP|MTL|MOK|MAK|PLO

price

number

Giá

quantity

number

Khối lượng

marketID

string

Sàn

origOrderID

string

account

string

Số tài khoản

channel

string

Kênh

inputTime

string

Thời gian nhận

modifiedTime

string

Thời gian sửa lệnh

isForceSell

Boolean

Luôn = F

isShortSell

Boolean

Luôn = F

origRequestID

string

stopOrder

string

True hoặc False

stopPrice

number

stopType

string

Loại điều kiện. Bắt buộc nhập nếu stopType = true

- D: Down

- U: Up

- V: Trailling Up

- E: Trailing Down

- O: OCO

- B: BullBear

stopStep

number

profitPrice

number

modifiable

string

note

string

Ghi chú

Ví dụ:

{
  "type": "orderError",
  "data": {
    "message": "This channel has been block; disallow to place order ",
    "notifyID": 0,
    "errorCode": "ORD015",
    "uniqueID": "6163422",
    "orderID": "T20230504w3806163422",
    "instrumentID": "SSI",
    "ipAddress": "10.255.241.47",
    "buySell": "B",
    "prefix": "w38",
    "orderType": "LO",
    "price": 19600,
    "quantity": 200,
    "marketID": "VN",
    "origOrderId": "T20230504w3806163422",
    "account": "0322206",
    "channel": "TA",
    "inputTime": "1683165600160",
    "modifiedTime": "1683165600161",
    "isForceSell": "F",
    "isShortSell": "F",
    "origRequestID": "6163422",
    "stopOrder": false,
    "stopPrice": 0,
    "stopType": "",
    "stopStep": 0,
    "profitPrice": 0,
    "modifiable": false,
    "note": ""
  }
}

3. Order Match Event

Thông tin Streaming gồm những trường sau:

Tên trườngKiểu dữ liệuMô tả

type

string

Tên event: orderMatchEvent

data

Thông tin khớp lệnh

orderID

string

Thông tin orderID

instrumentID

string

Mã chứng khoán

ipAddress

string

IP xác định từ yêu cầu Client

uniqueID

string

notifyid

string

buySell

string

matchPrice

number

giá khớp

matchQty

number

khối lượng khớp

prefix

string

account

string

Số tài khoản

matchTime

string

Thời gian khớp

Ví dụ:

{
  "type": "orderMatchEvent",
  "data": {
    "orderID": "16201867",
    "notifyID": 101180,
    "instrumentID": "BVS",
    "uniqueID": "24194396",
    "buySell": "B",
    "matchPrice": 1000,
    "ipAddress": "10.48.41.16",
    "matchQty": 100,
    "prefix": "t4c",
    "account": "1184411",
    "matchTime": "1656665019000"
  }
}

4. Vị thế phái sinh

Thông tin streaming vị thế phái sinh bao gồm vị thế mở và vị thế đã đóng trong ngày.

Tên trườngKiểu dữ liệuMô tả

type

string

Tên event: clientPortfolioEvent

uniqueid

string

connectionid

string

ipaddress

string

IP được xác định từ yêu cầu Client

notifyid

string

account

string

Số tài khoản

marketid

string

Thị trường - VNFE: Phái sinh

instrumentid

string

Mã chứng khoán

longqty

number

Vị thế long

shortqty

number

Vị thế short

Net

number

Vị thế net (Tính bằng long - short).

bidavgprice

number

Giá mua trung bình

askavgprice

number

Giá bán trung bình

tradeprice

number

Giá khớp

marketprice

number

Giá thị trường

floatingpl

number

Lãi/ Lỗ tạm tính

tradingpl

number

Lãi/ Lỗ đã chốt

Ví dụ:

{
  "type": "clientPortfolioEvent",
  "data": {
    "account": "0901358",
    "notifyID": 27,
    "data": null,
    "clientPortfoliosOpen": [
      {
        "martketID": "VNFE",
        "instrumentID": "VN30F2106",
        "longQty": 9,
        "shortQty": 0,
        "net": 9,
        "bidAvgPrice": 1402.4000244140625,
        "askAvgPrice": 0,
        "tradePrice": 0,
        "marketPrice": 873,
        "floatingPL": -476460000,
        "tradingPL": 0
      },
      {
        "martketID": "VNFE",
        "instrumentID": "VN30F2107",
        "longQty": 2,
        "shortQty": 0,
        "net": 2,
        "bidAvgPrice": 830,
        "askAvgPrice": 0,
        "tradePrice": 0,
        "marketPrice": 830,
        "floatingPL": 0,
        "tradingPL": 0
      }
    ],
    "uniqueID": null,
    "clientPortfoliosClose": null,
    "connectionID": "",
    "ipAddress": null,
    "prefix": null
  }
}

Last updated