Sample client guide
Python Client
Client Setup
Download url:
https://github.com/SSI-Securities-Corporation/python-fctrading
Python
Requires Python 3.x up (you can download at python.org/downloads/release/python-370/)
Note: Please tick Add system path when setting up Python.
Install Client
Step 1: Unzip the downloaded file.
Step 2: Type cmd to open command line
The following screen is displayed:
Step 3: Change the consumerid and consumer secret, and twoFAtype in file fc_config.py at examples folder.
Note: TwoFAType = 0: PIN and 1: OTP (SMS/ Email/ SmartOTP)
Step 4: Run the following command
Note: If your network is behind a proxy, please configure proxy as guided here.
Note:
+ 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)
Order update through streaming connection
+ Files example_api and example_streaming include all functions provided
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.
Run the api
Double click example_api, then open link: http://127.0.0.1:8000/docs to start using the APIs.
Streaming
Double click file example_stream to connect streaming.
Node.js Client
Client Setup
Download URL
https://github.com/SSI-Securities-Corporation/python-fctrading
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
Install Client
Step 1: Download the client and unzip
Step 2: Type cmd to launch command line
Step 3: Run the following command
Note: If your network is behind a proxy, please configure proxy as guided here.
Run Client
After installation is finished, there is index.js 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:
Configuration
Input your ConsumerID, ConsumerSecret, PrivateKey to config session in index.js file.
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.
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.
Input authentication code
Input the authentication code to the field "code" ở in “mockStockData” và “mockDeterativeData” of index.js file and save.
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.
If you use SmartOTP: input the OTP code on your SSI SmartOTP or iBoard depending on which app you activated the SmartOTP.
Run the client
Open cmd screen and run: node index.js
Place order and monitor streaming
Open web browser and type in: localhost:3011/NewOrder
Monitor the streaming on the cmd screen used to run index.js before
You can also try another APIs by typing the corresponding name in index.js file.
For example, to get purchasing power of the account, run the command localhost:3011/maxBuyQty
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.
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
The screen displays the window as follows:
Step 3: Run the following command
Run Client
In the installed folder, there are two files:
fctrading.json 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 to this file before running the client.
samples-2.0.0 run file jar
Setup API connection key to fctrading.json file
Input your API connection key to the fctrading.json file and save.
ConsumerId
ConsumerSecret
privateKey
File fctrading.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 fctrading.json (with Notepad ++…), edit the values and save.
To run the test:
Step 1: Input your API connection key to the fctrading.json file and save.
Note:
code: Enter the PIN code if the Customer uses the PIN authentication method
If the customer uses the OTP authentication method ->no required
Step 2: Run Client and select 1 + Corresponding API order to test API
Note:
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.
Reinitiate Client -> Select number 3 to exit.
If customer's authentication method is OTP -> for the first initiation, isSave = false by default and OTP is required.
In case customer's authentication method is OTP and isSave = false -> OTP is required for any transaction.
Monitor streaming
Run Client and select 2 to listen to the stream
Client .Net
Client Setup
Download URL
https://github.com/SSI-Securities-Corporation/dotnet-fctrading
Install Client
Step 1: Download the client and unzip
Client displays information as follows:
Step 2: Open Client
Double click on the text icon "SSI.FCTrading.ClientExample"
Client displays information as follows:
Run Client
In the installed folder, there are two files:
data 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 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.
ConsumerId
ConsumerSecret
privateKey
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 fctrading.json file and save.
Note:
code: Enter the PIN code if the Customer uses the PIN authentication method
If the customer uses the OTP authentication method ->no required
Step 2: Run Client and select 1 + Corresponding API order to test API
Note:
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.
Reinitiate Client -> Select number 3 to exit.
If customer's authentication method is OTP -> for the first initiation, isSave = false by default and OTP is required.
In case customer's authentication method is OTP and isSave = false -> OTP is required for any transaction.
Monitor streaming
Run Client and select 2 to listen to the stream
Last updated