phi 1 unified algorithmic trading · 2020. 11. 24. · statistical arbitrage 1. cipla and sun...
TRANSCRIPT
![Page 1: PHI 1 Unified Algorithmic Trading · 2020. 11. 24. · Statistical Arbitrage 1. Cipla and Sun Pharma 2. NestleInd and Dabur (Infy?) 3. M and M Limited and Tata Motors 4. Sbin, Indian](https://reader035.vdocuments.mx/reader035/viewer/2022071412/61084a020a8ff965824ddff8/html5/thumbnails/1.jpg)
PHI 1 – Unified Algorithmic Trading
Sets you free to think markets. Propels you beyond the status quo.
![Page 2: PHI 1 Unified Algorithmic Trading · 2020. 11. 24. · Statistical Arbitrage 1. Cipla and Sun Pharma 2. NestleInd and Dabur (Infy?) 3. M and M Limited and Tata Motors 4. Sbin, Indian](https://reader035.vdocuments.mx/reader035/viewer/2022071412/61084a020a8ff965824ddff8/html5/thumbnails/2.jpg)
Statistical Arbitrage
#Correlation Check
self.corr, self.p_value = pearsonr(self.datas[0].close.array,
self.datas[1].close.array)
Logs('Pearsons correlation coefficient: %.3f' % self.corr)
![Page 3: PHI 1 Unified Algorithmic Trading · 2020. 11. 24. · Statistical Arbitrage 1. Cipla and Sun Pharma 2. NestleInd and Dabur (Infy?) 3. M and M Limited and Tata Motors 4. Sbin, Indian](https://reader035.vdocuments.mx/reader035/viewer/2022071412/61084a020a8ff965824ddff8/html5/thumbnails/3.jpg)
Correlation
![Page 4: PHI 1 Unified Algorithmic Trading · 2020. 11. 24. · Statistical Arbitrage 1. Cipla and Sun Pharma 2. NestleInd and Dabur (Infy?) 3. M and M Limited and Tata Motors 4. Sbin, Indian](https://reader035.vdocuments.mx/reader035/viewer/2022071412/61084a020a8ff965824ddff8/html5/thumbnails/4.jpg)
Correlation
![Page 5: PHI 1 Unified Algorithmic Trading · 2020. 11. 24. · Statistical Arbitrage 1. Cipla and Sun Pharma 2. NestleInd and Dabur (Infy?) 3. M and M Limited and Tata Motors 4. Sbin, Indian](https://reader035.vdocuments.mx/reader035/viewer/2022071412/61084a020a8ff965824ddff8/html5/thumbnails/5.jpg)
Stationarity
![Page 6: PHI 1 Unified Algorithmic Trading · 2020. 11. 24. · Statistical Arbitrage 1. Cipla and Sun Pharma 2. NestleInd and Dabur (Infy?) 3. M and M Limited and Tata Motors 4. Sbin, Indian](https://reader035.vdocuments.mx/reader035/viewer/2022071412/61084a020a8ff965824ddff8/html5/thumbnails/6.jpg)
Stationarity
![Page 7: PHI 1 Unified Algorithmic Trading · 2020. 11. 24. · Statistical Arbitrage 1. Cipla and Sun Pharma 2. NestleInd and Dabur (Infy?) 3. M and M Limited and Tata Motors 4. Sbin, Indian](https://reader035.vdocuments.mx/reader035/viewer/2022071412/61084a020a8ff965824ddff8/html5/thumbnails/7.jpg)
Statistical Arbitrage`
#Stationarity Check
X = sm.add_constant(list(self.datas[1].close.array))
model = sm.OLS(list(self.datas[0].close.array),X, hasconst=True)
self.val = model.fit()
self.adfuller = adfuller(self.val.resid)
Logs('ADF Statistic: %f' % self.adfuller[0])
Logs('p-value: %f' % self.adfuller[1])
Logs('Critical Values:')
for key, value in self.adfuller[4].items():
Logs('\t%s: %.3f' % (key, value))
![Page 8: PHI 1 Unified Algorithmic Trading · 2020. 11. 24. · Statistical Arbitrage 1. Cipla and Sun Pharma 2. NestleInd and Dabur (Infy?) 3. M and M Limited and Tata Motors 4. Sbin, Indian](https://reader035.vdocuments.mx/reader035/viewer/2022071412/61084a020a8ff965824ddff8/html5/thumbnails/8.jpg)
Statistical Arbitrage`
#Trading Logic
self.val1 = self.datas[0].close - (self.datas[1].close * self.val.params[1]) -
self.val.params[0]
self.boll = BollingerBands(self.val1, period=20, devfactor=1.5)
![Page 9: PHI 1 Unified Algorithmic Trading · 2020. 11. 24. · Statistical Arbitrage 1. Cipla and Sun Pharma 2. NestleInd and Dabur (Infy?) 3. M and M Limited and Tata Motors 4. Sbin, Indian](https://reader035.vdocuments.mx/reader035/viewer/2022071412/61084a020a8ff965824ddff8/html5/thumbnails/9.jpg)
Statistical Arbitrage
1. Cipla and Sun Pharma
2. NestleInd and Dabur (Infy?)
3. M and M Limited and Tata Motors
4. Sbin, Indian bank/pnb
5. hdfcbank and axis, icici
More Examples
![Page 10: PHI 1 Unified Algorithmic Trading · 2020. 11. 24. · Statistical Arbitrage 1. Cipla and Sun Pharma 2. NestleInd and Dabur (Infy?) 3. M and M Limited and Tata Motors 4. Sbin, Indian](https://reader035.vdocuments.mx/reader035/viewer/2022071412/61084a020a8ff965824ddff8/html5/thumbnails/10.jpg)
Audience Exercise
mean_p = "Mean :" +str(self.val2)
Logs(mean_p )
std_d = "Standard Deviation :"
+str(self.val3)
Logs(std_d )
def norm(self.val.resid,mean,std):
z_score = [(x - mean)/std for x in data]
return z_score
self.val5 =
norm(self.val.resid,self.val2,self.val3)
normd_s = "Normalized Series :"
+str(self.val5)
Logs(normd_s)
def mean(sample):
return sum(sample) / len(sample)
self.val2 = mean(self.val.resid)
def std_d(data):
mean = sum(data) / len(data)
# Square deviations
deviations = [(x - mean)
** 2 for x in data]
s1=sum(deviations)
s2=s1/len(data)
s3=s2 ** (1/2)
return s3
self.val3 = std_d(self.val.resid)
Bollinger Bands Parameter Tuning
![Page 11: PHI 1 Unified Algorithmic Trading · 2020. 11. 24. · Statistical Arbitrage 1. Cipla and Sun Pharma 2. NestleInd and Dabur (Infy?) 3. M and M Limited and Tata Motors 4. Sbin, Indian](https://reader035.vdocuments.mx/reader035/viewer/2022071412/61084a020a8ff965824ddff8/html5/thumbnails/11.jpg)
Audience Exercise
if (self.val1[0] > self.boll.lines.top[0]) and (self.position.size==0):
buy(data = self.datas[1])
sell(data = self.datas[0])
if (self.val1[0] < self.boll.lines.mid[0]) and (self.position.size!=0):
square_off()
When Residual breaches the Upper Band
![Page 12: PHI 1 Unified Algorithmic Trading · 2020. 11. 24. · Statistical Arbitrage 1. Cipla and Sun Pharma 2. NestleInd and Dabur (Infy?) 3. M and M Limited and Tata Motors 4. Sbin, Indian](https://reader035.vdocuments.mx/reader035/viewer/2022071412/61084a020a8ff965824ddff8/html5/thumbnails/12.jpg)
Audience Exercise
Dollar Neutral
Beta Neutral
Industry/Sector Neutral
Interest Rate Neutral
Oil Price Neutral
………..
Factor Neutrality
Identify all factor risks and neutralize your portfolio (We are
capturing mispricing risk only)
![Page 13: PHI 1 Unified Algorithmic Trading · 2020. 11. 24. · Statistical Arbitrage 1. Cipla and Sun Pharma 2. NestleInd and Dabur (Infy?) 3. M and M Limited and Tata Motors 4. Sbin, Indian](https://reader035.vdocuments.mx/reader035/viewer/2022071412/61084a020a8ff965824ddff8/html5/thumbnails/13.jpg)
Caution
The strategy heavily depends on the mean reversion of prices to their historical or predicted normal. This may not happen in certain cases and the prices can continue to drift away from the historical normal.
Systematically determine when the reversion in spread is unlikely
and exit the trade
![Page 14: PHI 1 Unified Algorithmic Trading · 2020. 11. 24. · Statistical Arbitrage 1. Cipla and Sun Pharma 2. NestleInd and Dabur (Infy?) 3. M and M Limited and Tata Motors 4. Sbin, Indian](https://reader035.vdocuments.mx/reader035/viewer/2022071412/61084a020a8ff965824ddff8/html5/thumbnails/14.jpg)
Further Reading
Practitioners
![Page 15: PHI 1 Unified Algorithmic Trading · 2020. 11. 24. · Statistical Arbitrage 1. Cipla and Sun Pharma 2. NestleInd and Dabur (Infy?) 3. M and M Limited and Tata Motors 4. Sbin, Indian](https://reader035.vdocuments.mx/reader035/viewer/2022071412/61084a020a8ff965824ddff8/html5/thumbnails/15.jpg)
Further Reading
Academics and Educators
![Page 16: PHI 1 Unified Algorithmic Trading · 2020. 11. 24. · Statistical Arbitrage 1. Cipla and Sun Pharma 2. NestleInd and Dabur (Infy?) 3. M and M Limited and Tata Motors 4. Sbin, Indian](https://reader035.vdocuments.mx/reader035/viewer/2022071412/61084a020a8ff965824ddff8/html5/thumbnails/16.jpg)
Further Reading
Skeptics
![Page 17: PHI 1 Unified Algorithmic Trading · 2020. 11. 24. · Statistical Arbitrage 1. Cipla and Sun Pharma 2. NestleInd and Dabur (Infy?) 3. M and M Limited and Tata Motors 4. Sbin, Indian](https://reader035.vdocuments.mx/reader035/viewer/2022071412/61084a020a8ff965824ddff8/html5/thumbnails/17.jpg)
ALG
OR
ITH
MIC
TR
AD
ING
WO
RK
FLO
WCREATION EVALUATION / REFINEMENT DEPLOYMENT
Screening
Basic Screening
Advanced Screening
Strategy Creation
Evaluation
Bulk Backtesting
Scenario Backtesting
Grading on Scenarios
Ideabook Simulation (Paper)
Deployment
Monitoring Scaling
![Page 18: PHI 1 Unified Algorithmic Trading · 2020. 11. 24. · Statistical Arbitrage 1. Cipla and Sun Pharma 2. NestleInd and Dabur (Infy?) 3. M and M Limited and Tata Motors 4. Sbin, Indian](https://reader035.vdocuments.mx/reader035/viewer/2022071412/61084a020a8ff965824ddff8/html5/thumbnails/18.jpg)
AVIRAL [email protected] | +91 95655 13605
GAURAV [email protected] | +91 79000 76658
WEBSITEhttps://www.phi1.io/
OFFICEPowerweave Heuristic Investment Technologies Pvt. Ltd.Plot No. 27, Road No.11, Near Tunga Hotel,Marol Industrial Area, MIDC Andheri (E), Mumbai.
LET’S TALK