Spaces:
Running
Running
File size: 64,642 Bytes
5563527 |
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 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ForwardX - Advanced Forward Contract Trading</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<script>
tailwind.config = {
theme: {
extend: {
colors: {
primary: '#4f46e5',
secondary: '#10b981',
dark: '#1e293b',
light: '#f8fafc',
fractal: '#ED6B21',
bitcoin: '#F7931A',
bitcoinCash: '#0AC18E'
}
}
}
}
</script>
<style>
.gradient-bg {
background: linear-gradient(135deg, #4f46e5 0%, #10b981 100%);
}
.contract-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}
.chart-container {
height: 400px;
background-color: #f8fafc;
border-radius: 0.5rem;
}
.tab-active {
border-bottom: 3px solid #4f46e5;
color: #4f46e5;
font-weight: 600;
}
.order-book {
max-height: 300px;
overflow-y: auto;
}
.order-book::-webkit-scrollbar {
width: 5px;
}
.order-book::-webkit-scrollbar-thumb {
background-color: #cbd5e1;
border-radius: 10px;
}
#consentModal {
backdrop-filter: blur(5px);
}
.tradingview-widget-container iframe {
border-radius: 0.5rem;
}
.floating-action-btn {
position: fixed;
width: 60px;
height: 60px;
bottom: 40px;
right: 40px;
background-color: #4f46e5;
color: white;
border-radius: 50px;
text-align: center;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
z-index: 100;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: all 0.3s;
}
.floating-action-btn:hover {
transform: scale(1.1);
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}
.floating-action-menu {
position: fixed;
bottom: 110px;
right: 40px;
background: white;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
z-index: 99;
width: 250px;
overflow: hidden;
transform: translateY(20px);
opacity: 0;
visibility: hidden;
transition: all 0.3s;
}
.floating-action-menu.active {
transform: translateY(0);
opacity: 1;
visibility: visible;
}
.floating-action-item {
padding: 12px 16px;
display: flex;
align-items: center;
cursor: pointer;
transition: background 0.2s;
}
.floating-action-item:hover {
background: #f1f5f9;
}
.floating-action-item i {
margin-right: 10px;
font-size: 18px;
}
.floating-action-item.bitcoin i {
color: #F7931A;
}
.floating-action-item.fractal i {
color: #ED6B21;
}
.floating-action-item.bitcoin-cash i {
color: #0AC18E;
}
.price-movement-up {
animation: priceUp 1s ease-out;
}
.price-movement-down {
animation: priceDown 1s ease-out;
}
@keyframes priceUp {
0% { background-color: rgba(16, 185, 129, 0); }
50% { background-color: rgba(16, 185, 129, 0.3); }
100% { background-color: rgba(16, 185, 129, 0); }
}
@keyframes priceDown {
0% { background-color: rgba(239, 68, 68, 0); }
50% { background-color: rgba(239, 68, 68, 0.3); }
100% { background-color: rgba(239, 68, 68, 0); }
}
.crypto-badge {
display: inline-flex;
align-items: center;
padding: 2px 8px;
border-radius: 4px;
font-size: 12px;
font-weight: 600;
margin-left: 6px;
}
.badge-bitcoin {
background-color: #F7931A20;
color: #F7931A;
}
.badge-fractal {
background-color: #ED6B2120;
color: #ED6B21;
}
.badge-bitcoin-cash {
background-color: #0AC18E20;
color: #0AC18E;
}
</style>
</head>
<body class="bg-gray-50">
<!-- IP-based Account Notice -->
<div class="bg-blue-50 border-l-4 border-blue-500 p-4">
<div class="flex">
<div class="flex-shrink-0">
<i class="fas fa-info-circle text-blue-500 text-xl mt-1"></i>
</div>
<div class="ml-3">
<p class="text-sm text-blue-700">
Your session is automatically tracked via your IP address (<span id="userIP">detecting...</span>). No registration required.
</p>
</div>
</div>
</div>
<!-- Consent Modal -->
<div id="consentModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
<div class="bg-white rounded-lg p-6 max-w-md w-full">
<div class="flex items-center mb-4">
<i class="fas fa-shield-alt text-primary text-2xl mr-3"></i>
<h3 class="text-xl font-bold">Data Access Permission</h3>
</div>
<p class="mb-4 text-gray-700">
ForwardX would like to access market data from Trading Economics API to provide real-time forward contract pricing. This data will be used to display accurate market information and calculate contract values.
</p>
<div class="flex space-x-4">
<button id="denyConsent" class="flex-1 bg-gray-200 text-gray-800 py-2 rounded-md font-medium hover:bg-gray-300">Deny</button>
<button id="grantConsent" class="flex-1 bg-primary text-white py-2 rounded-md font-medium hover:bg-opacity-90">Allow</button>
</div>
</div>
</div>
<!-- Payment Modal -->
<div id="paymentModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
<div class="bg-white rounded-lg p-6 max-w-md w-full">
<div class="flex justify-between items-center mb-4">
<h3 class="text-xl font-bold" id="paymentTitle">Buy Forward Contract</h3>
<button id="closePaymentModal" class="text-gray-500 hover:text-gray-700">
<i class="fas fa-times"></i>
</button>
</div>
<div class="mb-4">
<label class="block text-gray-700 text-sm font-bold mb-2" for="cryptoAddress">
Your <span id="cryptoType">Bitcoin</span> Address
</label>
<input type="text" id="cryptoAddress" placeholder="Enter your cryptocurrency address" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-primary">
</div>
<div class="mb-4">
<label class="block text-gray-700 text-sm font-bold mb-2" for="contractAmount">
Contract Amount (USD)
</label>
<input type="number" id="contractAmount" placeholder="1000" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-primary">
</div>
<div class="mb-4">
<label class="block text-gray-700 text-sm font-bold mb-2" for="forwardPrice">
Forward Price (USD)
</label>
<input type="number" id="forwardPrice" placeholder="Enter forward price" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-primary">
</div>
<div class="mb-4 p-3 bg-gray-50 rounded-md">
<div class="flex justify-between mb-1">
<span class="text-gray-600">Current Spot Price:</span>
<span class="font-bold" id="currentSpotPrice">$52,123.45</span>
</div>
<div class="flex justify-between mb-1">
<span class="text-gray-600">You will pay:</span>
<span class="font-bold" id="cryptoAmount">0.0192 BTC</span>
</div>
<div class="flex justify-between">
<span class="text-gray-600">Expiry Date:</span>
<span class="font-bold" id="expiryDate">30 days</span>
</div>
</div>
<button id="confirmPayment" class="w-full bg-primary text-white py-3 rounded-md font-bold hover:bg-opacity-90">
Confirm & Pay with <span id="confirmCryptoType">Bitcoin</span>
</button>
</div>
</div>
<!-- Seller Agreement Modal -->
<div id="sellerModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
<div class="bg-white rounded-lg p-6 max-w-md w-full">
<div class="flex justify-between items-center mb-4">
<h3 class="text-xl font-bold">Sell Inventory Agreement</h3>
<button id="closeSellerModal" class="text-gray-500 hover:text-gray-700">
<i class="fas fa-times"></i>
</button>
</div>
<div class="mb-4">
<label class="block text-gray-700 text-sm font-bold mb-2" for="sellerAmount">
Amount to Sell (USD)
</label>
<input type="number" id="sellerAmount" placeholder="1000" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-primary">
</div>
<div class="mb-4">
<label class="block text-gray-700 text-sm font-bold mb-2" for="sellerPrice">
Forward Price (USD)
</label>
<input type="number" id="sellerPrice" placeholder="Enter forward price" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-primary">
</div>
<div class="mb-4">
<label class="block text-gray-700 text-sm font-bold mb-2" for="sellerExpiry">
Expiry Date
</label>
<input type="date" id="sellerExpiry" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-primary">
</div>
<div class="mb-4 p-3 bg-gray-50 rounded-md">
<div class="flex justify-between mb-1">
<span class="text-gray-600">Current Spot Price:</span>
<span class="font-bold">$52,123.45</span>
</div>
<div class="flex justify-between">
<span class="text-gray-600">You will receive at expiry:</span>
<span class="font-bold" id="sellerReceive">$52,123.45</span>
</div>
</div>
<button id="confirmSellerAgreement" class="w-full bg-green-500 text-white py-3 rounded-md font-bold hover:bg-green-600">
Create Sell Agreement
</button>
</div>
</div>
<!-- Header -->
<header class="gradient-bg text-white">
<div class="container mx-auto px-4 py-4">
<div class="flex justify-between items-center">
<div class="flex items-center space-x-2">
<i class="fas fa-forward text-2xl"></i>
<h1 class="text-2xl font-bold">ForwardX</h1>
</div>
<nav class="hidden md:flex space-x-6">
<a href="#" class="hover:text-gray-200">Markets</a>
<a href="#" class="hover:text-gray-200">Trade</a>
<a href="#" class="hover:text-gray-200">Derivatives</a>
<a href="#" class="hover:text-gray-200">Portfolio</a>
<a href="#" class="hover:text-gray-200">Learn</a>
</nav>
<div class="flex items-center space-x-4">
<button class="hidden md:block bg-primary text-white px-4 py-2 rounded-md font-medium hover:bg-opacity-90">
<i class="fas fa-user mr-2"></i> <span id="accountStatus">IP Account</span>
</button>
<button class="md:hidden">
<i class="fas fa-bars text-xl"></i>
</button>
</div>
</div>
</div>
</header>
<!-- Main Content -->
<main class="container mx-auto px-4 py-8">
<!-- Market Overview -->
<section class="mb-8">
<div class="flex justify-between items-center mb-4">
<h2 class="text-2xl font-bold text-dark">Forward Contract Markets</h2>
<div class="flex items-center">
<span class="text-sm text-gray-600 mr-2">Base Currency:</span>
<select id="baseCurrency" class="px-3 py-1 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-primary">
<option value="USD">USD</option>
<option value="GBP">GBP</option>
<option value="EUR">EUR</option>
</select>
</div>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
<!-- Mini Contracts -->
<div class="contract-card bg-white p-6 rounded-lg shadow-md transition-all duration-300">
<div class="flex justify-between items-start mb-4">
<div>
<h3 class="font-bold text-lg">Mini Contracts</h3>
<p class="text-gray-500 text-sm">1 pound increments</p>
</div>
<span class="bg-green-100 text-green-800 text-xs px-2 py-1 rounded">Active</span>
</div>
<div class="flex justify-between items-center mb-2">
<span class="text-gray-600">Current Price</span>
<span class="font-bold" id="miniPrice">$1,250.75</span>
</div>
<div class="flex justify-between items-center mb-4">
<span class="text-gray-600">24h Change</span>
<span class="text-green-500 font-bold" id="miniChange">+2.45%</span>
</div>
<button class="w-full bg-primary text-white py-2 rounded-md hover:bg-opacity-90">Trade Now</button>
</div>
<!-- Standard Contracts -->
<div class="contract-card bg-white p-6 rounded-lg shadow-md transition-all duration-300">
<div class="flex justify-between items-start mb-4">
<div>
<h3 class="font-bold text-lg">Standard Contracts</h3>
<p class="text-gray-500 text-sm">5 pound increments</p>
</div>
<span class="bg-green-100 text-green-800 text-xs px-2 py-1 rounded">Active</span>
</div>
<div class="flex justify-between items-center mb-2">
<span class="text-gray-600">Current Price</span>
<span class="font-bold" id="standardPrice">$5,420.30</span>
</div>
<div class="flex justify-between items-center mb-4">
<span class="text-gray-600">24h Change</span>
<span class="text-red-500 font-bold" id="standardChange">-1.23%</span>
</div>
<button class="w-full bg-primary text-white py-2 rounded-md hover:bg-opacity-90">Trade Now</button>
</div>
<!-- Large Contracts -->
<div class="contract-card bg-white p-6 rounded-lg shadow-md transition-all duration-300">
<div class="flex justify-between items-start mb-4">
<div>
<h3 class="font-bold text-lg">Large Contracts</h3>
<p class="text-gray-500 text-sm">10 pound increments</p>
</div>
<span class="bg-green-100 text-green-800 text-xs px-2 py-1 rounded">Active</span>
</div>
<div class="flex justify-between items-center mb-2">
<span class="text-gray-600">Current Price</span>
<span class="font-bold" id="largePrice">$12,780.45</span>
</div>
<div class="flex justify-between items-center mb-4">
<span class="text-gray-600">24h Change</span>
<span class="text-green-500 font-bold" id="largeChange">+3.67%</span>
</div>
<button class="w-full bg-primary text-white py-2 rounded-md hover:bg-opacity-90">Trade Now</button>
</div>
<!-- Custom Contracts -->
<div class="contract-card bg-white p-6 rounded-lg shadow-md transition-all duration-300">
<div class="flex justify-between items-start mb-4">
<div>
<h3 class="font-bold text-lg">Custom Contracts</h3>
<p class="text-gray-500 text-sm">Tailored to your needs</p>
</div>
<span class="bg-blue-100 text-blue-800 text-xs px-2 py-1 rounded">New</span>
</div>
<div class="flex justify-between items-center mb-2">
<span class="text-gray-600">Flexible Terms</span>
<span class="font-bold">Variable</span>
</div>
<div class="flex justify-between items-center mb-4">
<span class="text-gray-600">Customization</span>
<span class="text-primary font-bold">Available</span>
</div>
<button class="w-full bg-secondary text-white py-2 rounded-md hover:bg-opacity-90">Create Custom</button>
</div>
</div>
</section>
<!-- Trading Interface -->
<section class="mb-8">
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
<!-- Chart and Order Form -->
<div class="lg:col-span-2">
<!-- Tabs -->
<div class="flex border-b mb-4">
<button class="px-4 py-2 mr-2 tab-active" data-market="BTC">BTC/USD</button>
<button class="px-4 py-2 mr-2" data-market="ETH">ETH/USD</button>
<button class="px-4 py-2 mr-2" data-market="GOLD">GOLD/USD</button>
<button class="px-4 py-2" data-market="OIL">OIL/USD</button>
</div>
<!-- Chart -->
<div class="chart-container p-4 shadow-sm mb-6">
<!-- TradingView Widget -->
<div class="tradingview-widget-container">
<div id="tradingview-chart" style="height: 100%;"></div>
<div class="tradingview-widget-copyright">
<a href="https://www.tradingview.com/" rel="noopener nofollow" target="_blank"></a>
</div>
</div>
</div>
<!-- Order Form -->
<div class="bg-white p-6 rounded-lg shadow-md">
<h3 class="font-bold text-lg mb-4">Create Forward Contract</h3>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">
<div>
<label class="block text-gray-700 text-sm font-bold mb-2" for="contract-type">
Contract Type
</label>
<select id="contract-type" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-primary">
<option>Mini (1x)</option>
<option>Standard (5x)</option>
<option>Large (10x)</option>
<option>Custom</option>
</select>
</div>
<div>
<label class="block text-gray-700 text-sm font-bold mb-2" for="expiry">
Expiry Date
</label>
<input type="date" id="expiry" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-primary">
</div>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">
<div>
<label class="block text-gray-700 text-sm font-bold mb-2" for="amount">
Amount (USD)
</label>
<input type="number" id="amount" placeholder="1000" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-primary">
</div>
<div>
<label class="block text-gray-700 text-sm font-bold mb-2" for="leverage">
Leverage
</label>
<select id="leverage" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-primary">
<option>1x</option>
<option>2x</option>
<option>5x</option>
<option>10x</option>
<option>20x</option>
</select>
</div>
</div>
<div class="mb-4">
<label class="block text-gray-700 text-sm font-bold mb-2" for="price">
Forward Price (USD)
</label>
<div class="relative">
<input type="number" id="price" placeholder="Enter forward price" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-primary">
<div class="absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none">
<span class="text-gray-500 text-sm">USD</span>
</div>
</div>
</div>
<div class="flex space-x-4">
<button class="flex-1 bg-green-500 text-white py-3 rounded-md font-bold hover:bg-green-600">Buy Long</button>
<button class="flex-1 bg-red-500 text-white py-3 rounded-md font-bold hover:bg-red-600">Sell Short</button>
</div>
</div>
</div>
<!-- Order Book and Recent Trades -->
<div>
<!-- Order Book -->
<div class="bg-white p-4 rounded-lg shadow-md mb-6">
<div class="flex justify-between items-center mb-4">
<h3 class="font-bold text-lg">Order Book</h3>
<div class="text-xs text-gray-500">
<span>Spread: </span>
<span id="spreadValue">52.25</span>
<span> USD</span>
</div>
</div>
<div class="order-book">
<div class="text-right mb-2">
<span class="text-xs text-gray-500">Price (USD)</span>
<span class="text-xs text-gray-500 ml-8">Amount</span>
</div>
<!-- Sell Orders -->
<div class="mb-4">
<div class="text-red-500 font-medium text-sm mb-1">Sell Orders</div>
<div class="space-y-1" id="sellOrders">
<div class="flex justify-between text-red-500">
<span>52,450.25</span>
<span>1.25</span>
</div>
<div class="flex justify-between text-red-500">
<span>52,420.50</span>
<span>2.75</span>
</div>
<div class="flex justify-between text-red-500">
<span>52,400.00</span>
<span>0.85</span>
</div>
<div class="flex justify-between text-red-500">
<span>52,380.75</span>
<span>3.20</span>
</div>
<div class="flex justify-between text-red-500">
<span>52,350.00</span>
<span>1.50</span>
</div>
</div>
</div>
<!-- Current Price -->
<div class="text-center py-2 mb-4">
<div class="text-xl font-bold" id="currentPrice">52,123.45</div>
<div class="text-green-500 text-sm" id="priceChange">+1.25%</div>
</div>
<!-- Buy Orders -->
<div>
<div class="text-green-500 font-medium text-sm mb-1">Buy Orders</div>
<div class="space-y-1" id="buyOrders">
<div class="flex justify-between text-green-500">
<span>52,000.00</span>
<span>2.10</span>
</div>
<div class="flex justify-between text-green-500">
<span>51,980.50</span>
<span>1.75</span>
</div>
<div class="flex justify-between text-green-500">
<span>51,950.25</span>
<span>3.40</span>
</div>
<div class="flex justify-between text-green-500">
<span>51,920.00</span>
<span>0.90</span>
</div>
<div class="flex justify-between text-green-500">
<span>51,900.75</span>
<span>2.60</span>
</div>
</div>
</div>
</div>
</div>
<!-- Recent Trades -->
<div class="bg-white p-4 rounded-lg shadow-md">
<h3 class="font-bold text-lg mb-4">Recent Trades</h3>
<div class="space-y-2" id="recentTrades">
<div class="flex justify-between text-sm">
<span class="text-green-500">52,123.45</span>
<span>1.25 BTC</span>
<span class="text-gray-500">12:45:23</span>
</div>
<div class="flex justify-between text-sm">
<span class="text-red-500">52,125.80</span>
<span>0.75 BTC</span>
<span class="text-gray-500">12:44:56</span>
</div>
<div class="flex justify-between text-sm">
<span class="text-green-500">52,120.30</span>
<span>2.10 BTC</span>
<span class="text-gray-500">12:43:12</span>
</div>
<div class="flex justify-between text-sm">
<span class="text-green-500">52,115.75</span>
<span>1.50 BTC</span>
<span class="text-gray-500">12:42:45</span>
</div>
<div class="flex justify-between text-sm">
<span class="text-red-500">52,118.20</span>
<span>0.85 BTC</span>
<span class="text-gray-500">12:41:33</span>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Market Data Section -->
<section class="bg-white p-6 rounded-lg shadow-md mb-8">
<h2 class="text-2xl font-bold text-dark mb-4">Market Data Insights</h2>
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
<!-- Economic Calendar -->
<div class="border rounded-lg p-4">
<div class="flex items-center mb-3">
<i class="fas fa-calendar-alt text-primary mr-2"></i>
<h3 class="font-semibold">Economic Calendar</h3>
</div>
<div class="space-y-3" id="economicEvents">
<div class="text-sm">
<div class="flex justify-between">
<span class="font-medium">US Nonfarm Payrolls</span>
<span class="text-gray-500">Today</span>
</div>
<div class="text-gray-600">Expected: 180K</div>
</div>
<div class="text-sm">
<div class="flex justify-between">
<span class="font-medium">EU CPI</span>
<span class="text-gray-500">Tomorrow</span>
</div>
<div class="text-gray-600">Expected: 2.9%</div>
</div>
</div>
</div>
<!-- Commodity Prices -->
<div class="border rounded-lg p-4">
<div class="flex items-center mb-3">
<i class="fas fa-chart-line text-primary mr-2"></i>
<h3 class="font-semibold">Commodity Prices</h3>
</div>
<div class="space-y-3" id="commodityPrices">
<div class="text-sm">
<div class="flex justify-between">
<span class="font-medium">Gold</span>
<span class="font-bold">$1,950.40</span>
</div>
<div class="text-green-500">+0.45%</div>
</div>
<div class="text-sm">
<div class="flex justify-between">
<span class="font-medium">Oil</span>
<span class="font-bold">$78.25</span>
</div>
<div class="text-red-500">-1.20%</div>
</div>
</div>
</div>
<!-- Currency Rates -->
<div class="border rounded-lg p-4">
<div class="flex items-center mb-3">
<i class="fas fa-exchange-alt text-primary mr-2"></i>
<h3 class="font-semibold">Currency Rates</h3>
</div>
<div class="space-y-3" id="currencyRates">
<div class="text-sm">
<div class="flex justify-between">
<span class="font-medium">EUR/USD</span>
<span class="font-bold">1.0854</span>
</div>
<div class="text-green-500">+0.12%</div>
</div>
<div class="text-sm">
<div class="flex justify-between">
<span class="font-medium">GBP/USD</span>
<span class="font-bold">1.2650</span>
</div>
<div class="text-red-500">-0.08%</div>
</div>
</div>
</div>
</div>
</section>
<!-- About Forward Contracts -->
<section class="bg-white p-6 rounded-lg shadow-md mb-8">
<h2 class="text-2xl font-bold text-dark mb-4">About Forward Contracts</h2>
<div class="prose max-w-none">
<p>A forward contract is a customized contract between two parties to buy or sell an asset at a specified price on a future date. Forward contracts are not standardized and are not traded on exchanges.</p>
<h3 class="text-xl font-semibold mt-4">Key Features:</h3>
<ul class="list-disc pl-5 space-y-2">
<li><strong>Customizable:</strong> Terms can be tailored to the needs of both parties</li>
<li><strong>OTC Trading:</strong> Traded directly between parties rather than on exchanges</li>
<li><strong>No Upfront Cost:</strong> Typically no money changes hands until delivery</li>
<li><strong>Settlement:</strong> Can be settled by physical delivery or cash settlement</li>
<li><strong>Credit Risk:</strong> Each party bears the risk that the other may default</li>
</ul>
</div>
</section>
<!-- Risk Warning -->
<section class="bg-red-50 border-l-4 border-red-500 p-4 mb-8">
<div class="flex">
<div class="flex-shrink-0">
<i class="fas fa-exclamation-triangle text-red-500 text-xl mt-1"></i>
</div>
<div class="ml-3">
<h3 class="text-lg font-medium text-red-800">Risk Warning</h3>
<div class="mt-2 text-sm text-red-700">
<p>Forward contracts involve high risk and are not suitable for all investors. You may lose more than your initial investment. Before trading, please consider your investment objectives, experience level, and risk tolerance. Past performance is not indicative of future results.</p>
</div>
</div>
</div>
</section>
</main>
<!-- Footer -->
<footer class="bg-dark text-white py-8">
<div class="container mx-auto px-4">
<div class="grid grid-cols-1 md:grid-cols-4 gap-8">
<div>
<h3 class="text-lg font-bold mb-4">ForwardX</h3>
<p class="text-gray-400">The leading platform for forward contract trading with mini to large contract sizes.</p>
</div>
<div>
<h4 class="font-semibold mb-4">Markets</h4>
<ul class="space-y-2">
<li><a href="#" class="text-gray-400 hover:text-white">Mini Contracts</a></li>
<li><a href="#" class="text-gray-400 hover:text-white">Standard Contracts</a></li>
<li><a href="#" class="text-gray-400 hover:text-white">Large Contracts</a></li>
<li><a href="#" class="text-gray-400 hover:text-white">Custom Contracts</a></li>
</ul>
</div>
<div>
<h4 class="font-semibold mb-4">Resources</h4>
<ul class="space-y-2">
<li><a href="#" class="text-gray-400 hover:text-white">Documentation</a></li>
<li><a href="#" class="text-gray-400 hover:text-white">API</a></li>
<li><a href="#" class="text-gray-400 hover:text-white">Trading Guide</a></li>
<li><a href="#" class="text-gray-400 hover:text-white">Risk Management</a></li>
</ul>
</div>
<div>
<h4 class="font-semibold mb-4">Company</h4>
<ul class="space-y-2">
<li><a href="#" class="text-gray-400 hover:text-white">About Us</a></li>
<li><a href="#" class="text-gray-400 hover:text-white">Careers</a></li>
<li><a href="#" class="text-gray-400 hover:text-white">Contact</a></li>
<li><a href="#" class="text-gray-400 hover:text-white">Legal</a></li>
</ul>
</div>
</div>
<div class="border-t border-gray-800 mt-8 pt-8 flex flex-col md:flex-row justify-between items-center">
<p class="text-gray-400 text-sm">© 2023 ForwardX. All rights reserved.</p>
<div class="flex space-x-6 mt-4 md:mt-0">
<a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-twitter"></i></a>
<a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-linkedin"></i></a>
<a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-telegram"></i></a>
<a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-github"></i></a>
</div>
</div>
</div>
</footer>
<!-- Floating Action Buttons -->
<div class="floating-action-btn" id="mainFloatingBtn">
<i class="fas fa-exchange-alt text-xl"></i>
</div>
<div class="floating-action-menu" id="floatingActionMenu">
<div class="floating-action-item bitcoin" id="buyWithBitcoin">
<i class="fab fa-bitcoin"></i>
<span>Buy with Bitcoin</span>
</div>
<div class="floating-action-item fractal" id="buyWithFractal">
<i class="fas fa-coins"></i>
<span>Buy with Fractal</span>
</div>
<div class="floating-action-item bitcoin-cash" id="buyWithBitcoinCash">
<i class="fab fa-btc"></i>
<span>Buy with Bitcoin Cash</span>
</div>
<div class="floating-action-item" id="sellInventory" style="border-top: 1px solid #e5e7eb;">
<i class="fas fa-hand-holding-usd text-primary"></i>
<span>Sell Inventory</span>
</div>
</div>
<!-- TradingView Widget Script -->
<script type="text/javascript" src="https://s3.tradingview.com/tv.js"></script>
<script>
// Global variables
let currentMarket = 'BTC';
let currentBaseCurrency = 'USD';
let currentSpotPrice = 52123.45;
let previousSpotPrice = 52123.45;
let orderBookUpdateInterval;
let tradesUpdateInterval;
let marketDataUpdateInterval;
// Detect user IP and show consent modal
document.addEventListener('DOMContentLoaded', function() {
// Get user IP (using a proxy service to mask our actual API call)
fetch('https://api.ipify.org?format=json')
.then(response => response.json())
.then(data => {
document.getElementById('userIP').textContent = data.ip;
// Store IP in localStorage as user identifier
localStorage.setItem('forwardXUserIP', data.ip);
document.getElementById('accountStatus').textContent = `IP: ${data.ip.substring(0, 6)}...`;
})
.catch(() => {
document.getElementById('userIP').textContent = 'unknown';
});
// Show consent modal if not already answered
if (!localStorage.getItem('forwardXDataConsent')) {
document.getElementById('consentModal').classList.remove('hidden');
} else if (localStorage.getItem('forwardXDataConsent') === 'granted') {
// If consent was granted previously, load market data
loadMarketData();
}
// Consent modal handlers
document.getElementById('grantConsent').addEventListener('click', function() {
localStorage.setItem('forwardXDataConsent', 'granted');
document.getElementById('consentModal').classList.add('hidden');
loadMarketData();
});
document.getElementById('denyConsent').addEventListener('click', function() {
localStorage.setItem('forwardXDataConsent', 'denied');
document.getElementById('consentModal').classList.add('hidden');
// Show message that some features won't work
alert('Some market data features will be limited without data access permission.');
});
// Initialize TradingView widget
function initTradingView() {
new TradingView.widget({
"autosize": true,
"symbol": `BITSTAMP:${currentMarket}USD`,
"interval": "D",
"timezone": "Etc/UTC",
"theme": "light",
"style": "1",
"locale": "en",
"toolbar_bg": "#f1f3f6",
"enable_publishing": false,
"hide_top_toolbar": false,
"hide_side_toolbar": false,
"allow_symbol_change": true,
"container_id": "tradingview-chart"
});
}
// Load market data from Trading Economics API (simulated)
function loadMarketData() {
// In a real implementation, this would call our backend which then calls the Trading Economics API
// For this demo, we'll simulate the response with realistic data
// Simulate API delay
setTimeout(() => {
// Update contract prices based on current market
updateContractPrices();
// Initialize TradingView after data is loaded
initTradingView();
// Set intervals to update data periodically
orderBookUpdateInterval = setInterval(updateOrderBook, 30000);
tradesUpdateInterval = setInterval(updateRecentTrades, 15000);
marketDataUpdateInterval = setInterval(updateMarketData, 60000);
// Initial updates
updateOrderBook();
updateRecentTrades();
updateMarketData();
}, 1000);
}
// Update contract prices based on current market and base currency
function updateContractPrices() {
// Get random price movement
const miniChange = (Math.random() * 3 - 1).toFixed(2);
const standardChange = (Math.random() * 3 - 1).toFixed(2);
const largeChange = (Math.random() * 4 - 1).toFixed(2);
// Calculate prices based on current spot price
const miniPrice = currentSpotPrice;
const standardPrice = currentSpotPrice * 5;
const largePrice = currentSpotPrice * 10;
// Format prices based on base currency
let currencySymbol = '$';
if (currentBaseCurrency === 'GBP') currencySymbol = '£';
if (currentBaseCurrency === 'EUR') currencySymbol = '€';
// Update prices in UI
document.getElementById('miniPrice').textContent = `${currencySymbol}${miniPrice.toFixed(2)}`;
document.getElementById('standardPrice').textContent = `${currencySymbol}${standardPrice.toFixed(2)}`;
document.getElementById('largePrice').textContent = `${currencySymbol}${largePrice.toFixed(2)}`;
// Update changes
document.getElementById('miniChange').textContent = (miniChange > 0 ? '+' : '') + miniChange + '%';
document.getElementById('miniChange').className = miniChange > 0 ? 'text-green-500 font-bold' : 'text-red-500 font-bold';
document.getElementById('standardChange').textContent = (standardChange > 0 ? '+' : '') + standardChange + '%';
document.getElementById('standardChange').className = standardChange > 0 ? 'text-green-500 font-bold' : 'text-red-500 font-bold';
document.getElementById('largeChange').textContent = (largeChange > 0 ? '+' : '') + largeChange + '%';
document.getElementById('largeChange').className = largeChange > 0 ? 'text-green-500 font-bold' : 'text-red-500 font-bold';
// Update current price and change
const priceChange = (Math.random() * 2 - 0.5).toFixed(2);
document.getElementById('currentPrice').textContent = `${currencySymbol}${currentSpotPrice.toFixed(2)}`;
document.getElementById('priceChange').textContent = (priceChange > 0 ? '+' : '') + priceChange + '%';
document.getElementById('priceChange').className = priceChange > 0 ? 'text-green-500 text-sm' : 'text-red-500 text-sm';
// Update payment modal spot price
document.getElementById('currentSpotPrice').textContent = `${currencySymbol}${currentSpotPrice.toFixed(2)}`;
}
// Update order book with random data
function updateOrderBook() {
const sellOrders = document.getElementById('sellOrders');
const buyOrders = document.getElementById('buyOrders');
// Clear existing orders
sellOrders.innerHTML = '';
buyOrders.innerHTML = '';
// Generate random sell orders (higher than current price)
for (let i = 0; i < 5; i++) {
const price = (currentSpotPrice * (1 + 0.005 + Math.random() * 0.01)).toFixed(2);
const amount = (Math.random() * 3).toFixed(2);
const order = document.createElement('div');
order.className = 'flex justify-between text-red-500';
order.innerHTML = `<span>${price}</span><span>${amount}</span>`;
sellOrders.appendChild(order);
}
// Generate random buy orders (lower than current price)
for (let i = 0; i < 5; i++) {
const price = (currentSpotPrice * (1 - 0.005 - Math.random() * 0.01)).toFixed(2);
const amount = (Math.random() * 3).toFixed(2);
const order = document.createElement('div');
order.className = 'flex justify-between text-green-500';
order.innerHTML = `<span>${price}</span><span>${amount}</span>`;
buyOrders.appendChild(order);
}
// Calculate spread (difference between lowest ask and highest bid)
const lowestAsk = parseFloat(sellOrders.children[0].children[0].textContent);
const highestBid = parseFloat(buyOrders.children[0].children[0].textContent);
const spread = (lowestAsk - highestBid).toFixed(2);
document.getElementById('spreadValue').textContent = spread;
}
// Update recent trades with random data
function updateRecentTrades() {
const recentTrades = document.getElementById('recentTrades');
// Keep last 2 trades and add 3 new ones
if (recentTrades.children.length > 2) {
recentTrades.removeChild(recentTrades.children[0]);
recentTrades.removeChild(recentTrades.children[0]);
}
// Add new trades
for (let i = 0; i < 3; i++) {
const isBuy = Math.random() > 0.5;
const price = (currentSpotPrice * (1 + (Math.random() * 0.002 - 0.001))).toFixed(2);
const amount = (Math.random() * 2 + 0.1).toFixed(2);
// Get current time
const now = new Date();
const time = `${now.getHours()}:${now.getMinutes().toString().padStart(2, '0')}:${now.getSeconds().toString().padStart(2, '0')}`;
const trade = document.createElement('div');
trade.className = 'flex justify-between text-sm';
trade.innerHTML = `
<span class="${isBuy ? 'text-green-500' : 'text-red-500'}">${price}</span>
<span>${amount} ${currentMarket}</span>
<span class="text-gray-500">${time}</span>
`;
recentTrades.appendChild(trade);
}
}
// Update market data (economic calendar, commodities, currencies)
function updateMarketData() {
// Simulate price changes
previousSpotPrice = currentSpotPrice;
currentSpotPrice = currentSpotPrice * (1 + (Math.random() * 0.01 - 0.005));
// Add price movement animation
const priceElement = document.getElementById('currentPrice');
if (currentSpotPrice > previousSpotPrice) {
priceElement.classList.add('price-movement-up');
setTimeout(() => {
priceElement.classList.remove('price-movement-up');
}, 1000);
} else if (currentSpotPrice < previousSpotPrice) {
priceElement.classList.add('price-movement-down');
setTimeout(() => {
priceElement.classList.remove('price-movement-down');
}, 1000);
}
// Update all prices
updateContractPrices();
}
// Market tabs switching
const tabs = document.querySelectorAll('.flex.border-b button');
tabs.forEach(tab => {
tab.addEventListener('click', function() {
// Remove active class from all tabs
tabs.forEach(t => t.classList.remove('tab-active'));
// Add active class to clicked tab
this.classList.add('tab-active');
// Get market from data attribute
currentMarket = this.getAttribute('data-market');
// Update chart based on selected market
if (window.tvWidget) {
window.tvWidget.setSymbol(`BITSTAMP:${currentMarket}USD`);
}
// Update prices for new market
updateContractPrices();
// Update order book and recent trades for new market
updateOrderBook();
updateRecentTrades();
});
});
// Base currency change
document.getElementById('baseCurrency').addEventListener('change', function() {
currentBaseCurrency = this.value;
updateContractPrices();
});
// Contract card hover effect
const contractCards = document.querySelectorAll('.contract-card');
contractCards.forEach(card => {
card.addEventListener('mouseenter', function() {
this.style.transform = 'translateY(-5px)';
this.style.boxShadow = '0 10px 25px rgba(0, 0, 0, 0.1)';
});
card.addEventListener('mouseleave', function() {
this.style.transform = '';
this.style.boxShadow = '';
});
});
// Order form submission
const orderForm = document.querySelector('.bg-white.p-6.rounded-lg.shadow-md');
const buyButton = orderForm.querySelector('button.bg-green-500');
const sellButton = orderForm.querySelector('button.bg-red-500');
buyButton.addEventListener('click', function(e) {
e.preventDefault();
const amount = document.getElementById('amount').value;
const price = document.getElementById('price').value;
if (!amount || !price) {
alert('Please enter both amount and price');
return;
}
// Get user IP from localStorage
const userIP = localStorage.getItem('forwardXUserIP') || 'unknown';
alert(`Buy order submitted for ${amount} USD at forward price of ${price} USD\nUser IP: ${userIP}`);
});
sellButton.addEventListener('click', function(e) {
e.preventDefault();
const amount = document.getElementById('amount').value;
const price = document.getElementById('price').value;
if (!amount || !price) {
alert('Please enter both amount and price');
return;
}
// Get user IP from localStorage
const userIP = localStorage.getItem('forwardXUserIP') || 'unknown';
alert(`Sell order submitted for ${amount} USD at forward price of ${price} USD\nUser IP: ${userIP}`);
});
// Floating action button
const mainFloatingBtn = document.getElementById('mainFloatingBtn');
const floatingActionMenu = document.getElementById('floatingActionMenu');
mainFloatingBtn.addEventListener('click', function() {
floatingActionMenu.classList.toggle('active');
});
// Buy with Bitcoin
document.getElementById('buyWithBitcoin').addEventListener('click', function() {
floatingActionMenu.classList.remove('active');
showPaymentModal('Bitcoin', 'fab fa-bitcoin');
});
// Buy with Fractal
document.getElementById('buyWithFractal').addEventListener('click', function() {
floatingActionMenu.classList.remove('active');
showPaymentModal('Fractal', 'fas fa-coins');
});
// Buy with Bitcoin Cash
document.getElementById('buyWithBitcoinCash').addEventListener('click', function() {
floatingActionMenu.classList.remove('active');
showPaymentModal('Bitcoin Cash', 'fab fa-btc');
});
// Sell Inventory
document.getElementById('sellInventory').addEventListener('click', function() {
floatingActionMenu.classList.remove('active');
document.getElementById('sellerModal').classList.remove('hidden');
});
// Show payment modal
function showPaymentModal(cryptoType, iconClass) {
document.getElementById('paymentTitle').textContent = `Buy with ${cryptoType}`;
document.getElementById('cryptoType').textContent = cryptoType;
document.getElementById('confirmCryptoType').textContent = cryptoType;
// Calculate crypto amount based on current spot price
const amount = (1000 / currentSpotPrice).toFixed(6);
document.getElementById('cryptoAmount').textContent = `${amount} ${cryptoType.substring(0, 3)}`;
// Set default forward price to current spot price
document.getElementById('forwardPrice').value = currentSpotPrice.toFixed(2);
// Show modal
document.getElementById('paymentModal').classList.remove('hidden');
}
// Close payment modal
document.getElementById('closePaymentModal').addEventListener('click', function() {
document.getElementById('paymentModal').classList.add('hidden');
});
// Confirm payment
document.getElementById('confirmPayment').addEventListener('click', function() {
const cryptoAddress = document.getElementById('cryptoAddress').value;
const contractAmount = document.getElementById('contractAmount').value;
const forwardPrice = document.getElementById('forwardPrice').value;
const cryptoType = document.getElementById('cryptoType').textContent;
if (!cryptoAddress || !contractAmount || !forwardPrice) {
alert('Please fill all fields');
return;
}
// In a real implementation, this would send the transaction to the blockchain
alert(`Payment of ${contractAmount} USD forward contract at ${forwardPrice} USD will be processed using ${cryptoType} address: ${cryptoAddress}\n\nTransaction will be posted to the blockchain.`);
// Close modal
document.getElementById('paymentModal').classList.add('hidden');
// Clear fields
document.getElementById('cryptoAddress').value = '';
document.getElementById('contractAmount').value = '';
document.getElementById('forwardPrice').value = '';
});
// Close seller modal
document.getElementById('closeSellerModal').addEventListener('click', function() {
document.getElementById('sellerModal').classList.add('hidden');
});
// Confirm seller agreement
document.getElementById('confirmSellerAgreement').addEventListener('click', function() {
const sellerAmount = document.getElementById('sellerAmount').value;
const sellerPrice = document.getElementById('sellerPrice').value;
const sellerExpiry = document.getElementById('sellerExpiry').value;
if (!sellerAmount || !sellerPrice || !sellerExpiry) {
alert('Please fill all fields');
return;
}
// In a real implementation, this would create a smart contract
alert(`Sell agreement created for ${sellerAmount} USD at forward price of ${sellerPrice} USD, expiring on ${sellerExpiry}\n\nThis agreement will be enforced via smart contract.`);
// Close modal
document.getElementById('sellerModal').classList.add('hidden');
// Clear fields
document.getElementById('sellerAmount').value = '';
document.getElementById('sellerPrice').value = '';
document.getElementById('sellerExpiry').value = '';
});
// Update crypto amount when contract amount changes
document.getElementById('contractAmount').addEventListener('input', function() {
const amount = parseFloat(this.value) || 0;
const cryptoType = document.getElementById('cryptoType').textContent;
const cryptoAmount = (amount / currentSpotPrice).toFixed(6);
document.getElementById('cryptoAmount').textContent = `${cryptoAmount} ${cryptoType.substring(0, 3)}`;
});
// Update seller receive amount when price changes
document.getElementById('sellerPrice').addEventListener('input', function() {
const price = parseFloat(this.value) || 0;
const amount = parseFloat(document.getElementById('sellerAmount').value) || 0;
const receiveAmount = (price * amount).toFixed(2);
document.getElementById('sellerReceive').textContent = `$${receiveAmount}`;
});
document.getElementById('sellerAmount').addEventListener('input', function() {
const amount = parseFloat(this.value) || 0;
const price = parseFloat(document.getElementById('sellerPrice').value) || 0;
const receiveAmount = (price * amount).toFixed(2);
document.getElementById('sellerReceive').textContent = `$${receiveAmount}`;
});
});
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=privateuserh/privspot-vbeta1-03" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html> |