A simple function to classify whether a stock outperformed the S&P500 :param stock: stock price :param sp500: S&P500 price :param outperformance: stock is classified 1 if stock price > S&P500 price + outperformance :return: true/false
(stock, sp500, outperformance=10)
| 60 | |
| 61 | |
| 62 | def status_calc(stock, sp500, outperformance=10): |
| 63 | """A simple function to classify whether a stock outperformed the S&P500 |
| 64 | :param stock: stock price |
| 65 | :param sp500: S&P500 price |
| 66 | :param outperformance: stock is classified 1 if stock price > S&P500 price + outperformance |
| 67 | :return: true/false |
| 68 | """ |
| 69 | if outperformance < 0: |
| 70 | raise ValueError("outperformance must be positive") |
| 71 | return stock - sp500 >= outperformance |
no outgoing calls