Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -86,14 +86,16 @@ def analyze_btc_news(articles: List[Dict[str, str]]) -> Dict[str, Any]:
|
|
| 86 |
|
| 87 |
Arguments:
|
| 88 |
articles (List[Dict[str, str]]): A list of dictionaries representing Bitcoin news articles.
|
| 89 |
-
|
|
|
|
|
|
|
| 90 |
|
| 91 |
Returns:
|
| 92 |
Dict[str, Any]: A dictionary containing:
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
"""
|
| 98 |
sentiments = [TextBlob(article["title"]).sentiment.polarity for article in articles]
|
| 99 |
avg_sentiment = np.mean(sentiments) if sentiments else 0
|
|
@@ -114,16 +116,16 @@ def btc_market_insights() -> Dict[str, Any]:
|
|
| 114 |
|
| 115 |
Returns:
|
| 116 |
Dict[str, Any]: A dictionary containing:
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
"""
|
| 128 |
# Fetch current BTC price
|
| 129 |
price_url = "https://api.coingecko.com/api/v3/simple/price"
|
|
|
|
| 86 |
|
| 87 |
Arguments:
|
| 88 |
articles (List[Dict[str, str]]): A list of dictionaries representing Bitcoin news articles.
|
| 89 |
+
Each dictionary must include the following keys:
|
| 90 |
+
- 'title': The title of the article.
|
| 91 |
+
- 'url': The URL of the article.
|
| 92 |
|
| 93 |
Returns:
|
| 94 |
Dict[str, Any]: A dictionary containing:
|
| 95 |
+
- 'sentiment_score': The average sentiment polarity of the article titles.
|
| 96 |
+
- 'sentiment_label': A label ("Positive 😊", "Negative 😡", or "Neutral 😐")
|
| 97 |
+
based on the sentiment score.
|
| 98 |
+
- 'keywords': A list of keywords extracted from the article titles.
|
| 99 |
"""
|
| 100 |
sentiments = [TextBlob(article["title"]).sentiment.polarity for article in articles]
|
| 101 |
avg_sentiment = np.mean(sentiments) if sentiments else 0
|
|
|
|
| 116 |
|
| 117 |
Returns:
|
| 118 |
Dict[str, Any]: A dictionary containing:
|
| 119 |
+
- 'price': Current BTC price in USD.
|
| 120 |
+
- '24h_change': 24-hour price change percentage.
|
| 121 |
+
- 'ma_5m': 5-minute moving average.
|
| 122 |
+
- 'ma_1h': 1-hour moving average.
|
| 123 |
+
- 'ma_1d': 1-day moving average.
|
| 124 |
+
- 'ma_7d': 7-day moving average.
|
| 125 |
+
- 'ma_1m': 1-month moving average.
|
| 126 |
+
- 'ma_1y': 1-year moving average.
|
| 127 |
+
- 'fear_greed': Current Fear & Greed index value.
|
| 128 |
+
- 'fgi_text': Classification of the Fear & Greed index.
|
| 129 |
"""
|
| 130 |
# Fetch current BTC price
|
| 131 |
price_url = "https://api.coingecko.com/api/v3/simple/price"
|