Spaces:
Running
Running
Download index.html from nsa1/anycoder-651316b3: direct link, hf CLI and curl.
- Browser
- Download file 17.9 kB
-
https://huggingface.co/spaces/nsa1/anycoder-651316b3/resolve/main/index.html
- Command line
-
hf download hf://spaces/nsa1/anycoder-651316b3/index.html
-
curl -L -o index.html https://huggingface.co/spaces/nsa1/anycoder-651316b3/resolve/main/index.html
17.9 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>XRPL Auto-Bot | Smart Trading</title> | |
| <!-- Import FontAwesome for Icons --> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> | |
| <!-- Google Fonts --> | |
| <link | |
| href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&family=Fira+Code:wght@400;500&display=swap" | |
| rel="stylesheet"> | |
| <style> | |
| :root { | |
| --xrpl-blue: #003b5f; | |
| --xrpl-light: #2a4d69; | |
| --accent-green: #00e676; | |
| --accent-red: #ff1744; | |
| --bg-dark: #0f172a; | |
| --glass-bg: rgba(16, 28, 45, 0.7); | |
| --border-glass: rgba(255, 255, 255, 0.1); | |
| --text-main: #ffffff; | |
| --text-muted: #94a3b8; | |
| --font-main: 'Inter', sans-serif; | |
| --font-code: 'Fira Code', monospace; | |
| } | |
| * { | |
| box-sizing: box-box; | |
| margin: 0; | |
| padding: 0; | |
| } | |
| body { | |
| background-color: var(--bg-dark); | |
| color: var(--text-main); | |
| font-family: var(--font-main); | |
| height: 100vh; | |
| overflow: hidden; | |
| display: flex; | |
| flex-direction: column; | |
| background-image: radial-gradient(circle at 50% 50%, #1e293b 0%, #0f172a 100%); | |
| } | |
| /* Header & Nav */ | |
| header { | |
| padding: 1rem 2rem; | |
| display: flex; | |
| justify-content: space-between; | |
| align-items: center; | |
| border-bottom: 1px solid var(--border-glass); | |
| background: var(--glass-bg); | |
| backdrop-filter: blur(10px); | |
| z-index: 10; | |
| } | |
| .brand { | |
| font-weight: 700; | |
| font-size: 1.2rem; | |
| letter-spacing: -0.5px; | |
| display: flex; | |
| align-items: center; | |
| gap: 10px; | |
| } | |
| .brand i { | |
| color: var(--xrpl-blue); | |
| font-size: 1.4rem; | |
| } | |
| .anycoder-link { | |
| font-size: 0.8rem; | |
| color: var(--text-muted); | |
| text-decoration: none; | |
| border: 1px solid var(--border-glass); | |
| padding: 0.4rem 0.8rem; | |
| border-radius: 4px; | |
| transition: all 0.3s ease; | |
| } | |
| .anycoder-link:hover { | |
| color: var(--accent-green); | |
| border-color: var(--accent-green); | |
| background: rgba(0, 230, 116, 0.1); | |
| } | |
| /* Main Grid Layout */ | |
| main { | |
| display: grid; | |
| grid-template-columns: 300px 1fr 350px; | |
| grid-template-rows: 1fr; | |
| gap: 1rem; | |
| padding: 1rem; | |
| height: 100%; | |
| max-width: 1600px; | |
| margin: 0 auto; | |
| } | |
| /* Responsive Breakpoints */ | |
| @media (max-width: 1000px) { | |
| main { | |
| grid-template-columns: 1fr; | |
| grid-template-rows: auto auto auto; | |
| overflow-y: auto; | |
| } | |
| body { | |
| overflow: auto; | |
| } | |
| } | |
| /* Common Card Styles */ | |
| .card { | |
| background: var(--glass-bg); | |
| border: 1px solid var(--border-glass); | |
| border-radius: 16px; | |
| padding: 1.5rem; | |
| display: flex; | |
| flex-direction: column; | |
| position: relative; | |
| overflow: hidden; | |
| transition: transform 0.2s; | |
| } | |
| .card-header { | |
| display: flex; | |
| justify-content: space-between; | |
| align-items: center; | |
| margin-bottom: 1rem; | |
| font-size: 0.9rem; | |
| color: var(--text-muted); | |
| text-transform: uppercase; | |
| letter-spacing: 1px; | |
| } | |
| /* Sidebar: Wallet Stats */ | |
| .sidebar-left { | |
| display: flex; | |
| flex-direction: column; | |
| gap: 1rem; | |
| } | |
| .wallet-card { | |
| background: linear-gradient(145deg, rgba(16, 28, 45, 0.8), rgba(22, 36, 50, 0.9)); | |
| } | |
| .balance-display { | |
| font-family: var(--font-code); | |
| font-size: 2.5rem; | |
| font-weight: 700; | |
| margin: 0.5rem 0; | |
| color: var(--text-main); | |
| } | |
| .balance-sub { | |
| color: var(--accent-green); | |
| font-size: 0.9rem; | |
| display: flex; | |
| align-items: center; | |
| gap: 5px; | |
| } | |
| .stat-row { | |
| display: flex; | |
| justify-content: space-between; | |
| padding: 0.8rem 0; | |
| border-bottom: 1px solid var(--border-glass); | |
| font-size: 0.85rem; | |
| } | |
| /* Center: Chart Area */ | |
| .chart-container { | |
| position: relative; | |
| height: 100%; | |
| min-height: 400px; | |
| display: flex; | |
| flex-direction: column; | |
| } | |
| #price-chart { | |
| width: 100%; | |
| height: 100%; | |
| border-radius: 8px; | |
| background: rgba(0, 0, 0, 0.2); | |
| } | |
| .chart-overlay { | |
| position: absolute; | |
| top: 20px; | |
| left: 20px; | |
| z-index: 5; | |
| } | |
| .current-price { | |
| font-family: var(--font-code); | |
| font-size: 1.5rem; | |
| color: var(--text-main); | |
| } | |
| .price-trend { | |
| font-size: 0.8rem; | |
| padding: 2px 6px; | |
| border-radius: 4px; | |
| margin-left: 10px; | |
| } | |
| .trend-up { | |
| background: var(--accent-green); | |
| color: #000; | |
| } | |
| .trend-down { | |
| background: var(--accent-red); | |
| color: #fff; | |
| } | |
| /* Right: Bot Controls */ | |
| .sidebar-right { | |
| display: flex; | |
| flex-direction: column; | |
| gap: 1rem; | |
| } | |
| .bot-status-card { | |
| border-left: 4px solid var(--accent-green); | |
| } | |
| .bot-status-card.offline { | |
| border-left: 4px solid var(--accent-red); | |
| } | |
| .status-indicator { | |
| display: inline-flex; | |
| align-items: center; | |
| gap: 8px; | |
| font-weight: 600; | |
| margin-bottom: 1rem; | |
| } | |
| .pulse-dot { | |
| width: 10px; | |
| height: 10px; | |
| border-radius: 50%; | |
| background: var(--accent-green); | |
| animation: pulse 2s infinite; | |
| } | |
| .pulse-dot.offline { | |
| background: var(--accent-red); | |
| animation: none; | |
| } | |
| @keyframes pulse { | |
| 0% { | |
| opacity: 1; | |
| box-shadow: 0 0 5px var(--accent-green); | |
| } | |
| 50% { | |
| opacity: 0.5; | |
| box-shadow: 0 0 2px var(--accent-green); | |
| } | |
| 100% { | |
| opacity: 1; | |
| box-shadow: 0 0 5px var(--accent-green); | |
| } | |
| } | |
| .control-group { | |
| margin-top: 1rem; | |
| } | |
| .btn-toggle { | |
| width: 100%; | |
| padding: 1rem; | |
| background: transparent; | |
| border: 1px solid var(--border-glass); | |
| color: var(--text-main); | |
| font-weight: 600; | |
| cursor: pointer; | |
| border-radius: 8px; | |
| transition: 0.3s; | |
| display: flex; | |
| justify-content: center; | |
| align-items: center; | |
| gap: 10px; | |
| font-family: var(--font-main); | |
| } | |
| .btn-toggle.active { | |
| background: var(--xrpl-blue); | |
| border-color: var(--xrpl-blue); | |
| box-shadow: 0 0 15px rgba(0, 59, 95, 0.4); | |
| } | |
| .btn-toggle:hover { | |
| background: rgba(255, 255, 255, 0.05); | |
| } | |
| /* Transaction Log */ | |
| .log-container { | |
| flex-grow: 1; | |
| overflow-y: auto; | |
| max-height: 300px; | |
| margin-top: 1rem; | |
| font-family: var(--font-code); | |
| font-size: 0.8rem; | |
| } | |
| .log-item { | |
| padding: 0.6rem; | |
| border-bottom: 1px solid var(--border-glass); | |
| display: flex; | |
| justify-content: space-between; | |
| opacity: 0.8; | |
| transition: opacity 0.3s; | |
| } | |
| .log-item:hover { | |
| opacity: 1; | |
| background: rgba(255, 255, 255, 0.02); | |
| } | |
| .log-buy { | |
| color: var(--accent-green); | |
| } | |
| .log-sell { | |
| color: var(--accent-red); | |
| } | |
| /* Strategy Selector */ | |
| .strategy-select { | |
| width: 100%; | |
| padding: 0.8rem; | |
| background: rgba(0, 0, 0, 0.3); | |
| border: 1px solid var(--border-glass); | |
| color: var(--text-main); | |
| border-radius: 6px; | |
| margin-top: 0.5rem; | |
| font-family: var(--font-main); | |
| outline: none; | |
| } | |
| /* Utility Classes */ | |
| .badge { | |
| font-size: 0.7rem; | |
| padding: 2px 6px; | |
| border-radius: 4px; | |
| background: rgba(255, 255, 255, 0.1); | |
| } | |
| .loader { | |
| border: 2px solid rgba(255, 255, 255, 0.1); | |
| border-top: 2px solid var(--accent-green); | |
| border-radius: 4px; | |
| width: 16px; | |
| height: 16px; | |
| animation: spin 1s linear infinite; | |
| display: inline-block; | |
| } | |
| @keyframes spin { | |
| 0% { | |
| transform: rotate(0deg); | |
| } | |
| 100% { | |
| transform: rotate(360deg); | |
| } | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <header> | |
| <div class="brand"> | |
| <i class="fa-brands fa-bitcoin"></i> | |
| <span>XRPL Auto-Bot</span> | |
| </div> | |
| <!-- CRITICAL REQUIREMENT: Built with anycoder link --> | |
| <a href="https://huggingface.co/spaces/akhaliq/anycoder" class="anycoder-link" target="_blank"> | |
| Built with anycoder | |
| </a> | |
| </header> | |
| <main> | |
| <!-- Sidebar Left: Wallet Stats --> | |
| <section class="sidebar-left"> | |
| <div class="card wallet-card"> | |
| <div class="card-header"> | |
| <span>Wallet Overview</span> | |
| <i class="fa-solid fa-wallet"></i> | |
| </div> | |
| <div class="balance-display"> | |
| 1,450.00 XRP | |
| </div> | |
| <div class="balance-sub"> | |
| <i class="fa-solid fa-arrow-trend-up"></i> +2.4% (24h) | |
| </div> | |
| <div style="margin-top: 1.5rem;"> | |
| <div class="stat-row"> | |
| <span>USD Value</span> | |
| <span style="font-family: var(--font-code);">$872.50</span> | |
| </div> | |
| <div class="stat-row"> | |
| <span>Available</span> | |
| <span style="font-family: var(--font-code);">1,450 XRP</span> | |
| </div> | |
| <div class="stat-row"> | |
| <span>Reserved</span> | |
| <span style="font-family: var(--font-code);">10 XRP</span> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="card"> | |
| <div class="card-header"> | |
| <span>Network Status</span> | |
| <span class="badge">Mainnet</span> | |
| </div> | |
| <div class="stat-row"> | |
| <span>Latency</span> | |
| <span style="color: var(--accent-green)">12ms</span> | |
| </div> | |
| <div class="stat-row"> | |
| <span>Node</span> | |
| <span>s1.ripple.com</span> | |
| </div> | |
| </div> | |
| </section> | |
| <!-- Center: Chart Visualization --> | |
| <section class="card chart-container"> | |
| <div class="chart-overlay"> | |
| <div class="current-price"> | |
| $0.6024 <span id="trend-badge" class="price-trend trend-up">▲</span> | |
| </div> | |
| <div style="font-size: 0.8rem; color: var(--text-muted); margin-top: 5px;">XRP/USD Real-time</div> | |
| </div> | |
| <svg id="price-chart" viewBox="0 0 800 400" preserveAspectRatio="none"> | |
| <!-- Grid Lines --> | |
| <defs> | |
| <pattern id="grid" width="40" height="40" patternUnits="userSpaceOnUse"> | |
| <path d="M 40 0 L 0 0 0 40" fill="none" stroke="rgba(255,255,255,0.05)" stroke-width="1" /> | |
| </pattern> | |
| </defs> | |
| <rect width="100%" height="100%" fill="url(#grid)" /> | |
| <!-- Dynamic Path will be injected here --> | |
| <path id="chart-path" d="" fill="none" stroke="#00e676" stroke-width="2" /> | |
| <path id="chart-area" d="" fill="rgba(0, 230, 116, 0.1)" /> | |
| <!-- Buy/Sell Zone Indicators --> | |
| <rect x="0" y="300" width="800" height="100" fill="rgba(0, 230, 116, 0.05)" /> | |
| <text x="10" y="320" fill="rgba(0, 230, 116, 0.5)" font-size="10">BUY ZONE</text> | |
| <rect x="0" y="0" width="800" height="80" fill="rgba(255, 17, 68, 0.05)" /> | |
| <text x="10" y="20" fill="rgba(255, 17, 68, 0.5)" font-size="10">SELL ZONE</text> | |
| </svg> | |
| </section> | |
| <!-- Sidebar Right: Bot Controls --> | |
| <section class="sidebar-right"> | |
| <div class="card bot-status-card" id="bot-card"> | |
| <div class="card-header"> | |
| <span>Bot Engine</span> | |
| <i class="fa-solid fa-robot"></i> | |
| </div> | |
| <div class="status-indicator"> | |
| <div class="pulse-dot" id="bot-dot"></div> | |
| <span id="bot-status-text">System Idle</span> | |
| </div> | |
| <div class="control-group"> | |
| <label style="font-size: 0.8rem; color: var(--text-muted); display:block; margin-bottom: 5px;">Strategy Mode</label> | |
| <select class="strategy-select" id="strategy"> | |
| <option value="conservative">Conservative (Low Risk)</option> | |
| <option value="aggressive">Aggressive (High Vol)</option> | |
| <option value="dca">DCA (Long Term)</option> | |
| </select> | |
| </div> | |
| <button class="btn-toggle" id="toggle-bot" onclick="toggleBot()"> | |
| <i class="fa-solid fa-power-off"></i> | |
| <span>Activate Bot</span> | |
| </button> | |
| <div class="log-container" id="transaction-log"> | |
| <!-- Logs injected via JS --> | |
| <div class="log-item"> | |
| <span>System Init</span> | |
| <span style="color: var(--text-muted)">10:00 AM</span> | |
| </div> | |
| </div> | |
| </div> | |
| </section> | |
| </main> | |
| <script> | |
| // --- Simulation Logic --- | |
| let isBotActive = false; | |
| let currentPrice = 0.60; | |
| let priceHistory = []; | |
| const chartPath = document.getElementById('chart-path'); | |
| const chartArea = document.getElementById('chart-area'); | |
| const trendBadge = document.getElementById('trend-badge'); | |
| const botDot = document.getElementById('bot-dot'); | |
| const botStatusText = document.getElementById('bot-status-text'); | |
| const botCard = document.getElementById('bot-card'); | |
| const toggleBtn = document.getElementById('toggle-bot'); | |
| const logContainer = document.getElementById('transaction-log'); | |
| // Initialize Price History | |
| function initChart() { | |
| priceHistory = []; | |
| for (let i = 0; i < 50; i++) { | |
| priceHistory.push(0.60 + (Math.random() * 0.02 - 0.01)); | |
| } | |
| drawChart(); | |
| } | |
| // Draw SVG Chart | |
| function drawChart() { | |
| const width = 800; | |
| const height = 400; | |
| const maxPrice = 0.65; | |
| const minPrice = 0.55; | |
| // Create Path Data | |
| let d = ""; | |
| priceHistory.forEach((p, index) { | |
| const x = (index / priceHistory.length) * width; | |
| // Normalize Y | |
| const y = height - ((p - minPrice) / (maxPrice - minPrice)) * height; | |
| d += `L ${x} ${y} `; | |
| }); | |
| // Update SVG | |
| chartPath.setAttribute('d', d.replace('L', 'M')); // Start with M | |
| // Create Area fill (close the path) | |
| const areaD = d.replace('L', 'M') + `L ${width} ${height} L 0 ${height} Z`; | |
| chartArea.setAttribute('d', areaD); | |
| // Update UI Price | |
| const lastPrice = priceHistory[priceHistory.length - 1]; | |
| document.querySelector('.current-price').innerText = `$${lastPrice.toFixed(4)}`; | |
| // Update Trend Arrow | |
| const prevPrice = priceHistory[priceHistory.length - 2]; | |
| if (lastPrice > prevPrice) { | |
| trendBadge.innerText = "▲"; | |
| trendBadge.className = "price-trend trend-up"; | |
| } else { | |
| trendBadge.innerText = "▼"; | |
| trendBadge.className = "price-trend trend-down"; | |
| } | |
| } | |
| // Simulate Market Movement | |
| function simulateMarket() { | |
| // Random walk | |
| const change = (Math.random() * 0.04) - 0.02; | |
| let newPrice = priceHistory[priceHistory.length - 1] + change; | |
| // Keep within bounds | |
| if (newPrice > 0.65) newPrice = 0.65; | |
| if (newPrice < 0.55) newPrice = 0.55; | |
| priceHistory.push(newPrice); | |
| if (priceHistory.length > 50) priceHistory.shift(); | |
| drawChart(); | |
| if (isBotActive) { | |
| botLogic(newPrice); | |
| } | |
| } | |
| // Bot Logic: Buy Low, Sell High | |
| function botLogic(price) { | |
| const strategy = document.getElementById('strategy').value; | |
| let buyThreshold = 0.58; | |
| let sellThreshold = 0.62; | |
| if (strategy === 'aggressive') { | |
| buyThreshold = 0.59; | |
| sellThreshold = 0.61; | |
| } else if (strategy === 'dca') { | |
| buyThreshold = 0.60; // Buy constantly | |
| sellThreshold = 0.99; // Never sell in this sim | |
| } | |
| if (price <= buyThreshold) { | |
| triggerAction('BUY', price); | |
| } else if (price >= sellThreshold) { | |
| triggerAction('SELL', price); | |
| } | |
| } | |
| // Handle Transaction UI | |
| function triggerAction(type, price) { | |
| const time = new Date().toLocaleTimeString(); | |
| const html = ` | |
| <div class="log-item"> | |
| <span class="${type === 'BUY' ? 'log-buy' : 'log-sell'}"> | |
| <i class="fa-solid ${type === 'BUY' ? 'fa-cart-shopping' : 'fa-coins'}"></i> | |
| ${type} XRP | |
| </span> | |
| <span>@ $${price.toFixed(4)}</span> | |
| <span style="color: var(--text-muted)">${time}</span> | |
| </div> | |
| `; | |
| // Insert at top | |
| logContainer.innerHTML = html + logContainer.innerHTML; | |
| // Visual Flash effect on card | |
| botCard.style.boxShadow = type === 'BUY' ? '0 0 20px rgba(0, 230, 116, 0.2)' : '0 0 20px rgba(255, 17, 44, 0.2)'; | |
| setTimeout(() => { botCard.style.boxShadow = 'none'; }, 500); | |
| } | |
| // Toggle Bot State | |
| function toggleBot() { | |
| isBotActive = !isBotActive; | |
| if (isBotActive) { | |
| botDot.classList.remove('offline'); | |
| botStatusText.innerText = "Active - Scanning"; | |
| botCard.classList.remove('offline'); | |
| toggleBtn.classList.add('active'); | |
| toggleBtn.innerHTML = `<i class="fa-solid fa-spinner"></i> <span>Bot Running...</span>`; | |
| logContainer.innerHTML += `<div class="log-item"><span style="color:var(--accent-green)">Bot Started</span><span>${new Date().toLocaleTimeString()}</span></div>`; | |
| } else { | |
| botDot.classList.add('offline'); | |
| botStatusText.innerText = "System Idle"; | |
| botCard.classList.add('offline'); | |
| toggleBtn.classList.remove('active'); | |
| toggleBtn.innerHTML = `<i class="fa-solid fa-power-off"></i> <span>Activate Bot</span>`; | |
| logContainer.innerHTML += `<div class="log-item"><span style="color:var(--accent-red)">Bot Stopped</span><span>${new Date().toLocaleTimeString()}</span></div>`; | |
| } | |
| } | |
| // Start Simulation Loop | |
| initChart(); | |
| setInterval(simulateMarket, 1000); // Update every second | |
| </script> | |
| </body> | |
| </html> |