The TRIN strategy document from the "Trading using Options Sentiment Indicators" mentioned that we would pull the data from the Quandl database to calculate TRIN, but the code uses a CSV file.
Can you share the code to pull the data and perform the TRIN calculation?
You can fetch the stock data using the Quandl or Yahoo. You may find this link useful to perform the same. If you wish to pull data of all the stocks listed in S&P 500 as done in the course. You can do using the Wikipedia page relating to the S&P 500.
Code to perform the same in Python:
data = pd.read_html(
'https://en.wikipedia.org/wiki/List_of_S%26P_500_companies', header=0)
pd.DataFrame(data[0])
Once you fetch the required data, you need to calculate the number of advancing stocks, declining stocks, advancing and declining volume to calculate the TRIN. This blog post has covered this in detail.
Thanks Vihbu, good information in the links!