Author Topic: I want to get the cointegration p-value using Python: which package best to use?  (Read 1833 times)


  • Newbie
  • *
  • Posts: 23
  • Karma: +1/-0
Hello, Karel & Community,

While the PTL database is amazing and pretty accurate (backtesting and actually trading the pair seem aligned in term of perf), I need to compute the cointegration p-value using Python for some reasons.

I've been doing a lot of research, but there are soooo many Python packages available out there to compute the p-value, that I would like to know which one you recommend, and why?

Examples of python packages providing the calculation of the p-value:
  • One step only: statsmodels.tsa.stattools with coint()
  • Two steps: statsmodels.api with OLS() + statsmodels.tsa.stattools with adfuller()
  • scipy.stats with linregress()
  • Etc.
« Last Edit: August 26, 2022, 07:39:33 pm by JackBeach »