API Specs

API List

  • Token and Authentication code

  • Query cash and derivatives accounts

  • Order placing

  • Cash

  • Stock

  • Online Right Subscription

Configuration

Request access

POST AccessToken

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

To get token to access APIs.

Details

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

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

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

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

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

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

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

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

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

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

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

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

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

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 derNewOrder

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

To place derivatives orders.

Details

Sample

  • Successful request:

Input: 
{  
instrumentID: "VN30F2306",
market: "VNFE",
buySell: "B",
orderType: "LO",
channelID: "TA",
price: 1200,
quantity: 10,
account: "1184418",
stopOrder: false,
stopPrice: 0,
stopType: "string",
stopStep: 0,
lossStep: 0,
profitStep: 0
requestID: "1678198",
code:123456789,
deviceID: "MAC Address",
userAgent: “FCTrading"
 }
 Output: 
 {
  "message": "Success",
  "status": 200,
  "data": {
    "requestID": "3407154",
    "requestData": {
      "instrumentID": "VN30F2306",
      "market": "VNFE",
      "buySell": "B",
      "orderType": "LO",
      "channelID": "TA",
      "price": 1200,
      "quantity": 100,
      "account": "1184418",
      "stopOrder": false,
      "stopPrice": 0,
      "stopType": "",
      "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 derModifyOrder

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

To amend a derivatives order.

Details

Sample

  • Successful request:

Input: 
{
requestID: "93235974",
orderID: "12658867",
price: 1410,
quantity: 3,
account: "1184418",
instrumentID: "VN30F2306",
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: 3,
         account: "1184418",
         instrumentID: "VN30F2306",
         marketID: "VNFE",
         buySell: "B",
         orderType: "LO"
      }
  }
}
  • Error request:

Input: 
{
requestID: "93235974",
orderID: "",
price: 1410,
quantity: 3,
account: "1184418",
instrumentID: "VN30F2306",
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 derCancelOrder

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

To cancel a derivatives order.

Details

Sample

  • Successfull request:

Input: 
{
orderID: "12658867",
account: "1184418",
marketID: "VNFE",
instrumentID: "VN30F2306",
buySell: "B",
requestID: "52513603"
code:”123456789,
      deviceID: "MAC Address",
      userAgent: “FCTrading”
}
Output: 
{
message: "Success",
status: 200,
data: {
    requestID: "52513603",
    requestData: {
         orderID: "12658867",
         account: "1184418",
         marketID: "VNFE",
         instrumentID: "VN30F2106",
         buySell: "B",
         requestID: "52513603"
       }
    }
}
  • Error request:

Input: 
{
orderID: " ",
account: "0901358",
marketID: "VNFE",
instrumentID: "VN30F2106",
buySell: "B",
requestID: "52513603"
code:”123456789,
deviceID: "MAC Address",
userAgent: “FCTrading”
}
Output: 
{
message: "’Order ID' must not be empty.",
status: 400,
data: null
}

GET rateLimit

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

Get rate Limit

Details

Sample:

Output: 
{
  "message": "Success",
  "status": 200,
  "data": [
    {
      "endpoint": "*",
      "period": "1s",
      "limit": 5
    },
    {
      "endpoint": "*",
      "period": "5s",
      "limit": 30
    }
  ]
}

Cash

GET cashInAdvanceAmount

https://fc-tradeapi.ssi.com.vn/api/v2/cash/cashInAdvanceAmount

Query cash in advance available amount

Details

Sample:

Input: 
{
  account: "8888881"
}
Output: 
{
    "message": "Success",
    "status": 200,
    "data": {
        "account": "8888881",
        "ciaAmounts": [
            {
                "dueDate": "08/03/2023",
                "sellValue": 3000000.0,
                "netSellValue": 0.0,
                "advance": 0.0,
                "cashAdvance": 0.0
            }
        ]
    }
}

GET unsettleSoldTransaction

https://fc-tradeapi.ssi.com.vn/api/v2/cash/unsettleSoldTransaction

Query unsettle sold transactions

Details

Sample:

Input: 
{
  account: "8888881",
  settleDate: "10/03/2023"
}
Output: 
{
    "message": "Success",
    "status": 200,
    "data": {
        "account": "8888881",
        "unsettledSoldTransactions": [
            {
                "tradeDate": "08/03/2023",
                "instrumentID": "SSI",
                "quantity": 100,
                "price": 0.0,
                "netSellValue": 1990000.0
            },
            {
                "tradeDate": "08/03/2023",
                "instrumentID": "SSI",
                "quantity": 100,
                "price": 0.0,
                "netSellValue": 1990000.0
            },
            {
                "tradeDate": "08/03/2023",
                "instrumentID": "SSI",
                "quantity": 100,
                "price": 0.0,
                "netSellValue": 117410.0
            }
        ]