This assignment was given to me by Benjamin Leiblich of Equity Data Science.
Aim of this is to use a
Inputs:
1. Metric determined by 2 ratios, numerator and denominator, so say, they can be Price and Earnings, or Enterprise Value and EBITDA, or pB and 1 for the input.
2. Number of months (period)
3. Minimum value of the metric
So, here we find how many stocks at all dates have ratios> minVal, find returns to all their corresponding dates(there can be multiple entries of stocks because they might have same ratios on different dates), and plot returns on a histogram so that it can help to find base rates of returns of stocks with such characteristics.
Time taken to code : 2 days (I did not code in R till then)
** Benjamin wasn't even grateful for the work and the attempt was a huge dissappointment.