Sample client guide

Python and Node.js sample codes provided.

Service endpoints

  • API: https://fc-data.ssi.com.vn/v2.0/Market

  • Price streaming Nodejs: wss://fc-datahub.ssi.com.vn/v2.0

  • Price streaming Python/ .Net: https://fc-datahub.ssi.com.vn/v2.0

  • URL api Java/ .Net: https://fc-data.ssi.com.vn/

  • Price streaming Java: https://fc-datahub.ssi.com.vn/

Python Client

Setup

https://github.com/SSI-Securities-Corporation/python-fcdata

Python installation

Python 3.x is required. (you can download at python.org/downloads/release/python-370/)

Note: Remember to tick on "Add system path" when setting up Python

Client installation

Step 1: Extract the downloaded zip file and go to the extracted folder

Step 2: Type cmd to the address bar to launch command line

Step 3: Run the following command to install

pip install dist/<foldername>

Note: If your network requires proxy, follow steps here to configure proxy before running the installation command in step 3.

Run Client

In the installation folder, there are 3 following files:

  • config.py is the file storing service connection configuration (service access endpoints, ConsumerID, ConsumerSecret and PrivateKey). You need to input the API connection key created on iBoard at registration steps to this file before running the client.

  • test_Req_Res.py is the file run to test the APIs.

  • test_Streaming.py is the file run to test the streaming.

Run API

File test_Req_Res.py contains pre-set input parameters for the APIs. You can change these parameters to feed your needs.

To change the input parameters, open file test_Req_Res.py (with Notepad ++…) and amend and save the file.

To run test the APIs, follow the steps below:

Step 1: Run the following command:

python test_Req_Res.py

Step 2: Input from 11 to 18 to the "Enter your choice" and enter

Streaming connection

Step 1: Launch the client by command: python test_Streaming.py

Step 2: Input the following values to get the corresponding data:

  • ALL: All types of data

  • F: securities status

  • X: Best prices

  • R: Foreign room

  • MI: Indexes

  • B: Realtime OHLC

Refer to 2. Streaming FastConnect Data for more details of each message type.

For example, to receive streaming update of VN30, input MI:VN30

Note: if you choose ALL, the volume of data can be high, causing slow from client side.

Node.js Client

Setup

https://github.com/SSI-Securities-Corporation/node-fcdata

Or you can login iBoard and download Client from menu API Service/Service management.

Node.js setup

Requires Node.js version v.10.15.3 up.

To check if Node.js is installed and which version, run the command:

cmd node –version

Install Node.js Client

Step 1: Extract the downloaded file.

Step 2: Launch command line

Step 3: Run the following command to install sample client

npm install ssi-fcdata

Note: If your network is behind a proxy, follow the steps here to configure proxy before running the install command in Step 3.

Run Client

In the installed folder, there are two files:

  • config.js: is the file storing service connection configuration (service access endpoints, ConsumerID, ConsumerSecret and PrivateKey). You need to input the API connection key created on iBoard at registration steps to this file before running the client.

  • main.js is the file to run test APIs and streaming.

Setup API connection key to config.js file

Input your API connection key to the config.js file and save.

  • ConsumerId

  • ConsumerSecret

Run client

File main.js contains pre-set input parameters for the APIs. You can change these parameters to feed your needs.

To change the input paramters, open the file main.js (with Notepad ++…), edit the values and save.

To run the test:

Step 1: Open command line and run the following:

node main.js

If the client is run successfully, the following message is displayed:

Example app listinging on port <port number>!

You should remember this port to use in the next step.

For example, in the below picture, app is up at port 3020.

Step 2: Open your web browser and type the following:

http://localhost:<port hiển thị trên màn hình chạy main.js>/<tên hàm cần truy vấn>

The response is shown on the web browser.

Example:

To get the symbol list of HNX, using function Securities, follow the below steps:

  • Open file main.js, find /Securities, input HNX to the market field and save the file.

  • Run the client by command:

node main.js

Streaming Market data

Step 1: Launch command line and go to the installed folder. You can go to the folder by explorer and then type cmd on the address bar to launch the command line.

Step 2: Open file main.js, go to line 183 (mkClient.serviceHandlers.connected) to enter data type and save the file.

Step 3: Run the client by command

node main.js

Client Java

Setup

https://github.com/SSI-Securities-Corporation/java-fcdata

Java setup

Requires computer or laptop to have Java installed

Install Java Client

Step 1: Extract the downloaded file

Step 2: Launch command line

The screen displays the window as follows:

Step 3: Run the following command to install sample client

java -jar <tensamplejava>.jar

Run Client

In the installed folder, there are two files:

  • fcdata.json is the file storing service connection configuration (service access endpoints, ConsumerID, ConsumerSecret). You need to input the API connection key created on iBoard at registration steps to this file before running the client.

  • samples-2.0.0 run file jar

Setup API connection key to fcdata.json file

Input your API connection key to the fcdata.json file and save.

  • ConsumerId

  • ConsumerSecret

File fcdata.json contains pre-set input parameters for the APIs. You can change these parameters to feed your needs.

To change the input paramters, open the file fcdata.json (with Notepad ++…), edit the values and save.

To run the test:

Step 1: Input your API connection key to the fcdata.json file and save.

Step 2: Run Client and select 1 + Corresponding API order to test API data

Note:

  • Re-enter the connection key or change the API input. Save the file and select number 9 to re-initialize the Client

  • Re-initialize Client -> Select number 3 to Exit

Streaming Market data

Step 1: Input your API connection key and input channels to the fcdata.json file and save.

Refer to 2. Streaming FastConnect Data for more details of each message type.

Step 2: Run Client and select 2 to listen to the stream

Note:

  • Re-enter the connection key or change the API input. Save the file and select number 9 to re-initialize the Client

  • Re-initialize Client -> Select number 3 to Exit

Client .NET

Setup

https://github.com/SSI-Securities-Corporation/dotnet-fcdata/releases/latest/download/fc-data-win64.net.zip

Client installation

Step 1: Extract the downloaded zip file and go to the extracted folder

Step 2: Open Client

Double click on the text icon "DotnetClientTest"

Client displays information as follows:

Run Client

In the installation folder, there is one file:

  • data is the file storing service connection configuration (service access endpoints, ConsumerID, ConsumerSecret). You need to input the API connection key created on iBoard at registration steps to this file before running the client.

Setup API connection key to data file

Input your API connection key to the data file and save.

File data contains pre-set input parameters for the APIs. You can change these parameters to feed your needs.

To change the input paramters, open the file data (with Notepad ++…), edit the values and save.

To run the test:

Step 1: Input your API connection key to the data file and save.

Step 2: Run Client and select 2 + Corresponding API order to test API data

Note:

  • Re-enter the connection key or change the API input. Save the file and select number 10 to re-initialize the Client

  • Re-initialize Client -> Select number 3 to Exit

Streaming Market data

Step 1: Input your API connection key and input channels to the fcdata.json file and save.

Refer to 2. Streaming FastConnect Data for more details of each message type.

Run Client and select 1 to listen to the stream

Note:

  • Re-enter the connection key or change the API input. Save the file and select number 10 to re-initialize the Client

  • Re-initialize Client -> Select number 3 to Exit

Last updated