API Specs

API List

  • Token and Authentication code

APIMethodPath

AccessToken

POST

Trading/AccessToken

GetOTP

POST

Trading/GetOTP

  • Query cash and derivatives accounts

APIMethodPath

orderBook

GET

Trading/orderBook

auditOrderBook

GET

Trading/auditOrderBook

cashAcctBal

GET

Trading/cashAcctBal

derivAcctBal

GET

Trading/derivAcctBal

ppmmraccount

GET

Trading/ppmmraccount

stockPosition

GET

Trading/stockPosition

derivPosition

GET

Trading/derivPosition

maxBuyQty

GET

Trading/maxBuyQty

maxSellQty

GET

Trading/maxSellQty

orderHistory

GET

Trading/orderHistory

rateLimit

GET

Trading/rateLimit

  • Order placing

APIMethodPath

NewOrder

POST

Trading/NewOrder

CancelOrder

POST

Trading/CancelOrder

derNewOrder

POST

Trading/derNewOrder

ModifyOrder

POST

Trading/ModifyOrder

derCancelOrder

POST

Trading/derCancelOrder

derModifyOrder

POST

Trading/derModifyOrder

  • Cash

APIMethodPath

cashInAdvanceAmount

GET

cash/cashInAdvanceAmount

unsettleSoldTransaction

GET

cash/unsettleSoldTransaction

transferHistories

GET

cash/transferHistories

cashInAdvanceHistories

GET

cash/cashInAdvanceHistories

estCashInAdvanceFee

GET

cash/estCashInAdvanceFee

vsdCashDW

POST

cash/vsdCashDW

transferInternal

POST

cash/transferInternal

createCashInAdvance

POST

cash/createCashInAdvance

  • Stock

APIMethodPath

transferable

GET

stock/transferable

transferHistories

GET

stock/transferHistories

transfer

POST

stock/transfer

  • Online Right Subscription

APIMethodPath

dividend

GET

ors/dividend

exercisableQuantity

GET

ors/exercisableQuantity

histories

GET

ors/histories

create

POST

ors/create

Configuration

MethodContentContent

Post

Header (Authorization, Content-Type)

Body (json)

Get

Header (Authorization)

Params

Request access

POST AccessToken

https://fc-tradeapi.ssi.com.vn/api/v2/Trading/AccessToken

To get token to access APIs.

Details

FieldTypeRequired?Description

consumerID

string

Yes

Your consumerID

consumerSecret

string

Yes

Your consumerSecret

code

string

No

Authentication code. Refer to General Information for details. Required if isSave = true.

TwoFactorType

string

Yes

Your account's authentication type. Supported values: 0 (PIN), 1 (OTP)

isSave

boolean

Yes

  • If true: you will not have to fill in authentication code for each transaction. The code will be saved within the login sesion.

  • If false: you will have to fill in authentication code for each transaction.

Sample

  • Successfull request:

