Spaces:
Running
Running
File size: 46,602 Bytes
75139ed 3137d1b 75139ed 3137d1b 75139ed | 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 | <!DOCTYPE html>
<html lang="en" class="scroll-smooth">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Advanced Analysis | Pinky Forecasters</title>
<link rel="icon" type="image/x-icon" href="/static/favicon.ico">
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/feather-icons"></script>
<script src="https://cdn.jsdelivr.net/npm/vue@3/dist/vue.global.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script src="https://cdn.jsdelivr.net/npm/luxon@3.0.1/build/global/luxon.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chartjs-adapter-luxon@1.2.0/dist/chartjs-adapter-luxon.min.js"></script>
</head>
<body class="bg-white font-sans antialiased">
<div id="app" class="min-h-screen flex flex-col">
<!-- Navigation -->
<nav class="bg-white border-b border-pink-100 sticky top-0 z-50">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex justify-between h-16">
<div class="flex items-center">
<div class="flex-shrink-0 flex items-center">
<i data-feather="trending-up" class="h-8 w-8 text-primary-500"></i>
<span class="ml-2 text-xl font-bold text-gray-900">Pinky Forecasters</span>
</div>
</div>
<div class="hidden sm:ml-6 sm:flex sm:items-center">
<a href="dashboard.html" class="px-3 py-2 rounded-md text-sm font-medium text-gray-500 hover:text-gray-700">Dashboard</a>
<a href="fundamentals.html" class="px-3 py-2 rounded-md text-sm font-medium text-gray-500 hover:text-gray-700 ml-4">Fundamentals</a>
<a href="analysis.html" class="px-3 py-2 rounded-md text-sm font-medium text-primary-600 bg-pink-50 ml-4">Analysis</a>
<button class="ml-4 inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-primary-500 hover:bg-primary-600 focus:outline-none">
<i data-feather="user" class="mr-2 h-4 w-4"></i> Sign In
</button>
</div>
<div class="-mr-2 flex items-center sm:hidden">
<button @click="mobileMenuOpen = !mobileMenuOpen" class="inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-gray-500 hover:bg-gray-100 focus:outline-none">
<i :data-feather="mobileMenuOpen ? 'x' : 'menu'" class="h-6 w-6"></i>
</button>
</div>
</div>
</div>
<!-- Mobile menu -->
<div v-show="mobileMenuOpen" class="sm:hidden border-t border-pink-100">
<div class="pt-2 pb-3 space-y-1">
<a href="dashboard.html" class="block px-3 py-2 rounded-md text-base font-medium text-gray-500 hover:text-gray-700">Dashboard</a>
<a href="fundamentals.html" class="block px-3 py-2 rounded-md text-base font-medium text-gray-500 hover:text-gray-700">Fundamentals</a>
<a href="analysis.html" class="block px-3 py-2 rounded-md text-base font-medium text-primary-600 bg-pink-50">Analysis</a>
<button class="w-full mt-2 inline-flex justify-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-primary-500 hover:bg-primary-600 focus:outline-none">
<i data-feather="user" class="mr-2 h-4 w-4"></i> Sign In
</button>
</div>
</div>
</nav>
<!-- Main Content -->
<main class="flex-grow">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
<div class="text-center mb-12">
<h1 class="text-4xl font-extrabold text-gray-900 sm:text-5xl">
<span class="text-primary-500">Advanced</span> Market Analysis
</h1>
<p class="mt-3 max-w-2xl mx-auto text-xl text-gray-500">
In-depth technical, fundamental and sentiment indicators
</p>
</div>
<!-- Asset Selector -->
<div class="bg-white shadow rounded-lg p-6 mb-8">
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Select Asset</label>
<select v-model="selectedAsset" @change="loadAssetData" class="w-full rounded-md border-gray-300 shadow-sm focus:border-primary-500 focus:ring-primary-500">
<option v-for="asset in assets" :value="asset.symbol">{{ asset.name }} ({{ asset.symbol }})</option>
</select>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Timeframe</label>
<select v-model="selectedTimeframe" @change="loadAssetData" class="w-full rounded-md border-gray-300 shadow-sm focus:border-primary-500 focus:ring-primary-500">
<option value="1m">1 Month</option>
<option value="3m">3 Months</option>
<option value="6m">6 Months</option>
<option value="1y">1 Year</option>
</select>
</div>
</div>
</div>
<!-- Score Summary -->
<div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-8">
<!-- Overall Score -->
<div class="bg-white shadow rounded-lg p-6 border-l-4" :class="getScoreBorderClass(assetData.overall_score)">
<div class="flex items-center">
<div class="rounded-full p-3 mr-4" :class="getScoreBgClass(assetData.overall_score)">
<i data-feather="activity" class="h-6 w-6 text-white"></i>
</div>
<div>
<p class="text-sm text-gray-500">Overall Score</p>
<h3 class="text-2xl font-bold" :class="getScoreTextClass(assetData.overall_score)">
{{ assetData.overall_score || '--' }}
</h3>
</div>
</div>
</div>
<!-- Fundamental Score -->
<div class="bg-white shadow rounded-lg p-6 border-l-4" :class="getScoreBorderClass(assetData.fundamental_score)">
<div class="flex items-center">
<div class="rounded-full p-3 mr-4" :class="getScoreBgClass(assetData.fundamental_score)">
<i data-feather="layers" class="h-6 w-6 text-white"></i>
</div>
<div>
<p class="text-sm text-gray-500">Fundamental</p>
<h3 class="text-2xl font-bold" :class="getScoreTextClass(assetData.fundamental_score)">
{{ assetData.fundamental_score || '--' }}
</h3>
</div>
</div>
</div>
<!-- Technical Score -->
<div class="bg-white shadow rounded-lg p-6 border-l-4" :class="getScoreBorderClass(assetData.technical_score)">
<div class="flex items-center">
<div class="rounded-full p-3 mr-4" :class="getScoreBgClass(assetData.technical_score)">
<i data-feather="trending-up" class="h-6 w-6 text-white"></i>
</div>
<div>
<p class="text-sm text-gray-500">Technical</p>
<h3 class="text-2xl font-bold" :class="getScoreTextClass(assetData.technical_score)">
{{ assetData.technical_score || '--' }}
</h3>
</div>
</div>
</div>
</div>
<!-- Charts Section -->
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6 mb-8">
<!-- Price Chart -->
<div class="bg-white shadow rounded-lg p-6">
<div class="flex justify-between items-center mb-4">
<h3 class="text-lg font-medium text-gray-900">Price Action</h3>
<div class="flex space-x-2">
<button @click="setChartType('line')" class="px-2 py-1 text-sm rounded" :class="chartType === 'line' ? 'bg-primary-100 text-primary-600' : 'text-gray-500 hover:bg-gray-100'">
Line
</button>
<button @click="setChartType('candlestick')" class="px-2 py-1 text-sm rounded" :class="chartType === 'candlestick' ? 'bg-primary-100 text-primary-600' : 'text-gray-500 hover:bg-gray-100'">
Candles
</button>
</div>
</div>
<div class="h-80">
<canvas ref="priceChart"></canvas>
</div>
</div>
<!-- Volume Chart -->
<div class="bg-white shadow rounded-lg p-6">
<h3 class="text-lg font-medium text-gray-900 mb-4">Volume & Open Interest</h3>
<div class="h-80">
<canvas ref="volumeChart"></canvas>
</div>
</div>
</div>
<!-- Indicators Section -->
<div class="bg-white shadow rounded-lg p-6 mb-8">
<h3 class="text-lg font-medium text-gray-900 mb-6">Key Indicators</h3>
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
<!-- Macro Indicators -->
<div>
<h4 class="text-md font-medium text-gray-900 mb-3 flex items-center">
<i data-feather="globe" class="h-4 w-4 mr-2 text-primary-500"></i>
Macro Indicators
</h4>
<div class="space-y-3">
<div>
<div class="flex justify-between text-sm mb-1">
<span class="text-gray-500">GDP Growth</span>
<span class="font-medium" :class="getChangeClass(assetData.gdp_change)">{{ assetData.gdp_change || '--' }}%</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2">
<div class="bg-blue-500 h-2 rounded-full" :style="{ width: Math.min(100, Math.max(0, 50 + assetData.gdp_change * 10)) + '%' }"></div>
</div>
</div>
<div>
<div class="flex justify-between text-sm mb-1">
<span class="text-gray-500">Inflation</span>
<span class="font-medium" :class="getChangeClass(assetData.inflation)">{{ assetData.inflation || '--' }}%</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2">
<div class="bg-purple-500 h-2 rounded-full" :style="{ width: Math.min(100, Math.max(0, assetData.inflation * 10)) + '%' }"></div>
</div>
</div>
<div>
<div class="flex justify-between text-sm mb-1">
<span class="text-gray-500">Interest Rate</span>
<span class="font-medium">{{ assetData.interest_rate || '--' }}%</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2">
<div class="bg-green-500 h-2 rounded-full" :style="{ width: Math.min(100, Math.max(0, assetData.interest_rate * 10)) + '%' }"></div>
</div>
</div>
</div>
</div>
<!-- Technical Indicators -->
<div>
<h4 class="text-md font-medium text-gray-900 mb-3 flex items-center">
<i data-feather="bar-chart-2" class="h-4 w-4 mr-2 text-primary-500"></i>
Technical Indicators
</h4>
<div class="space-y-3">
<div>
<div class="flex justify-between text-sm mb-1">
<span class="text-gray-500">RSI (14)</span>
<span class="font-medium" :class="getRsiClass(assetData.rsi)">{{ assetData.rsi || '--' }}</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2">
<div class="bg-yellow-500 h-2 rounded-full" :style="{ width: assetData.rsi || 0 + '%' }"></div>
</div>
</div>
<div>
<div class="flex justify-between text-sm mb-1">
<span class="text-gray-500">MACD</span>
<span class="font-medium" :class="getMacdClass(assetData.macd)">{{ assetData.macd || '--' }}</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2">
<div class="bg-red-500 h-2 rounded-full" :style="{ width: Math.min(100, Math.max(0, 50 + (assetData.macd * 10))) + '%' }"></div>
</div>
</div>
<div>
<div class="flex justify-between text-sm mb-1">
<span class="text-gray-500">Volatility</span>
<span class="font-medium">{{ assetData.volatility || '--' }}%</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2">
<div class="bg-pink-500 h-2 rounded-full" :style="{ width: Math.min(100, assetData.volatility || 0 * 2) + '%' }"></div>
</div>
</div>
</div>
</div>
<!-- Sentiment Indicators -->
<div>
<h4 class="text-md font-medium text-gray-900 mb-3 flex items-center">
<i data-feather="users" class="h-4 w-4 mr-2 text-primary-500"></i>
Sentiment Indicators
</h4>
<div class="space-y-3">
<div>
<div class="flex justify-between text-sm mb-1">
<span class="text-gray-500">COT Net Position</span>
<span class="font-medium" :class="getChangeClass(assetData.cot_net)">{{ assetData.cot_net || '--' }}%</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2">
<div class="bg-indigo-500 h-2 rounded-full" :style="{ width: Math.min(100, Math.max(0, 50 + assetData.cot_net)) + '%' }"></div>
</div>
</div>
<div>
<div class="flex justify-between text-sm mb-1">
<span class="text-gray-500">Put/Call Ratio</span>
<span class="font-medium">{{ assetData.put_call || '--' }}</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2">
<div class="bg-teal-500 h-2 rounded-full" :style="{ width: Math.min(100, Math.max(0, assetData.put_call * 100)) + '%' }"></div>
</div>
</div>
<div>
<div class="flex justify-between text-sm mb-1">
<span class="text-gray-500">Social Sentiment</span>
<span class="font-medium" :class="getChangeClass(assetData.sentiment)">{{ assetData.sentiment || '--' }}%</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2">
<div class="bg-blue-400 h-2 rounded-full" :style="{ width: Math.min(100, Math.max(0, 50 + assetData.sentiment)) + '%' }"></div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Recommendations -->
<div class="bg-white shadow rounded-lg p-6">
<h3 class="text-lg font-medium text-gray-900 mb-4">Trading Recommendations</h3>
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
<div class="bg-gray-50 rounded-lg p-4">
<div class="flex items-center mb-3">
<div class="rounded-full p-2 mr-3" :class="getBiasBgClass(assetData.bias)">
<i data-feather="alert-circle" class="h-5 w-5 text-white"></i>
</div>
<h4 class="text-md font-medium">Current Bias</h4>
</div>
<p class="text-sm text-gray-600">
{{ assetData.bias_analysis || 'Loading analysis...' }}
</p>
</div>
<div class="bg-gray-50 rounded-lg p-4">
<div class="flex items-center mb-3">
<div class="rounded-full p-2 mr-3 bg-blue-100">
<i data-feather="target" class="h-5 w-5 text-blue-500"></i>
</div>
<h4 class="text-md font-medium">Key Levels</h4>
</div>
<div class="grid grid-cols-2 gap-2 text-sm">
<div>
<p class="text-gray-500">Resistance</p>
<p class="font-medium">{{ assetData.resistance || '--' }}</p>
</div>
<div>
<p class="text-gray-500">Support</p>
<p class="font-medium">{{ assetData.support || '--' }}</p>
</div>
<div>
<p class="text-gray-500">Pivot</p>
<p class="font-medium">{{ assetData.pivot || '--' }}</p>
</div>
<div>
<p class="text-gray-500">ATR</p>
<p class="font-medium">{{ assetData.atr || '--' }}</p>
</div>
</div>
</div>
<div class="bg-gray-50 rounded-lg p-4">
<div class="flex items-center mb-3">
<div class="rounded-full p-2 mr-3 bg-green-100">
<i data-feather="calendar" class="h-5 w-5 text-green-500"></i>
</div>
<h4 class="text-md font-medium">Seasonality</h4>
</div>
<p class="text-sm text-gray-600">
{{ assetData.seasonality || 'Loading seasonality data...' }}
</p>
</div>
</div>
</div>
</div>
</main>
<!-- Footer -->
<footer class="bg-white border-t border-pink-100 mt-auto">
<div class="max-w-7xl mx-auto py-12 px-4 sm:px-6 lg:px-8">
<div class="xl:grid xl:grid-cols-3 xl:gap-8">
<div class="space-y-8 xl:col-span-1">
<div class="flex items-center">
<i data-feather="trending-up" class="h-8 w-8 text-primary-500"></i>
<span class="ml-2 text-xl font-bold text-gray-900">Pinky Forecasters</span>
</div>
<p class="text-gray-500 text-base">
Making financial forecasting fun and accessible.
</p>
<div class="flex space-x-6">
<a href="#" class="text-gray-400 hover:text-gray-500">
<i data-feather="twitter" class="h-6 w-6"></i>
</a>
<a href="#" class="text-gray-400 hover:text-gray-500">
<i data-feather="facebook" class="h-6 w-6"></i>
</a>
<a href="#" class="text-gray-400 hover:text-gray-500">
<i data-feather="instagram" class="h-6 w-6"></i>
</a>
<a href="#" class="text-gray-400 hover:text-gray-500">
<i data-feather="linkedin" class="h-6 w-6"></i>
</a>
</div>
</div>
<div class="mt-12 grid grid-cols-2 gap-8 xl:mt-0 xl:col-span-2">
<div class="md:grid md:grid-cols-2 md:gap-8">
<div>
<h3 class="text-sm font-semibold text-gray-500 tracking-wider uppercase">
Products
</h3>
<div class="mt-4 space-y-4">
<a href="index.html" class="text-base text-gray-500 hover:text-gray-900 block">
Market Forecasts
</a>
<a href="fundamentals.html" class="text-base text-gray-500 hover:text-gray-900 block">
Fundamental Analysis
</a>
<a href="analysis.html" class="text-base text-gray-500 hover:text-gray-900 block">
Advanced Tools
</a>
</div>
</div>
<div class="mt-12 md:mt-0">
<h3 class="text-sm font-semibold text-gray-500 tracking-wider uppercase">
Resources
</h3>
<div class="mt-4 space-y-4">
<a href="#" class="text-base text-gray-500 hover:text-gray-900 block">
Documentation
</a>
<a href="#" class="text-base text-gray-500 hover:text-gray-900 block">
Guides
</a>
<a href="#" class="text-base text-gray-500 hover:text-gray-900 block">
Blog
</a>
</div>
</div>
</div>
<div class="md:grid md:grid-cols-2 md:gap-8">
<div>
<h3 class="text-sm font-semibold text-gray-500 tracking-wider uppercase">
Company
</h3>
<div class="mt-4 space-y-4">
<a href="#" class="text-base text-gray-500 hover:text-gray-900 block">
About
</a>
<a href="#" class="text-base text-gray-500 hover:text-gray-900 block">
Careers
</a>
<a href="#" class="text-base text-gray-500 hover:text-gray-900 block">
Contact
</a>
</div>
</div>
<div class="mt-12 md:mt-0">
<h3 class="text-sm font-semibold text-gray-500 tracking-wider uppercase">
Legal
</h3>
<div class="mt-4 space-y-4">
<a href="#" class="text-base text-gray-500 hover:text-gray-900 block">
Privacy
</a>
<a href="#" class="text-base text-gray-500 hover:text-gray-900 block">
Terms
</a>
<a href="#" class="text-base text-gray-500 hover:text-gray-900 block">
Compliance
</a>
</div>
</div>
</div>
</div>
</div>
<div class="mt-12 border-t border-gray-200 pt-8">
<p class="text-base text-gray-400 text-center">
© 2023 Pinky Finance Forecasters. All rights reserved.
</p>
</div>
</div>
</footer>
</div>
<script>
feather.replace();
const { createApp, ref, onMounted, watch } = Vue;
createApp({
setup() {
const mobileMenuOpen = ref(false);
const selectedAsset = ref('EURUSD');
const selectedTimeframe = ref('1m');
const chartType = ref('line');
const priceChart = ref(null);
const volumeChart = ref(null);
let priceChartInstance = null;
let volumeChartInstance = null;
const assets = ref([
{ symbol: 'EURUSD', name: 'Euro/Dollar', icon: 'dollar-sign' },
{ symbol: 'USDJPY', name: 'Dollar/Yen', icon: 'dollar-sign' },
{ symbol: 'XAUUSD', name: 'Gold', icon: 'award' },
{ symbol: 'CL1!', name: 'Crude Oil', icon: 'droplet' },
{ symbol: 'SPX500', name: 'S&P 500', icon: 'bar-chart-2' },
{ symbol: 'NDX', name: 'Nasdaq 100', icon: 'bar-chart-2' }
]);
const assetData = ref({
overall_score: null,
fundamental_score: null,
technical_score: null,
bias: 'Neutral',
bias_analysis: '',
gdp_change: null,
inflation: null,
interest_rate: null,
rsi: null,
macd: null,
volatility: null,
cot_net: null,
put_call: null,
sentiment: null,
resistance: null,
support: null,
pivot: null,
atr: null,
seasonality: '',
price_history: [],
volume_history: []
});
const loadAssetData = async () => {
try {
// Fetch asset data from APIs
const [fundamentals, technicals, sentiment] = await Promise.all([
fetchFundamentalData(),
fetchTechnicalData(),
fetchSentimentData()
]);
// Calculate overall score
const overallScore = Math.round(
fundamentals.score * 0.4 +
technicals.score * 0.4 +
sentiment.score * 0.2
);
// Update asset data
assetData.value = {
overall_score: overallScore,
fundamental_score: fundamentals.score,
technical_score: technicals.score,
bias: getBiasFromScore(overallScore),
bias_analysis: getBiasAnalysis(overallScore),
gdp_change: fundamentals.gdp_change,
inflation: fundamentals.inflation,
interest_rate: fundamentals.interest_rate,
rsi: technicals.rsi,
macd: technicals.macd,
volatility: technicals.volatility,
cot_net: sentiment.cot_net,
put_call: sentiment.put_call,
sentiment: sentiment.social_sentiment,
resistance: technicals.resistance,
support: technicals.support,
pivot: technicals.pivot,
atr: technicals.atr,
seasonality: getSeasonalityAnalysis(),
price_history: technicals.price_history,
volume_history: technicals.volume_history
};
// Update charts
updateCharts();
} catch (error) {
console.error('Error loading asset data:', error);
}
};
const fetchFundamentalData = async () => {
try {
const response = await fetch(`https://api.marketdata.com/v3/fundamentals/${selectedAsset.value}`);
const data = await response.json();
return {
score: data.overall_score,
gdp_change: data.gdp_change,
inflation: data.inflation_rate,
interest_rate: data.interest_rate
};
} catch (error) {
console.error('Error fetching fundamental data:', error);
return {
score: 50,
gdp_change: 0,
inflation: 0,
interest_rate: 0
};
}
};
const fetchTechnicalData = async () => {
try {
const response = await fetch(`https://api.marketdata.com/v3/technicals/${selectedAsset.value}?timeframe=${selectedTimeframe.value}`);
const data = await response.json();
return {
score: data.overall_score,
rsi: data.rsi,
macd: data.macd,
volatility: data.volatility,
resistance: data.resistance,
support: data.support,
pivot: data.pivot,
atr: data.atr,
price_history: data.price_history,
volume_history: data.volume_history
};
} catch (error) {
console.error('Error fetching technical data:', error);
return {
score: 50,
rsi: 50,
macd: 0,
volatility: 0,
resistance: 0,
support: 0,
pivot: 0,
atr: 0,
price_history: [],
volume_history: []
};
}
};
const fetchSentimentData = async () => {
try {
const response = await fetch(`https://api.marketdata.com/v3/sentiment/${selectedAsset.value}`);
const data = await response.json();
return {
score: data.overall_score,
cot_net: data.cot_net_position,
put_call: data.put_call_ratio,
social_sentiment: data.social_sentiment
};
} catch (error) {
console.error('Error fetching sentiment data:', error);
return {
score: 50,
cot_net: 0,
put_call: 0,
social_sentiment: 0
};
}
};
const getBiasFromScore = (score) => {
if (score > 60) return 'Bullish';
if (score < 40) return 'Bearish';
return 'Neutral';
};
const getBiasAnalysis = (score) => {
if (score > 60) return 'Strong bullish fundamentals with positive technical indicators suggest potential upside.';
if (score > 40) return 'Moderately bullish conditions with mixed signals. Favor long positions with tight stops.';
if (score > 30) return 'Neutral to slightly bearish. Consider range-bound strategies or staying sidelined.';
return 'Strong bearish signals across indicators. Short opportunities may be favorable.';
};
const getSeasonalityAnalysis = () => {
const month = new Date().getMonth();
const seasonalPatterns = {
'EURUSD': month > 3 && month < 9 ? 'Typically weaker in summer months' : 'Historically stronger in Q4',
'USDJPY': 'Tends to strengthen in risk-off environments',
'XAUUSD': 'Strongest performance in Q1 and Q4',
'CL1!': 'Summer driving season typically supports prices',
'SPX500': 'Historically strong November-April period',
'NDX': 'Tech often outperforms in Q4'
};
return seasonalPatterns[selectedAsset.value] || 'No strong seasonal pattern detected';
};
const setChartType = (type) => {
chartType.value = type;
updateCharts();
};
const updateCharts = () => {
// Destroy existing charts if they exist
if (priceChartInstance) priceChartInstance.destroy();
if (volumeChartInstance) volumeChartInstance.destroy();
// Create new price chart
const priceCtx = priceChart.value.getContext('2d');
priceChartInstance = new Chart(priceCtx, {
type: chartType.value === 'line' ? 'line' : 'candlestick',
data: {
labels: assetData.value.price_history.map((_, i) => `Day ${i+1}`),
datasets: chartType.value === 'line' ? [
{
label: 'Price',
data: assetData.value.price_history.map(p => p.close),
borderColor: '#3b82f6',
backgroundColor: 'rgba(59, 130, 246, 0.1)',
borderWidth: 2,
tension: 0.1,
fill: true
}
] : [
{
label: 'Candles',
data: assetData.value.price_history.map(p => ({
x: p.date,
o: p.open,
h: p.high,
l: p.low,
c: p.close
})),
color: {
up: '#10b981',
down: '#ef4444',
unchanged: '#64748b',
}
}
]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
title: {
display: true,
text: `${selectedAsset.value} Price Action`,
font: {
size: 16
}
},
legend: {
display: false
}
},
scales: {
x: {
type: 'time',
time: {
unit: 'day'
}
},
y: {
beginAtZero: false
}
}
}
});
// Create new volume chart
const volumeCtx = volumeChart.value.getContext('2d');
volumeChartInstance = new Chart(volumeCtx, {
type: 'bar',
data: {
labels: assetData.value.volume_history.map((_, i) => `Day ${i+1}`),
datasets: [
{
label: 'Volume',
data: assetData.value.volume_history.map(v => v.volume),
backgroundColor: 'rgba(99, 102, 241, 0.7)',
borderColor: 'rgba(99, 102, 241, 1)',
borderWidth: 1
},
{
label: 'Open Interest',
data: assetData.value.volume_history.map(v => v.open_interest),
backgroundColor: 'rgba(236, 72, 153, 0.7)',
borderColor: 'rgba(236, 72, 153, 1)',
borderWidth: 1,
type: 'line'
}
]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
title: {
display: true,
text: 'Volume & Open Interest',
font: {
size: 16
}
}
},
scales: {
x: {
stacked: true
},
y: {
stacked: false,
beginAtZero: true
}
}
}
});
};
// Helper methods for styling
const getScoreBorderClass = (score) => {
if (!score) return 'border-gray-300';
if (score > 60) return 'border-green-500';
if (score < 40) return 'border-red-500';
return 'border-yellow-500';
};
const getScoreBgClass = (score) => {
if (!score) return 'bg-gray-300';
if (score > 60) return 'bg-green-500';
if (score < 40) return 'bg-red-500';
return 'bg-yellow-500';
};
const getScoreTextClass = (score) => {
if (!score) return 'text-gray-900';
if (score > 60) return 'text-green-600';
if (score < 40) return 'text-red-600';
return 'text-yellow-600';
};
const getBiasBgClass = (bias) => {
switch(bias) {
case 'Bullish': return 'bg-green-500';
case 'Bearish': return 'bg-red-500';
default: return 'bg-yellow-500';
}
};
const getChangeClass = (value) => {
if (!value) return '';
return value > 0 ? 'text-green-600' : value < 0 ? 'text-red-600' : '';
};
const getRsiClass = (value) => {
if (!value) return '';
if (value > 70) return 'text-red-600';
if (value < 30) return 'text-green-600';
return '';
};
const getMacdClass = (value) => {
if (!value) return '';
return value > 0 ? 'text-green-600' : 'text-red-600';
};
// Initial load
onMounted(() => {
loadAssetData();
});
// Watch for asset changes
watch([selectedAsset, selectedTimeframe], () => {
loadAssetData();
});
return {
mobileMenuOpen,
assets,
selectedAsset,
selectedTimeframe,
chartType,
priceChart,
volumeChart,
assetData,
loadAssetData,
setChartType,
getScoreBorderClass,
getScoreBgClass,
getScoreTextClass,
getBiasBgClass,
getChangeClass,
getRsiClass,
getMacdClass
};
}
}).mount('#app');
</script>
</body>
</html> |