A Sneak Peek into Artificial Intelligence Based HFT Trading Strategies

18
A Sneak Peek to AI to HFT based trading Strategies Friday, 27 th February, 2015 Mr. Sameer Kumar Head, Technology at iRageCapital, Director and Faculty at QuantInsti WEBINAR

Transcript of A Sneak Peek into Artificial Intelligence Based HFT Trading Strategies

Page 1: A Sneak Peek into Artificial Intelligence Based HFT Trading Strategies

A Sneak Peek to AI to HFT based trading Strategies

Friday, 27th February, 2015

Mr. Sameer KumarHead, Technology at iRageCapital,Director and Faculty at QuantInsti

WEBINAR

Page 2: A Sneak Peek into Artificial Intelligence Based HFT Trading Strategies

Agenda

• Economic Concepts

• AI and machine learning

• Building sample model using machine learning

• Introduction to QuantInsti

Page 3: A Sneak Peek into Artificial Intelligence Based HFT Trading Strategies

Economic Concepts

• Stock Market

• Stock price and volume

• Stock Market data – Broadcast/TBT

• Indicators - moving avg crossover, spread etc.

Page 4: A Sneak Peek into Artificial Intelligence Based HFT Trading Strategies

AI and Machine Learning

Artificial Intelligence is intelligence of machines, where intelligent agent (system) perceives its environment and takes action which maximizes its chances of success.

Machine Learning is a subset of AI dedicated to classification and finding patterns and extrapolate it to new data.

There are hedge funds purely based on AI. e.g.. rebellion research, KFL capital etc.

Page 5: A Sneak Peek into Artificial Intelligence Based HFT Trading Strategies

Machine Learning

Supervised and Unsupervised learning

Unsupervised learning is the ability to find patterns in astream of data without labeling the data. e.g SOM

In Supervised learning, we specify the classes/labels oftraining data. e.g. SVM

Page 6: A Sneak Peek into Artificial Intelligence Based HFT Trading Strategies

Support Vector Machines

SVMs are supervised learning models that analyze data andrecognize patterns.

SVMs were originally proposed by Boser, Guyon and Vapnik in1992 and gained increasing popularity in late 1990s.

SVMs are currently among the best performers for a numberof classification tasks ranging from text to genomic data.

Page 7: A Sneak Peek into Artificial Intelligence Based HFT Trading Strategies

Binary classification can be viewed as the task of separating classes in feature spaces:

wTx + b = 0

wTx + b < 0wTx + b > 0

f(x) = sign(wTx + b)

Support Vector Machines

Page 8: A Sneak Peek into Artificial Intelligence Based HFT Trading Strategies

Classification Margin Distance from example xi to the separator is

Examples closest to the hyperplane are support vectors. Margin ρ of the separator is the distance between support vectors.

r

ρ

Support Vector Machines

Page 9: A Sneak Peek into Artificial Intelligence Based HFT Trading Strategies

Common Kernels

Polynomial:

Gaussian radial basis function

For the polynomial, we choose the degree, while for radial basis we choose gamma parameter.Cost parameter is used to control over fitting of the model.

Parameters that the user must choose

)(tanh),(

),(

)1.(),(

22 2/| || |

x.yyx

yx

yxyx

yx

kK

eK

K p

Neural net:

Page 10: A Sneak Peek into Artificial Intelligence Based HFT Trading Strategies

SVM: Applying Class Labels

Class labels are nothing but a way to identify which class this data point belongs. e.g.. if tomorrow's close is greater than today's close price, we can label “+1” and if its lesser, we can label “-1”. so these two are class labels.

We have to manually assign these labels, so we probably need to use R/excel to assign these labels to a large dataset.

Page 11: A Sneak Peek into Artificial Intelligence Based HFT Trading Strategies

Nifty Training Data

Nifty Data from YahooAdd indicators ( cross over, sma, lma, lag 1..5 )Add labels ( Up, Down, Stationary )

nifty<-read.csv( "http://ichart.finance.yahoo.com/table.csv?s=^NSEI&a=08&b=16&c=2006&d=02&e=27&f=2015&g=d&ignore=.csv")

nifty$Sma=filter(nifty$Close,rep(1/7,7),sides=1) nifty$Lma=filter(nifty$Close,rep(1/21,21),sides=1)

b=c(diff(0.1*nifty$Close),0)nifty$direction = ifelse(b>c,1,0)nifty$direction = ifelse(b < -c,-1,nifty$direction)

Page 12: A Sneak Peek into Artificial Intelligence Based HFT Trading Strategies

Nifty Prediction ( SVM )

SVM Learning Applied

svm(formula = dir ~ . - label - Date - Close, data =

nifty_train)

Parameters:

SVM-Type: C-classification

SVM-Kernel: radial

cost: 1

gamma: 0.125

Number of Support Vectors: 1289

> nifty_pred = predict(nifty_svm,nifty_train)

> table(nifty_pred,nifty_train$dir)

nifty_pred -1 0 1

-1 25 6 6

0 294 1103 313

1 31 19 58

Accuracy for predicting “Stationary” is 97.7%

Page 13: A Sneak Peek into Artificial Intelligence Based HFT Trading Strategies

Nifty Prediction ( SVM )

SVM plot using Lag2 and Lma ( keeping others constant)

Page 14: A Sneak Peek into Artificial Intelligence Based HFT Trading Strategies

Nifty Prediction ( Neural Network )

nifty_nn = neuralnet(label~Sma+Lma+Lag1+Lag2+Lag3+Lag4+Lag5+cross,data=nifty_train, hidden=3)

Page 15: A Sneak Peek into Artificial Intelligence Based HFT Trading Strategies

Nifty Training Data ( Tick By Tick)

Nifty TBT data contains all the orders and trades happened over entire day. It has over couple of millions of orders in a single day. Add indicators ( based on paper – Modeling HF Limit order book dynamics with SVM )

Page 16: A Sneak Peek into Artificial Intelligence Based HFT Trading Strategies

Further Learning

Models : HMM, decision tree, random forest, KNN etc. Weka : UI tool to experiment with different classification algorithms Machine learning courses ( popular one is taught by Andrew NG on coursera. )

Books :

Page 17: A Sneak Peek into Artificial Intelligence Based HFT Trading Strategies

About QI & EPAT Quantinsti Quantitative Pvt Ltd.

Quantinsti developed the curriculum for the first dedicated educational program on Algorithmic and High-Frequency Trading globally (EPAT) in 2009. Launched with an aim to introduce its course participants to a world class exposure in the domain of Algorithmic trading, it provides participants with in-house proprietary tools and other globally renowned applications to rise steeply on the learning curve that they witness during the program.

Executive Program in Algorithmic Trading (EPAT)• 6-months long comprehensive course in Algorithmic and Quantitative Trading.

• Primary focus on financial technology trends and solutions.

• It is an online live interactive course aimed at working professionals from diverse backgrounds such as trading-brokerage services, Analytics, Quantitative roles, and Programming & IT industry.

• Get placement assistance and internship opportunities with leading global firms after the program

Page 18: A Sneak Peek into Artificial Intelligence Based HFT Trading Strategies

Thank you!

To Learn Automated Trading

Email: [email protected]

Connect With Us:

SINGAPORE

11 Collyer Quay,

#10-10, The Arcade,

Singapore - 049317

Phone: +65-6221-3654

INDIA

A-309, Boomerang,

Chandivali Farm Road, Powai,

Mumbai - 400 072

Phone: +91-022-61691400