Input: 
{
  consumerID: "38f5fdfa56b44d5ab8b95895eb588e99",
  consumerSecret: "6d61bffefc6540fc837c71afd2ca4bcf",
  twoFactorType: 1,
  code: "123456789",
  isSave: false
}
Output: 
{
    message: "Success",
    status: 200,
    data: {
        "accessToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ”
}
  • Error request:

Input: 
{
  consumerID: "38f5fdfa56b44d5ab8b95895eb588e99",
  consumerSecret: "6d61bffefc6540fc837c71afd2ca4bcf",
  twoFactorType: 0,
  code: "123456789",
  isSave: true
}
Output: 
{
message: "Key does not exist.",
status: 400,
data: null
 }

POST GetOTP

https://fc-tradeapi.ssi.com.vn/api/v2/Trading/GetOTP

To get OTP code if you registered SMS OTP/Email OTP.

If you get OTP code for 5 times without verification, your OTP service will be temporarily blocked and then automatically unlocked after sometimes.

Details

FieldTypeRequired?Description

consumerID

string

Yes

You consumerID

consumerSecret

string

Yes

Your consumerSecret

Sample

  • Successfull request:

Input: 
{
  "consumerID": "968d7b5940f5437583021aea2b038f35",
  "consumerSecret": "11ab3fc6af954c59ba646fac016f30cb"
}
Output: 
{
    message: "Success",
    status: 200
}
  • Error request:

Input: 
{
  "consumerID": "968d7b5940f5437583021aea2b038f351",
  "consumerSecret": "11ab3fc6af954c59ba646fac016f30cb"
}
Output: 
{
  "message": "ConsumerID is invalid",
  "status": 400
}

GET auditOrderBook

https://fc-tradeapi.ssi.com.vn/api/v2/Trading/auditOrderBook

To get the audit of the orders.

Details

FieldTypeRequired?Description

account

string

Yes

Sample

Input: 
{
account: "1184418"
}
Output: 
{
  "message": "Success",
  "status": 200,
  "data": {
    "account": "1184418",
    "orders": [
      {
        "uniqueID": "73885549",
        "orderID": "T202306146w273885549",
        "buySell": "B",
        "price": 1000,
        "quantity": 100,
        "filledQty": 0,
        "orderStatus": "RJ",
        "marketID": "VNFE",
        "inputTime": "1686730747945",
        "modifiedTime": "1686730747945",
        "instrumentID": "VN30F2306",
        "orderType": "LO",
        "cancelQty": 0,
        "avgPrice": 0,
        "isForcesell": "F",
        "isShortsell": "F",
        "rejectReason": "Invalid market status",
        "lastErrorEvent": null
      }     
    ]
  }
}

POST OrderBook

https://fc-tradeapi.ssi.com.vn/api/v2/Trading/OrderBook

To get latest orderbook, for both cash and derivatives accounts.

Details

FieldTypeRequired?Description

account

string

Yes

Input the account to query. Accept both cash and derivatives accounts.

Sample

Input: 
{
account: "1184418"
}
Output: 
{
  "message": "Success",
  "status": 200,
  "data": {
    "account": "1184418",
    "orders": [
      {
        "uniqueID": "73885549",
        "orderID": "T202306146w273885549",
        "buySell": "B",
        "price": 1000,
        "quantity": 100,
        "filledQty": 0,
        "orderStatus": "RJ",
        "marketID": "VNFE",
        "inputTime": "1686730747945",
        "modifiedTime": "1686730747945",
        "instrumentID": "VN30F2306",
        "orderType": "LO",
        "cancelQty": 0,
        "avgPrice": 0,
        "isForcesell": "F",
        "isShortsell": "F",
        "rejectReason": "Invalid market status"
      }     
    ]
  }
}

GET orderHistory

https://fc-tradeapi.ssi.com.vn/api/v2/Trading/orderHistory

To get order history, for both cash and derivatives accounts.

Details

FieldTypeRequired?Description

account

string

Yes

startDate

date

Yes

Format dd/mm/yyyy

endDate

date

Yes

Format dd/mm/yyyy

Sample

Input: 
{
account: "0901358",
startDate:18/11/2020,
endDate:18/11/2020
}
Output: 
{
    message: "Success",
    status: 200,
    data: {
        orderHistories: [
      {
                uniqueID: null,
                orderID: "12626539",
                buySell: "B",
                price: 800.0,
                quantity: 10,
                filledQty: 0,
                orderStatus: "RJ",
                marketID: "VNFE",
                inputTime: "1603157594668",
                modifiedTime: "1603157594668",
                instrumentID: "VN30F2012",
                orderType: "LO",
                cancelQty: 0,
                avgPrice: 0.0,
                isForcesell: null,
                isShortsell: null
            }
],
        account: "0901358"
    }
 }

GET cashAccountBalance

https://fc-tradeapi.ssi.com.vn/api/v2/Trading/cashAcctBal

To get cash account's balance.

Details

FieldTypeRequiredDescription

account

string

Yes

Sample

Input: 
{
    account: "0901351",
}
Output: 
{
message: "Success",
status: 200,
data: {
account: "0901351",
cashBal: 7459369481,
cashOnHold: 0,
secureAmount: 0,
withdrawable: 7459367581,
receivingCashT1: 0,
receivingCashT2: 0,
matchedBuyVolume: 0,
matchedSellVolume: 0,
debt: 1900,
unMatchedBuyVolume: 0,
unMatchedSellVolume: 864619337,
paidCashT1: 0,
paidCashT2: 0,
cia: 0,
purchasingPower: 7459367581,
totalAssets: 9726161481
       }
}

GET stockPosition

https://fc-tradeapi.ssi.com.vn/api/v2/Trading/stockPosition

To query stock positions of cash accounts.

Details

FieldTypeRequired?Description

account

string

Yes

Input account number

Sample

Input: 
{
account: "0901351",
}
}
Output: 
{
  "message": "Success",
  "status": 200,
  "data": {
    "account": "0001011",
    "totalMarketValue": 0,
    "stockPositions": [
      {
        "marketID": "VN",
        "instrumentID": "AMC",
        "onHand": 300,
        "block": 0,
        "bonus": 3819,
        "buyT0": 0,
        "buyT1": 0,
        "buyT2": 0,
        "sellT0": 0,
        "sellT1": 0,
        "sellT2": 0,
        "avgPrice": 1529,
        "mortgage": 0,
        "sellableQty": 300,
        "holdForTrade": 0,
        "marketPrice": 0
      }
    ]
  }
}

