hi,
in the mean reversion strategy course one section tells us about trading pairs. I want to modify the code for the pair trade. I want to feed the code a CSV file which contains the stocks' price data. These stocks are the components of an index. I want the code to form all possible pair combinations between these stocks, calculate cointegration of these combinations and then pick the 5 best cointegrated pair combinations.
Some code fragments from index arb section and pair trade sections works well but I need help with forming the combinations and putting all these code together…
thanks… have a nice day
Hi Yusuf,
Please check the below link, where one of the EPAT participants has already created the functions you have asked for.
https://www.quantinsti.com/blog/k-means-pair-selection-python-part-4
You need to run a for loop on the columns of a CSV file containing the close prices of different stocks, and pass them as inputs to the functions mentioned in the above link to check for cointegration.
Hope this helps.