Add 3 files
Browse files- README.md +7 -5
- index.html +359 -19
- prompts.txt +1 -0
README.md
CHANGED
@@ -1,10 +1,12 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: static
|
7 |
pinned: false
|
|
|
|
|
8 |
---
|
9 |
|
10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
---
|
2 |
+
title: panda-py-screener
|
3 |
+
emoji: 🐳
|
4 |
+
colorFrom: pink
|
5 |
+
colorTo: gray
|
6 |
sdk: static
|
7 |
pinned: false
|
8 |
+
tags:
|
9 |
+
- deepsite
|
10 |
---
|
11 |
|
12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
@@ -1,19 +1,359 @@
|
|
1 |
-
<!
|
2 |
-
<html>
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>Wall Street Watchdog AI</title>
|
7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
8 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
9 |
+
<style>
|
10 |
+
@keyframes pulse {
|
11 |
+
0%, 100% { opacity: 1; }
|
12 |
+
50% { opacity: 0.5; }
|
13 |
+
}
|
14 |
+
.animate-pulse { animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
|
15 |
+
.card-hover:hover {
|
16 |
+
transform: translateY(-5px);
|
17 |
+
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
|
18 |
+
}
|
19 |
+
.ticker-badge {
|
20 |
+
position: absolute;
|
21 |
+
top: -10px;
|
22 |
+
right: -10px;
|
23 |
+
width: 40px;
|
24 |
+
height: 40px;
|
25 |
+
border-radius: 50%;
|
26 |
+
display: flex;
|
27 |
+
align-items: center;
|
28 |
+
justify-content: center;
|
29 |
+
font-weight: bold;
|
30 |
+
font-size: 0.9rem;
|
31 |
+
}
|
32 |
+
.action-buy { background-color: rgba(74, 222, 128, 0.9); }
|
33 |
+
.action-sell { background-color: rgba(248, 113, 113, 0.9); }
|
34 |
+
.action-hold { background-color: rgba(251, 191, 36, 0.9); }
|
35 |
+
.action-news { background-color: rgba(96, 165, 250, 0.9); }
|
36 |
+
.action-upgrade { background-color: rgba(167, 243, 208, 0.9); color: #065f46; }
|
37 |
+
.action-downgrade { background-color: rgba(254, 202, 202, 0.9); color: #991b1b; }
|
38 |
+
.skeleton-loader {
|
39 |
+
background: linear-gradient(90deg, #1a1a1a 25%, #2d2d2d 50%, #1a1a1a 75%);
|
40 |
+
background-size: 200% 100%;
|
41 |
+
animation: shimmer 1.5s infinite linear;
|
42 |
+
}
|
43 |
+
@keyframes shimmer {
|
44 |
+
0% { background-position: 200% 0; }
|
45 |
+
100% { background-position: -200% 0; }
|
46 |
+
}
|
47 |
+
</style>
|
48 |
+
</head>
|
49 |
+
<body class="bg-black text-white min-h-screen">
|
50 |
+
<div class="container mx-auto px-4 py-8">
|
51 |
+
<!-- Header -->
|
52 |
+
<header class="mb-8">
|
53 |
+
<div class="flex justify-between items-center">
|
54 |
+
<div>
|
55 |
+
<h1 class="text-3xl md:text-4xl font-bold bg-gradient-to-r from-green-400 to-blue-500 bg-clip-text text-transparent">
|
56 |
+
Wall Street Watchdog AI
|
57 |
+
</h1>
|
58 |
+
<p class="text-gray-400 mt-2">Real-time market intelligence powered by AI</p>
|
59 |
+
</div>
|
60 |
+
<div class="flex items-center space-x-4">
|
61 |
+
<div class="hidden md:block">
|
62 |
+
<div class="text-sm text-gray-400">Last updated</div>
|
63 |
+
<div id="lastUpdated" class="text-sm font-mono">Just now</div>
|
64 |
+
</div>
|
65 |
+
<button id="refreshBtn" class="bg-gray-800 hover:bg-gray-700 text-white px-4 py-2 rounded-lg flex items-center space-x-2 transition-all">
|
66 |
+
<i class="fas fa-sync-alt" id="refreshIcon"></i>
|
67 |
+
<span class="hidden md:inline">Refresh</span>
|
68 |
+
</button>
|
69 |
+
</div>
|
70 |
+
</div>
|
71 |
+
|
72 |
+
<div class="mt-6 flex flex-wrap items-center justify-between gap-4">
|
73 |
+
<div class="flex items-center space-x-4">
|
74 |
+
<div class="bg-gray-800 px-3 py-1 rounded-full text-sm flex items-center">
|
75 |
+
<span class="w-2 h-2 rounded-full bg-green-500 mr-2 animate-pulse"></span>
|
76 |
+
<span id="alertCount">0</span> active alerts
|
77 |
+
</div>
|
78 |
+
<div class="hidden md:block text-sm text-gray-400">
|
79 |
+
Auto-refresh in <span id="countdown">300</span>s
|
80 |
+
</div>
|
81 |
+
</div>
|
82 |
+
|
83 |
+
<div class="flex space-x-2">
|
84 |
+
<button class="filter-btn active bg-gray-800 px-3 py-1 rounded-full text-sm" data-filter="all">All</button>
|
85 |
+
<button class="filter-btn bg-gray-800 px-3 py-1 rounded-full text-sm" data-filter="buy">Buy</button>
|
86 |
+
<button class="filter-btn bg-gray-800 px-3 py-1 rounded-full text-sm" data-filter="sell">Sell</button>
|
87 |
+
<button class="filter-btn bg-gray-800 px-3 py-1 rounded-full text-sm" data-filter="news">News</button>
|
88 |
+
</div>
|
89 |
+
</div>
|
90 |
+
</header>
|
91 |
+
|
92 |
+
<!-- Main Content -->
|
93 |
+
<main>
|
94 |
+
<!-- Loading State -->
|
95 |
+
<div id="loadingState" class="grid md:grid-cols-2 lg:grid-cols-3 gap-6">
|
96 |
+
<div class="bg-gray-900 rounded-xl p-4 h-64 skeleton-loader"></div>
|
97 |
+
<div class="bg-gray-900 rounded-xl p-4 h-64 skeleton-loader"></div>
|
98 |
+
<div class="bg-gray-900 rounded-xl p-4 h-64 skeleton-loader hidden md:block"></div>
|
99 |
+
</div>
|
100 |
+
|
101 |
+
<!-- Alerts Grid -->
|
102 |
+
<div id="alertsGrid" class="grid md:grid-cols-2 lg:grid-cols-3 gap-6 hidden">
|
103 |
+
<!-- Alerts will be inserted here by JavaScript -->
|
104 |
+
</div>
|
105 |
+
|
106 |
+
<!-- Empty State -->
|
107 |
+
<div id="emptyState" class="text-center py-16 hidden">
|
108 |
+
<i class="fas fa-bell-slash text-4xl text-gray-600 mb-4"></i>
|
109 |
+
<h3 class="text-xl font-medium text-gray-300">No alerts found</h3>
|
110 |
+
<p class="text-gray-500 mt-2">Try refreshing or check back later for updates</p>
|
111 |
+
</div>
|
112 |
+
</main>
|
113 |
+
|
114 |
+
<!-- Footer -->
|
115 |
+
<footer class="mt-12 pt-6 border-t border-gray-800 text-center text-gray-500 text-sm">
|
116 |
+
<p>Wall Street Watchdog AI © 2023 - Real-time market monitoring</p>
|
117 |
+
<p class="mt-1">Data sources: Yahoo Finance, MarketBeat, CoinDesk</p>
|
118 |
+
</footer>
|
119 |
+
</div>
|
120 |
+
|
121 |
+
<script>
|
122 |
+
// Mock data - in a real app this would come from an API
|
123 |
+
const mockAlerts = [
|
124 |
+
{
|
125 |
+
ticker: "AAPL",
|
126 |
+
action: "Upgrade",
|
127 |
+
summary: "Apple received an upgrade to Buy from Neutral at UBS with a price target of $210, citing strong iPhone 15 demand.",
|
128 |
+
source: "MarketBeat",
|
129 |
+
date: new Date().toISOString()
|
130 |
+
},
|
131 |
+
{
|
132 |
+
ticker: "TSLA",
|
133 |
+
action: "Downgrade",
|
134 |
+
summary: "Tesla downgraded to Hold from Buy at Morgan Stanley due to valuation concerns after recent rally.",
|
135 |
+
source: "MarketBeat",
|
136 |
+
date: new Date().toISOString()
|
137 |
+
},
|
138 |
+
{
|
139 |
+
ticker: "NVDA",
|
140 |
+
action: "Buy",
|
141 |
+
summary: "Nvidia maintains Buy rating at Goldman Sachs with $650 target, as AI chip demand continues to exceed supply.",
|
142 |
+
source: "MarketBeat",
|
143 |
+
date: new Date().toISOString()
|
144 |
+
},
|
145 |
+
{
|
146 |
+
ticker: "CRYPTO",
|
147 |
+
action: "News",
|
148 |
+
summary: "Bitcoin surges past $45,000 as spot ETF approvals appear imminent, according to industry analysts.",
|
149 |
+
source: "CoinDesk",
|
150 |
+
date: new Date().toISOString()
|
151 |
+
},
|
152 |
+
{
|
153 |
+
ticker: "AMZN",
|
154 |
+
action: "News",
|
155 |
+
summary: "Amazon Web Services announces new AI tools and partnerships at re:Invent conference, boosting cloud growth prospects.",
|
156 |
+
source: "Yahoo Finance",
|
157 |
+
date: new Date().toISOString()
|
158 |
+
},
|
159 |
+
{
|
160 |
+
ticker: "META",
|
161 |
+
action: "Hold",
|
162 |
+
summary: "Meta Platforms rating maintained at Equal Weight by Barclays, awaiting clearer signs of Reality Labs profitability.",
|
163 |
+
source: "MarketBeat",
|
164 |
+
date: new Date().toISOString()
|
165 |
+
}
|
166 |
+
];
|
167 |
+
|
168 |
+
// DOM Elements
|
169 |
+
const alertsGrid = document.getElementById('alertsGrid');
|
170 |
+
const loadingState = document.getElementById('loadingState');
|
171 |
+
const emptyState = document.getElementById('emptyState');
|
172 |
+
const refreshBtn = document.getElementById('refreshBtn');
|
173 |
+
const refreshIcon = document.getElementById('refreshIcon');
|
174 |
+
const countdownEl = document.getElementById('countdown');
|
175 |
+
const lastUpdatedEl = document.getElementById('lastUpdated');
|
176 |
+
const alertCountEl = document.getElementById('alertCount');
|
177 |
+
const filterButtons = document.querySelectorAll('.filter-btn');
|
178 |
+
|
179 |
+
// State
|
180 |
+
let countdown = 300;
|
181 |
+
let currentFilter = 'all';
|
182 |
+
let alerts = [];
|
183 |
+
|
184 |
+
// Initialize
|
185 |
+
document.addEventListener('DOMContentLoaded', () => {
|
186 |
+
fetchAlerts();
|
187 |
+
startCountdown();
|
188 |
+
|
189 |
+
// Set up filter buttons
|
190 |
+
filterButtons.forEach(btn => {
|
191 |
+
btn.addEventListener('click', () => {
|
192 |
+
filterButtons.forEach(b => b.classList.remove('active'));
|
193 |
+
btn.classList.add('active');
|
194 |
+
currentFilter = btn.dataset.filter;
|
195 |
+
renderAlerts();
|
196 |
+
});
|
197 |
+
});
|
198 |
+
});
|
199 |
+
|
200 |
+
// Fetch alerts (simulated)
|
201 |
+
function fetchAlerts() {
|
202 |
+
loadingState.classList.remove('hidden');
|
203 |
+
alertsGrid.classList.add('hidden');
|
204 |
+
emptyState.classList.add('hidden');
|
205 |
+
|
206 |
+
// Simulate API call delay
|
207 |
+
setTimeout(() => {
|
208 |
+
alerts = mockAlerts;
|
209 |
+
renderAlerts();
|
210 |
+
updateLastUpdated();
|
211 |
+
resetCountdown();
|
212 |
+
|
213 |
+
loadingState.classList.add('hidden');
|
214 |
+
alertsGrid.classList.remove('hidden');
|
215 |
+
|
216 |
+
if (alerts.length === 0) {
|
217 |
+
emptyState.classList.remove('hidden');
|
218 |
+
}
|
219 |
+
}, 1000);
|
220 |
+
|
221 |
+
// Add loading animation to refresh button
|
222 |
+
refreshIcon.classList.add('fa-spin');
|
223 |
+
setTimeout(() => {
|
224 |
+
refreshIcon.classList.remove('fa-spin');
|
225 |
+
}, 1000);
|
226 |
+
}
|
227 |
+
|
228 |
+
// Render alerts based on current filter
|
229 |
+
function renderAlerts() {
|
230 |
+
alertsGrid.innerHTML = '';
|
231 |
+
|
232 |
+
const filteredAlerts = currentFilter === 'all'
|
233 |
+
? alerts
|
234 |
+
: alerts.filter(alert => {
|
235 |
+
const action = alert.action.toLowerCase();
|
236 |
+
if (currentFilter === 'buy') return action.includes('buy') || action.includes('upgrade');
|
237 |
+
if (currentFilter === 'sell') return action.includes('sell') || action.includes('downgrade');
|
238 |
+
if (currentFilter === 'news') return action.includes('news');
|
239 |
+
return true;
|
240 |
+
});
|
241 |
+
|
242 |
+
alertCountEl.textContent = filteredAlerts.length;
|
243 |
+
|
244 |
+
if (filteredAlerts.length === 0) {
|
245 |
+
emptyState.classList.remove('hidden');
|
246 |
+
return;
|
247 |
+
}
|
248 |
+
|
249 |
+
filteredAlerts.forEach(alert => {
|
250 |
+
const alertCard = createAlertCard(alert);
|
251 |
+
alertsGrid.appendChild(alertCard);
|
252 |
+
});
|
253 |
+
}
|
254 |
+
|
255 |
+
// Create an alert card element
|
256 |
+
function createAlertCard(alert) {
|
257 |
+
const card = document.createElement('div');
|
258 |
+
card.className = 'bg-gray-900 border border-gray-800 rounded-xl overflow-hidden transition-all duration-300 card-hover relative';
|
259 |
+
|
260 |
+
// Determine action class
|
261 |
+
const action = alert.action.toLowerCase();
|
262 |
+
let actionClass = 'action-news';
|
263 |
+
if (action.includes('buy') || action.includes('upgrade')) actionClass = 'action-buy';
|
264 |
+
if (action.includes('sell') || action.includes('downgrade')) actionClass = 'action-sell';
|
265 |
+
if (action.includes('hold')) actionClass = 'action-hold';
|
266 |
+
|
267 |
+
// Format date
|
268 |
+
const date = new Date(alert.date);
|
269 |
+
const timeString = date.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
|
270 |
+
const dateString = date.toLocaleDateString([], { month: 'short', day: 'numeric' });
|
271 |
+
|
272 |
+
card.innerHTML = `
|
273 |
+
<div class="p-5">
|
274 |
+
<div class="flex justify-between items-start mb-3">
|
275 |
+
<div>
|
276 |
+
<h3 class="text-xl font-bold">${alert.ticker}</h3>
|
277 |
+
<p class="text-sm text-gray-400">${alert.source} • ${timeString}</p>
|
278 |
+
</div>
|
279 |
+
<div class="flex items-center space-x-2">
|
280 |
+
<span class="px-2 py-1 rounded text-xs font-medium ${getActionColorClass(alert.action)}">
|
281 |
+
${alert.action}
|
282 |
+
</span>
|
283 |
+
</div>
|
284 |
+
</div>
|
285 |
+
|
286 |
+
<p class="text-gray-300 mb-4">${alert.summary}</p>
|
287 |
+
|
288 |
+
<div class="bg-gray-800 rounded-lg p-3">
|
289 |
+
<div class="flex justify-between items-center text-sm mb-2">
|
290 |
+
<span class="text-gray-400">${dateString}</span>
|
291 |
+
<a href="#" class="text-blue-400 hover:text-blue-300">View details <i class="fas fa-chevron-right ml-1 text-xs"></i></a>
|
292 |
+
</div>
|
293 |
+
<div class="flex justify-between items-center">
|
294 |
+
<div>
|
295 |
+
<span class="text-2xl font-bold">$${getRandomPrice(100, 500).toFixed(2)}</span>
|
296 |
+
<span class="ml-2 text-sm ${Math.random() > 0.5 ? 'text-green-400' : 'text-red-400'}">
|
297 |
+
${(Math.random() * 5).toFixed(2)}%
|
298 |
+
<i class="fas ${Math.random() > 0.5 ? 'fa-caret-up' : 'fa-caret-down'} ml-1"></i>
|
299 |
+
</span>
|
300 |
+
</div>
|
301 |
+
<div class="text-right">
|
302 |
+
<div class="text-xs text-gray-400">Volume</div>
|
303 |
+
<div class="text-sm">${(Math.random() * 10).toFixed(1)}M</div>
|
304 |
+
</div>
|
305 |
+
</div>
|
306 |
+
</div>
|
307 |
+
</div>
|
308 |
+
|
309 |
+
<div class="ticker-badge ${actionClass}">
|
310 |
+
${alert.ticker === 'CRYPTO' ? '₿' : alert.ticker}
|
311 |
+
</div>
|
312 |
+
`;
|
313 |
+
|
314 |
+
return card;
|
315 |
+
}
|
316 |
+
|
317 |
+
// Helper function to get action color class
|
318 |
+
function getActionColorClass(action) {
|
319 |
+
action = action.toLowerCase();
|
320 |
+
if (action.includes('buy') || action.includes('upgrade')) return 'bg-green-900 text-green-300';
|
321 |
+
if (action.includes('sell') || action.includes('downgrade')) return 'bg-red-900 text-red-300';
|
322 |
+
if (action.includes('hold')) return 'bg-yellow-900 text-yellow-300';
|
323 |
+
return 'bg-blue-900 text-blue-300';
|
324 |
+
}
|
325 |
+
|
326 |
+
// Helper function to generate random price
|
327 |
+
function getRandomPrice(min, max) {
|
328 |
+
return Math.random() * (max - min) + min;
|
329 |
+
}
|
330 |
+
|
331 |
+
// Countdown timer
|
332 |
+
function startCountdown() {
|
333 |
+
setInterval(() => {
|
334 |
+
countdown--;
|
335 |
+
countdownEl.textContent = countdown;
|
336 |
+
|
337 |
+
if (countdown <= 0) {
|
338 |
+
fetchAlerts();
|
339 |
+
countdown = 300;
|
340 |
+
}
|
341 |
+
}, 1000);
|
342 |
+
}
|
343 |
+
|
344 |
+
function resetCountdown() {
|
345 |
+
countdown = 300;
|
346 |
+
countdownEl.textContent = countdown;
|
347 |
+
}
|
348 |
+
|
349 |
+
// Update last updated time
|
350 |
+
function updateLastUpdated() {
|
351 |
+
const now = new Date();
|
352 |
+
lastUpdatedEl.textContent = now.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
|
353 |
+
}
|
354 |
+
|
355 |
+
// Event listeners
|
356 |
+
refreshBtn.addEventListener('click', fetchAlerts);
|
357 |
+
</script>
|
358 |
+
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=70pher703/panda-py-screener" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
359 |
+
</html>
|
prompts.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
// Wall Street Watchdog AI - Full App (Frontend + Backend) // --- Frontend (React) --- import React, { useEffect, useState } from 'react'; import { Card, CardContent } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { ReloadIcon } from "lucide-react"; import axios from 'axios'; const API_ENDPOINT = "/api/alerts"; export default function WatchdogApp() { const [alerts, setAlerts] = useState([]); const [loading, setLoading] = useState(false); const [countdown, setCountdown] = useState(300); const fetchAlerts = async () => { setLoading(true); try { const res = await axios.get(API_ENDPOINT); setAlerts(res.data.alerts); } catch (err) { console.error("Error fetching alerts:", err); } setLoading(false); }; useEffect(() => { fetchAlerts(); const interval = setInterval(fetchAlerts, 300000); const countdownInterval = setInterval(() => setCountdown((c) => (c > 0 ? c - 1 : 300)), 1000); return () => { clearInterval(interval); clearInterval(countdownInterval); }; }, []); return ( <div className="p-6 bg-black text-white min-h-screen"> <h1 className="text-3xl font-bold mb-4">Wall Street Watchdog AI</h1> <div className="flex justify-between items-center mb-2"> <p className="text-sm">Auto-refresh in {countdown}s</p> <Button onClick={fetchAlerts} disabled={loading}> {loading ? <ReloadIcon className="animate-spin" /> : "Refresh Now"} </Button> </div> <div className="grid md:grid-cols-2 lg:grid-cols-3 gap-4"> {alerts.map((alert, idx) => ( <Card key={idx} className="bg-gray-900 border border-gray-700 rounded-2xl shadow-xl"> <CardContent className="p-4"> <p className="text-xl font-semibold">{alert.ticker} — {alert.action}</p> <p className="text-sm text-gray-400">{alert.source}</p> <p className="text-base mt-2">{alert.summary}</p> <div className="mt-4"> <iframe src={`https://s.tradingview.com/embed-widget/mini-symbol-overview/?symbol=${alert.ticker}&locale=en`} width="100%" height="100" frameBorder="0" allowTransparency scrolling="no" /> </div> </CardContent> </Card> ))} </div> </div> ); } // --- Backend API (FastAPI) --- from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from pydantic import BaseModel from typing import List import requests from bs4 import BeautifulSoup from datetime import datetime import openai import os app = FastAPI() app.add_middleware( CORSMiddleware, allow_origins=[""], allow_credentials=True, allow_methods=[""], allow_headers=["*"], ) class Alert(BaseModel): ticker: str action: str summary: str source: str date: str class AlertResponse(BaseModel): alerts: List[Alert] openai.api_key = os.getenv("OPENAI_API_KEY") def summarize_text(text): try: response = openai.ChatCompletion.create( model="gpt-3.5-turbo", messages=[ {"role": "system", "content": "Summarize the following financial update in 1-2 sentences."}, {"role": "user", "content": text} ] ) return response['choices'][0]['message']['content'] except: return text[:200] def get_yahoo_news(): url = "https://finance.yahoo.com/" r = requests.get(url) soup = BeautifulSoup(r.text, "html.parser") articles = soup.select("li.js-stream-content")[:5] alerts = [] for a in articles: headline = a.get_text() link = a.find("a")['href'] if a.find("a") else "" summary = summarize_text(headline) alerts.append(Alert( ticker="MKT", action="News", summary=summary, source="Yahoo Finance", date=str(datetime.utcnow()) )) return alerts def get_marketbeat_ratings(): url = "https://www.marketbeat.com/ratings/" r = requests.get(url) soup = BeautifulSoup(r.text, "html.parser") rows = soup.select("table.ratings-table tbody tr")[:5] alerts = [] for row in rows: cols = row.find_all("td") if len(cols) >= 5: ticker = cols[0].get_text(strip=True) action = cols[2].get_text(strip=True) summary = summarize_text(f"{ticker} received a {action} rating from {cols[1].get_text(strip=True)}") alerts.append(Alert( ticker=ticker, action=action, summary=summary, source="MarketBeat", date=str(datetime.utcnow()) )) return alerts def get_coindesk(): url = "https://www.coindesk.com/" r = requests.get(url) soup = BeautifulSoup(r.text, "html.parser") articles = soup.select("a.card-title")[:5] alerts = [] for a in articles: headline = a.get_text(strip=True) summary = summarize_text(headline) alerts.append(Alert( ticker="CRYPTO", action="News", summary=summary, source="CoinDesk", date=str(datetime.utcnow()) )) return alerts @app.get("/api/alerts", response_model=AlertResponse) async def get_all_alerts(): alerts = [] alerts += get_yahoo_news() alerts += get_marketbeat_ratings() alerts += get_coindesk() return {"alerts": alerts}
|