GET derivativeAccountBalance

https://fc-tradeapi.ssi.com.vn/api/v2/Trading/derivAcctBal

To get derivatives account's balance.

Sample

FieldTypeRequired?Description

account

string

Yes

Sample

Input: 
{
    account: "0901358",
}
Output: 
{
message: "Success",
status: 200,
data: {
account: "0901358",
accountBalance: 11166309263,
fee: 0,
commission: 0,
interest: 1514965,
loan: 0,
deliveryAmount: 0,
floatingPL: 0,
totalPL: 0,
marginable: 0,
depositable: 1148597520,
rcCall: 0,
withdrawable: 10912447363,
nonCashDrawableRCCall: 0,
internalAssets: {
cash: 1165730020,
validNonCash: 0,
totalValue: 11166309263,
maxValidNonCash: 0,
cashWithdrawable: 1148597520,
ee: 8197059272
        },
exchangeAssets: {
cash: 10000579243,
validNonCash: 0,
totalValue: 10000579243,
maxValidNonCash: 0,
cashWithdrawable: 9763849843,
ee: 7322887382
         },
        internalMargin: {
initialMargin: 172660800,
deliveryMargin: 0,
marginReq: 172660800,
accountRatio: 1.5462656096416592,
usedLimitWarningLevel1: 75,
usedLimitWarningLevel2: 85,
usedLimitWarningLevel3: 90,
marginCall: 0
        },
      exchangeMargin: {
marginReq: 172660800,
accountRatio: 1.7265079932330476,
usedLimitWarningLevel1: 75,
usedLimitWarningLevel2: 85,
usedLimitWarningLevel3: 90,
marginCall: 0
        }
     }
}

GET derivativePosition

https://fc-tradeapi.ssi.com.vn/api/v2/Trading/derivPosition

To get dervatives account's position. After getting the snapshot, you can subscribed streaming to get realtime update.

Details

FieldTypeRequired?Description

account

string

Yes

querySummary

boolean

Yes

  • True: Netoff position

  • False: don't netoff position

Sample

Input: 
{
account: "0901358",
querySummary: true
}
Output: 
{
message: "Success",
status: 200,
data: {
       account: "0901358",
       openPosition: [
       {
           marketID: "VNFE",
           instrumentID: "VN30F2106",
           longQty: 8,
           shortQty: 0,
           net: 8,
           bidAvgPrice: 0,
           askAvgPrice: 0,
           tradePrice: 1452.7,
           marketPrice: 1452.7,
           floatingPL: 0,
           tradingPL: 0
          }   ],
        closePosition: [ ]
    }
}

GET maxBuyQty

https://fc-tradeapi.ssi.com.vn/api/v2/Trading/maxBuyQty

To get max buy quantity. Applied for both cash and derivatives accounts.

Details

FieldTypeRequired?Description

account

string

Yes

instrumentID

string

Yes

price

number

Yes

Sample

Input: 
{
account: "0041691",
instrumentD: “SSI”,
price:17
}
Output: 
{
    message: "Success",
    status: 200,
    data: {
        account: "0041691",
        maxBuyQty: 8241440,
        marginRatio: "50%",
        purchasingPower: 99292902171
    }
}

GET maxSellQty

https://fc-tradeapi.ssi.com.vn/api/v2/Trading/maxSellQty

To get max sell quantity. Applied for both cash and derivatives accounts.

Details

FieldTypeRequired?Description

account

string

Yes

instrumentID

string

Yes

price

number

Yes

Sample

Input: 
{
account: "0041691",
intrumentID: “SSI”
}
Output: 
{
    "message": "Success",
    "status": 200,
    "data": {
        "account": "0041691",
        "maxSellQty": 2000
    }
}

