There is a Beta function in the TA-LIB. You can use the portfolio value, that is the weighted sum of all current option values, for the first data series and the S&P500 for the second data series.