Hi all ,
Hope you are doing good . I wanted to know if someone could help me code a stat.arb strategy in python . I have it in R , but i want to shift it to python . I'm putting down the steps , its a very basic and simple stat.arb strategy . I haven't attempted to code it in python , cause i dont know much about it . If it is any help , i can post the R codes .
- Find the correlation Coefficient of 2 stocks , and plot thier prices on a graph .
- then calculate its price ratio (using EOD/end of day data) and then calculate a 100day weighted moving average of the price ratio and plot the 100day WMA on the same chart as the 2 stock prices .
- Calculate 2.5 standard deviation from the 100day WMA above and below (i,e. 2.5+ SD and 2.5- SD)
- generate trade signal when one of the prices hit the 2.5+ SD band and one hit the 2.5- SD .
- Stoploss at 3.5SD and get out at 1.5SD .
Could really use help regarding it badly .
Regards,
Lost