Spaces:
Running
Running
undefined - Initial Deployment
Browse files- README.md +7 -5
- index.html +805 -19
- prompts.txt +0 -0
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: trading-interface
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: gray
|
| 5 |
+
colorTo: pink
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,805 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Sui AI Trading Agent Prototype</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 9 |
+
<style>
|
| 10 |
+
/* Custom styles for trading chart and animations */
|
| 11 |
+
@keyframes pulse {
|
| 12 |
+
0%, 100% { opacity: 1; }
|
| 13 |
+
50% { opacity: 0.5; }
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
.trading-chart {
|
| 17 |
+
background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
|
| 18 |
+
border-radius: 0.75rem;
|
| 19 |
+
position: relative;
|
| 20 |
+
overflow: hidden;
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
.chart-line {
|
| 24 |
+
position: absolute;
|
| 25 |
+
height: 2px;
|
| 26 |
+
background: #3b82f6;
|
| 27 |
+
width: 100%;
|
| 28 |
+
top: 50%;
|
| 29 |
+
transform-origin: left center;
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
.price-marker {
|
| 33 |
+
position: absolute;
|
| 34 |
+
width: 6px;
|
| 35 |
+
height: 6px;
|
| 36 |
+
background: #ec4899;
|
| 37 |
+
border-radius: 50%;
|
| 38 |
+
transform: translate(-50%, -50%);
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
.ai-thinking {
|
| 42 |
+
animation: pulse 1.5s infinite;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
/* Custom scrollbar */
|
| 46 |
+
::-webkit-scrollbar {
|
| 47 |
+
width: 8px;
|
| 48 |
+
}
|
| 49 |
+
::-webkit-scrollbar-track {
|
| 50 |
+
background: #1e293b;
|
| 51 |
+
}
|
| 52 |
+
::-webkit-scrollbar-thumb {
|
| 53 |
+
background: #3b82f6;
|
| 54 |
+
border-radius: 4px;
|
| 55 |
+
}
|
| 56 |
+
</style>
|
| 57 |
+
</head>
|
| 58 |
+
<body class="bg-gray-900 text-gray-100 min-h-screen">
|
| 59 |
+
<!-- Top Navigation -->
|
| 60 |
+
<nav class="bg-gray-800 py-4 px-6 flex justify-between items-center sticky top-0 z-50">
|
| 61 |
+
<div class="flex items-center space-x-4">
|
| 62 |
+
<div class="text-2xl font-bold text-blue-400 flex items-center">
|
| 63 |
+
<i class="fas fa-robot mr-2"></i>
|
| 64 |
+
<span>SuiAI Trader</span>
|
| 65 |
+
</div>
|
| 66 |
+
<div class="hidden md:flex space-x-6">
|
| 67 |
+
<a href="#" class="hover:text-blue-400 transition">Dashboard</a>
|
| 68 |
+
<a href="#" class="hover:text-blue-400 transition">Strategies</a>
|
| 69 |
+
<a href="#" class="hover:text-blue-400 transition">History</a>
|
| 70 |
+
<a href="#" class="hover:text-blue-400 transition">Analytics</a>
|
| 71 |
+
</div>
|
| 72 |
+
</div>
|
| 73 |
+
<div class="flex items-center space-x-4">
|
| 74 |
+
<div class="hidden md:block px-4 py-2 bg-gray-700 rounded-full text-sm">
|
| 75 |
+
<span class="text-green-400"><i class="fas fa-circle text-xs mr-1"></i> Connected</span>
|
| 76 |
+
<span class="text-gray-300 ml-2">Sui Testnet</span>
|
| 77 |
+
</div>
|
| 78 |
+
<button class="bg-blue-600 hover:bg-blue-700 px-4 py-2 rounded-full text-sm font-medium transition">
|
| 79 |
+
<i class="fas fa-wallet mr-1"></i> 0x3f...4a2b
|
| 80 |
+
</button>
|
| 81 |
+
<button class="md:hidden text-gray-300 hover:text-white">
|
| 82 |
+
<i class="fas fa-bars text-xl"></i>
|
| 83 |
+
</button>
|
| 84 |
+
</div>
|
| 85 |
+
</nav>
|
| 86 |
+
|
| 87 |
+
<div class="container mx-auto px-4 py-8">
|
| 88 |
+
<!-- Header and Stats -->
|
| 89 |
+
<div class="mb-8">
|
| 90 |
+
<h1 class="text-3xl font-bold mb-2">AI Trading Dashboard</h1>
|
| 91 |
+
<p class="text-gray-400 mb-6">Automated trading powered by machine learning on the Sui blockchain</p>
|
| 92 |
+
|
| 93 |
+
<div class="grid grid-cols-1 md:grid-cols-4 gap-4 mb-6">
|
| 94 |
+
<div class="bg-gray-800 p-4 rounded-lg border-l-4 border-blue-500">
|
| 95 |
+
<div class="text-gray-400 text-sm mb-1">Portfolio Value</div>
|
| 96 |
+
<div class="text-2xl font-bold">$24,857.42</div>
|
| 97 |
+
<div class="text-green-400 text-sm mt-1"><i class="fas fa-arrow-up mr-1"></i>+12.4% (7d)</div>
|
| 98 |
+
</div>
|
| 99 |
+
<div class="bg-gray-800 p-4 rounded-lg border-l-4 border-purple-500">
|
| 100 |
+
<div class="text-gray-400 text-sm mb-1">Active Bots</div>
|
| 101 |
+
<div class="text-2xl font-bold">3</div>
|
| 102 |
+
<div class="text-green-400 text-sm mt-1"><i class="fas fa-circle text-xs mr-1"></i> All running</div>
|
| 103 |
+
</div>
|
| 104 |
+
<div class="bg-gray-800 p-4 rounded-lg border-l-4 border-green-500">
|
| 105 |
+
<div class="text-gray-400 text-sm mb-1">24h Trades</div>
|
| 106 |
+
<div class="text-2xl font-bold">47</div>
|
| 107 |
+
<div class="text-blue-400 text-sm mt-1">+18.2% from yesterday</div>
|
| 108 |
+
</div>
|
| 109 |
+
<div class="bg-gray-800 p-4 rounded-lg border-l-4 border-yellow-500">
|
| 110 |
+
<div class="text-gray-400 text-sm mb-1">Success Rate</div>
|
| 111 |
+
<div class="text-2xl font-bold">85.7%</div>
|
| 112 |
+
<div class="text-green-400 text-sm mt-1">AI Score: 92/100</div>
|
| 113 |
+
</div>
|
| 114 |
+
</div>
|
| 115 |
+
</div>
|
| 116 |
+
|
| 117 |
+
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
|
| 118 |
+
<!-- Main Trading Interface -->
|
| 119 |
+
<div class="lg:col-span-2">
|
| 120 |
+
<!-- Trading Chart -->
|
| 121 |
+
<div class="trading-chart h-80 mb-6 p-4 relative">
|
| 122 |
+
<div class="absolute top-4 left-4 z-10">
|
| 123 |
+
<div class="text-white font-bold">SUI/USDT</div>
|
| 124 |
+
<div class="text-green-400 text-2xl">$1.2467 <span class="text-sm ml-1">+2.34%</span></div>
|
| 125 |
+
</div>
|
| 126 |
+
<div class="absolute top-4 right-4 z-10 flex space-x-2">
|
| 127 |
+
<button class="bg-gray-700 hover:bg-gray-600 px-3 py-1 rounded text-xs">1H</button>
|
| 128 |
+
<button class="bg-blue-600 px-3 py-1 rounded text-xs">6H</button>
|
| 129 |
+
<button class="bg-gray-700 hover:bg-gray-600 px-3 py-1 rounded text-xs">1D</button>
|
| 130 |
+
<button class="bg-gray-700 hover:bg-gray-600 px-3 py-1 rounded text-xs">1W</button>
|
| 131 |
+
</div>
|
| 132 |
+
|
| 133 |
+
<!-- Simulated chart line with dynamic points -->
|
| 134 |
+
<div class="chart-line" style="transform: rotate(-5deg);"></div>
|
| 135 |
+
<div class="absolute w-full h-full" id="chartPoints"></div>
|
| 136 |
+
|
| 137 |
+
<!-- AI Analysis Overlay -->
|
| 138 |
+
<div class="absolute bottom-4 left-4 right-4 bg-black bg-opacity-50 p-3 rounded-lg flex items-center">
|
| 139 |
+
<div class="bg-blue-600 p-2 rounded-full mr-3 ai-thinking">
|
| 140 |
+
<i class="fas fa-brain text-white"></i>
|
| 141 |
+
</div>
|
| 142 |
+
<div class="text-sm">
|
| 143 |
+
<div class="font-medium">AI Analysis: Bullish Momentum</div>
|
| 144 |
+
<div class="text-gray-300 text-xs">Detected positive sentiment (72%) with increasing volume. Recommended action: BUY with 0.3% stop-loss.</div>
|
| 145 |
+
</div>
|
| 146 |
+
</div>
|
| 147 |
+
</div>
|
| 148 |
+
|
| 149 |
+
<!-- Trading Controls -->
|
| 150 |
+
<div class="bg-gray-800 rounded-lg p-6 mb-6">
|
| 151 |
+
<h2 class="text-xl font-semibold mb-4 flex items-center">
|
| 152 |
+
<i class="fas fa-sliders-h mr-2 text-blue-400"></i>
|
| 153 |
+
Trading Configuration
|
| 154 |
+
</h2>
|
| 155 |
+
|
| 156 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
| 157 |
+
<!-- Strategy Selection -->
|
| 158 |
+
<div>
|
| 159 |
+
<label class="block text-gray-400 text-sm mb-2">Trading Strategy</label>
|
| 160 |
+
<div class="relative">
|
| 161 |
+
<select class="bg-gray-700 border border-gray-600 rounded-lg px-4 py-2 w-full appearance-none focus:outline-none focus:ring-2 focus:ring-blue-500 pr-8">
|
| 162 |
+
<option>Machine Learning Trend</option>
|
| 163 |
+
<option>Mean Reversion</option>
|
| 164 |
+
<option>Arbitrage Bot</option>
|
| 165 |
+
<option>News Sentiment</option>
|
| 166 |
+
<option>Custom Strategy</option>
|
| 167 |
+
</select>
|
| 168 |
+
<div class="absolute right-3 top-3 text-gray-400">
|
| 169 |
+
<i class="fas fa-chevron-down"></i>
|
| 170 |
+
</div>
|
| 171 |
+
</div>
|
| 172 |
+
</div>
|
| 173 |
+
|
| 174 |
+
<!-- Risk Level -->
|
| 175 |
+
<div>
|
| 176 |
+
<label class="block text-gray-400 text-sm mb-2">Risk Tolerance</label>
|
| 177 |
+
<div class="flex items-center">
|
| 178 |
+
<input type="range" min="1" max="5" value="3" class="w-full h-2 bg-gray-700 rounded-lg appearance-none cursor-pointer">
|
| 179 |
+
<div class="ml-3 text-xs text-gray-300">
|
| 180 |
+
<span class="font-medium text-blue-400">Balanced</span>
|
| 181 |
+
<div>(3/5)</div>
|
| 182 |
+
</div>
|
| 183 |
+
</div>
|
| 184 |
+
</div>
|
| 185 |
+
|
| 186 |
+
<!-- Trading Pairs -->
|
| 187 |
+
<div>
|
| 188 |
+
<label class="block text-gray-400 text-sm mb-2">Trading Pairs</label>
|
| 189 |
+
<div class="flex flex-wrap gap-2">
|
| 190 |
+
<button class="bg-blue-600 px-3 py-1 rounded-full text-xs">SUI/USDT</button>
|
| 191 |
+
<button class="bg-gray-700 hover:bg-gray-600 px-3 py-1 rounded-full text-xs">BTC/USDT</button>
|
| 192 |
+
<button class="bg-gray-700 hover:bg-gray-600 px-3 py-1 rounded-full text-xs">ETH/USDT</button>
|
| 193 |
+
<button class="bg-gray-700 hover:bg-gray-600 px-3 py-1 rounded-full text-xs">+ Add</button>
|
| 194 |
+
</div>
|
| 195 |
+
</div>
|
| 196 |
+
|
| 197 |
+
<!-- Trading Mode -->
|
| 198 |
+
<div>
|
| 199 |
+
<label class="block text-gray-400 text-sm mb-2">Trading Mode</label>
|
| 200 |
+
<div class="flex space-x-2">
|
| 201 |
+
<button id="autoMode" class="bg-green-600 hover:bg-green-700 px-4 py-2 rounded-lg font-medium text-sm">
|
| 202 |
+
<i class="fas fa-robot mr-1"></i> Auto Trade
|
| 203 |
+
</button>
|
| 204 |
+
<button id="manualMode" class="bg-gray-700 hover:bg-gray-600 px-4 py-2 rounded-lg font-medium text-sm">
|
| 205 |
+
<i class="fas fa-hand-paper mr-1"></i> Manual
|
| 206 |
+
</button>
|
| 207 |
+
</div>
|
| 208 |
+
</div>
|
| 209 |
+
</div>
|
| 210 |
+
|
| 211 |
+
<!-- Manual Trade Panel (hidden by default) -->
|
| 212 |
+
<div id="manualPanel" class="hidden mt-6 border-t border-gray-700 pt-4">
|
| 213 |
+
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
|
| 214 |
+
<div>
|
| 215 |
+
<label class="block text-gray-400 text-sm mb-2">Amount (SUI)</label>
|
| 216 |
+
<input type="text" value="100" class="bg-gray-700 border border-gray-600 rounded-lg px-4 py-2 w-full focus:outline-none focus:ring-2 focus:ring-blue-500">
|
| 217 |
+
</div>
|
| 218 |
+
<div class="flex items-end space-x-2">
|
| 219 |
+
<button class="bg-green-600 hover:bg-green-700 px-4 py-2 rounded-lg font-medium flex-1">
|
| 220 |
+
<i class="fas fa-arrow-up mr-1"></i> Buy
|
| 221 |
+
</button>
|
| 222 |
+
<button class="bg-red-600 hover:bg-red-700 px-4 py-2 rounded-lg font-medium flex-1">
|
| 223 |
+
<i class="fas fa-arrow-down mr-1"></i> Sell
|
| 224 |
+
</button>
|
| 225 |
+
</div>
|
| 226 |
+
<div>
|
| 227 |
+
<label class="block text-gray-400 text-sm mb-2">Slippage</label>
|
| 228 |
+
<div class="flex">
|
| 229 |
+
<input type="text" value="0.5" class="bg-gray-700 border border-gray-600 rounded-l-lg px-4 py-2 w-full focus:outline-none focus:ring-2 focus:ring-blue-500">
|
| 230 |
+
<span class="bg-gray-600 px-3 py-2 rounded-r-lg text-sm">%</span>
|
| 231 |
+
</div>
|
| 232 |
+
</div>
|
| 233 |
+
</div>
|
| 234 |
+
</div>
|
| 235 |
+
</div>
|
| 236 |
+
|
| 237 |
+
<!-- Recent Transactions (Blockchain Explorer) -->
|
| 238 |
+
<div class="bg-gray-800 rounded-lg p-6">
|
| 239 |
+
<h2 class="text-xl font-semibold mb-4 flex items-center">
|
| 240 |
+
<i class="fas fa-link mr-2 text-purple-400"></i>
|
| 241 |
+
Recent Blockchain Transactions
|
| 242 |
+
</h2>
|
| 243 |
+
|
| 244 |
+
<div class="overflow-x-auto">
|
| 245 |
+
<table class="w-full">
|
| 246 |
+
<thead>
|
| 247 |
+
<tr class="text-gray-400 text-sm border-b border-gray-700">
|
| 248 |
+
<th class="pb-2 text-left">Transaction ID</th>
|
| 249 |
+
<th class="pb-2 text-left">Action</th>
|
| 250 |
+
<th class="pb-2 text-right">Amount</th>
|
| 251 |
+
<th class="pb-2 text-right">Status</th>
|
| 252 |
+
</tr>
|
| 253 |
+
</thead>
|
| 254 |
+
<tbody>
|
| 255 |
+
<tr class="text-sm border-b border-gray-700 hover:bg-gray-700">
|
| 256 |
+
<td class="py-3 text-blue-400">0x4a2...c3e1</td>
|
| 257 |
+
<td class="py-3">AI Trade: Sell SUI</td>
|
| 258 |
+
<td class="py-3 text-right">150 SUI</td>
|
| 259 |
+
<td class="py-3 text-right"><span class="bg-green-900 text-green-400 px-2 py-1 rounded-full text-xs">Confirmed</span></td>
|
| 260 |
+
</tr>
|
| 261 |
+
<tr class="text-sm border-b border-gray-700 hover:bg-gray-700">
|
| 262 |
+
<td class="py-3 text-blue-400">0x8b3...d5f7</td>
|
| 263 |
+
<td class="py-3">AI Trade: Buy SUI</td>
|
| 264 |
+
<td class="py-3 text-right">200 SUI</td>
|
| 265 |
+
<td class="py-3 text-right"><span class="bg-green-900 text-green-400 px-2 py-1 rounded-full text-xs">Confirmed</span></td>
|
| 266 |
+
</tr>
|
| 267 |
+
<tr class="text-sm border-b border-gray-700 hover:bg-gray-700">
|
| 268 |
+
<td class="py-3 text-blue-400">0x1e9...7a2d</td>
|
| 269 |
+
<td class="py-3">Funds Deposit</td>
|
| 270 |
+
<td class="py-3 text-right">1000 USDT</td>
|
| 271 |
+
<td class="py-3 text-right"><span class="bg-yellow-900 text-yellow-400 px-2 py-1 rounded-full text-xs">Pending</span></td>
|
| 272 |
+
</tr>
|
| 273 |
+
<tr class="text-sm hover:bg-gray-700">
|
| 274 |
+
<td class="py-3 text-blue-400">0x6f2...9e10</td>
|
| 275 |
+
<td class="py-3">AI Trade: Buy BTC</td>
|
| 276 |
+
<td class="py-3 text-right">0.02 BTC</td>
|
| 277 |
+
<td class="py-3 text-right"><span class="bg-green-900 text-green-400 px-2 py-1 rounded-full text-xs">Confirmed</span></td>
|
| 278 |
+
</tr>
|
| 279 |
+
</tbody>
|
| 280 |
+
</table>
|
| 281 |
+
</div>
|
| 282 |
+
</div>
|
| 283 |
+
</div>
|
| 284 |
+
|
| 285 |
+
<!-- Right Sidebar -->
|
| 286 |
+
<div>
|
| 287 |
+
<!-- Portfolio Summary -->
|
| 288 |
+
<div class="bg-gray-800 rounded-lg p-6 mb-6">
|
| 289 |
+
<h2 class="text-xl font-semibold mb-4 flex items-center">
|
| 290 |
+
<i class="fas fa-wallet mr-2 text-yellow-400"></i>
|
| 291 |
+
Portfolio
|
| 292 |
+
</h2>
|
| 293 |
+
|
| 294 |
+
<div class="space-y-4">
|
| 295 |
+
<div class="flex items-center justify-between">
|
| 296 |
+
<div class="flex items-center">
|
| 297 |
+
<div class="bg-blue-600 p-2 rounded-full mr-3">
|
| 298 |
+
<i class="fas fa-coins text-white"></i>
|
| 299 |
+
</div>
|
| 300 |
+
<div>
|
| 301 |
+
<div class="font-medium">SUI</div>
|
| 302 |
+
<div class="text-gray-400 text-sm">5,342.21 SUI</div>
|
| 303 |
+
</div>
|
| 304 |
+
</div>
|
| 305 |
+
<div class="text-right">
|
| 306 |
+
<div class="font-medium">$6,658.09</div>
|
| 307 |
+
<div class="text-green-400 text-sm">+4.2%</div>
|
| 308 |
+
</div>
|
| 309 |
+
</div>
|
| 310 |
+
|
| 311 |
+
<div class="flex items-center justify-between">
|
| 312 |
+
<div class="flex items-center">
|
| 313 |
+
<div class="bg-green-600 p-2 rounded-full mr-3">
|
| 314 |
+
<i class="fab fa-ethereum text-white"></i>
|
| 315 |
+
</div>
|
| 316 |
+
<div>
|
| 317 |
+
<div class="font-medium">ETH</div>
|
| 318 |
+
<div class="text-gray-400 text-sm">2.43 ETH</div>
|
| 319 |
+
</div>
|
| 320 |
+
</div>
|
| 321 |
+
<div class="text-right">
|
| 322 |
+
<div class="font-medium">$4,187.52</div>
|
| 323 |
+
<div class="text-red-400 text-sm">-1.7%</div>
|
| 324 |
+
</div>
|
| 325 |
+
</div>
|
| 326 |
+
|
| 327 |
+
<div class="flex items-center justify-between">
|
| 328 |
+
<div class="flex items-center">
|
| 329 |
+
<div class="bg-orange-500 p-2 rounded-full mr-3">
|
| 330 |
+
<i class="fab fa-bitcoin text-white"></i>
|
| 331 |
+
</div>
|
| 332 |
+
<div>
|
| 333 |
+
<div class="font-medium">BTC</div>
|
| 334 |
+
<div class="text-gray-400 text-sm">0.042 BTC</div>
|
| 335 |
+
</div>
|
| 336 |
+
</div>
|
| 337 |
+
<div class="text-right">
|
| 338 |
+
<div class="font-medium">$1,258.11</div>
|
| 339 |
+
<div class="text-green-400 text-sm">+8.3%</div>
|
| 340 |
+
</div>
|
| 341 |
+
</div>
|
| 342 |
+
|
| 343 |
+
<div class="flex items-center justify-between">
|
| 344 |
+
<div class="flex items-center">
|
| 345 |
+
<div class="bg-gray-500 p-2 rounded-full mr-3">
|
| 346 |
+
<i class="fas fa-dollar-sign text-white"></i>
|
| 347 |
+
</div>
|
| 348 |
+
<div>
|
| 349 |
+
<div class="font-medium">USDT</div>
|
| 350 |
+
<div class="text-gray-400 text-sm">12,753.42 USDT</div>
|
| 351 |
+
</div>
|
| 352 |
+
</div>
|
| 353 |
+
<div class="text-right">
|
| 354 |
+
<div class="font-medium">$12,753.42</div>
|
| 355 |
+
<div class="text-gray-400 text-sm">0.0%</div>
|
| 356 |
+
</div>
|
| 357 |
+
</div>
|
| 358 |
+
</div>
|
| 359 |
+
|
| 360 |
+
<div class="mt-6 pt-4 border-t border-gray-700">
|
| 361 |
+
<button class="w-full bg-blue-600 hover:bg-blue-700 py-2 rounded-lg font-medium">
|
| 362 |
+
<i class="fas fa-plus mr-1"></i> Deposit Funds
|
| 363 |
+
</button>
|
| 364 |
+
<button class="w-full bg-gray-700 hover:bg-gray-600 py-2 rounded-lg font-medium mt-2">
|
| 365 |
+
<i class="fas fa-external-link-alt mr-1"></i> Withdraw
|
| 366 |
+
</button>
|
| 367 |
+
</div>
|
| 368 |
+
</div>
|
| 369 |
+
|
| 370 |
+
<!-- Active Bots -->
|
| 371 |
+
<div class="bg-gray-800 rounded-lg p-6 mb-6">
|
| 372 |
+
<h2 class="text-xl font-semibold mb-4 flex items-center">
|
| 373 |
+
<i class="fas fa-robot mr-2 text-red-400"></i>
|
| 374 |
+
Active Trading Bots
|
| 375 |
+
</h2>
|
| 376 |
+
|
| 377 |
+
<div class="space-y-4">
|
| 378 |
+
<div class="bg-gray-700 p-4 rounded-lg">
|
| 379 |
+
<div class="flex justify-between items-start mb-2">
|
| 380 |
+
<div>
|
| 381 |
+
<div class="font-medium">ML Trend Follower</div>
|
| 382 |
+
<div class="text-gray-400 text-sm">SUI/USDT</div>
|
| 383 |
+
</div>
|
| 384 |
+
<div class="bg-green-600 px-2 py-1 rounded-full text-xs">Running</div>
|
| 385 |
+
</div>
|
| 386 |
+
<div class="flex justify-between text-sm mt-3">
|
| 387 |
+
<div>
|
| 388 |
+
<div class="text-gray-400">24h Trades</div>
|
| 389 |
+
<div class="font-medium">12</div>
|
| 390 |
+
</div>
|
| 391 |
+
<div>
|
| 392 |
+
<div class="text-gray-400">Win Rate</div>
|
| 393 |
+
<div class="font-medium text-green-400">83%</div>
|
| 394 |
+
</div>
|
| 395 |
+
<div>
|
| 396 |
+
<div class="text-gray-400">Profit</div>
|
| 397 |
+
<div class="font-medium">+$324.21</div>
|
| 398 |
+
</div>
|
| 399 |
+
</div>
|
| 400 |
+
</div>
|
| 401 |
+
|
| 402 |
+
<div class="bg-gray-700 p-4 rounded-lg">
|
| 403 |
+
<div class="flex justify-between items-start mb-2">
|
| 404 |
+
<div>
|
| 405 |
+
<div class="font-medium">Arbitrage Scanner</div>
|
| 406 |
+
<div class="text-gray-400 text-sm">Multi-pair</div>
|
| 407 |
+
</div>
|
| 408 |
+
<div class="bg-green-600 px-2 py-1 rounded-full text-xs">Running</div>
|
| 409 |
+
</div>
|
| 410 |
+
<div class="flex justify-between text-sm mt-3">
|
| 411 |
+
<div>
|
| 412 |
+
<div class="text-gray-400">24h Trades</div>
|
| 413 |
+
<div class="font-medium">24</div>
|
| 414 |
+
</div>
|
| 415 |
+
<div>
|
| 416 |
+
<div class="text-gray-400">Win Rate</div>
|
| 417 |
+
<div class="font-medium text-green-400">92%</div>
|
| 418 |
+
</div>
|
| 419 |
+
<div>
|
| 420 |
+
<div class="text-gray-400">Profit</div>
|
| 421 |
+
<div class="font-medium">+$187.43</div>
|
| 422 |
+
</div>
|
| 423 |
+
</div>
|
| 424 |
+
</div>
|
| 425 |
+
|
| 426 |
+
<div class="bg-gray-700 p-4 rounded-lg">
|
| 427 |
+
<div class="flex justify-between items-start mb-2">
|
| 428 |
+
<div>
|
| 429 |
+
<div class="font-medium">News Sentiment</div>
|
| 430 |
+
<div class="text-gray-400 text-sm">Top 10 Coins</div>
|
| 431 |
+
</div>
|
| 432 |
+
<div class="bg-green-600 px-2 py-1 rounded-full text-xs">Running</div>
|
| 433 |
+
</div>
|
| 434 |
+
<div class="flex justify-between text-sm mt-3">
|
| 435 |
+
<div>
|
| 436 |
+
<div class="text-gray-400">24h Trades</div>
|
| 437 |
+
<div class="font-medium">11</div>
|
| 438 |
+
</div>
|
| 439 |
+
<div>
|
| 440 |
+
<div class="text-gray-400">Win Rate</div>
|
| 441 |
+
<div class="font-medium text-green-400">73%</div>
|
| 442 |
+
</div>
|
| 443 |
+
<div>
|
| 444 |
+
<div class="text-gray-400">Profit</div>
|
| 445 |
+
<div class="font-medium">+$143.75</div>
|
| 446 |
+
</div>
|
| 447 |
+
</div>
|
| 448 |
+
</div>
|
| 449 |
+
</div>
|
| 450 |
+
|
| 451 |
+
<button class="w-full bg-gray-700 hover:bg-gray-600 py-2 rounded-lg font-medium mt-4">
|
| 452 |
+
<i class="fas fa-plus mr-1"></i> Create New Bot
|
| 453 |
+
</button>
|
| 454 |
+
</div>
|
| 455 |
+
|
| 456 |
+
<!-- System Architecture Diagram -->
|
| 457 |
+
<div class="bg-gray-800 rounded-lg p-6">
|
| 458 |
+
<h2 class="text-xl font-semibold mb-4 flex items-center">
|
| 459 |
+
<i class="fas fa-project-diagram mr-2 text-purple-400"></i>
|
| 460 |
+
System Architecture
|
| 461 |
+
</h2>
|
| 462 |
+
|
| 463 |
+
<div class="bg-gray-900 p-4 rounded-lg text-xs">
|
| 464 |
+
<div class="flex justify-center mb-4">
|
| 465 |
+
<div class="bg-blue-600 text-white px-3 py-2 rounded-lg text-center max-w-xs">
|
| 466 |
+
<i class="fas fa-user"></i><br>
|
| 467 |
+
User Interface
|
| 468 |
+
</div>
|
| 469 |
+
</div>
|
| 470 |
+
|
| 471 |
+
<div class="flex justify-center mb-4">
|
| 472 |
+
<div class="border-l-2 border-gray-600 h-6"></div>
|
| 473 |
+
</div>
|
| 474 |
+
|
| 475 |
+
<div class="grid grid-cols-3 gap-2 mb-4">
|
| 476 |
+
<div class="bg-purple-600 text-white px-2 py-1 rounded-lg text-center">
|
| 477 |
+
<i class="fas fa-brain"></i><br>
|
| 478 |
+
AI Engine
|
| 479 |
+
</div>
|
| 480 |
+
<div class="bg-green-600 text-white px-2 py-1 rounded-lg text-center">
|
| 481 |
+
<i class="fas fa-exchange-alt"></i><br>
|
| 482 |
+
Trading Logic
|
| 483 |
+
</div>
|
| 484 |
+
<div class="bg-yellow-600 text-white px-2 py-1 rounded-lg text-center">
|
| 485 |
+
<i class="fas fa-database"></i><br>
|
| 486 |
+
Data Feed
|
| 487 |
+
</div>
|
| 488 |
+
</div>
|
| 489 |
+
|
| 490 |
+
<div class="flex justify-center mb-4">
|
| 491 |
+
<div class="border-l-2 border-gray-600 h-6"></div>
|
| 492 |
+
</div>
|
| 493 |
+
|
| 494 |
+
<div class="flex justify-center">
|
| 495 |
+
<div class="bg-red-600 text-white px-3 py-2 rounded-lg text-center max-w-xs">
|
| 496 |
+
<i class="fas fa-cube"></i><br>
|
| 497 |
+
Sui Blockchain
|
| 498 |
+
</div>
|
| 499 |
+
</div>
|
| 500 |
+
</div>
|
| 501 |
+
</div>
|
| 502 |
+
</div>
|
| 503 |
+
</div>
|
| 504 |
+
|
| 505 |
+
<!-- Code Samples Section -->
|
| 506 |
+
<div class="mt-12 bg-gray-800 rounded-lg p-6">
|
| 507 |
+
<h2 class="text-2xl font-bold mb-6">Technical Implementation</h2>
|
| 508 |
+
|
| 509 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-8">
|
| 510 |
+
<!-- Move Smart Contract Sample -->
|
| 511 |
+
<div>
|
| 512 |
+
<div class="flex items-center mb-4">
|
| 513 |
+
<div class="bg-green-600 p-2 rounded-full mr-3">
|
| 514 |
+
<i class="fas fa-file-contract text-white"></i>
|
| 515 |
+
</div>
|
| 516 |
+
<h3 class="text-xl font-semibold">Sui Move Smart Contract</h3>
|
| 517 |
+
</div>
|
| 518 |
+
|
| 519 |
+
<div class="bg-gray-900 rounded-lg p-4 overflow-x-auto">
|
| 520 |
+
<pre class="text-green-400 text-sm"><code>module ai_trader::trading_contract {
|
| 521 |
+
use sui::tx_context::TxContext;
|
| 522 |
+
use sui::coin::{Coin, TreasuryCap};
|
| 523 |
+
use sui::balance::{Self, Balance};
|
| 524 |
+
use sui::transfer;
|
| 525 |
+
|
| 526 |
+
/// Global trading configuration shared by all users
|
| 527 |
+
struct GlobalConfig has key {
|
| 528 |
+
id: UID,
|
| 529 |
+
fee_percentage: u64,
|
| 530 |
+
treasury_cap: TreasuryCap<SUI>
|
| 531 |
+
}
|
| 532 |
+
|
| 533 |
+
/// User-specific trading account
|
| 534 |
+
struct TradingAccount has key {
|
| 535 |
+
id: UID,
|
| 536 |
+
owner: address,
|
| 537 |
+
balance: Balance<SUI>,
|
| 538 |
+
open_positions: vector<Position>,
|
| 539 |
+
trading_stats: TradingStats
|
| 540 |
+
}
|
| 541 |
+
|
| 542 |
+
/// Represents an open trading position
|
| 543 |
+
struct Position has store {
|
| 544 |
+
pair: String,
|
| 545 |
+
amount: u64,
|
| 546 |
+
entry_price: u64,
|
| 547 |
+
direction: bool, // true = long, false = short
|
| 548 |
+
timestamp: u64
|
| 549 |
+
}
|
| 550 |
+
|
| 551 |
+
/// Initialize the trading contract
|
| 552 |
+
public entry fun init(ctx: &mut TxContext) {
|
| 553 |
+
let treasury_cap = treasury_policy::create_supply_limited(
|
| 554 |
+
1000000000, // max supply
|
| 555 |
+
18, // decimals
|
| 556 |
+
ctx
|
| 557 |
+
);
|
| 558 |
+
|
| 559 |
+
let config = GlobalConfig {
|
| 560 |
+
id: object::new(ctx),
|
| 561 |
+
fee_percentage: 10, // 0.1%
|
| 562 |
+
treasury_cap
|
| 563 |
+
};
|
| 564 |
+
|
| 565 |
+
transfer::share_object(config);
|
| 566 |
+
}
|
| 567 |
+
|
| 568 |
+
/// Execute a trade through the AI agent
|
| 569 |
+
public entry fun execute_ai_trade(
|
| 570 |
+
config: &GlobalConfig,
|
| 571 |
+
account: &mut TradingAccount,
|
| 572 |
+
pair: String,
|
| 573 |
+
amount: u64,
|
| 574 |
+
is_buy: bool,
|
| 575 |
+
ctx: &mut TxContext
|
| 576 |
+
) {
|
| 577 |
+
// AI trading logic would be implemented here
|
| 578 |
+
// including price checking, risk management, etc.
|
| 579 |
+
|
| 580 |
+
// Charge trading fee
|
| 581 |
+
let fee = (amount * config.fee_percentage) / 10000;
|
| 582 |
+
let trade_amount = amount - fee;
|
| 583 |
+
|
| 584 |
+
// Update account balance
|
| 585 |
+
let coin = balance::withdraw(&mut account.balance, trade_amount);
|
| 586 |
+
|
| 587 |
+
// Execute trade (simplified for example)
|
| 588 |
+
if (is_buy) {
|
| 589 |
+
// Buy logic
|
| 590 |
+
} else {
|
| 591 |
+
// Sell logic
|
| 592 |
+
}
|
| 593 |
+
|
| 594 |
+
// Update trading stats
|
| 595 |
+
event::emit(AITradeEvent {
|
| 596 |
+
trader: tx_context::sender(ctx),
|
| 597 |
+
pair: pair,
|
| 598 |
+
amount: trade_amount,
|
| 599 |
+
is_buy: is_buy,
|
| 600 |
+
timestamp: tx_context::epoch(ctx)
|
| 601 |
+
});
|
| 602 |
+
}
|
| 603 |
+
}</code></pre>
|
| 604 |
+
</div>
|
| 605 |
+
</div>
|
| 606 |
+
|
| 607 |
+
<!-- Python AI Logic Sample -->
|
| 608 |
+
<div>
|
| 609 |
+
<div class="flex items-center mb-4">
|
| 610 |
+
<div class="bg-blue-600 p-2 rounded-full mr-3">
|
| 611 |
+
<i class="fab fa-python text-white"></i>
|
| 612 |
+
</div>
|
| 613 |
+
<h3 class="text-xl font-semibold">Python AI Trading Logic</h3>
|
| 614 |
+
</div>
|
| 615 |
+
|
| 616 |
+
<div class="bg-gray-900 rounded-lg p-4 overflow-x-auto">
|
| 617 |
+
<pre class="text-blue-400 text-sm"><code>import pandas as pd
|
| 618 |
+
import numpy as np
|
| 619 |
+
from sklearn.ensemble import RandomForestClassifier
|
| 620 |
+
from sui_sdk import SuiClient
|
| 621 |
+
|
| 622 |
+
class AITradingAgent:
|
| 623 |
+
def __init__(self, sui_client: SuiClient):
|
| 624 |
+
self.sui = sui_client
|
| 625 |
+
self.model = self._train_model()
|
| 626 |
+
|
| 627 |
+
def _train_model(self):
|
| 628 |
+
"""Train the AI model with historical data"""
|
| 629 |
+
# Load historical price data
|
| 630 |
+
data = pd.read_csv('historical_prices.csv')
|
| 631 |
+
data['returns'] = data['close'].pct_change()
|
| 632 |
+
|
| 633 |
+
# Create features
|
| 634 |
+
data['sma_50'] = data['close'].rolling(50).mean()
|
| 635 |
+
data['sma_200'] = data['close'].rolling(200).mean()
|
| 636 |
+
data['rsi'] = self._calculate_rsi(data['close'])
|
| 637 |
+
data = data.dropna()
|
| 638 |
+
|
| 639 |
+
# Create target (1 if next return is positive, 0 otherwise)
|
| 640 |
+
data['target'] = (data['returns'].shift(-1) > 0).astype(int)
|
| 641 |
+
|
| 642 |
+
# Train Random Forest classifier
|
| 643 |
+
features = ['sma_50', 'sma_200', 'rsi']
|
| 644 |
+
X = data[features]
|
| 645 |
+
y = data['target']
|
| 646 |
+
|
| 647 |
+
model = RandomForestClassifier(n_estimators=100)
|
| 648 |
+
model.fit(X, y)
|
| 649 |
+
|
| 650 |
+
return model
|
| 651 |
+
|
| 652 |
+
def analyze_market(self, pair: str):
|
| 653 |
+
"""Analyze market conditions and make a trading decision"""
|
| 654 |
+
# Fetch current market data
|
| 655 |
+
candles = self.sui.get_candles(pair, '1h', limit=300)
|
| 656 |
+
df = pd.DataFrame(candles)
|
| 657 |
+
|
| 658 |
+
# Calculate features for prediction
|
| 659 |
+
df['sma_50'] = df['close'].rolling(50).mean()
|
| 660 |
+
df['sma_200'] = df['close'].rolling(200).mean()
|
| 661 |
+
df['rsi'] = self._calculate_rsi(df['close'])
|
| 662 |
+
latest = df.iloc[-1]
|
| 663 |
+
|
| 664 |
+
# Make prediction
|
| 665 |
+
features = latest[['sma_50', 'sma_200', 'rsi']].values.reshape(1, -1)
|
| 666 |
+
proba = self.model.predict_proba(features)[0]
|
| 667 |
+
|
| 668 |
+
# Calculate confidence score
|
| 669 |
+
confidence = max(proba) * 100
|
| 670 |
+
signal = 'BUY' if np.argmax(proba) == 1 else 'SELL'
|
| 671 |
+
|
| 672 |
+
return {
|
| 673 |
+
'pair': pair,
|
| 674 |
+
'signal': signal,
|
| 675 |
+
'confidence': confidence,
|
| 676 |
+
'current_price': latest['close'],
|
| 677 |
+
'recommended_size': self._calculate_position_size(confidence)
|
| 678 |
+
}
|
| 679 |
+
|
| 680 |
+
def execute_trade(self, decision):
|
| 681 |
+
"""Execute trade through Sui blockchain"""
|
| 682 |
+
# Prepare transaction
|
| 683 |
+
tx = {
|
| 684 |
+
'function': 'ai_trader::trading_contract::execute_ai_trade',
|
| 685 |
+
'arguments': [
|
| 686 |
+
decision['pair'],
|
| 687 |
+
decision['recommended_size'],
|
| 688 |
+
decision['signal'] == 'BUY'
|
| 689 |
+
],
|
| 690 |
+
'gas_budget': 10000
|
| 691 |
+
}
|
| 692 |
+
|
| 693 |
+
# Sign and execute transaction
|
| 694 |
+
result = self.sui.execute_transaction(tx)
|
| 695 |
+
return result
|
| 696 |
+
|
| 697 |
+
def _calculate_rsi(self, prices, window=14):
|
| 698 |
+
deltas = np.diff(prices)
|
| 699 |
+
seed = deltas[:window+1]
|
| 700 |
+
up = seed[seed >= 0].sum()/window
|
| 701 |
+
down = -seed[seed < 0].sum()/window
|
| 702 |
+
rs = up/down
|
| 703 |
+
rsi = np.zeros_like(prices)
|
| 704 |
+
rsi[:window] = 100. - 100./(1.+rs)
|
| 705 |
+
|
| 706 |
+
for i in range(window, len(prices)):
|
| 707 |
+
delta = deltas[i-1]
|
| 708 |
+
if delta > 0:
|
| 709 |
+
upval = delta
|
| 710 |
+
downval = 0.
|
| 711 |
+
else:
|
| 712 |
+
upval = 0.
|
| 713 |
+
downval = -delta
|
| 714 |
+
|
| 715 |
+
up = (up*(window-1) + upval)/window
|
| 716 |
+
down = (down*(window-1) + downval)/window
|
| 717 |
+
rs = up/down
|
| 718 |
+
rsi[i] = 100. - 100./(1.+rs)
|
| 719 |
+
|
| 720 |
+
return rsi
|
| 721 |
+
|
| 722 |
+
def _calculate_position_size(self, confidence):
|
| 723 |
+
"""Calculate position size based on confidence and risk management"""
|
| 724 |
+
base_size = 100 # Base size in SUI
|
| 725 |
+
risk_multiplier = confidence / 50 # Scale with confidence
|
| 726 |
+
return int(base_size * risk_multiplier)</code></pre>
|
| 727 |
+
</div>
|
| 728 |
+
</div>
|
| 729 |
+
</div>
|
| 730 |
+
</div>
|
| 731 |
+
</div>
|
| 732 |
+
|
| 733 |
+
<script>
|
| 734 |
+
// Generate random chart points
|
| 735 |
+
function generateChartPoints() {
|
| 736 |
+
const chartContainer = document.getElementById('chartPoints');
|
| 737 |
+
chartContainer.innerHTML = '';
|
| 738 |
+
|
| 739 |
+
const width = chartContainer.parentElement.clientWidth;
|
| 740 |
+
const height = chartContainer.parentElement.clientHeight;
|
| 741 |
+
|
| 742 |
+
// Generate a realistic price path
|
| 743 |
+
let x = 0;
|
| 744 |
+
let y = height / 2;
|
| 745 |
+
let angle = -0.2;
|
| 746 |
+
|
| 747 |
+
for (let i = 0; i < 40; i++) {
|
| 748 |
+
const point = document.createElement('div');
|
| 749 |
+
point.className = 'price-marker';
|
| 750 |
+
|
| 751 |
+
// Random angle change to simulate market movements
|
| 752 |
+
angle += (Math.random() - 0.5) * 0.3;
|
| 753 |
+
x += width / 30;
|
| 754 |
+
y += Math.sin(angle) * 10;
|
| 755 |
+
|
| 756 |
+
point.style.left = `${x}px`;
|
| 757 |
+
point.style.top = `${y}px`;
|
| 758 |
+
|
| 759 |
+
chartContainer.appendChild(point);
|
| 760 |
+
|
| 761 |
+
// Connect points with lines
|
| 762 |
+
if (i > 0) {
|
| 763 |
+
const line = document.createElement('div');
|
| 764 |
+
line.className = 'absolute bg-blue-500 h-0.5';
|
| 765 |
+
line.style.left = `${prevX}px`;
|
| 766 |
+
line.style.top = `${prevY}px`;
|
| 767 |
+
line.style.width = `${Math.sqrt(Math.pow(x - prevX, 2) + Math.pow(y - prevY, 2))}px`;
|
| 768 |
+
line.style.transform = `rotate(${Math.atan2(y - prevY, x - prevX)}rad)`;
|
| 769 |
+
line.style.transformOrigin = '0 0';
|
| 770 |
+
|
| 771 |
+
chartContainer.appendChild(line);
|
| 772 |
+
}
|
| 773 |
+
|
| 774 |
+
prevX = x;
|
| 775 |
+
prevY = y;
|
| 776 |
+
}
|
| 777 |
+
}
|
| 778 |
+
|
| 779 |
+
// Toggle manual trading panel
|
| 780 |
+
document.getElementById('manualMode').addEventListener('click', function() {
|
| 781 |
+
this.classList.remove('bg-gray-700', 'hover:bg-gray-600');
|
| 782 |
+
this.classList.add('bg-blue-600', 'hover:bg-blue-700');
|
| 783 |
+
|
| 784 |
+
document.getElementById('autoMode').classList.remove('bg-blue-600', 'hover:bg-blue-700');
|
| 785 |
+
document.getElementById('autoMode').classList.add('bg-gray-700', 'hover:bg-gray-600');
|
| 786 |
+
|
| 787 |
+
document.getElementById('manualPanel').classList.remove('hidden');
|
| 788 |
+
});
|
| 789 |
+
|
| 790 |
+
document.getElementById('autoMode').addEventListener('click', function() {
|
| 791 |
+
this.classList.remove('bg-gray-700', 'hover:bg-gray-600');
|
| 792 |
+
this.classList.add('bg-green-600', 'hover:bg-green-700');
|
| 793 |
+
|
| 794 |
+
document.getElementById('manualMode').classList.remove('bg-blue-600', 'hover:bg-blue-700');
|
| 795 |
+
document.getElementById('manualMode').classList.add('bg-gray-700', 'hover:bg-gray-600');
|
| 796 |
+
|
| 797 |
+
document.getElementById('manualPanel').classList.add('hidden');
|
| 798 |
+
});
|
| 799 |
+
|
| 800 |
+
// Initialize the chart
|
| 801 |
+
window.addEventListener('load', generateChartPoints);
|
| 802 |
+
window.addEventListener('resize', generateChartPoints);
|
| 803 |
+
</script>
|
| 804 |
+
<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=0xLaszlo/trading-interface" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 805 |
+
</html>
|
prompts.txt
ADDED
|
File without changes
|