Devendra21 commited on
Commit
3b92bf9
·
verified ·
1 Parent(s): e4cbddb

Create sentiment_analysis.py

Browse files
Files changed (1) hide show
  1. utils/sentiment_analysis.py +8 -0
utils/sentiment_analysis.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+
3
+ def fetch_sentiment(currency_pair, api_key):
4
+ # Fetch news and perform sentiment analysis
5
+ response = requests.get(f"https://newsapi.org/v2/everything?q={currency_pair}&apiKey={api_key}")
6
+ data = response.json()
7
+ # Perform sentiment logic (e.g., positive/negative/neutral)
8
+ return "Positive"