Spaces:
Sleeping
Sleeping
UI Redesign: Glassmorphism and Fintech Terminal Aesthetic
Browse files- backend/.env +1 -1
- backend/__pycache__/app.cpython-313.pyc +0 -0
- backend/__pycache__/stock_data.cpython-313.pyc +0 -0
- backend/app.py +45 -25
- backend/stock_data.py +27 -2
- frontend/app.js +33 -16
- frontend/dashboard.css +11 -3
- frontend/dashboard.html +15 -0
- frontend/dashboard.js +25 -16
- frontend/index.html +15 -0
- frontend/style.css +76 -41
backend/.env
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
TWELVE_DATA_API_KEY=a2979cf662ba4f5885b8fe982fdd83e1
|
backend/__pycache__/app.cpython-313.pyc
CHANGED
|
Binary files a/backend/__pycache__/app.cpython-313.pyc and b/backend/__pycache__/app.cpython-313.pyc differ
|
|
|
backend/__pycache__/stock_data.cpython-313.pyc
CHANGED
|
Binary files a/backend/__pycache__/stock_data.cpython-313.pyc and b/backend/__pycache__/stock_data.cpython-313.pyc differ
|
|
|
backend/app.py
CHANGED
|
@@ -73,27 +73,27 @@ def get_market_indices():
|
|
| 73 |
for name, symbol in indices.items():
|
| 74 |
try:
|
| 75 |
stock = yf.Ticker(symbol)
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
price =
|
| 85 |
-
prev = info.get("previousClose", info.get("regularMarketPreviousClose",
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
change = round(price - prev, 2)
|
| 94 |
change_pct = round((change / prev) * 100, 2) if prev else 0
|
| 95 |
results.append({
|
| 96 |
-
"name": name, "symbol": symbol, "price": price,
|
| 97 |
"change": change, "change_pct": change_pct,
|
| 98 |
"direction": "up" if change >= 0 else "down",
|
| 99 |
})
|
|
@@ -372,7 +372,11 @@ def _analyze_one(ticker: str) -> dict | None:
|
|
| 372 |
macd = float(latest["MACD"])
|
| 373 |
macd_signal = float(latest["MACD_Signal"])
|
| 374 |
sma_20 = float(latest["SMA_20"])
|
| 375 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 376 |
|
| 377 |
score = 50
|
| 378 |
if rsi < 30: score += 20
|
|
@@ -391,11 +395,6 @@ def _analyze_one(ticker: str) -> dict | None:
|
|
| 391 |
if vol_avg > 0 and vol > vol_avg * 1.3: score += 10
|
| 392 |
|
| 393 |
# ── Trend / momentum correction ───────────────────────────────────────
|
| 394 |
-
# Prevent "Strong Buy" for stocks in a clear downtrend.
|
| 395 |
-
# Uses 1-day and 5-day price changes to penalize falling stocks.
|
| 396 |
-
prev_close = float(df.iloc[-2]["Close"])
|
| 397 |
-
change_pct = round(((price - prev_close) / prev_close) * 100, 2)
|
| 398 |
-
|
| 399 |
if len(df) >= 6:
|
| 400 |
price_5d_ago = float(df.iloc[-6]["Close"])
|
| 401 |
trend_5d_pct = (price - price_5d_ago) / price_5d_ago * 100
|
|
@@ -721,7 +720,28 @@ def dashboard_data(ticker: str):
|
|
| 721 |
# 2. Profile
|
| 722 |
import yfinance as yf
|
| 723 |
yinfo = yf.Ticker(ticker).info
|
| 724 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 725 |
|
| 726 |
# 3. Sentiment & News
|
| 727 |
sent = analyze_sentiment(ticker)
|
|
|
|
| 73 |
for name, symbol in indices.items():
|
| 74 |
try:
|
| 75 |
stock = yf.Ticker(symbol)
|
| 76 |
+
fast = stock.fast_info
|
| 77 |
+
|
| 78 |
+
# Prefer fast live info points to avoid stale historical daily bars
|
| 79 |
+
price = fast.get("lastPrice", 0)
|
| 80 |
+
prev = fast.get("previousClose", 0)
|
| 81 |
+
|
| 82 |
+
if not price or not prev:
|
| 83 |
+
info = stock.info or {}
|
| 84 |
+
price = price or info.get("currentPrice", info.get("regularMarketPrice", 0))
|
| 85 |
+
prev = prev or info.get("previousClose", info.get("regularMarketPreviousClose", 0))
|
| 86 |
+
|
| 87 |
+
if not price or not prev:
|
| 88 |
+
hist = stock.history(period="5d")
|
| 89 |
+
if len(hist) >= 2:
|
| 90 |
+
price = price or round(float(hist["Close"].iloc[-1]), 2)
|
| 91 |
+
prev = prev or round(float(hist["Close"].iloc[-2]), 2)
|
| 92 |
+
|
| 93 |
change = round(price - prev, 2)
|
| 94 |
change_pct = round((change / prev) * 100, 2) if prev else 0
|
| 95 |
results.append({
|
| 96 |
+
"name": name, "symbol": symbol, "price": round(price, 2),
|
| 97 |
"change": change, "change_pct": change_pct,
|
| 98 |
"direction": "up" if change >= 0 else "down",
|
| 99 |
})
|
|
|
|
| 372 |
macd = float(latest["MACD"])
|
| 373 |
macd_signal = float(latest["MACD_Signal"])
|
| 374 |
sma_20 = float(latest["SMA_20"])
|
| 375 |
+
|
| 376 |
+
# Use live price/prev close from info to avoid "day before yesterday" lag
|
| 377 |
+
price = info.get("current_price") or float(latest["Close"])
|
| 378 |
+
prev_close_price = info.get("prev_close") or (float(df.iloc[-2]["Close"]) if len(df) >= 2 else price)
|
| 379 |
+
change_pct = round(((price - prev_close_price) / prev_close_price) * 100, 2) if prev_close_price else 0.0
|
| 380 |
|
| 381 |
score = 50
|
| 382 |
if rsi < 30: score += 20
|
|
|
|
| 395 |
if vol_avg > 0 and vol > vol_avg * 1.3: score += 10
|
| 396 |
|
| 397 |
# ── Trend / momentum correction ───────────────────────────────────────
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 398 |
if len(df) >= 6:
|
| 399 |
price_5d_ago = float(df.iloc[-6]["Close"])
|
| 400 |
trend_5d_pct = (price - price_5d_ago) / price_5d_ago * 100
|
|
|
|
| 720 |
# 2. Profile
|
| 721 |
import yfinance as yf
|
| 722 |
yinfo = yf.Ticker(ticker).info
|
| 723 |
+
raw_profile = yinfo.get("longBusinessSummary", f"{company['name']} is a publicly traded company on the NSE.")
|
| 724 |
+
import re
|
| 725 |
+
sentences = re.split(r'(?<=[.!?])\s+', raw_profile)
|
| 726 |
+
|
| 727 |
+
intro = sentences[0] if len(sentences) > 0 else raw_profile
|
| 728 |
+
bullets = ""
|
| 729 |
+
if len(sentences) > 1:
|
| 730 |
+
for s in sentences[1:5]:
|
| 731 |
+
if len(s) > 10:
|
| 732 |
+
bullets += f"\n• {s.strip()}"
|
| 733 |
+
|
| 734 |
+
industry = yinfo.get("industry", "N/A")
|
| 735 |
+
sector = yinfo.get("sector", "N/A")
|
| 736 |
+
employees = f"{yinfo.get('fullTimeEmployees', 'N/A'):,}" if yinfo.get('fullTimeEmployees') else "N/A"
|
| 737 |
+
website = yinfo.get("website", "N/A")
|
| 738 |
+
|
| 739 |
+
profile_text = (
|
| 740 |
+
f"**Sector**: {sector} | **Industry**: {industry} | **Employees**: {employees}\n\n"
|
| 741 |
+
f"**Overview**\n{intro}\n\n"
|
| 742 |
+
f"**Key Highlights**{bullets}\n\n"
|
| 743 |
+
f"**Website**: <a href='{website}' target='_blank' style='color:var(--cyan);'>{website}</a>"
|
| 744 |
+
)
|
| 745 |
|
| 746 |
# 3. Sentiment & News
|
| 747 |
sent = analyze_sentiment(ticker)
|
backend/stock_data.py
CHANGED
|
@@ -62,11 +62,36 @@ def get_stock_info(ticker: str) -> dict:
|
|
| 62 |
|
| 63 |
|
| 64 |
def fetch_live_price(ticker: str) -> dict:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
stock = yf.Ticker(ticker)
|
|
|
|
|
|
|
|
|
|
| 66 |
info = stock.info
|
| 67 |
|
| 68 |
-
|
| 69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
|
| 71 |
change = round(current - prev_close, 2) if current and prev_close else 0
|
| 72 |
change_pct = round((change / prev_close) * 100, 2) if prev_close else 0
|
|
|
|
| 62 |
|
| 63 |
|
| 64 |
def fetch_live_price(ticker: str) -> dict:
|
| 65 |
+
import requests
|
| 66 |
+
import os
|
| 67 |
+
from dotenv import load_dotenv
|
| 68 |
+
from datetime import datetime
|
| 69 |
+
|
| 70 |
+
load_dotenv()
|
| 71 |
+
twelve_key = os.getenv("TWELVE_DATA_API_KEY", "a2979cf662ba4f5885b8fe982fdd83e1")
|
| 72 |
+
|
| 73 |
stock = yf.Ticker(ticker)
|
| 74 |
+
|
| 75 |
+
# Prefer fast_info for more robust fallback live data
|
| 76 |
+
fast = stock.fast_info
|
| 77 |
info = stock.info
|
| 78 |
|
| 79 |
+
prev_close = fast.get("previousClose", info.get("previousClose", 0))
|
| 80 |
+
current = None
|
| 81 |
+
|
| 82 |
+
# Use Twelve Data for importing price while keeping API key hidden (Proxy pattern)
|
| 83 |
+
try:
|
| 84 |
+
twelve_ticker = ticker.replace(".NS", "").replace(".BO", "")
|
| 85 |
+
url = f"https://api.twelvedata.com/quote?symbol={twelve_ticker}&country=India&apikey={twelve_key}"
|
| 86 |
+
td_resp = requests.get(url, timeout=3).json()
|
| 87 |
+
if "close" in td_resp and "status" not in td_resp:
|
| 88 |
+
current = float(td_resp["close"])
|
| 89 |
+
except Exception:
|
| 90 |
+
pass
|
| 91 |
+
|
| 92 |
+
# For other uses (all other endpoints and charts) or as fallback, use yfinance
|
| 93 |
+
if not current:
|
| 94 |
+
current = fast.get("lastPrice", info.get("currentPrice", info.get("regularMarketPrice", 0)))
|
| 95 |
|
| 96 |
change = round(current - prev_close, 2) if current and prev_close else 0
|
| 97 |
change_pct = round((change / prev_close) * 100, 2) if prev_close else 0
|
frontend/app.js
CHANGED
|
@@ -457,19 +457,23 @@ function drawMainChart(data) {
|
|
| 457 |
const lows = data.map((d) => d.low);
|
| 458 |
|
| 459 |
const isUp = closes[closes.length - 1] >= closes[0];
|
| 460 |
-
const lineColor = isUp ? "#
|
| 461 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 462 |
|
| 463 |
if (mainChart) mainChart.destroy();
|
| 464 |
|
| 465 |
-
mainChart = new Chart(
|
| 466 |
type: "line",
|
| 467 |
data: {
|
| 468 |
labels,
|
| 469 |
datasets: [
|
| 470 |
-
{ label: "Close", data: closes, borderColor: lineColor, backgroundColor: fillColor, fill: true, tension: 0.3, pointRadius: 0, borderWidth:
|
| 471 |
-
{ label: "High", data: highs, borderColor: "rgba(
|
| 472 |
-
{ label: "Low", data: lows, borderColor: "rgba(239,68,68,0.2)", borderDash: [2, 4], pointRadius: 0, borderWidth: 1, fill: false },
|
| 473 |
],
|
| 474 |
},
|
| 475 |
options: {
|
|
@@ -477,12 +481,12 @@ function drawMainChart(data) {
|
|
| 477 |
maintainAspectRatio: false,
|
| 478 |
interaction: { mode: "index", intersect: false },
|
| 479 |
plugins: {
|
| 480 |
-
legend: { labels: { color: "#
|
| 481 |
-
tooltip: { backgroundColor: "
|
| 482 |
},
|
| 483 |
scales: {
|
| 484 |
-
x: { ticks: { color: "#
|
| 485 |
-
y: { ticks: { color: "#
|
| 486 |
},
|
| 487 |
},
|
| 488 |
});
|
|
@@ -601,24 +605,37 @@ function drawPredictionChart(pred) {
|
|
| 601 |
const histData = [...hist, ...Array(future.length).fill(null)];
|
| 602 |
const predData = [...Array(hist.length - 1).fill(null), hist[hist.length - 1], ...future];
|
| 603 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 604 |
if (predChart) predChart.destroy();
|
| 605 |
|
| 606 |
-
predChart = new Chart(
|
| 607 |
type: "line",
|
| 608 |
data: {
|
| 609 |
labels,
|
| 610 |
datasets: [
|
| 611 |
-
{ label: "Historical", data: histData, borderColor: "#3b82f6", backgroundColor:
|
| 612 |
-
{ label: "Forecast", data: predData, borderColor: "#
|
| 613 |
],
|
| 614 |
},
|
| 615 |
options: {
|
| 616 |
responsive: true,
|
| 617 |
maintainAspectRatio: false,
|
| 618 |
-
plugins: {
|
|
|
|
|
|
|
|
|
|
| 619 |
scales: {
|
| 620 |
-
x: { ticks: { color: "#
|
| 621 |
-
y: { ticks: { color: "#
|
| 622 |
},
|
| 623 |
},
|
| 624 |
});
|
|
|
|
| 457 |
const lows = data.map((d) => d.low);
|
| 458 |
|
| 459 |
const isUp = closes[closes.length - 1] >= closes[0];
|
| 460 |
+
const lineColor = isUp ? "#10b981" : "#ef4444";
|
| 461 |
+
|
| 462 |
+
const ctx = document.getElementById("mainChart").getContext("2d");
|
| 463 |
+
let fillColor = ctx.createLinearGradient(0, 0, 0, 400);
|
| 464 |
+
fillColor.addColorStop(0, isUp ? "rgba(16, 185, 129, 0.2)" : "rgba(239, 68, 68, 0.2)");
|
| 465 |
+
fillColor.addColorStop(1, "rgba(0, 0, 0, 0)");
|
| 466 |
|
| 467 |
if (mainChart) mainChart.destroy();
|
| 468 |
|
| 469 |
+
mainChart = new Chart(ctx, {
|
| 470 |
type: "line",
|
| 471 |
data: {
|
| 472 |
labels,
|
| 473 |
datasets: [
|
| 474 |
+
{ label: "Close", data: closes, borderColor: lineColor, backgroundColor: fillColor, fill: true, tension: 0.3, pointRadius: 0, borderWidth: 1.5 },
|
| 475 |
+
{ label: "High", data: highs, borderColor: "rgba(16, 185, 129, 0.2)", borderDash: [2, 4], pointRadius: 0, borderWidth: 1, fill: false },
|
| 476 |
+
{ label: "Low", data: lows, borderColor: "rgba(239, 68, 68, 0.2)", borderDash: [2, 4], pointRadius: 0, borderWidth: 1, fill: false },
|
| 477 |
],
|
| 478 |
},
|
| 479 |
options: {
|
|
|
|
| 481 |
maintainAspectRatio: false,
|
| 482 |
interaction: { mode: "index", intersect: false },
|
| 483 |
plugins: {
|
| 484 |
+
legend: { labels: { color: "#8b949e", font: { family: "'JetBrains Mono', monospace", size: 11 } } },
|
| 485 |
+
tooltip: { backgroundColor: "rgba(10, 11, 16, 0.85)", borderColor: "rgba(255, 255, 255, 0.08)", borderWidth: 1, titleColor: "#fff", bodyColor: "#d1d5db", titleFont: { family: "'JetBrains Mono', monospace" }, bodyFont: { family: "'JetBrains Mono', monospace" } },
|
| 486 |
},
|
| 487 |
scales: {
|
| 488 |
+
x: { ticks: { color: "#8b949e", maxTicksLimit: 10, maxRotation: 0, font: { family: "'JetBrains Mono', monospace", size: 10 } }, grid: { color: "rgba(255, 255, 255, 0.03)", lineWidth: 1 } },
|
| 489 |
+
y: { ticks: { color: "#8b949e", font: { family: "'JetBrains Mono', monospace", size: 10 } }, grid: { color: "rgba(255, 255, 255, 0.03)", lineWidth: 1 } },
|
| 490 |
},
|
| 491 |
},
|
| 492 |
});
|
|
|
|
| 605 |
const histData = [...hist, ...Array(future.length).fill(null)];
|
| 606 |
const predData = [...Array(hist.length - 1).fill(null), hist[hist.length - 1], ...future];
|
| 607 |
|
| 608 |
+
const ctx = document.getElementById("predChart").getContext("2d");
|
| 609 |
+
|
| 610 |
+
let histGradient = ctx.createLinearGradient(0, 0, 0, 400);
|
| 611 |
+
histGradient.addColorStop(0, "rgba(59, 130, 246, 0.25)");
|
| 612 |
+
histGradient.addColorStop(1, "rgba(0, 0, 0, 0)");
|
| 613 |
+
|
| 614 |
+
let predGradient = ctx.createLinearGradient(0, 0, 0, 400);
|
| 615 |
+
predGradient.addColorStop(0, "rgba(16, 185, 129, 0.25)");
|
| 616 |
+
predGradient.addColorStop(1, "rgba(0, 0, 0, 0)");
|
| 617 |
+
|
| 618 |
if (predChart) predChart.destroy();
|
| 619 |
|
| 620 |
+
predChart = new Chart(ctx, {
|
| 621 |
type: "line",
|
| 622 |
data: {
|
| 623 |
labels,
|
| 624 |
datasets: [
|
| 625 |
+
{ label: "Historical", data: histData, borderColor: "#3b82f6", backgroundColor: histGradient, fill: true, tension: 0.3, pointRadius: 0, borderWidth: 1.5 },
|
| 626 |
+
{ label: "Forecast", data: predData, borderColor: "#10b981", borderDash: [6, 3], backgroundColor: predGradient, fill: true, tension: 0.3, pointRadius: 3, borderWidth: 1.5, pointBackgroundColor: "#10b981" },
|
| 627 |
],
|
| 628 |
},
|
| 629 |
options: {
|
| 630 |
responsive: true,
|
| 631 |
maintainAspectRatio: false,
|
| 632 |
+
plugins: {
|
| 633 |
+
legend: { labels: { color: "#8b949e", font: { family: "'JetBrains Mono', monospace" } } },
|
| 634 |
+
tooltip: { backgroundColor: "rgba(10, 11, 16, 0.85)", borderColor: "rgba(255, 255, 255, 0.08)", borderWidth: 1, titleColor: "#fff", bodyColor: "#d1d5db", titleFont: { family: "'JetBrains Mono', monospace" }, bodyFont: { family: "'JetBrains Mono', monospace" } },
|
| 635 |
+
},
|
| 636 |
scales: {
|
| 637 |
+
x: { ticks: { color: "#8b949e", maxTicksLimit: 10, maxRotation: 45, font: { family: "'JetBrains Mono', monospace", size: 9 } }, grid: { color: "rgba(255, 255, 255, 0.03)", lineWidth: 1 } },
|
| 638 |
+
y: { ticks: { color: "#8b949e", font: { family: "'JetBrains Mono', monospace", size: 10 } }, grid: { color: "rgba(255, 255, 255, 0.03)", lineWidth: 1 } },
|
| 639 |
},
|
| 640 |
},
|
| 641 |
});
|
frontend/dashboard.css
CHANGED
|
@@ -67,10 +67,14 @@
|
|
| 67 |
display: flex;
|
| 68 |
justify-content: space-between;
|
| 69 |
align-items: center;
|
| 70 |
-
background: var(--
|
|
|
|
|
|
|
| 71 |
padding: 1.2rem 2.5rem;
|
| 72 |
border-radius: 12px;
|
| 73 |
border: 1px solid var(--border);
|
|
|
|
|
|
|
| 74 |
box-shadow: 0 8px 32px rgba(0,0,0,0.3);
|
| 75 |
}
|
| 76 |
|
|
@@ -174,8 +178,12 @@
|
|
| 174 |
|
| 175 |
/* Zone Structure */
|
| 176 |
.bento-card {
|
| 177 |
-
background: var(--
|
|
|
|
|
|
|
| 178 |
border: 1px solid var(--border);
|
|
|
|
|
|
|
| 179 |
border-radius: 12px;
|
| 180 |
padding: 1.5rem;
|
| 181 |
overflow: hidden;
|
|
@@ -259,7 +267,7 @@
|
|
| 259 |
}
|
| 260 |
|
| 261 |
.param-card {
|
| 262 |
-
background:
|
| 263 |
border-radius: 8px;
|
| 264 |
padding: 1rem;
|
| 265 |
display: flex;
|
|
|
|
| 67 |
display: flex;
|
| 68 |
justify-content: space-between;
|
| 69 |
align-items: center;
|
| 70 |
+
background: var(--glass-bg);
|
| 71 |
+
backdrop-filter: var(--glass-blur);
|
| 72 |
+
-webkit-backdrop-filter: var(--glass-blur);
|
| 73 |
padding: 1.2rem 2.5rem;
|
| 74 |
border-radius: 12px;
|
| 75 |
border: 1px solid var(--border);
|
| 76 |
+
border-top-color: var(--border-light);
|
| 77 |
+
border-left-color: var(--border-light);
|
| 78 |
box-shadow: 0 8px 32px rgba(0,0,0,0.3);
|
| 79 |
}
|
| 80 |
|
|
|
|
| 178 |
|
| 179 |
/* Zone Structure */
|
| 180 |
.bento-card {
|
| 181 |
+
background: var(--glass-bg);
|
| 182 |
+
backdrop-filter: var(--glass-blur);
|
| 183 |
+
-webkit-backdrop-filter: var(--glass-blur);
|
| 184 |
border: 1px solid var(--border);
|
| 185 |
+
border-top-color: var(--border-light);
|
| 186 |
+
border-left-color: var(--border-light);
|
| 187 |
border-radius: 12px;
|
| 188 |
padding: 1.5rem;
|
| 189 |
overflow: hidden;
|
|
|
|
| 267 |
}
|
| 268 |
|
| 269 |
.param-card {
|
| 270 |
+
background: rgba(255, 255, 255, 0.01);
|
| 271 |
border-radius: 8px;
|
| 272 |
padding: 1rem;
|
| 273 |
display: flex;
|
frontend/dashboard.html
CHANGED
|
@@ -11,8 +11,23 @@
|
|
| 11 |
<!-- Chart.js replacing React's Recharts given vanilla JS constraints -->
|
| 12 |
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
| 13 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
|
|
|
|
|
|
|
|
|
| 14 |
</head>
|
| 15 |
<body class="dashboard-body loading-state">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
<!-- Main Taskbar -->
|
| 17 |
<nav class="topbar">
|
| 18 |
<div class="brand">📈 <span>StockSense AI</span></div>
|
|
|
|
| 11 |
<!-- Chart.js replacing React's Recharts given vanilla JS constraints -->
|
| 12 |
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
| 13 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 14 |
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
| 15 |
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
| 16 |
+
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;700&display=swap" rel="stylesheet">
|
| 17 |
</head>
|
| 18 |
<body class="dashboard-body loading-state">
|
| 19 |
+
<!-- Static Fibonacci/Mesh Watermark -->
|
| 20 |
+
<div style="position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; overflow: hidden; z-index: -1; pointer-events: none; opacity: 0.03;">
|
| 21 |
+
<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">
|
| 22 |
+
<defs>
|
| 23 |
+
<pattern id="fibonacciGrid" width="100" height="100" patternUnits="userSpaceOnUse">
|
| 24 |
+
<path d="M 100 0 L 0 0 0 100" fill="none" stroke="#ffffff" stroke-width="0.5"/>
|
| 25 |
+
<path d="M 0 38.2 L 100 38.2 M 0 61.8 L 100 61.8 M 38.2 0 L 38.2 100 M 61.8 0 L 61.8 100" fill="none" stroke="#ffffff" stroke-width="0.2"/>
|
| 26 |
+
</pattern>
|
| 27 |
+
</defs>
|
| 28 |
+
<rect width="100%" height="100%" fill="url(#fibonacciGrid)" />
|
| 29 |
+
</svg>
|
| 30 |
+
</div>
|
| 31 |
<!-- Main Taskbar -->
|
| 32 |
<nav class="topbar">
|
| 33 |
<div class="brand">📈 <span>StockSense AI</span></div>
|
frontend/dashboard.js
CHANGED
|
@@ -83,7 +83,9 @@ async function renderDashboard(ticker) {
|
|
| 83 |
}, 300);
|
| 84 |
|
| 85 |
// 3. Profile
|
| 86 |
-
|
|
|
|
|
|
|
| 87 |
|
| 88 |
// 4. News Feed
|
| 89 |
const newsContainer = document.getElementById('newsList');
|
|
@@ -145,8 +147,12 @@ function drawChart(pred) {
|
|
| 145 |
const ctx = document.getElementById('priceForecastChart').getContext('2d');
|
| 146 |
|
| 147 |
let gradient = ctx.createLinearGradient(0, 0, 0, 400);
|
| 148 |
-
gradient.addColorStop(0, 'rgba(6, 182, 212, 0.
|
| 149 |
-
gradient.addColorStop(1, 'rgba(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 150 |
|
| 151 |
if (chartInstance) chartInstance.destroy();
|
| 152 |
|
|
@@ -160,7 +166,7 @@ function drawChart(pred) {
|
|
| 160 |
data: histData,
|
| 161 |
borderColor: '#06b6d4',
|
| 162 |
backgroundColor: gradient,
|
| 163 |
-
borderWidth:
|
| 164 |
fill: true,
|
| 165 |
pointRadius: 0,
|
| 166 |
pointHoverRadius: 5,
|
|
@@ -169,12 +175,13 @@ function drawChart(pred) {
|
|
| 169 |
{
|
| 170 |
label: 'AI Forecast',
|
| 171 |
data: predData,
|
| 172 |
-
borderColor: '#
|
| 173 |
borderDash: [5, 5],
|
| 174 |
-
|
| 175 |
-
|
|
|
|
| 176 |
pointRadius: 3,
|
| 177 |
-
pointBackgroundColor: '#
|
| 178 |
tension: 0.3
|
| 179 |
}
|
| 180 |
]
|
|
@@ -188,26 +195,28 @@ function drawChart(pred) {
|
|
| 188 |
},
|
| 189 |
plugins: {
|
| 190 |
legend: {
|
| 191 |
-
labels: { color: '#
|
| 192 |
},
|
| 193 |
tooltip: {
|
| 194 |
-
backgroundColor: '
|
| 195 |
titleColor: '#fff',
|
| 196 |
bodyColor: '#d1d5db',
|
| 197 |
-
borderColor: '
|
| 198 |
borderWidth: 1,
|
| 199 |
padding: 10,
|
| 200 |
-
displayColors: true
|
|
|
|
|
|
|
| 201 |
}
|
| 202 |
},
|
| 203 |
scales: {
|
| 204 |
x: {
|
| 205 |
-
grid: { color: '
|
| 206 |
-
ticks: { color: '#
|
| 207 |
},
|
| 208 |
y: {
|
| 209 |
-
grid: { color: '
|
| 210 |
-
ticks: { color: '#
|
| 211 |
}
|
| 212 |
}
|
| 213 |
}
|
|
|
|
| 83 |
}, 300);
|
| 84 |
|
| 85 |
// 3. Profile
|
| 86 |
+
let formattedProfile = data.profile.replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>');
|
| 87 |
+
formattedProfile = formattedProfile.replace(/\n/g, '<br/>');
|
| 88 |
+
document.getElementById('companyOverviewText').innerHTML = formattedProfile;
|
| 89 |
|
| 90 |
// 4. News Feed
|
| 91 |
const newsContainer = document.getElementById('newsList');
|
|
|
|
| 147 |
const ctx = document.getElementById('priceForecastChart').getContext('2d');
|
| 148 |
|
| 149 |
let gradient = ctx.createLinearGradient(0, 0, 0, 400);
|
| 150 |
+
gradient.addColorStop(0, 'rgba(6, 182, 212, 0.25)');
|
| 151 |
+
gradient.addColorStop(1, 'rgba(0, 0, 0, 0)');
|
| 152 |
+
|
| 153 |
+
let predGradient = ctx.createLinearGradient(0, 0, 0, 400);
|
| 154 |
+
predGradient.addColorStop(0, 'rgba(16, 185, 129, 0.25)');
|
| 155 |
+
predGradient.addColorStop(1, 'rgba(0, 0, 0, 0)');
|
| 156 |
|
| 157 |
if (chartInstance) chartInstance.destroy();
|
| 158 |
|
|
|
|
| 166 |
data: histData,
|
| 167 |
borderColor: '#06b6d4',
|
| 168 |
backgroundColor: gradient,
|
| 169 |
+
borderWidth: 1.5,
|
| 170 |
fill: true,
|
| 171 |
pointRadius: 0,
|
| 172 |
pointHoverRadius: 5,
|
|
|
|
| 175 |
{
|
| 176 |
label: 'AI Forecast',
|
| 177 |
data: predData,
|
| 178 |
+
borderColor: '#10b981',
|
| 179 |
borderDash: [5, 5],
|
| 180 |
+
backgroundColor: predGradient,
|
| 181 |
+
borderWidth: 1.5,
|
| 182 |
+
fill: true,
|
| 183 |
pointRadius: 3,
|
| 184 |
+
pointBackgroundColor: '#10b981',
|
| 185 |
tension: 0.3
|
| 186 |
}
|
| 187 |
]
|
|
|
|
| 195 |
},
|
| 196 |
plugins: {
|
| 197 |
legend: {
|
| 198 |
+
labels: { color: '#8b949e', font: { family: "'JetBrains Mono', monospace", size: 11 } }
|
| 199 |
},
|
| 200 |
tooltip: {
|
| 201 |
+
backgroundColor: 'rgba(10, 11, 16, 0.85)',
|
| 202 |
titleColor: '#fff',
|
| 203 |
bodyColor: '#d1d5db',
|
| 204 |
+
borderColor: 'rgba(255, 255, 255, 0.08)',
|
| 205 |
borderWidth: 1,
|
| 206 |
padding: 10,
|
| 207 |
+
displayColors: true,
|
| 208 |
+
titleFont: { family: "'JetBrains Mono', monospace" },
|
| 209 |
+
bodyFont: { family: "'JetBrains Mono', monospace" }
|
| 210 |
}
|
| 211 |
},
|
| 212 |
scales: {
|
| 213 |
x: {
|
| 214 |
+
grid: { color: 'rgba(255, 255, 255, 0.03)', lineWidth: 1 },
|
| 215 |
+
ticks: { color: '#8b949e', font: { family: "'JetBrains Mono', monospace", size: 9 }, maxTicksLimit: 10, maxRotation: 45 }
|
| 216 |
},
|
| 217 |
y: {
|
| 218 |
+
grid: { color: 'rgba(255, 255, 255, 0.03)', lineWidth: 1 },
|
| 219 |
+
ticks: { color: '#8b949e', font: { family: "'JetBrains Mono', monospace", size: 10 } }
|
| 220 |
}
|
| 221 |
}
|
| 222 |
}
|
frontend/index.html
CHANGED
|
@@ -9,9 +9,24 @@
|
|
| 9 |
<!-- Razorpay Checkout Script -->
|
| 10 |
<script src="https://checkout.razorpay.com/v1/checkout.js"></script>
|
| 11 |
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.0"></script>
|
|
|
|
|
|
|
|
|
|
| 12 |
</head>
|
| 13 |
|
| 14 |
<body>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
<!-- Wallet Panel — Premium Slide-in -->
|
| 17 |
<div id="walletPanel" class="wallet-panel hidden">
|
|
|
|
| 9 |
<!-- Razorpay Checkout Script -->
|
| 10 |
<script src="https://checkout.razorpay.com/v1/checkout.js"></script>
|
| 11 |
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.0"></script>
|
| 12 |
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
| 13 |
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
| 14 |
+
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;700&display=swap" rel="stylesheet">
|
| 15 |
</head>
|
| 16 |
|
| 17 |
<body>
|
| 18 |
+
<!-- Static Fibonacci/Mesh Watermark -->
|
| 19 |
+
<div style="position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; overflow: hidden; z-index: -1; pointer-events: none; opacity: 0.03;">
|
| 20 |
+
<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">
|
| 21 |
+
<defs>
|
| 22 |
+
<pattern id="fibonacciGrid" width="100" height="100" patternUnits="userSpaceOnUse">
|
| 23 |
+
<path d="M 100 0 L 0 0 0 100" fill="none" stroke="#ffffff" stroke-width="0.5"/>
|
| 24 |
+
<path d="M 0 38.2 L 100 38.2 M 0 61.8 L 100 61.8 M 38.2 0 L 38.2 100 M 61.8 0 L 61.8 100" fill="none" stroke="#ffffff" stroke-width="0.2"/>
|
| 25 |
+
</pattern>
|
| 26 |
+
</defs>
|
| 27 |
+
<rect width="100%" height="100%" fill="url(#fibonacciGrid)" />
|
| 28 |
+
</svg>
|
| 29 |
+
</div>
|
| 30 |
|
| 31 |
<!-- Wallet Panel — Premium Slide-in -->
|
| 32 |
<div id="walletPanel" class="wallet-panel hidden">
|
frontend/style.css
CHANGED
|
@@ -547,39 +547,66 @@
|
|
| 547 |
}
|
| 548 |
|
| 549 |
:root {
|
| 550 |
-
--bg: #
|
| 551 |
-
--
|
| 552 |
-
--
|
| 553 |
-
--
|
|
|
|
|
|
|
| 554 |
--text: #d1d5db;
|
| 555 |
-
--text-dim: #
|
| 556 |
-
--green: #
|
| 557 |
--red: #ef4444;
|
| 558 |
--blue: #3b82f6;
|
| 559 |
--cyan: #06b6d4;
|
| 560 |
--yellow: #eab308;
|
| 561 |
-
--accent: #
|
| 562 |
--purple: #a855f7;
|
|
|
|
|
|
|
|
|
|
| 563 |
}
|
| 564 |
|
| 565 |
body {
|
| 566 |
-
font-family: '
|
| 567 |
-
background: var(--bg);
|
|
|
|
| 568 |
color: var(--text);
|
| 569 |
min-height: 100vh;
|
| 570 |
font-size: 14px;
|
| 571 |
}
|
| 572 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 573 |
|
| 574 |
.topbar {
|
| 575 |
display: flex;
|
| 576 |
align-items: center;
|
| 577 |
justify-content: space-between;
|
| 578 |
padding: 0.6rem 1.5rem;
|
| 579 |
-
background:
|
| 580 |
-
backdrop-filter:
|
| 581 |
-
-webkit-backdrop-filter:
|
| 582 |
-
border-bottom: 1px solid
|
|
|
|
| 583 |
position: sticky;
|
| 584 |
top: 0;
|
| 585 |
z-index: 100;
|
|
@@ -840,10 +867,10 @@ body {
|
|
| 840 |
|
| 841 |
|
| 842 |
.market-bar {
|
| 843 |
-
background:
|
| 844 |
-
backdrop-filter:
|
| 845 |
-
-webkit-backdrop-filter:
|
| 846 |
-
border-bottom: 1px solid
|
| 847 |
padding: 0.45rem 1.5rem;
|
| 848 |
position: sticky;
|
| 849 |
top: 42px;
|
|
@@ -905,10 +932,10 @@ body {
|
|
| 905 |
justify-content: space-between;
|
| 906 |
align-items: center;
|
| 907 |
padding: 1rem 1.5rem;
|
| 908 |
-
background:
|
| 909 |
-
backdrop-filter:
|
| 910 |
-
-webkit-backdrop-filter:
|
| 911 |
-
border-bottom: 1px solid
|
| 912 |
}
|
| 913 |
|
| 914 |
.price-main {
|
|
@@ -1026,11 +1053,13 @@ body {
|
|
| 1026 |
|
| 1027 |
|
| 1028 |
.chart-container {
|
| 1029 |
-
background:
|
| 1030 |
-
backdrop-filter:
|
| 1031 |
-
-webkit-backdrop-filter:
|
| 1032 |
-
border: 1px solid
|
| 1033 |
-
border-
|
|
|
|
|
|
|
| 1034 |
padding: 0.8rem;
|
| 1035 |
margin-bottom: 0.8rem;
|
| 1036 |
height: 450px;
|
|
@@ -1081,11 +1110,13 @@ body {
|
|
| 1081 |
|
| 1082 |
|
| 1083 |
.panel {
|
| 1084 |
-
background:
|
| 1085 |
-
backdrop-filter:
|
| 1086 |
-
-webkit-backdrop-filter:
|
| 1087 |
-
border: 1px solid
|
| 1088 |
-
border-
|
|
|
|
|
|
|
| 1089 |
padding: 1rem;
|
| 1090 |
margin-bottom: 0.8rem;
|
| 1091 |
}
|
|
@@ -1291,11 +1322,13 @@ body {
|
|
| 1291 |
}
|
| 1292 |
|
| 1293 |
.port-card {
|
| 1294 |
-
background:
|
| 1295 |
-
backdrop-filter:
|
| 1296 |
-
-webkit-backdrop-filter:
|
| 1297 |
-
border: 1px solid
|
| 1298 |
-
border-
|
|
|
|
|
|
|
| 1299 |
padding: 1rem;
|
| 1300 |
text-align: center;
|
| 1301 |
}
|
|
@@ -1323,11 +1356,13 @@ body {
|
|
| 1323 |
display: flex;
|
| 1324 |
align-items: center;
|
| 1325 |
justify-content: space-between;
|
| 1326 |
-
background:
|
| 1327 |
-
backdrop-filter:
|
| 1328 |
-
-webkit-backdrop-filter:
|
| 1329 |
-
border: 1px solid
|
| 1330 |
-
border-
|
|
|
|
|
|
|
| 1331 |
padding: 1rem 1.5rem;
|
| 1332 |
}
|
| 1333 |
|
|
|
|
| 547 |
}
|
| 548 |
|
| 549 |
:root {
|
| 550 |
+
--bg-gradient: radial-gradient(circle at 50% 0%, #12141d 0%, #0a0b10 100%);
|
| 551 |
+
--bg: #0a0b10;
|
| 552 |
+
--bg2: rgba(255, 255, 255, 0.03);
|
| 553 |
+
--bg3: rgba(255, 255, 255, 0.05);
|
| 554 |
+
--border: rgba(255, 255, 255, 0.08);
|
| 555 |
+
--border-light: rgba(255, 255, 255, 0.12);
|
| 556 |
--text: #d1d5db;
|
| 557 |
+
--text-dim: #8b949e;
|
| 558 |
+
--green: #10b981;
|
| 559 |
--red: #ef4444;
|
| 560 |
--blue: #3b82f6;
|
| 561 |
--cyan: #06b6d4;
|
| 562 |
--yellow: #eab308;
|
| 563 |
+
--accent: #10b981;
|
| 564 |
--purple: #a855f7;
|
| 565 |
+
|
| 566 |
+
--glass-bg: rgba(255, 255, 255, 0.02);
|
| 567 |
+
--glass-blur: blur(14px);
|
| 568 |
}
|
| 569 |
|
| 570 |
body {
|
| 571 |
+
font-family: 'JetBrains Mono', 'Inter', monospace;
|
| 572 |
+
background: var(--bg-gradient);
|
| 573 |
+
background-attachment: fixed;
|
| 574 |
color: var(--text);
|
| 575 |
min-height: 100vh;
|
| 576 |
font-size: 14px;
|
| 577 |
}
|
| 578 |
|
| 579 |
+
.glass-pane {
|
| 580 |
+
background: var(--glass-bg);
|
| 581 |
+
backdrop-filter: var(--glass-blur);
|
| 582 |
+
-webkit-backdrop-filter: var(--glass-blur);
|
| 583 |
+
border: 1px solid var(--border);
|
| 584 |
+
border-top-color: var(--border-light);
|
| 585 |
+
border-left-color: var(--border-light);
|
| 586 |
+
border-radius: 12px;
|
| 587 |
+
}
|
| 588 |
+
|
| 589 |
+
.glow-up {
|
| 590 |
+
color: var(--green);
|
| 591 |
+
text-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
|
| 592 |
+
}
|
| 593 |
+
|
| 594 |
+
.glow-down {
|
| 595 |
+
color: var(--red);
|
| 596 |
+
text-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
|
| 597 |
+
}
|
| 598 |
+
|
| 599 |
|
| 600 |
.topbar {
|
| 601 |
display: flex;
|
| 602 |
align-items: center;
|
| 603 |
justify-content: space-between;
|
| 604 |
padding: 0.6rem 1.5rem;
|
| 605 |
+
background: var(--glass-bg);
|
| 606 |
+
backdrop-filter: var(--glass-blur);
|
| 607 |
+
-webkit-backdrop-filter: var(--glass-blur);
|
| 608 |
+
border-bottom: 1px solid var(--border);
|
| 609 |
+
border-bottom-color: var(--border-light);
|
| 610 |
position: sticky;
|
| 611 |
top: 0;
|
| 612 |
z-index: 100;
|
|
|
|
| 867 |
|
| 868 |
|
| 869 |
.market-bar {
|
| 870 |
+
background: var(--glass-bg);
|
| 871 |
+
backdrop-filter: var(--glass-blur);
|
| 872 |
+
-webkit-backdrop-filter: var(--glass-blur);
|
| 873 |
+
border-bottom: 1px solid var(--border);
|
| 874 |
padding: 0.45rem 1.5rem;
|
| 875 |
position: sticky;
|
| 876 |
top: 42px;
|
|
|
|
| 932 |
justify-content: space-between;
|
| 933 |
align-items: center;
|
| 934 |
padding: 1rem 1.5rem;
|
| 935 |
+
background: var(--glass-bg);
|
| 936 |
+
backdrop-filter: var(--glass-blur);
|
| 937 |
+
-webkit-backdrop-filter: var(--glass-blur);
|
| 938 |
+
border-bottom: 1px solid var(--border);
|
| 939 |
}
|
| 940 |
|
| 941 |
.price-main {
|
|
|
|
| 1053 |
|
| 1054 |
|
| 1055 |
.chart-container {
|
| 1056 |
+
background: var(--glass-bg);
|
| 1057 |
+
backdrop-filter: var(--glass-blur);
|
| 1058 |
+
-webkit-backdrop-filter: var(--glass-blur);
|
| 1059 |
+
border: 1px solid var(--border);
|
| 1060 |
+
border-top-color: var(--border-light);
|
| 1061 |
+
border-left-color: var(--border-light);
|
| 1062 |
+
border-radius: 12px;
|
| 1063 |
padding: 0.8rem;
|
| 1064 |
margin-bottom: 0.8rem;
|
| 1065 |
height: 450px;
|
|
|
|
| 1110 |
|
| 1111 |
|
| 1112 |
.panel {
|
| 1113 |
+
background: var(--glass-bg);
|
| 1114 |
+
backdrop-filter: var(--glass-blur);
|
| 1115 |
+
-webkit-backdrop-filter: var(--glass-blur);
|
| 1116 |
+
border: 1px solid var(--border);
|
| 1117 |
+
border-top-color: var(--border-light);
|
| 1118 |
+
border-left-color: var(--border-light);
|
| 1119 |
+
border-radius: 12px;
|
| 1120 |
padding: 1rem;
|
| 1121 |
margin-bottom: 0.8rem;
|
| 1122 |
}
|
|
|
|
| 1322 |
}
|
| 1323 |
|
| 1324 |
.port-card {
|
| 1325 |
+
background: var(--glass-bg);
|
| 1326 |
+
backdrop-filter: var(--glass-blur);
|
| 1327 |
+
-webkit-backdrop-filter: var(--glass-blur);
|
| 1328 |
+
border: 1px solid var(--border);
|
| 1329 |
+
border-top-color: var(--border-light);
|
| 1330 |
+
border-left-color: var(--border-light);
|
| 1331 |
+
border-radius: 12px;
|
| 1332 |
padding: 1rem;
|
| 1333 |
text-align: center;
|
| 1334 |
}
|
|
|
|
| 1356 |
display: flex;
|
| 1357 |
align-items: center;
|
| 1358 |
justify-content: space-between;
|
| 1359 |
+
background: var(--glass-bg);
|
| 1360 |
+
backdrop-filter: var(--glass-blur);
|
| 1361 |
+
-webkit-backdrop-filter: var(--glass-blur);
|
| 1362 |
+
border: 1px solid var(--border);
|
| 1363 |
+
border-top-color: var(--border-light);
|
| 1364 |
+
border-left-color: var(--border-light);
|
| 1365 |
+
border-radius: 12px;
|
| 1366 |
padding: 1rem 1.5rem;
|
| 1367 |
}
|
| 1368 |
|