# Sample client guide

## Python Client

### Client Setup

#### Download url:

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

#### Python

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

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

#### Install Client

**Step 1:** Unzip the downloaded file.&#x20;

**Step 2:** Type cmd to open command line

<figure><img src="/files/9phK4ywEUzEQZYEZA12j" alt=""><figcaption></figcaption></figure>

The following screen is displayed:&#x20;

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

**Step 3**: Change the consumerid and consumer secret, and twoFAtype in file fc\_config.py at examples folder.&#x20;

![](/files/yRdvda9RbbDEFr09mZXY)

{% hint style="info" %}
**Note**: TwoFAType = 0: PIN and 1: OTP (SMS/ Email/ SmartOTP)
{% endhint %}

**Step 4:** Run the following command

```
pip install ssi-fctrading
```

{% hint style="info" %}
**Note**: If your network is behind a proxy, please configure proxy as guided [here](broken://pages/1oRUqxT4JWWYDDgcecVY). &#x20;
{% endhint %}

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

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

\+ Just need to install once. After that, to run the client, only need to double click file example\_api and example\_stream

* Place/Amend/Cancel orders and query through link: <http://127.0.0.1:8000/docs> (marked red in the picture)&#x20;
* Order update through streaming connection

\+ Files example\_api and example\_streaming include all functions provided
{% endhint %}

### Run Client

After installation, the folder will have the following files:

* fc\_config.py: contains connection parameters
* example\_api: executable file to test the api
* example\_stream: to test streaming connection

#### Connection configuration

Change the consumerID, consumerSecret, privateKey in fc\_config.py to your API connection keys and input your twoFAtype and save the file. You just need to setup once.&#x20;

#### Run the api

Double click example\_api, then open link: <http://127.0.0.1:8000/docs> to start using the APIs.&#x20;

<figure><img src="/files/fFUFWdyHrMF0CLdvjeHD" alt=""><figcaption><p>Swagger đặt lệnh và truy vấn API</p></figcaption></figure>

#### Streaming

* Double click file example\_stream to connect streaming.&#x20;

<figure><img src="/files/bxhrg8KdwjIAmiIsRueO" alt="" width="375"><figcaption><p>Streaming lệnh </p></figcaption></figure>

## Node.js Client

### Client Setup

#### Download URL

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

#### Setup Node.js

* Requires Node.js (from v.10.15.3 up)
* Check if Node.js is installed and what version by command: cmd node –version

![](/files/TCOlp2F9jUkkeHV1rEla)

#### Install Client

**Step 1:** Download the client and unzip

**Step 2:** Type cmd to launch command line

![](/files/OdnThCvVFgU1dn39QiDq)

**Step 3:** Run the following command

```
npm install ssi-fctrading
```

{% hint style="info" %}
**Note**: If your network is behind a proxy, please configure proxy as guided [here](broken://pages/4bjHVCLeGBBYxvyJtCH3).
{% endhint %}

### Run Client

After installation is finished, there is <mark style="color:blue;">index.js</mark> file in the folder. This file contains information about connection configuration, sample test data and is the main executed file. You will need to change the data in the file before running it. Follow the steps mentioned below:&#x20;

#### Configuration

* Input your ConsumerID, ConsumerSecret, PrivateKey to config session in index.js file.&#x20;
* Input your registered authentication type to the field TwoFAType. If you use PIN, input 0. If you use SMS OTP/Email OTP/SmartOTP,input 1.&#x20;

#### &#x20;                                ![](/files/CilF6x9lHSwy4Oh1TKS2)

#### Input account and order info

In index.js file, the variable "mockStockData" contains info to place cash market order and  the variable "mockDerivativeData" contains info to place derivatives order. You need to change the values of account, ordertype, stock symbol, price, volume as you wish and save the file.&#x20;

#### Input authentication code

Input the authentication code to the field "code" ở in “mockStockData” và “mockDeterativeData” of index.js file and save.&#x20;

&#x20;                       ![](/files/cf0VxmRd1f0611c3juza)

**How to get authentication code**

* If you use PIN, enter the PIN code
* If you use SMS/Email OTP: open web browser and run: localhost:3011/getOTP to get the OTP code.&#x20;

&#x20;                        ![](/files/KQ15lJwPPIj7T7FsMosL)

* If you use SmartOTP: input the OTP code on your SSI SmartOTP or iBoard depending on which app you activated the SmartOTP. &#x20;

#### Run the client

Open cmd screen and run: node index.js

![](/files/YVW3ySsXa3uvRiksUZm9)

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

#### Place order and monitor streaming

* Open web browser and type in: <mark style="color:blue;">localhost:3011/NewOrder</mark>
* Monitor the streaming on the cmd screen used to run index.js before

&#x20;                   ![](/files/cb7k4M4N4ZcAdcHudAUM)

You can also try another APIs by typing the corresponding name in index.js file.&#x20;

For example, to get purchasing power of the account, run the command <mark style="color:blue;">localhost:3011/maxBuyQty</mark>

&#x20;                  ![](/files/vmvIkofZAPrALAQInHtQ)

{% hint style="info" %}
Order streaming is updated only when there is an order placed/amended/cancelled/matched.

Derivatives portfolio streaming is updated only when there is an order matched or changed in market price. &#x20;
{% endhint %}

## Java Client

### Client Setup

#### Download URL

<https://github.com/SSI-Securities-Corporation/java-fctrading>

#### Setup Java

Requires computer or laptop to have Java installed

#### Install Client

**Step 1:** Download the client and unzip

**Step 2:** Type cmd to launch command line

<figure><img src="/files/7gHEBIM8TjFuLdUtZylc" alt=""><figcaption></figcaption></figure>

The screen displays the window as follows:

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

**Step 3:** Run the following command

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

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

### Run Client

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

* <mark style="color:blue;">fctrading.json</mark> is the file storing service connection configuration (service access endpoints, ConsumerID, ConsumerSecret, 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;">samples-2.0.0</mark> run file jar

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

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

* ConsumerId
* ConsumerSecret
* privateKey

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

File fctrading.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 fctrading.json (with Notepad ++…), edit the values and save.&#x20;

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

To run the test:

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

<figure><img src="/files/1urIo7QNq1RwWCTkNke1" alt=""><figcaption></figcaption></figure>

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

* code: Enter the PIN code if the Customer uses the PIN authentication method&#x20;
* If the customer uses the OTP authentication method ->no required
  {% endhint %}

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

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

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

* If the connection key is re-entered or API input is changed, it is necessary to Save file and select number 35 to reinitiate Client.&#x20;
* Reinitiate Client -> Select number 3 to exit.&#x20;
* If customer's authentication method is OTP -> for the first initiation, isSave = false by default and OTP is required.&#x20;
* In case customer's authentication method is OTP and isSave = false -> OTP is required for any transaction.
  {% endhint %}

#### Monitor streaming

Run Client and select 2 to listen to the stream

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

## Client .Net

### Client Setup

#### Download URL

[https://github.com/SSI-Securities-Corporation/dotnet-fctrading](https://github.com/SSI-Securities-Corporation/dotnet-fctrading/releases/latest/download/fc-trading-win64.net.zip)

#### Install Client

**Step 1:** Download the client and unzip

Client displays information as follows:

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

**Step 2:** Open Client

Double click on the text icon "SSI.FCTrading.ClientExample"

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

Client displays information as follows:

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

### Run Client

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

* <mark style="color:blue;">data</mark> is the file storing service connection configuration (service access endpoints, ConsumerID, ConsumerSecret, 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;

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

#### **Setup API connection key to&#x20;**<mark style="color:blue;">**data**</mark>**&#x20;file**

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

* ConsumerId
* ConsumerSecret
* privateKey

<figure><img src="/files/3wJb44F2EJFZUtflStLR" 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/DguF3ESkrNK3UFzMUV40" alt=""><figcaption></figcaption></figure>

To run the test:

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

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

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

* code: Enter the PIN code if the Customer uses the PIN authentication method&#x20;
* If the customer uses the OTP authentication method ->no required
  {% endhint %}

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

<figure><img src="/files/4b8y0cQLOJBEh0NjZd7P" alt=""><figcaption></figcaption></figure>

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

* If the connection key is re-entered or API input is changed, it is necessary to Save file and select number 19 to reinitiate Client.&#x20;
* Reinitiate Client -> Select number 3 to exit.&#x20;
* If customer's authentication method is OTP -> for the first initiation, isSave = false by default and OTP is required.&#x20;
* In case customer's authentication method is OTP and isSave = false -> OTP is required for any transaction.
  {% endhint %}

#### Monitor streaming

Run Client and select 2 to listen to the stream

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://guide.ssi.com.vn/ssi-products/fastconnect-trading/sample-client-guide.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
