MCPcopy
hub / github.com/tradytics/surpriver / calculate_volatility

Method calculate_volatility

data_loader.py:150–156  ·  view source on GitHub ↗
(self, stock_price_data)

Source from the content-addressed store, hash-verified

148 return historical_prices, future_prices_list, False
149
150 def calculate_volatility(self, stock_price_data):
151 CLOSE_PRICE_INDEX = 4
152 stock_price_data_list = stock_price_data.values.tolist()
153 close_prices = [float(item[CLOSE_PRICE_INDEX]) for item in stock_price_data_list]
154 close_prices = [item for item in close_prices if item != 0]
155 volatility = np.std(close_prices)
156 return volatility
157
158 def collect_data_for_all_tickers(self):
159 """

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected