Saturday, January 27, 2018

How to use AlgoTrader APIs and how to develop your own AWS application using algorithmic trading tools

Hello everyone,



Today, I am going to show how to create a trade strategy using AlgoTrader API. How to use AlgoTrader APIs and how to develop your own application using algorithmic trading APIs for broker/customer markets

Using Auto Trader API you can create trading strategies, deploy and generates the back tests to your trade. You can generate Options & Futures as other many features.

Few points before we start:

You need a cloud service account, eg: Amazon AWS account id. That will be the service account to generate the trades, exchanges and back tests and logs.
Once you have this prerequisite setup, you can go thru your Amazon EC2 VM and
start running your development as I show below.



The beauty is these back tests can process 500,000 events per seconds. Once you are happy with back tests results you can start doing tradings.

For Options & Futures you can have SABR calibration and Delta Hedging service
- OptionUtil, OptionService and ch.algotrader.service.OptionService.


Summarizing it - In this article, I am going to show:
1. How to create a new strategy using eclipse and Autotrader API.
2. How to back test it.
3. How to deploy it.

First of all, I would like to show the DataModel of AlgoTrader to clarify how the strategy is connected to the other actions and events.


And also the UML diagram of the strategy:




So, let’s move to the steps to use AlgoTrader Api.
1. How to create a new strategy using eclipse and Autotrader API.
1.1.1. First step: You need to create a new strategy using eclipse. Create a new Maven project as showed below.






1.1.2. The modules(eg: module-box-init.epl) contains the signal generation logic. Such as SEND_ORDER, MOVING_AVERAGE , in case of strategy many others for each as specific case scenario.

1.1.3. Example Service:

1.1.3.1.1. onStart method is called on the strategy starts up.

1.1.3.1.2. sendOrder is called from a signal to create a market order that sends to exchange process.

2. The backtest
2.1.1. The backTest is logged to the console. It can process up to 500.000 process per second.


2.1.2. At the end of the backTest, it generates a concise report with key metrics for you analysis.

NOTE: in excel format

3. Deploy it
3.1.1. You can place order manually
3.1.2. You can see and draw in your chart.
3.1.3. The latest release AlgoTrader is using Docker to build, ship and run this distributed application.
3.1.4. Using Docker, we can easily deploy a trading strategy in AWS - where you can monitor thru the browser anywhere.


4. Benefits of AlgoTrader
4.1. Running multiple strategies simultaneously.
4.2. Customizing the platform.
4.3. Integrating the third party libraries
4.4. Trading multiple accounts.
4.5. Connecting to multiple brokers at same time.
4.6- There are very nice features developing Options(Using the Class OptionUtil). You can run by option price, implied volatility, intrinsic value, delta,vega,theta, forward price, moneyness or even strike by delta.
4.7- SABR Calibration- OptionService class has the SABR calibration that happens for one specific expiration and takes an array of strikes with their corresponding array of volatilities.


I hope it helps all of you that want to create your own trade tool or web application.


Happy coding,
Thiago Leoncio.
               


Reference:
AlgoTrader JAVA API http://doc.algotrader.ch/javadoc/index.html
AlgoTrader UML Model http://doc.algotrader.ch/uml/AlgoTrader-UML-Model.pdf
SABR Stochastic model: http://www.lesniewski.us/papers/published/HedgingUnderSABRModel.pdf






No comments:

Post a Comment