Connection guide

Service endpoints

Service nameEndpoint

FCTrading API

https://fc-tradeapi.ssi.com.vn

FCTrading Streaming

https://fc-tradehub.ssi.com.vn

Credentials

After registration, you can create the API connection keys (refer here).

Integration diagram

Integration diagram

Access token request

To secure your account activities, authentication code is required together with ConsumerID and ConsumerSecret when you request access token. Authentication code is dependent on the authentication method you registered:

  • PIN: Input your PIN code.

  • SMS OTP: Use function GetOTP to get OTP code. OTP code will be sent to your registered mobile number.

  • Email OTP: Use function GetOTP to get OTP code. OTP code will be sent to your registered email address.

  • Smart OTP: Input OTP code from SSI SmartOTP app or iBoard app depending on which app you have activated the service.

We recommend you use SMS OTP or SmartOTP for security enhancement. PIN will soon be out of support.

Access token usage

  • Regarding query functions, only access token is required for authentication before executing the request.

  • Regarding functions impacting to cash/securities (place/amend/cancel orders, internal transfer, right subscription, stock transfer, initial margin deposit/withdraw), you will need to sign the data by the Private Key provided. Refer here for details of Signature.

Access token is valid within 8h. You cannot access our service with an expired token. Remember to renew access token before it expires to make sure the availability of your system.

When requesting access token, you can choose to save the effective period of the authentication code.

  • If you choose to save, you will not need to enter authentication code when executing transactions related to cash/securities.

  • If you don't choose to save, you will need to enter authentication

Streaming connection

To use streaming update, you need to init the connection and bind to subcribe for different type of data.

Init connection

Initstream:
client.initStream({
    url: config.stream_url,
    consumer_id: config. ConsumerID,
    consumer_secret: config. ConsumerSecret,
    notify_id:   0

});

Notes:

notify_id is the sequential order of the streaming messages. When init connection, you need to set value for notify_id.

  • notify_id = 0: the system will return all messages from the beginning of the day

  • notify_id = -1: the system will return update messages after connected.

  • notify_id = n: the system will return messages from n, with n equal to the sequence number of the last message received before disconnection + 1.

During connected time, you should store this id, which will be used in case of disconnection.

FastConnect system will reset notify_id to 0 at 00:00 daily.

Subscribe data changes

Order update

//Bind a callback function to: event onNewOrder:
client.bind(client.events.onOrderUpdate, function (e,data) {
	    console.log(e + ": ");
	    console.log(JSON.stringify(data));
    
});

//Bind a callback function to event onOrderError::
client.bind(client.events.onOrderError, function (e, data) {
	   console.log(e + ": ");
	   console.log(JSON.stringify(data));

Derivatives portfolio update

client.bind(client.events.onClientPortfolioEvent,function(e,data){
Process data...
console.log(e + ": ");
console.log(JSON.stringify(data));
});

Order placing process

Last updated