POST NewOrder

https://fc-tradeapi.ssi.com.vn/api/v2/Trading/NewOrder

To place orders.

Details

FieldTypeRequired?Description

instrumentID

string

Yes

market

string

Yes

VN: cash market

VNFE: derivatives market

buySell

string

Yes

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

B: Buy

S: Sell

orderType

string

Yes

channelID

string

Yes

Kênh đặt lệnh VD: TA (trader API)

price

number

Yes

Giá đặt lệnh:

- Nếu loại lệnh là LO -> Giá đặt > 0

- Nếu loại lệnh khác LO -> Giá đặt = 0

quantity

number

Yes

account

string

Yes

requestID

string

Yes

ID đặt lệnh trong ngày. Bắt buộc 8 số random

stopOrder

string

Yes

  • True: conditional orders. Only applied for derivatives market.

  • False: normal orders

stopPrice

number

Yes

If stopOrder = true -> stopPrice > 0

stopType

string

Yes

Required if stopType = true:

  • D: Down

  • U: Up

  • V: Trailling Up

  • E: Trailing Down

  • O: OCO

  • B: BullBear

stopStep

number

Yes

Stop loss amount, only applied for BullBear (stopType = B)

profitStep

number

Yes

Take profit amount, only applied for BullBear (stopType = B)

code

number

No

Authentication code: PIN/OTP (depending on your registered authentication type)

deviceID

string

Yes

userAgent

string

No

Sample

  • Successful request:

Input: 
{ 
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”
 }
 Output: 
 {
message: "Success",
status: 200,
data: {
requestID: "1678195",
requestData: 
{
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
}
    }
}
  • Error request:

Input: 
{  
instrumentID: "SSI",
market: "VN",
buySell: "B",
orderType: "ATO",
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”
 }
Output: 
 {
    message: "Price is null or equal zero when order is market order",
    status: 400,
    data: null
}

POST ModifyOrder

https://fc-tradeapi.ssi.com.vn/api/v2/Trading/ModifyOrder

To amend an order.

Details

FieldTypeRequired?Description

orderID

string

Yes

instrumentID

string

Yes

instrument of the amended order

marketID

string

Yes

VN: cash market

VNFE: derivatives market

buySell

string

Yes

side of the amended order

orderType

string

Yes

channelID

string

Yes

price

number

Yes

New price

quantity

number

Yes

New quantity

account

string

Yes

requestID

string

Yes

Unique id of the request generated by client. Required 8 digits.

code

number

No

deviceID

string

Yes

userAgent

string

No

Sample

  • Successful request:

Input: 
{
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”
}
Output: 
{
message: "Success",
status: 200,
data: {
   requestID: "93235974",
   requestData: {
         orderID: "12658867",
         price: 1410,
         quantity: 2,
         account: "0901358",
         instrumentID: "VN30F2106",
         marketID: "VNFE",
         buySell: "B",
         orderType: "LO"
      }
  }
}
  • Error request:

Input: 
{
requestID: "93235971",
orderID: "",
price: 1410,
quantity: 2,
account: "0901358",
instrumentID: "VN30F2106",
marketID: "VNFE",
buySell: "B",
orderType: "LO"
code:”123456789,
deviceID: "MAC Address",
userAgent: “FCTrading”
}
Output: 
{
data: null,
message: "’Order ID’ must not be empty ",
status: 400
}

POST CancelOrder

https://fc-tradeapi.ssi.com.vn/api/v2/Trading/CancelOrder

To cancel an order.

Details

FieldTypeRequired?Description

orderID

string

Yes

instrumentID

string

Yes

market

string

Yes

buySell

string

Yes

orderType

string

Yes

channelID

string

Yes

price

number

Yes

quantity

number

Yes

account

string

Yes

requestID

string

Yes

code

number

No

deviceID

string

Yes

userAgent

string

No

Sample

  • Successful request:

Input: 
{
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”
}
Output: 
{
message: "Success",
status: 200,
data: {
   requestID: "93235974",
   requestData: {
         orderID: "12658867",
         price: 1410,
         quantity: 2,
         account: "0901358",
         instrumentID: "VN30F2106",
         marketID: "VNFE",
         buySell: "B",
         orderType: "LO"
      }
  }
}
  • Error request:

Input: 
{