-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmarket.html
More file actions
239 lines (215 loc) · 9.8 KB
/
market.html
File metadata and controls
239 lines (215 loc) · 9.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="US Stock Market overview and news summary from PassiveCash.xyz.">
<title>Market Overview - PassiveCash.xyz</title>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-Q203YEXP0D"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-Q203YEXP0D');
</script>
<link rel="preload" href="style.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="style.css"></noscript>
<!-- Social Media Meta Tags -->
<!-- Open Graph / Facebook -->
<meta property="og:type" content="website">
<meta property="og:url" content="https://www.passivecash.xyz/market.html">
<meta property="og:title" content="Market Overview - PassiveCash.xyz">
<meta property="og:description" content="US Stock Market overview and news summary from PassiveCash.xyz.">
<meta property="og:image" content="https://www.passivecash.xyz/images/logo.jpg">
<meta property="og:site_name" content="PassiveCash.xyz">
<!-- Twitter -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:url" content="https://www.passivecash.xyz/market.html">
<meta name="twitter:title" content="Market Overview - PassiveCash.xyz">
<meta name="twitter:description" content="US Stock Market overview and news summary from PassiveCash.xyz.">
<meta name="twitter:image" content="https://www.passivecash.xyz/images/logo.jpg">
</head>
<body>
<nav class="navbar">
<div class="container">
<a href="index.html" class="logo">PassiveCash.xyz</a>
<!-- Hamburger Button -->
<button id="hamburger-btn" aria-label="Toggle Navigation Menu" aria-expanded="false">
<span class="bar"></span>
<span class="bar"></span>
<span class="bar"></span>
</button>
<!-- Navigation Links -->
<ul id="nav-links">
<li><a href="index.html">Home</a></li>
<li><a href="calculators.html">Calculators</a></li>
<li><a href="crypto.html">Crypto</a></li>
<li><a href="market.html" class="active">Market</a></li> <!-- Add Market link -->
<li><a href="contact.html">Contact</a></li>
<li><a href="disclaimer.html">Disclaimer</a></li>
</ul>
</div>
</nav>
<!-- Advertisement Bar -->
<div id="advertisement"></div>
<div class="content-container">
<h1>Market Overview</h1>
<!-- TradingView Widget BEGIN -->
<div class="tradingview-widget-container">
<div class="tradingview-widget-container__widget" style="height:calc(100% - 32px); width:100%;"></div>
<div class="tradingview-widget-copyright"><a href="https://www.tradingview.com/" rel="noopener nofollow" target="_blank"><span class="blue-text">Track all markets on TradingView</span></a></div>
<script type="text/javascript" src="https://s3.tradingview.com/external-embedding/embed-widget-market-overview.js" async>
{
"colorTheme": "dark",
"dateRange": "12M",
"showChart": true,
"locale": "en",
"largeChartUrl": "",
"isTransparent": false,
"showSymbolLogo": true,
"showFloatingTooltip": false,
"width": "100%",
"height": "660",
"plotLineColorGrowing": "rgba(41, 98, 255, 1)",
"plotLineColorFalling": "rgba(41, 98, 255, 1)",
"gridLineColor": "rgba(42, 46, 57, 0)",
"scaleFontColor": "rgba(134, 137, 147, 1)",
"belowLineFillColorGrowing": "rgba(41, 98, 255, 0.12)",
"belowLineFillColorFalling": "rgba(41, 98, 255, 0.12)",
"belowLineFillColorGrowingBottom": "rgba(41, 98, 255, 0)",
"belowLineFillColorFallingBottom": "rgba(41, 98, 255, 0)",
"symbolActiveColor": "rgba(41, 98, 255, 0.12)",
"tabs": [
{
"title": "Indices",
"symbols": [
{
"s": "FOREXCOM:SPXUSD",
"d": "S&P 500"
},
{
"s": "FOREXCOM:DJI",
"d": "Dow 30"
},
{
"s": "FOREXCOM:NSXUSD",
"d": "Nasdaq 100"
}
],
"originalTitle": "Indices"
},
{
"title": "Commodities",
"symbols": [
{
"s": "TVC:SILVER",
"d": "Silver"
},
{
"s": "TVC:GOLD",
"d": "Gold"
}
],
"originalTitle": "Commodities"
}
]
}
</script>
</div>
<!-- TradingView Widget END -->
<!-- WSB RSS Feed Section -->
<div id="wsb-rss-feed" class="rss-feed-container">
<h4>WallStreetBets Latest News</h4>
<div class="feed-items"><!-- RSS feed content will be loaded here --></div>
</div>
<!-- End WSB RSS Feed Section -->
</div>
<!-- Include jQuery -->
<script src="js/jquery-3.6.0.min.js"></script>
<!-- Hamburger Menu Script is now in js/main.js -->
<!-- Fetch and Display Market Overview -->
<!-- Removed the old script that fetched from the Flask app -->
<!-- RSS Feed Script -->
<script>
// --- Function to fetch and display RSS feed ---
// Copied and adapted from crypto.html
async function fetchAndDisplayRSS(feedUrl, containerId) {
const feedItemsContainer = $(`#${containerId} .feed-items`); // Target the inner div
const cacheKey = `rss_feed_${feedUrl}`;
const cacheDuration = 15 * 60 * 1000; // 15 minutes in milliseconds
// Try loading from cache first
try {
const cachedData = sessionStorage.getItem(cacheKey);
if (cachedData) {
const { timestamp, htmlContent } = JSON.parse(cachedData);
const now = Date.now();
if (now - timestamp < cacheDuration) {
console.log(`Using cached RSS feed for ${feedUrl}`);
feedItemsContainer.html(htmlContent);
return; // Exit function, cache is valid
} else {
console.log(`Cache expired for ${feedUrl}`);
}
}
} catch (e) {
console.error("Error reading RSS cache:", e);
// Proceed to fetch if cache read fails
}
// If cache is invalid or doesn't exist, fetch new data
feedItemsContainer.html('<p class="loading-text">Loading news...</p>'); // Show loading state
// Using api.rss2json.com to convert RSS to JSON
const apiUrl = `https://api.rss2json.com/v1/api.json?rss_url=${encodeURIComponent(feedUrl)}`;
try {
const response = await fetch(apiUrl);
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
if (data.status !== 'ok') {
throw new Error(`rss2json API error: ${data.message || 'Failed to fetch feed'}`);
}
const items = data.items;
let htmlContent = '<ul>';
let count = 0;
if (items && items.length > 0) {
items.forEach(item => {
if (count >= 10) return; // Limit to 10 news items for WSB
const title = item.title || 'No title';
const link = item.link || '#';
// Add rel="nofollow" for external links
htmlContent += `<li><a href="${link}" target="_blank" rel="noopener noreferrer nofollow">${title}</a></li>`;
count++;
});
}
htmlContent += '</ul>';
if (count === 0) {
htmlContent = '<p>News feed is empty or could not be loaded.</p>'; // Store empty message too
}
// Display the fetched content
feedItemsContainer.html(htmlContent);
// Store the fetched content and timestamp in cache
try {
const cachePayload = JSON.stringify({ timestamp: Date.now(), htmlContent });
sessionStorage.setItem(cacheKey, cachePayload);
console.log(`Cached RSS feed for ${feedUrl}`);
} catch (e) {
console.error("Error writing RSS cache:", e);
}
} catch (error) {
console.error(`Error fetching/parsing RSS feed via rss2json for ${feedUrl}:`, error);
feedItemsContainer.html(`<p class="error-message">Error loading news feed: ${error.message || 'Unknown error'}</p>`);
}
}
// Fetch WSB feed on document ready
$(document).ready(function() {
const wsbFeedUrl = 'https://www.reddit.com/r/wallstreetbets/new/.rss';
const wsbContainerId = 'wsb-rss-feed';
fetchAndDisplayRSS(wsbFeedUrl, wsbContainerId);
});
</script>
<!-- Advertisement Script -->
<script src="js/advertisement.js"></script>
<script src="js/main.js"></script> <!-- Include consolidated main script -->
</body>
</html>