> For the complete documentation index, see [llms.txt](https://guide.ssi.com.vn/ssi-products/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://guide.ssi.com.vn/ssi-products/fastconnect-data/sample-client-guide.md).

# Sample client guide

## Service endpoints

* API: <mark style="color:blue;"><https://fc-data.ssi.com.vn/v2.0/Market></mark>
* Price streaming Nodejs: <mark style="color:blue;">wss\://fc-datahub.ssi.com.vn/v2.0</mark>
* Price streaming Python/ .Net: <mark style="color:blue;"><https://fc-datahub.ssi.com.vn/v2.0></mark>
* URL api Java/ .Net: <mark style="color:blue;"><https://fc-data.ssi.com.vn/></mark>
* Price streaming Java: <mark style="color:blue;"><https://fc-datahub.ssi.com.vn/></mark>

## Python Client

### Setup

#### Sample code download link

[https://github.com/SSI-Securities-Corporation/python-fcdata](https://github.com/SSI-Securities-Corporation/python-fcdata/releases/latest/download/fc-data.py.zip)

#### Python installation

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

{% hint style="info" %}
**Note**: Remember to tick on "Add system path" when setting up Python
{% endhint %}

#### 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>
```

<figure><img src="/files/Ep8SNjseVILup5YC3agY" alt=""><figcaption><p>Sample screen for successful setup</p></figcaption></figure>

{% hint style="info" %}
**Note:** If your network requires proxy, follow steps here to configure proxy before running the installation command in step 3.&#x20;
{% endhint %}

### Run Client

In the installation folder, there are 3 following files:&#x20;

* <mark style="color:blue;">config.py</mark> 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](/ssi-products/service-registration.md) to this file before running the client.&#x20;
* <mark style="color:blue;">test\_Req\_Res.py</mark> is the file run to test the APIs.&#x20;
* <mark style="color:blue;">test\_Streaming.py</mark> is the file run to test the streaming.&#x20;

#### Run API

File  <mark style="color:blue;">**test\_Req\_Res.py**</mark> contains pre-set input parameters for the APIs. You can change these parameters to feed your needs.&#x20;

To change the input parameters, open file test\_Req\_Res.py (with Notepad ++…) and amend and save the file.&#x20;

<figure><img src="/files/ZHJKO1bvUjOJi8Fnj6Lc" alt=""><figcaption><p>Sample screen for input parameters in the file</p></figcaption></figure>

To run test the APIs, follow the steps below:

**Step 1:** Run the following command:&#x20;

```
python test_Req_Res.py
```

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

<figure><img src="/files/WFFelbgCTWwBNxfoLQho" alt=""><figcaption><p>Sample screen for successful case</p></figcaption></figure>

#### Streaming connection

**Step 1:** Launch the client by command: python test\_Streaming.py

**Step 2:** Input the following values to get the corresponding data: &#x20;

* ALL: All types of data
* F: securities status
* X: Best prices
* R: Foreign room
* MI: Indexes
* B: Realtime OHLC

{% hint style="info" %}
Refer to [2. Streaming FastConnect Data](https://guide.ssi.com.vn/ssi-products/fastconnect-data/pages/gcBDFec4YHSZxNZH6pir#2.-streaming-fastconnect-data) for more details of each message type.
{% endhint %}

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

<figure><img src="/files/gqgC6mFMbGBKtnGkGKDK" alt=""><figcaption><p>Streaming update VN30 index</p></figcaption></figure>

{% hint style="info" %}
**Note**: if you choose ALL, the volume of data can be high, causing slow from client side.&#x20;
{% endhint %}

## Node.js Client

### Setup

#### Client download link

[https://github.com/SSI-Securities-Corporation/node-fcdata](https://github.com/SSI-Securities-Corporation/node-fcdata/releases/latest/download/fc-data.zip)

Or you can login iBoard and download Client from menu API Service/Service management. &#x20;

#### Node.js setup

Requires Node.js version v.10.15.3 up.&#x20;

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
```

<figure><img src="/files/F1EuoffwRyEDZN8szqy9" alt=""><figcaption><p>Sample screen for successful installation</p></figcaption></figure>

{% hint style="info" %}
**Note:** If your network is behind a proxy, follow the steps here to configure proxy before running the install command in Step 3. &#x20;
{% endhint %}

### Run Client

In the installed folder, there are two files:&#x20;

* <mark style="color:blue;">config.js</mark>: 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](/ssi-products/service-registration.md) to this file before running the client.&#x20;
* <mark style="color:blue;">main.js</mark> is the file to run test APIs and streaming.&#x20;

#### **Setup API connection key to config.js file**

Input your API connection key to the config.js file and save.&#x20;

* ConsumerId
* ConsumerSecret

<figure><img src="/files/sKDfN2H89qGnPl0Y0tlz" alt=""><figcaption><p>Input file config.js</p></figcaption></figure>

#### Run client

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

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

To run the test:

**Step 1:** Open command line and run the following:&#x20;

```
node main.js
```

If the client is run successfully, the following message is displayed: &#x20;

&#x20;                                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 <mark style="color:blue;">**3020**</mark>.&#x20;

<figure><img src="/files/RI4RaLwEsFGBTYdwxQJh" alt=""><figcaption><p>Minh họa chạy client thành công</p></figcaption></figure>

**Step 2:** Open your web browser and type the following:&#x20;

```
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.&#x20;

**Example:**&#x20;

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.&#x20;

<figure><img src="/files/smVNudsE5jFzdDGp4LMg" alt=""><figcaption><p>Sample screen of editing parameters of main.js file</p></figcaption></figure>

* Run the client by command:

```
node main.js
```

* Open web browser and type: <http://localhost:3020/Securities>

<figure><img src="/files/iXftwCCqVHo4gCR8jMLe" alt=""><figcaption><p>Sample response of Securities api</p></figcaption></figure>

#### 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.&#x20;

![](/files/ybAl9ca1DYJ2V8ZGxwu8)

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

<figure><img src="/files/jL427ceWjOqZTBgbui1J" alt=""><figcaption></figcaption></figure>

**Step 3:** Run the client by command

```
node main.js
```

## Client Java

### Setup

#### Client download link

<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

<figure><img src="/files/bCggdiMvKuGyfjWxIs5T" alt=""><figcaption></figcaption></figure>

The screen displays the window as follows:&#x20;

<figure><img src="/files/o9ZeBrcmJ124XNhT6qQr" alt=""><figcaption></figcaption></figure>

**Step 3:** Run the following command to install sample client

```
java -jar <tensamplejava>.jar
```

<figure><img src="/files/OHhlgzZp3A0vfomEqaFA" alt=""><figcaption></figcaption></figure>

### Run Client

In the installed folder, there are two files:&#x20;

* <mark style="color:blue;">fcdata.json</mark> 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](/ssi-products/service-registration.md) to this file before running the client.&#x20;
* <mark style="color:blue;">samples-2.0.0</mark> run file jar

#### **Setup API connection key to fcdata.json file**

Input your API connection key to the fcdata.json file and save.&#x20;

* ConsumerId
* ConsumerSecret

<figure><img src="/files/pJrpYsUXwEiGIeGmO8kW" alt=""><figcaption></figcaption></figure>

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

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

<figure><img src="/files/jRaDtOVsJps0BCjkXZHU" alt=""><figcaption></figcaption></figure>

To run the test:

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

<figure><img src="/files/D6Tqhjwket2FKiFi7S0N" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/QcGmInW1O8Lw8jz8B2de" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
**Note:** &#x20;

* Re-enter the connection key or change the API input. Save the file and select number 9 to re-initialize the Client&#x20;
* Re-initialize Client -> Select number 3 to Exit
  {% endhint %}

#### Streaming Market data

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

{% hint style="info" %}
Refer to [2. Streaming FastConnect Data](https://guide.ssi.com.vn/ssi-products/fastconnect-data/pages/gcBDFec4YHSZxNZH6pir#2.-streaming-fastconnect-data) for more details of each message type.
{% endhint %}

<figure><img src="/files/rw5tYC2BQAcPWeI1MSct" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/jQB6GugTDINvVhbZ4L2t" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
**Note:** &#x20;

* Re-enter the connection key or change the API input. Save the file and select number 9 to re-initialize the Client&#x20;
* Re-initialize Client -> Select number 3 to Exit
  {% endhint %}

## Client .NET

### Setup

#### Sample code download link

<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

<figure><img src="/files/6jC4RA4GpNc93dqSksS0" alt=""><figcaption></figcaption></figure>

**Step 2:** Open Client

Double click on the text icon "DotnetClientTest"

<figure><img src="/files/BTCcR4oE8stKCp6WrElK" alt=""><figcaption></figcaption></figure>

Client displays information as follows:

<figure><img src="/files/jc81CEYbvCQKu3ObMbTb" alt=""><figcaption></figcaption></figure>

### Run Client

In the installation folder, there is one file:&#x20;

* <mark style="color:blue;">data</mark> 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](/ssi-products/service-registration.md) to this file before running the client.&#x20;

<figure><img src="/files/DdB9ezhFnACTGNOlm6ps" alt=""><figcaption></figcaption></figure>

#### **Setup API connection key to data file**

Input your API connection key to the <mark style="color:blue;">data</mark> file and save.&#x20;

<figure><img src="/files/oQyqrwq2D87p5pHg94ED" alt=""><figcaption></figcaption></figure>

File <mark style="color:blue;">data</mark> contains pre-set input parameters for the APIs. You can change these parameters to feed your needs.&#x20;

To change the input paramters, open the file <mark style="color:blue;">data</mark> (with Notepad ++…), edit the values and save.&#x20;

<figure><img src="/files/bWIFOBBeESnAYzzSLz4v" alt=""><figcaption></figcaption></figure>

To run the test:

**Step 1:** Input your API connection key to the <mark style="color:blue;">data</mark> file and save.

<figure><img src="/files/xX8lDt2zyqTyiTi8ZI82" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/CekOmDEaSAZ2U3AIl5gm" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
**Note:** &#x20;

* Re-enter the connection key or change the API input. Save the file and select number 10 to re-initialize the Client&#x20;
* Re-initialize Client -> Select number 3 to Exit
  {% endhint %}

#### Streaming Market data

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

{% hint style="info" %}
Refer to [2. Streaming FastConnect Data](https://guide.ssi.com.vn/ssi-products/fastconnect-data/pages/gcBDFec4YHSZxNZH6pir#2.-streaming-fastconnect-data) for more details of each message type.
{% endhint %}

<figure><img src="/files/589TPvLFwVOveU8BSksY" alt=""><figcaption></figcaption></figure>

Run Client and select 1 to listen to the stream

<figure><img src="/files/SLsLjKGdtQrLmC4mis6f" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
**Note:** &#x20;

* Re-enter the connection key or change the API input. Save the file and select number 10 to re-initialize the Client&#x20;
* Re-initialize Client -> Select number 3 to Exit
  {% endhint %}
