File size: 50,856 Bytes
e76e775 1d2e312 e76e775 1d2e312 e76e775 1d2e312 e76e775 1d2e312 e76e775 1227679 | 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 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AI Infra Ecosystem 2026 | Live Intel</title>
<script src="https://d3js.org/d3.v7.min.js"></script>
<link
href="https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&family=JetBrains+Mono:wght@500&display=swap"
rel="stylesheet">
<style>
:root {
--bg: #05070a;
--panel: rgba(15, 23, 42, 0.7);
--accent: #00f2ff;
--accent-glow: rgba(0, 242, 255, 0.3);
--text-main: #f8fafc;
--text-dim: #94a3b8;
--border: rgba(255, 255, 255, 0.1);
}
body {
margin: 0;
font-family: 'Outfit', sans-serif;
background: var(--bg);
color: var(--text-main);
overflow: hidden;
background-image: radial-gradient(circle at 50% 50%, #0f172a 0%, #05070a 100%);
}
.header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 15px 30px;
background: rgba(0, 0, 0, 0.4);
backdrop-filter: blur(20px);
border-bottom: 1px solid var(--border);
z-index: 100;
}
h1 {
margin: 0;
font-size: 1.8em;
font-weight: 700;
background: linear-gradient(135deg, #fff 0%, #00f2ff 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
letter-spacing: -0.5px;
}
.container {
display: flex;
height: calc(100vh - 70px);
}
#graph-container {
flex: 1;
position: relative;
background: transparent;
}
.sidebar {
width: 420px;
background: var(--panel);
backdrop-filter: blur(30px);
border-left: 1px solid var(--border);
display: flex;
flex-direction: column;
gap: 20px;
padding: 25px;
overflow-y: auto;
scrollbar-width: thin;
}
.sidebar::-webkit-scrollbar {
width: 6px;
}
.sidebar::-webkit-scrollbar-thumb {
background: var(--border);
border-radius: 10px;
}
.panel {
background: rgba(255, 255, 255, 0.03);
border: 1px solid var(--border);
border-radius: 16px;
padding: 20px;
}
h2 {
font-size: 0.9em;
text-transform: uppercase;
letter-spacing: 1.5px;
color: var(--text-dim);
margin: 0 0 15px 0;
display: flex;
align-items: center;
gap: 8px;
}
.settings-panel {
display: flex;
flex-direction: column;
gap: 12px;
margin-bottom: 5px;
}
input.api-key,
#search {
width: 100%;
box-sizing: border-box;
padding: 12px 16px;
background: #000;
border: 1px solid var(--border);
border-radius: 10px;
color: var(--accent);
font-family: 'JetBrains Mono', monospace;
font-size: 0.85em;
transition: all 0.2s;
}
input:focus {
outline: none;
border-color: var(--accent);
box-shadow: 0 0 15px var(--accent-glow);
}
.filter-grid {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
button.filter {
padding: 6px 12px;
background: rgba(255, 255, 255, 0.05);
border: 1px solid var(--border);
color: var(--text-dim);
border-radius: 8px;
cursor: pointer;
font-size: 0.85em;
transition: all 0.2s;
}
button.filter.active {
background: var(--accent);
color: #000;
border-color: var(--accent);
font-weight: 600;
}
.company-list {
list-style: none;
padding: 0;
margin: 0;
display: flex;
flex-direction: column;
gap: 10px;
}
.company-list li {
padding: 14px;
background: rgba(255, 255, 255, 0.02);
border: 1px solid var(--border);
border-radius: 12px;
cursor: pointer;
display: flex;
justify-content: space-between;
align-items: center;
transition: transform 0.2s, border-color 0.2s;
}
.company-list li:hover {
transform: translateX(5px);
border-color: var(--accent);
background: rgba(0, 242, 255, 0.05);
}
.calendar-grid {
display: grid;
grid-template-columns: 1fr;
gap: 10px;
}
.calendar-day {
background: rgba(255, 255, 255, 0.02);
border: 1px solid var(--border);
border-radius: 12px;
padding: 12px;
}
.calendar-day.today {
border-color: #ffd700;
background: rgba(255, 215, 0, 0.05);
}
.calendar-date {
font-weight: 600;
color: var(--accent);
font-size: 0.8em;
margin-bottom: 8px;
opacity: 0.7;
}
.calendar-item {
padding: 8px 10px;
margin: 2px 0;
display: flex;
justify-content: space-between;
font-size: 0.9em;
border-radius: 6px;
transition: all 0.2s;
border: 1px solid transparent;
}
.calendar-item:hover { background: rgba(255, 255, 255, 0.05); }
.calendar-item.active {
background: rgba(0, 242, 255, 0.1);
border-color: var(--accent);
box-shadow: 0 0 10px var(--accent-glow);
}
.node circle {
filter: drop-shadow(0 0 8px rgba(0, 0, 0, 0.5));
transition: r 0.3s;
}
.link {
stroke: #334155;
stroke-opacity: 0.3;
transition: all 0.3s;
}
.highlight-link {
stroke: var(--accent) !important;
stroke-opacity: 0.8;
stroke-width: 3;
}
.highlight-node circle {
stroke: #fff;
stroke-width: 4;
filter: drop-shadow(0 0 15px var(--accent));
}
.tooltip {
position: absolute;
background: rgba(15, 23, 42, 0.95);
backdrop-filter: blur(10px);
border: 1px solid var(--accent);
border-radius: 14px;
padding: 18px;
pointer-events: none;
max-width: 320px;
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
z-index: 1000;
}
.live-price {
font-family: 'JetBrains Mono', monospace;
font-weight: 700;
}
.price-up {
color: #10b981;
}
.price-down {
color: #ef4444;
}
.status-badge {
display: flex;
align-items: center;
gap: 8px;
font-size: 0.75em;
background: #000;
padding: 6px 12px;
border-radius: 20px;
border: 1px solid var(--border);
}
.status-dot {
width: 8px;
height: 8px;
border-radius: 50%;
position: relative;
}
.status-dot::after {
content: '';
position: absolute;
inset: -4px;
border-radius: 50%;
background: inherit;
opacity: 0.4;
animation: pulse 2s infinite;
}
@keyframes pulse {
0% {
transform: scale(1);
opacity: 0.4;
}
100% {
transform: scale(2.5);
opacity: 0;
}
}
.badge {
font-size: 0.65em;
padding: 2px 8px;
border-radius: 100px;
background: rgba(255, 255, 255, 0.1);
}
.badge-reported {
background: rgba(16, 185, 129, 0.2);
color: #10b981;
}
.impact-panel-content {
font-size: 0.9em;
line-height: 1.6;
}
.data-label {
color: var(--text-dim);
font-size: 0.8em;
margin-bottom: 2px;
}
.data-value {
font-weight: 600;
margin-bottom: 12px;
}
/* Custom Scrollbar for sidebars */
::-webkit-scrollbar {
width: 4px;
}
::-webkit-scrollbar-track {
background: transparent;
}
::-webkit-scrollbar-thumb {
background: var(--border);
border-radius: 10px;
}
</style>
</head>
<body>
<div class="header">
<div>
<h1>AI Infra Ecosystem <span style="font-weight:300; opacity:0.6;">2026</span></h1>
<div style="font-size: 0.75em; color: var(--text-dim); margin-top: 4px;">Supply Chain Intelligence • Live
Profit Flow • Institutional Intel</div>
</div>
<div class="status-badge">
<span id="status-dot" class="status-dot status-sim"></span>
<span id="status-text" style="font-family:'JetBrains Mono';">Simulation Mode</span>
<span
style="border-left:1px solid var(--border); margin-left:8px; padding-left:8px; opacity:0.6; font-size:0.9em;">
Init: April 30, 2026 (Manual Sync)
</span>
</div>
</div>
<div class="container">
<div id="graph-container"></div>
<div class="sidebar">
<div class="settings-panel">
<input type="password" id="api-key" class="api-key" placeholder="Finnhub API Key..."
value="d7ph5ppr01qlb0a9vvjgd7ph5ppr01qlb0a9vvk0">
<input type="text" id="search" placeholder="Search companies or tickers...">
</div>
<div class="panel">
<h2><span style="color:var(--accent);">◈</span> Category Filters</h2>
<div class="filter-grid" id="filters"></div>
</div>
<div class="panel">
<h2><span style="color:#ffd700;">◈</span> Earnings Calendar</h2>
<div id="calendar-panel">
<div class="calendar-grid" id="earnings-calendar"></div>
</div>
</div>
<div class="panel" id="selection-panel">
<h2 id="selected-name">Select a node to inspect</h2>
<div id="impact-details" class="impact-panel-content"></div>
</div>
<div class="panel">
<h2><span style="color:var(--accent);">◈</span> Market Overview</h2>
<ul class="company-list" id="company-list"></ul>
</div>
</div>
</div>
<script>
// ================== EXHAUSTIVE DATA 2026 ==================
const companies = [
// Chips (ASICs, GPUs, CPUs)
{ id: "NVDA", name: "NVIDIA", ticker: "NVDA", category: "chip", color: "#ff6b6b", aiExposure: 92, return1y: 52, earnings: "2026-05-20", price: 209.25, change: -1.84 },
{ id: "AMD", name: "AMD", ticker: "AMD", category: "chip", color: "#ff6b6b", aiExposure: 68, return1y: 95, earnings: "2026-05-05", price: 337.11, change: 4.3 },
{ id: "AVGO", name: "Broadcom", ticker: "AVGO", category: "chip", color: "#ff6b6b", aiExposure: 58, return1y: 78, earnings: "2026-06-03", price: 405.45, change: 1.41 },
{ id: "MRVL", name: "Marvell", ticker: "MRVL", category: "chip", color: "#ff6b6b", aiExposure: 65, return1y: 53, earnings: "2026-05-21", price: 156.57, change: 2.18 },
{ id: "INTC", name: "Intel", ticker: "INTC", category: "chip", color: "#ff6b6b", aiExposure: 40, return1y: 12, earnings: "2026-04-23", price: 94.75, change: 12.1 },
{ id: "ARM", name: "ARM Holdings", ticker: "ARM", category: "chip", color: "#ff6b6b", aiExposure: 85, return1y: 120, earnings: "2026-05-08", price: 201.69, change: 1.53 },
// Foundry & Equipment
{ id: "TSM", name: "TSMC", ticker: "TSM", category: "foundry", color: "#4ecdc4", aiExposure: 60, return1y: 100, earnings: "2026-04-16", price: 393.83, change: 0.38 },
{ id: "ASML", name: "ASML", ticker: "ASML", category: "equipment", color: "#4ecdc4", aiExposure: 45, return1y: 94, earnings: "2026-04-15", price: 1394.08, change: 0.69 },
{ id: "AMAT", name: "Applied Materials", ticker: "AMAT", category: "equipment", color: "#4ecdc4", aiExposure: 48, return1y: 134, earnings: "2026-05-15", price: 382.59, change: 0.39 },
{ id: "LRCX", name: "Lam Research", ticker: "LRCX", category: "equipment", color: "#4ecdc4", aiExposure: 52, return1y: 193, earnings: "2026-04-17", price: 248.75, change: -0.99 },
// Memory
{ id: "MU", name: "Micron", ticker: "MU", category: "memory", color: "#96ceb4", aiExposure: 72, return1y: 305, earnings: "2026-06-24", price: 518.46, change: 2.81 },
{ id: "HYNIX", name: "SK Hynix", ticker: "000660.KS", category: "memory", color: "#96ceb4", aiExposure: 78, return1y: 50, earnings: "2026-04-25", price: 1286000.0, change: -0.54 },
// Storage
{ id: "PSTG", name: "Pure Storage", ticker: "PSTG", category: "storage", color: "#fab1a0", aiExposure: 75, return1y: 85, earnings: "2026-05-27", price: 70.31, change: -0.87 },
// Power & Cooling
{ id: "VRT", name: "Vertiv", ticker: "VRT", category: "power", color: "#ffea67", aiExposure: 82, return1y: 238, earnings: "2026-04-22", price: 306.18, change: 0.38 },
{ id: "MOD", name: "Modine", ticker: "MOD", category: "cooling", color: "#ffea67", aiExposure: 65, return1y: 180, earnings: "2026-05-22", price: 233.39, change: -1.55 },
{ id: "NVT", name: "nVent", ticker: "NVT", category: "cooling", color: "#ffea67", aiExposure: 55, return1y: 95, earnings: "2026-04-30", price: 137.37, change: -0.67 },
{ id: "GEV", name: "GE Vernova", ticker: "GEV", category: "energy", color: "#55efc4", aiExposure: 35, return1y: 45, earnings: "2026-04-23", price: 1063.11, change: -2.37 },
{ id: "BE", name: "Bloom Energy", ticker: "BE", category: "energy", color: "#55efc4", aiExposure: 65, return1y: 555, earnings: "2026-05-07", price: 287.97, change: 27.21 },
{ id: "PWR", name: "Quanta Services", ticker: "PWR", category: "energy", color: "#55efc4", aiExposure: 52, return1y: 116, earnings: "2026-05-02", price: 628.6, change: -0.37 },
// Networking & Optics
{ id: "ANET", name: "Arista", ticker: "ANET", category: "network", color: "#ff9eaa", aiExposure: 75, return1y: 55, earnings: "2026-05-05", price: 168.68, change: 2.05 },
{ id: "CSCO", name: "Cisco", ticker: "CSCO", category: "network", color: "#ff9eaa", aiExposure: 30, return1y: 15, earnings: "2026-05-13", price: 89.57, change: 3.12 },
{ id: "LITE", name: "Lumentum", ticker: "LITE", category: "network", color: "#ff9eaa", aiExposure: 82, return1y: 102, earnings: "2026-05-05", price: 858.32, change: 8.46 },
{ id: "COHR", name: "Coherent", ticker: "COHR", category: "network", color: "#ff9eaa", aiExposure: 68, return1y: 145, earnings: "2026-05-07", price: 304.93, change: 0.32 },
{ id: "CRDO", name: "Credo", ticker: "CRDO", category: "network", color: "#ff9eaa", aiExposure: 88, return1y: 180, earnings: "2026-05-28", price: 175.77, change: 5.94 },
// Servers & Integrators
{ id: "SMCI", name: "Supermicro", ticker: "SMCI", category: "server", color: "#a29bfe", aiExposure: 90, return1y: -36, earnings: "2026-05-05", price: 26.32, change: -3.41 },
{ id: "DELL", name: "Dell", ticker: "DELL", category: "server", color: "#a29bfe", aiExposure: 55, return1y: 140, earnings: "2026-05-28", price: 205.66, change: -0.13 },
{ id: "HPE", name: "HPE", ticker: "HPE", category: "server", color: "#a29bfe", aiExposure: 45, return1y: 42, earnings: "2026-06-02", price: 28.3, change: 1.25 },
{ id: "CLS", name: "Celestica", ticker: "CLS", category: "server", color: "#a29bfe", aiExposure: 75, return1y: 238, earnings: "2026-04-23", price: 376.54, change: 4.15 },
// Hyperscalers
{ id: "MSFT", name: "Microsoft", ticker: "MSFT", category: "hyperscaler", color: "#f1c40f", aiExposure: 32, return1y: 25, earnings: "2026-04-29", price: 424.46, change: -1.12 },
{ id: "GOOGL", name: "Google", ticker: "GOOGL", category: "hyperscaler", color: "#f1c40f", aiExposure: 28, return1y: 42, earnings: "2026-04-29", price: 349.94, change: 0.05 },
{ id: "AMZN", name: "Amazon", ticker: "AMZN", category: "hyperscaler", color: "#f1c40f", aiExposure: 25, return1y: 38, earnings: "2026-04-30", price: 263.04, change: 1.29 },
{ id: "META", name: "Meta", ticker: "META", category: "hyperscaler", color: "#f1c40f", aiExposure: 35, return1y: 85, earnings: "2026-04-29", price: 669.12, change: -0.33 },
{ id: "ORCL", name: "Oracle", ticker: "ORCL", category: "hyperscaler", color: "#f1c40f", aiExposure: 45, return1y: 65, earnings: "2026-06-15", price: 163.83, change: -1.28 },
{ id: "ORCL", name: "Oracle", ticker: "ORCL", category: "hyperscaler", color: "#f1c40f", aiExposure: 45, return1y: 65, earnings: "2026-06-15", price: 163.83, change: -1.28 },
// Design IP & EDA (Architects)
{ id: "SNPS", name: "Synopsys", ticker: "SNPS", category: "design_ip", color: "#6c5ce7", aiExposure: 85, return1y: 42, earnings: "2026-05-21", price: 481.50, change: 0 },
{ id: "CDNS", name: "Cadence", ticker: "CDNS", category: "design_ip", color: "#6c5ce7", aiExposure: 82, return1y: 38, earnings: "2026-05-24", price: 333.20, change: 0 },
// Testing & Verification
{ id: "TER", name: "Teradyne", ticker: "TER", category: "testing", color: "#e17055", aiExposure: 55, return1y: 25, earnings: "2026-04-29", price: 112.40, change: 0 },
{ id: "ATEYY", name: "Advantest", ticker: "ATEYY", category: "testing", color: "#e17055", aiExposure: 68, return1y: 45, earnings: "2026-04-30", price: 184.50, change: 0 },
// Materials & Fab Equipment
{ id: "TOELY", name: "Tokyo Electron", ticker: "TOELY", category: "materials", color: "#00cec9", aiExposure: 60, return1y: 52, earnings: "2026-04-30", price: 139.20, change: 0 },
{ id: "ENTG", name: "Entegris", ticker: "ENTG", category: "materials", color: "#00cec9", aiExposure: 45, return1y: 32, earnings: "2026-04-30", price: 156.40, change: 0 },
// Storage Hub (Massive Capacity)
{ id: "WDC", name: "Western Digital", ticker: "WDC", category: "storage", color: "#fab1a0", aiExposure: 55, return1y: 82, earnings: "2026-04-28", price: 110.40, change: 0 },
{ id: "STX", name: "Seagate", ticker: "STX", category: "storage", color: "#fab1a0", aiExposure: 50, return1y: 75, earnings: "2026-04-23", price: 125.60, change: 0 },
{ id: "SMSN", name: "Samsung", ticker: "005930.KS", category: "ram", color: "#96ceb4", aiExposure: 65, return1y: 42, earnings: "2026-04-30", price: 85200, change: 0, currency: "KRW" },
// Cables & Fiber Backbone
{ id: "APH", name: "Amphenol", ticker: "APH", category: "cables", color: "#fdcb6e", aiExposure: 72, return1y: 95, earnings: "2026-04-22", price: 145.20, change: 0 },
{ id: "GLW", name: "Corning", ticker: "GLW", category: "cables", color: "#fdcb6e", aiExposure: 68, return1y: 55, earnings: "2026-04-28", price: 48.50, change: 0 },
// Power Management & Infrastructure
{ id: "ETN", name: "Eaton", ticker: "ETN", category: "power", color: "#ffea67", aiExposure: 62, return1y: 110, earnings: "2026-04-29", price: 352.40, change: 0 },
{ id: "EQIX", name: "Equinix", ticker: "EQIX", category: "infra", color: "#00b894", aiExposure: 55, return1y: 35, earnings: "2026-05-06", price: 890.50, change: 0 },
// NSE (India) Hub
{ id: "RELIANCE", name: "Reliance Industries", ticker: "RELIANCE.NS", category: "hyperscaler", color: "#f1c40f", aiExposure: 25, return1y: 32, earnings: "2026-04-20", price: 1431.1, change: 0.4, currency: "INR" },
{ id: "ADANIENT", name: "Adani Enterprises", ticker: "ADANIENT.NS", category: "hyperscaler", color: "#f1c40f", aiExposure: 20, return1y: 45, earnings: "2026-05-02", price: 2410.7, change: -0.63, currency: "INR" },
{ id: "BHARTIARTL", name: "Bharti Airtel", ticker: "BHARTIARTL.NS", category: "hyperscaler", color: "#f1c40f", aiExposure: 18, return1y: 28, earnings: "2026-05-14", price: 1886.0, change: -0.11, currency: "INR" },
{ id: "NETWEB", name: "Netweb Tech", ticker: "NETWEB.NS", category: "server", color: "#a29bfe", aiExposure: 85, return1y: 210, earnings: "2026-05-12", price: 4066.1, change: 0.87, currency: "INR" },
{ id: "E2E", name: "E2E Networks", ticker: "E2E.NS", category: "server", color: "#a29bfe", aiExposure: 92, return1y: 450, earnings: "2026-05-20", price: 2890.0, change: -1.64, currency: "INR" },
{ id: "LT", name: "Larsen & Toubro", ticker: "LT.NS", category: "foundry", color: "#4ecdc4", aiExposure: 15, return1y: 42, earnings: "2026-05-08", price: 4015.6, change: -1.97, currency: "INR" },
{ id: "TATACOMM", name: "Tata Comm", ticker: "TATACOMM.NS", category: "network", color: "#ff9eaa", aiExposure: 35, return1y: 55, earnings: "2026-05-10", price: 1580.0, change: -1.39, currency: "INR" },
{ id: "ABB_IN", name: "ABB India", ticker: "ABB.NS", category: "power", color: "#ffea67", aiExposure: 22, return1y: 65, earnings: "2026-05-11", price: 7800, change: 0, currency: "INR" },
{ id: "REC", name: "REC Ltd", ticker: "RECLTD.NS", category: "grid", color: "#55efc4", aiExposure: 25, return1y: 120, earnings: "2026-05-12", price: 620, change: 0, currency: "INR" },
{ id: "PFC", name: "PFC", ticker: "PFC.NS", category: "grid", color: "#55efc4", aiExposure: 22, return1y: 115, earnings: "2026-05-14", price: 542, change: 0, currency: "INR" },
{ id: "STLTECH", name: "Sterlite Tech", ticker: "STLTECH.NS", category: "cables", color: "#fdcb6e", aiExposure: 58, return1y: 45, earnings: "2026-05-15", price: 282, change: 0, currency: "INR" },
{ id: "HFCL", name: "HFCL", ticker: "HFCL.NS", category: "cables", color: "#fdcb6e", aiExposure: 62, return1y: 88, earnings: "2026-05-18", price: 146, change: 0, currency: "INR" },
{ id: "KAYNES", name: "Kaynes Tech", ticker: "KAYNES.NS", category: "ems", color: "#d63031", aiExposure: 65, return1y: 140, earnings: "2026-05-20", price: 4110, change: 0, currency: "INR" },
{ id: "DIXON", name: "Dixon Tech", ticker: "DIXON.NS", category: "ems", color: "#d63031", aiExposure: 40, return1y: 110, earnings: "2026-05-22", price: 11325, change: 0, currency: "INR" },
{ id: "TEJAS", name: "Tejas Networks", ticker: "TEJASNET.NS", category: "network", color: "#ff9eaa", aiExposure: 72, return1y: 180, earnings: "2026-05-25", price: 1416, change: 0, currency: "INR" },
{ id: "TATAELXSI", name: "Tata Elxsi", ticker: "TATAELXSI.NS", category: "design_ip", color: "#6c5ce7", aiExposure: 55, return1y: 28, earnings: "2026-05-28", price: 8148, change: 0, currency: "INR" }
];
const links = [
// Chip Supply
{ source: "NVDA", target: "MSFT", type: "supplies" }, { source: "NVDA", target: "GOOGL", type: "supplies" },
{ source: "NVDA", target: "AMZN", type: "supplies" }, { source: "NVDA", target: "META", type: "supplies" },
{ source: "NVDA", target: "ORCL", type: "supplies" }, { source: "AMD", target: "MSFT", type: "supplies" },
{ source: "AMD", target: "META", type: "supplies" }, { source: "AVGO", target: "GOOGL", type: "supplies" },
{ source: "AVGO", target: "META", type: "supplies" }, { source: "MRVL", target: "AMZN", type: "supplies" },
{ source: "ARM", target: "NVDA", type: "architecture" }, { source: "ARM", target: "MSFT", type: "architecture" },
{ source: "INTC", target: "AMZN", type: "foundry" },
// Foundry/Equipment
{ source: "TSM", target: "NVDA", type: "manufactures" }, { source: "TSM", target: "AMD", type: "manufactures" },
{ source: "TSM", target: "AVGO", type: "manufactures" }, { source: "TSM", target: "ARM", type: "manufactures" },
{ source: "ASML", target: "TSM", type: "equipment" }, { source: "AMAT", target: "TSM", type: "equipment" },
{ source: "LRCX", target: "TSM", type: "equipment" },
// Memory & Storage
{ source: "MU", target: "NVDA", type: "supplies" }, { source: "HYNIX", target: "NVDA", type: "supplies" },
{ source: "PSTG", target: "MSFT", type: "storage" }, { source: "PSTG", target: "GOOGL", type: "storage" },
// Power & Cooling
{ source: "VRT", target: "NVDA", type: "cooling" }, { source: "VRT", target: "MSFT", type: "cooling" },
{ source: "MOD", target: "VRT", type: "components" }, { source: "NVT", target: "SMCI", type: "power" },
{ source: "BE", target: "MSFT", type: "energy" }, { source: "PWR", target: "GOOGL", type: "grid" },
{ source: "GEV", target: "AMZN", type: "energy" },
// Networking
{ source: "ANET", target: "META", type: "networking" }, { source: "ANET", target: "MSFT", type: "networking" },
{ source: "CSCO", target: "ORCL", type: "networking" }, { source: "LITE", target: "ANET", type: "optics" },
{ source: "COHR", target: "ANET", type: "optics" }, { source: "CRDO", target: "ANET", type: "interconnect" },
// Servers
{ source: "SMCI", target: "NVDA", type: "integrates" }, { source: "DELL", target: "NVDA", type: "integrates" },
{ source: "HPE", target: "NVDA", type: "integrates" }, { source: "CLS", target: "NVDA", type: "integrates" },
{ source: "DELL", target: "MSFT", type: "enterprise" }, { source: "HPE", target: "ORCL", type: "enterprise" },
// NSE Connections
{ source: "RELIANCE", target: "NVDA", type: "partnership" }, { source: "RELIANCE", target: "NETWEB", type: "client" },
{ source: "ADANIENT", target: "MSFT", type: "jv" }, { source: "LT", target: "ADANIENT", type: "builder" },
{ source: "E2E", target: "NVDA", type: "cloud_partner" }, { source: "TATACOMM", target: "TSM", type: "network_infra" },
{ source: "ABB_IN", target: "RELIANCE", type: "power_systems" },
{ source: "REC", target: "ADANIENT", type: "grid_finance" }, { source: "STLTECH", target: "BHARTIARTL", type: "network_rollout" },
{ source: "HFCL", target: "RELIANCE", type: "ai_networks" },
{ source: "SNPS", target: "NVDA", type: "design_tools" }, { source: "CDNS", target: "AMD", type: "design_tools" },
{ source: "TER", target: "TSM", type: "chip_testing" }, { source: "ATEYY", target: "SMSN", type: "chip_testing" },
{ source: "TOELY", target: "TSM", type: "fab_equipment" }, { source: "ENTG", target: "INTC", type: "materials" },
{ source: "KAYNES", target: "NETWEB", type: "server_assembly" }, { source: "TEJAS", target: "TATACOMM", type: "optical_gear" }
];
let svg, simulation, nodeGroup, linkGroup, labelGroup, currentFilter = "all";
function initGraph() {
const container = document.getElementById("graph-container");
const width = container.clientWidth, height = container.clientHeight;
svg = d3.select("#graph-container").append("svg")
.attr("width", "100%").attr("height", "100%")
.attr("viewBox", [0, 0, width, height]);
// Zoom setup
const zoom = d3.zoom()
.scaleExtent([0.3, 5])
.on("zoom", (event) => {
g.attr("transform", event.transform);
});
svg.call(zoom);
// Add glowing filter for nodes
const defs = svg.append("defs");
const filter = defs.append("filter").attr("id", "glow");
filter.append("feGaussianBlur").attr("stdDeviation", "3.5").attr("result", "coloredBlur");
const feMerge = filter.append("feMerge");
feMerge.append("feMergeNode").attr("in", "coloredBlur");
feMerge.append("feMergeNode").attr("in", "SourceGraphic");
const g = svg.append("g");
// Improved simulation for better spacing
simulation = d3.forceSimulation(companies)
.force("link", d3.forceLink(links).id(d => d.id).distance(120))
.force("charge", d3.forceManyBody().strength(-800))
.force("center", d3.forceCenter(width / 2, height / 2))
.force("collision", d3.forceCollide().radius(60));
linkGroup = g.append("g").selectAll("line")
.data(links).join("line").attr("class", "link").attr("stroke-width", 1.5);
nodeGroup = g.append("g").selectAll("g")
.data(companies).join("g").attr("class", "node")
.call(d3.drag().on("start", dragstarted).on("drag", dragged).on("end", dragended));
nodeGroup.append("circle")
.attr("r", d => d.category === "hyperscaler" ? 32 : 24)
.attr("fill", d => `url(#grad-${d.id})`)
.attr("stroke", d => d.color).attr("stroke-width", 2)
.style("filter", "url(#glow)");
// Add gradients for each node
companies.forEach(c => {
const grad = defs.append("radialGradient").attr("id", `grad-${c.id}`);
grad.append("stop").attr("offset", "0%").attr("stop-color", c.color);
grad.append("stop").attr("offset", "100%").attr("stop-color", d3.color(c.color).darker(2));
});
labelGroup = g.append("g").selectAll("text")
.data(companies).join("text")
.text(d => d.ticker)
.attr("font-family", "JetBrains Mono")
.attr("font-size", "10px").attr("fill", "#fff")
.attr("text-anchor", "middle").attr("dy", 4).style("font-weight", "700");
const tooltip = d3.select("body").append("div").attr("class", "tooltip").style("opacity", 0);
nodeGroup.on("mouseover", (event, d) => {
tooltip.transition().duration(200).style("opacity", 1);
tooltip.html(`
<div style="font-size:1.1em; font-weight:700; margin-bottom:8px; color:var(--accent);">${d.name}</div>
<div style="display:grid; grid-template-columns: 1fr 1fr; gap:10px; font-size:0.85em;">
<div><span style="opacity:0.6;">Ticker</span><br><strong>${d.ticker}</strong></div>
<div><span style="opacity:0.6;">AI Exp</span><br><strong style="color:#ffd700;">${d.aiExposure}%</strong></div>
<div><span style="opacity:0.6;">Price</span><br><strong class="live-price ${d.change >= 0 ? 'price-up' : 'price-down'}">${d.currency === 'INR' ? '₹' : '$'}${d.price.toLocaleString()}</strong></div>
<div><span style="opacity:0.6;">Earnings</span><br><strong>${d.earnings}</strong></div>
</div>
`).style("left", (event.pageX + 20) + "px").style("top", (event.pageY - 20) + "px");
}).on("mouseout", () => tooltip.transition().duration(200).style("opacity", 0))
.on("click", (_, d) => highlightPaths(d));
simulation.on("tick", () => {
linkGroup.attr("x1", d => d.source.x).attr("y1", d => d.source.y)
.attr("x2", d => d.target.x).attr("y2", d => d.target.y);
nodeGroup.attr("transform", d => `translate(${d.x},${d.y})`);
labelGroup.attr("x", d => d.x).attr("y", d => d.y);
});
// Double click to reset zoom
svg.on("dblclick.zoom", () => {
svg.transition().duration(750).call(zoom.transform, d3.zoomIdentity);
});
createFilters();
renderCompanyList();
renderEarningsCalendar();
startStockPulse();
const initialKey = document.getElementById("api-key").value;
if (initialKey) {
enableLiveFeed(initialKey);
}
document.getElementById("api-key").addEventListener("change", (e) => {
const key = e.target.value;
if (key) enableLiveFeed(key);
});
}
function enableLiveFeed(key) {
document.getElementById("status-dot").className = "status-dot status-live";
document.getElementById("status-text").textContent = "Live Feed Connected";
fetchLivePrices(key);
// Refresh live data every 60 seconds
setInterval(() => fetchLivePrices(key), 60000);
}
function renderEarningsCalendar() {
const calendar = document.getElementById("earnings-calendar");
calendar.innerHTML = "";
// Group companies by earnings date
const groups = {};
companies.forEach(c => {
if (!groups[c.earnings]) groups[c.earnings] = [];
groups[c.earnings].push(c);
});
const dates = Object.keys(groups).sort();
const today = new Date().toISOString().split('T')[0];
dates.forEach(date => {
if (date.startsWith("2026-05") || date === today) {
const dayDiv = document.createElement("div");
dayDiv.className = `calendar-day ${date === today ? 'today' : ''}`;
const dateStr = new Date(date).toLocaleDateString('en-US', { month: 'short', day: 'numeric' });
let itemsHtml = groups[date].map(c => `
<div class="calendar-item" data-id="${c.id}" onclick="highlightPathsById('${c.id}')" style="cursor:pointer">
<span>${c.ticker}</span>
<span class="badge ${date < today ? 'badge-reported' : ''}">${date < today ? '✓' : ''}</span>
</div>
`).join("");
dayDiv.innerHTML = `
<div class="calendar-date">${dateStr}${date === today ? ' (Today)' : ''}</div>
${itemsHtml}
`;
calendar.appendChild(dayDiv);
}
});
}
function highlightPathsById(id) {
const company = companies.find(c => c.id === id);
if (company) highlightPaths(company);
}
function createFilters() {
const cats = ["all", "chip", "foundry", "equipment", "memory", "storage", "power", "cooling", "energy", "network", "server", "hyperscaler"];
const container = document.getElementById("filters");
container.innerHTML = "";
cats.forEach(cat => {
const btn = document.createElement("button");
btn.className = "filter";
btn.textContent = cat === "all" ? "All" : cat.charAt(0).toUpperCase() + cat.slice(1);
if (cat === "all") btn.classList.add("active");
btn.onclick = () => {
currentFilter = cat;
document.querySelectorAll(".filter").forEach(b => b.classList.remove("active"));
btn.classList.add("active");
filterGraph();
};
container.appendChild(btn);
});
}
function filterGraph() {
if (currentFilter === "all") {
nodeGroup.style("opacity", 1);
linkGroup.style("opacity", 0.65);
} else {
const visible = new Set(companies.filter(c => c.category === currentFilter).map(c => c.id));
nodeGroup.style("opacity", d => visible.has(d.id) ? 1 : 0.15);
linkGroup.style("opacity", d => (visible.has(d.source.id) && visible.has(d.target.id)) ? 0.65 : 0.08);
}
}
function highlightPaths(selected) {
// Update calendar highlights
document.querySelectorAll(".calendar-item").forEach(item => {
item.classList.toggle("active", item.getAttribute("data-id") === selected.id);
});
document.getElementById("selected-name").innerHTML = `
${selected.name} (${selected.ticker})
<span class="live-price ${selected.change >= 0 ? 'price-up' : 'price-down'}">
$${selected.price.toFixed(2)} (${selected.change >= 0 ? '+' : ''}${selected.change.toFixed(2)}%)
</span>
`;
const connected = new Set([selected.id]);
const upstream = new Set();
const downstream = new Set();
links.forEach(l => {
if (l.source.id === selected.id) { connected.add(l.target.id); downstream.add(l.target.id); }
if (l.target.id === selected.id) { connected.add(l.source.id); upstream.add(l.source.id); }
});
nodeGroup.selectAll("circle").classed("highlight-node", d => d.id === selected.id || connected.has(d.id));
linkGroup.classed("highlight-link", d =>
(d.source.id === selected.id || d.target.id === selected.id)
);
const impactHTML = `
<div style="margin-bottom:15px; padding:10px; background:rgba(255,215,0,0.1); border-radius:8px; border:1px solid #ffd70044;">
<strong>AI Revenue Exposure:</strong> <span class="ai-exposure" style="font-size:1.2em;">${selected.aiExposure}%</span>
</div>
<strong>Strategic Profit Flow:</strong><br>
<p style="color:#cbd5e1; margin-top:5px;">${getProfitImpact(selected.id)}</p>
<div style="display:flex; gap:10px; margin-top:15px;">
<div style="flex:1; background:rgba(0,255,157,0.05); padding:8px; border-radius:6px; border:1px dashed #00ff9d44;">
<small style="color:#00ff9d; display:block;">Upstream Partners</small>
${Array.from(upstream).slice(0, 3).join(", ") || "N/A"}
</div>
<div style="flex:1; background:rgba(0,212,255,0.05); padding:8px; border-radius:6px; border:1px dashed #00d4ff44;">
<small style="color:#00d4ff; display:block;">Downstream Customers</small>
${Array.from(downstream).slice(0, 3).join(", ") || "N/A"}
</div>
</div>
<div style="margin-top:20px; border-top:1px solid #334155; padding-top:15px; display:flex; justify-content:space-between; align-items:center;">
<div>
<small style="color:var(--text-dim); display:block;">Next Earnings</small>
<strong style="color:#ffd700;">${selected.earnings}</strong>
</div>
<a href="https://finance.yahoo.com/quote/${selected.ticker}" target="_blank" style="color:var(--accent); text-decoration:none; font-size:0.8em; padding:6px 12px; border:1px solid var(--accent); border-radius:6px; transition: all 0.2s;">
Yahoo Finance ↗
</a>
</div>
`;
document.getElementById("impact-details").innerHTML = impactHTML;
}
function getProfitImpact(id) {
const map = {
"NVDA": "<strong>King of Compute:</strong> Supplies Blackwell GPUs to MSFT/META. Relies on TSM (Production) and MU (Memory). <br><strong>Earnings Outlook:</strong> Stock booms if GB200 Blackwell orders exceed current $100B estimates. Price targets are rising on H100 margin persistence.",
"AMD": "<strong>The Alternative:</strong> Gaining 15% market share from NVDA with MI300X. Linked to MSFT and META as a secondary supplier. <br><strong>Earnings Outlook:</strong> Stock rises if software (ROCm) adoption shows parity with CUDA, enabling Hyperscalers to swap chips.",
"TSM": "<strong>The Sole Gateway:</strong> Manufactures 100% of advanced AI silicon for NVDA, AMD, and ARM. Bottleneck of the entire ecosystem. <br><strong>Earnings Outlook:</strong> Massive capex spend ($30B+) signals long-term multi-year growth in 2nm nodes.",
"BE": "<strong>Off-Grid Power:</strong> Solves the 5-year grid wait time for MSFT/AMZN by providing hydrogen fuel cells for instant power. <br><strong>Earnings Outlook:</strong> Stock is a 'Power Play'—booms as soon as grid-constrained data centers sign MW-scale fuel cell contracts.",
"VRT": "<strong>Thermal Mastery:</strong> The liquid cooling bottleneck. Essential for cooling NVIDIA GB200 racks (120kW+). <br><strong>Earnings Outlook:</strong> High-margin service revenue from retrofitting air-cooled centers for high-density AI heat loads.",
"NETWEB": "<strong>India's AI Builder:</strong> Local server integrator for NVDA under the Sovereign AI initiative. Key for India's Digital Mission. <br><strong>Earnings Outlook:</strong> Large orders from Indian Govt and private telcos (Jio) for indigenous AI infrastructure.",
"RELIANCE": "<strong>Sovereign AI Lead:</strong> Building gigawatt-scale data centers for Jio. Partnered with NVDA for an India-specific AI stack. <br><strong>Earnings Outlook:</strong> Valuation expands as Jio transforms from a Telco into an AI/Cloud powerhouse.",
"ANET": "<strong>Network Spine:</strong> Ethernet leader vs InfiniBand. Key partner for META's 600,000 GPU cluster. <br><strong>Earnings Outlook:</strong> Gains from the 'Ethernet-is-Better' narrative for massive-scale cluster interconnects.",
"ASML": "<strong>Photolithography Monopolist:</strong> Only company capable of building EUV machines needed for 2nm/3nm AI chips. <br><strong>Earnings Outlook:</strong> Rebound expected as foundries (TSM, INTC) ramp up next-gen fab capacity for 2027.",
"MU": "<strong>The HBM Bottleneck:</strong> Supplies High Bandwidth Memory (HBM3e) for NVDA GPUs. Memory is the current supply constraint. <br><strong>Earnings Outlook:</strong> Record-high ASPs (Average Selling Prices) for memory will lead to huge profit surprises.",
"PSTG": "<strong>AI Storage Feed:</strong> Flash storage is 10x faster for feeding data into GPU clusters than legacy drives. <br><strong>Earnings Outlook:</strong> Booms as 'Retrieval-Augmented Generation' (RAG) makes fast storage critical for enterprise AI.",
"E2E": "<strong>The GPU Cloud:</strong> Providing 'GPU-as-a-Service' to Indian startups. Cloud-native alternative to AWS for cheaper AI training. <br><strong>Earnings Outlook:</strong> Massive subscriber growth from Indian SaaS and AI startups migrating from US-based clouds.",
"LT": "<strong>The Builder:</strong> Dominant EPC contractor for data center shells and power transmission in India. <br><strong>Earnings Outlook:</strong> Record order book from AdaniConneX and Nxtra projects signaling a multi-year construction boom.",
"WDC": "<strong>Storage Giant:</strong> Critical supplier of NAND/SSD for AI model weights. SanDisk brand dominates edge AI storage. <br><strong>Earnings Outlook:</strong> Stock booms as data center SSD shortages lead to 20% price spikes.",
"STX": "<strong>Mass Capacity:</strong> Leader in high-capacity HDDs needed for training data archives. <br><strong>Earnings Outlook:</strong> Massive margin expansion as Hyperscalers ramp up 'Warm Storage' capacity.",
"SMSN": "<strong>The Memory Rival:</strong> Challenging SK Hynix for NVIDIA's HBM3e business. Also a logic foundry alternative to TSM. <br><strong>Earnings Outlook:</strong> Massive profit expansion as HBM qualification for Blackwell GPUs is confirmed.",
"APH": "<strong>AI Nerve System:</strong> Supplies high-speed connectors and internal rack cabling for NVDA GB200 systems. <br><strong>Earnings Outlook:</strong> Revenue grows with 'Rack-Scale' AI sales, which require 10x more cabling than legacy servers.",
"REC": "<strong>Green Grid Engine:</strong> Financing the massive power infrastructure needed for India's 1.5GW data center expansion. <br><strong>Earnings Outlook:</strong> Profit surge from high-yield loans to renewable energy and grid-modernization projects.",
"ETN": "<strong>Power Distribution:</strong> Controls the switchgear and electrical flow for Hyperscale sites. <br><strong>Earnings Outlook:</strong> Stock rises as 'Electrification of AI' becomes the #1 priority for cloud providers.",
"GLW": "<strong>Optical Backbone:</strong> Provides the specialized fiber needed for the Meta/Microsoft multi-site data center interconnects. <br><strong>Earnings Outlook:</strong> Booms on massive fiber pull-through from AI clusters requiring ultra-low latency.",
"STLTECH": "<strong>Digital Infrastructure:</strong> Building the end-to-end fiber connectivity for Indian AI data centers. <br><strong>Earnings Outlook:</strong> Stock is a 'Turnaround Play'—gaining from the massive shift to high-density 5G/AI networks.",
"PFC": "<strong>Power Finance Lead:</strong> Primary lender for India's massive energy grid expansion. <br><strong>Earnings Outlook:</strong> Valuation catch-up as credit growth hits 10-year highs due to AI power demand.",
"HFCL": "<strong>Networking Native:</strong> Indigenous provider of fiber-optic cables and 5G/AI networking gear for the Reliance/Jio ecosystem. <br><strong>Earnings Outlook:</strong> Booms as 'Make in India' mandates force tech giants to source networking gear locally.",
"SNPS": "<strong>The Architect's Tool:</strong> Provides the EDA software without which NVDA cannot design a single transistor. <br><strong>Earnings Outlook:</strong> Massive growth from 'Custom Silicon' trend as MSFT/GOOGL design their own AI chips.",
"TER": "<strong>Quality Control:</strong> The final gatekeeper. Tests every AI chip for defects before it leaves the factory. <br><strong>Earnings Outlook:</strong> Complexity of 3nm chips means testing takes 2x longer, driving more machine sales.",
"KAYNES": "<strong>India's AI Factory:</strong> Critical EMS partner for manufacturing AI servers and IoT nodes in India. <br><strong>Earnings Outlook:</strong> Stock booms on PLI disbursement and new export orders for AI-ready telecom gear.",
"TOELY": "<strong>Fab Precision:</strong> Supplies the etching and deposition machines for TSM's most advanced nodes. <br><strong>Earnings Outlook:</strong> Booms as the industry shifts to 'GAA' (Gate-All-Around) transistors for 2nm AI chips."
};
return map[id] || "<strong>Critical Component:</strong> This company provides essential 'Picks and Shovels' for the AI data center buildout. Its stock price is highly sensitive to the Capex spending announcements of Hyperscalers (MSFT, AMZN, GOOGL).";
}
function renderCompanyList() {
const ul = document.getElementById("company-list");
ul.innerHTML = "";
companies.sort((a, b) => b.aiExposure - a.aiExposure).forEach(c => {
const li = document.createElement("li");
li.innerHTML = `
<div>
<strong>${c.name}</strong> <small style="color:#94a3b8">${c.ticker}</small>
<div style="font-size:0.8em; color:#ffd700">${c.aiExposure}% Exposure</div>
</div>
<div class="live-price ${c.change >= 0 ? 'price-up' : 'price-down'}">
${c.currency === 'INR' ? '₹' : '$'}${c.price.toLocaleString()}
<div style="font-size:0.7em; text-align:right;">${c.change >= 0 ? '+' : ''}${c.change.toFixed(2)}%</div>
</div>
`;
li.onclick = () => highlightPaths(c);
ul.appendChild(li);
});
}
function startStockPulse() {
setInterval(() => {
companies.forEach(c => {
const volatility = 0.002; // 0.2% max move per tick
const move = (Math.random() - 0.5) * volatility;
c.price *= (1 + move);
c.change = ((Math.random() * 4) - 2); // Simulating daily change
});
renderCompanyList();
}, 3000);
}
async function fetchLivePrices(apiKey) {
try {
const promises = companies.slice(0, 10).map(c =>
fetch(`https://finnhub.io/api/v1/quote?symbol=${c.ticker}&token=${apiKey}`)
.then(res => res.json())
.then(data => {
if (data.c) {
c.price = data.c;
c.change = data.dp;
}
})
);
await Promise.all(promises);
renderCompanyList();
} catch (e) {
console.error("Live fetch failed", e);
}
}
function dragstarted(event) { if (!event.active) simulation.alphaTarget(0.3).restart(); event.subject.fx = event.subject.x; event.subject.fy = event.subject.y; }
function dragged(event) { event.subject.fx = event.x; event.subject.fy = event.y; }
function dragended(event) { if (!event.active) simulation.alphaTarget(0); event.subject.fx = null; event.subject.fy = null; }
document.getElementById("search").addEventListener("keyup", function () {
const term = this.value.toLowerCase();
document.querySelectorAll("#company-list li").forEach(li => {
li.style.display = li.textContent.toLowerCase().includes(term) ? "" : "none";
});
});
window.onload = initGraph;
</script>
</body>
</html> |