-- Prerequisites
- Node JS >= 6.0 should be installed on your machine
- Note: Due to some library dependecies the Node JS >= 11 version does not work with this app. Hence please install Node JS < 11 version and >= 6 version.
-- Installation
- Open command prompt and run the following command to install gulp globally
npm install -g gulp
- Go to project root directory (Ex: D:\sdoosa-algo-trade-app).
- Run the command
npm install
to install all dependent npm libraries. - Run the command
gulp deploy
to compile the source code. This will compile the code todist
folder in your project root directory. - If you change only client source code then you can run
gulp deploy-client
. Similarly if you change only server code you can rungulp deploy-server
commands. The commandgulp deploy
compiles both server and client code.
-- Deployment and Configuration
- Create a new directory with the path
C:\algo-trade\
- Copy the
config
folder from the project path (Ex:D:\sdoosa-algo-trade-app\src\config
) toC:\algo-trade\
folder. - After copying the config path would be
C:\algo-trade\config\
. - There are 4 json files in the config path
C:\algo-trade\config\
which are used by the algo app. They areusers.json
,config.json
,strategies.json
andholidays.json
- Edit
users.json
file to configure your username and password to login to the app. Note: These are just for app login not broker login credentials. - Edit
config.json
and configure the port number on which you would like to run the algo trade app. Default port used is8080
. You need to setenableSSL
totrue
when you deploy the app on public domain. Because brokers do not accept your public domain with justhttp
. They expect your server to supporthttps
. So when you deploy on cloud the redirect URL you configure starts withhttps
instead ofhttp
. Brokers supporthttp
only withlocalhost
if you are running the app on your local machine instead of cloud. - When you set
enableSSL
totrue
the app expects theserver.key
andserver.cert
files to be present in the folderC:\algo-trade\ssl-cert\
. Please do search on google how to generate self certified SSL certificate and key and then create the above filesserver.cert
andserver.key
and put the in the mentioned folder. You can skip this step if you are running the app on your machine locally. This is needed only when you deploy the app on cloud. - Configure your brokers API key and secret key under each broker section. If you have not subscribed to any broker, then please put some dummy values in api key and secret key fields. Copy the redirect URL from the respective broker section and go to your broker developer account and configure the the same in the app of your developer account where you have subscribed to APIs.
- Edit
strategies.json
file and configure the parameters for execution of strategy as per the provided details in this file. Each strategy that you are going to develop should have an entry in this file. - Edit
holidays.json
if necessary. Ideally this should be updated once in a year by getting all trading holidays list from your broker.
-- Starting Server
- Open command prompt and go to project root directory. (Ex:
D:\sdoosa-algo-trade-app\
) - Run the command
gulp server
to start the app - You should see the logs as
app started and listening on port 8080/8443
without any errors. - Next open your browser and enter
http://localhost:8080
in new tab/window. - Login to the app (with any of the user credentials that you have configured in
users.json
in above section) - Go to to the respective broker tab and click on
Login to {broker name}
to sign in to your broker. This will redirect you to broker authentication page. Login with with your client credentials of the corresponding broker and accept T&C if any then you will be redirected to algo trade app page. - Click on
Start Algo..
button to start the algo on your app. - Start observing the logs on command prompt and on your broker terminal if all things are working as expected or not.
- Have a good day :)