Files
trading_bot_v4/quick-trade.html
mindesbunister 3e2cf2eec2 feat: add Telegram bot for manual trade commands
- Added telegram_command_bot.py with slash commands (/buySOL, /sellBTC, etc)
- Docker compose setup with DNS configuration
- Sends trades as plain text to n8n webhook (same format as TradingView)
- Improved Telegram success message formatting
- Only responds to authorized chat ID (579304651)
- Commands: /buySOL, /sellSOL, /buyBTC, /sellBTC, /buyETH, /sellETH
2025-10-27 00:23:09 +01:00

106 lines
3.5 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Quick Trade</title>
<style>
body {
font-family: Arial, sans-serif;
max-width: 500px;
margin: 50px auto;
padding: 20px;
background: #1a1a1a;
color: #fff;
}
button {
width: 48%;
padding: 30px;
margin: 5px 1%;
font-size: 20px;
border: none;
border-radius: 10px;
cursor: pointer;
font-weight: bold;
}
.buy { background: #10b981; color: white; }
.sell { background: #ef4444; color: white; }
.row { margin: 20px 0; }
h2 { text-align: center; color: #10b981; }
#status {
margin-top: 20px;
padding: 15px;
border-radius: 10px;
display: none;
text-align: center;
}
.success { background: #10b981; }
.error { background: #ef4444; }
</style>
</head>
<body>
<h2>📱 Quick Trade</h2>
<div class="row">
<button class="buy" onclick="trade('buy', 'sol')">BUY SOL</button>
<button class="sell" onclick="trade('sell', 'sol')">SELL SOL</button>
</div>
<div class="row">
<button class="buy" onclick="trade('buy', 'btc')">BUY BTC</button>
<button class="sell" onclick="trade('sell', 'btc')">SELL BTC</button>
</div>
<div class="row">
<button class="buy" onclick="trade('buy', 'eth')">BUY ETH</button>
<button class="sell" onclick="trade('sell', 'eth')">SELL ETH</button>
</div>
<div id="status"></div>
<script>
// SECRET TOKEN - Keep this file private! Only accessible from localhost
const SECRET_TOKEN = 'YOUR_SECRET_HERE_' + Math.random().toString(36).substring(7);
// Only allow from localhost/internal network
if (!window.location.hostname.match(/^(localhost|127\.0\.0\.1|10\.|192\.168\.|172\.)/)) {
document.body.innerHTML = '<h2 style="color:red">Access Denied</h2>';
}
async function trade(action, symbol) {
const status = document.getElementById('status');
status.style.display = 'block';
status.className = '';
status.textContent = '⏳ Sending...';
try {
const response = await fetch('http://10.0.0.48:8098/webhook/3371ad7c-0866-4161-90a4-f251de4aceb8', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Secret-Token': SECRET_TOKEN
},
body: JSON.stringify({
body: `${action} ${symbol}`,
secret: SECRET_TOKEN
})
});
if (response.ok) {
status.className = 'success';
status.textContent = `${action.toUpperCase()} ${symbol.toUpperCase()} sent!`;
} else {
throw new Error(`HTTP ${response.status}`);
}
} catch (error) {
status.className = 'error';
status.textContent = `❌ Error: ${error.message}`;
}
setTimeout(() => {
status.style.display = 'none';
}, 3000);
}
</script>
</body>
</html>