MCPcopy Index your code
hub / github.com/robertmartin8/MachineLearningStocks / status_calc

Function status_calc

utils.py:62–71  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

60
61
62def 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

Callers 2

build_data_setFunction · 0.90
backtestFunction · 0.90

Calls

no outgoing calls

Tested by 1

backtestFunction · 0.72