Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -63,7 +63,7 @@ def fetch_btc_news() -> List[Dict[str, str]]:
|
|
| 63 |
|
| 64 |
### 🔹 2. Analyze News Sentiment ###
|
| 65 |
@tool
|
| 66 |
-
def analyze_btc_news(articles):
|
| 67 |
"""
|
| 68 |
Analyzes sentiment of Bitcoin news articles using TextBlob.
|
| 69 |
"""
|
|
@@ -71,12 +71,16 @@ def analyze_btc_news(articles):
|
|
| 71 |
avg_sentiment = np.mean(sentiments) if sentiments else 0
|
| 72 |
sentiment_label = "Positive 😊" if avg_sentiment > 0 else "Negative 😡" if avg_sentiment < 0 else "Neutral 😐"
|
| 73 |
keywords = list(set([word for article in articles for word in article["title"].split()[:5]]))
|
| 74 |
-
|
| 75 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
|
| 77 |
### 🔹 3. Get BTC Market Insights ###
|
| 78 |
@tool
|
| 79 |
-
def btc_market_insights():
|
| 80 |
"""
|
| 81 |
Fetch BTC price, historical trends, moving averages, and Fear & Greed Index.
|
| 82 |
"""
|
|
@@ -121,7 +125,7 @@ def btc_market_insights():
|
|
| 121 |
|
| 122 |
### 🔹 4. Make Buy/Sell/HODL Decision ###
|
| 123 |
@tool
|
| 124 |
-
def btc_decision(news_analysis, market_insights):
|
| 125 |
"""
|
| 126 |
Aggregates news sentiment & market insights to suggest Buy, Sell, or HODL.
|
| 127 |
"""
|
|
|
|
| 63 |
|
| 64 |
### 🔹 2. Analyze News Sentiment ###
|
| 65 |
@tool
|
| 66 |
+
def analyze_btc_news(articles: List[Dict[str, str]]) -> Dict[str, any]:
|
| 67 |
"""
|
| 68 |
Analyzes sentiment of Bitcoin news articles using TextBlob.
|
| 69 |
"""
|
|
|
|
| 71 |
avg_sentiment = np.mean(sentiments) if sentiments else 0
|
| 72 |
sentiment_label = "Positive 😊" if avg_sentiment > 0 else "Negative 😡" if avg_sentiment < 0 else "Neutral 😐"
|
| 73 |
keywords = list(set([word for article in articles for word in article["title"].split()[:5]]))
|
| 74 |
+
|
| 75 |
+
return {
|
| 76 |
+
"sentiment_score": avg_sentiment,
|
| 77 |
+
"sentiment_label": sentiment_label,
|
| 78 |
+
"keywords": keywords
|
| 79 |
+
}
|
| 80 |
|
| 81 |
### 🔹 3. Get BTC Market Insights ###
|
| 82 |
@tool
|
| 83 |
+
def btc_market_insights() -> Dict[str, any]:
|
| 84 |
"""
|
| 85 |
Fetch BTC price, historical trends, moving averages, and Fear & Greed Index.
|
| 86 |
"""
|
|
|
|
| 125 |
|
| 126 |
### 🔹 4. Make Buy/Sell/HODL Decision ###
|
| 127 |
@tool
|
| 128 |
+
def btc_decision(news_analysis: Dict[str, any], market_insights: Dict[str, any]) -> Dict[str, str]:
|
| 129 |
"""
|
| 130 |
Aggregates news sentiment & market insights to suggest Buy, Sell, or HODL.
|
| 131 |
"""
|