muskangoyal06 commited on
Commit
7a274a9
·
verified ·
1 Parent(s): a77c7a2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -4,7 +4,6 @@ import requests
4
  from googleapiclient.discovery import build
5
  from transformers import pipeline
6
  import numpy as np
7
- import daal4py as d4p
8
 
9
  # YouTube API setup
10
  def youtube_api_setup():
@@ -32,9 +31,9 @@ def fetch_youtube_sentiment(symbol, youtube, sentiment_model):
32
 
33
  # Moving Average (technical analysis)
34
  def calculate_moving_average(stock_data, window_size):
35
- moving_avg_algo = d4p.moving_average(window_size)
36
- result = moving_avg_algo.compute(stock_data['Close'].to_numpy())
37
- return result
38
 
39
  # Fetch stock data using Yahoo Finance
40
  def fetch_stock_data(symbol):
@@ -92,3 +91,4 @@ if __name__ == "__main__":
92
  main()
93
 
94
 
 
 
4
  from googleapiclient.discovery import build
5
  from transformers import pipeline
6
  import numpy as np
 
7
 
8
  # YouTube API setup
9
  def youtube_api_setup():
 
31
 
32
  # Moving Average (technical analysis)
33
  def calculate_moving_average(stock_data, window_size):
34
+ prices = stock_data['Close'].to_numpy()
35
+ moving_avg = np.convolve(prices, np.ones(window_size)/window_size, mode='valid')
36
+ return moving_avg
37
 
38
  # Fetch stock data using Yahoo Finance
39
  def fetch_stock_data(symbol):
 
91
  main()
92
 
93
 
94
+