Download index.html from note6/btcpro7: direct link, hf CLI and curl.
- Browser
- Download file 40 kB
-
https://huggingface.co/spaces/note6/btcpro7/resolve/main/index.html
- Command line
-
hf download hf://spaces/note6/btcpro7/index.html
-
curl -L -o index.html https://huggingface.co/spaces/note6/btcpro7/resolve/main/index.html
40 kB
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Bitcoin Price Predictor</title>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/luxon@2.0.2"></script>
<script src="https://cdn.jsdelivr.net/npm/chartjs-adapter-luxon@1.0.0"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
<style>
* {
box-sizing: border-box;
margin: 0;
padding: 0;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
body {
background-color: #f5f7fa;
color: #333;
line-height: 1.6;
}
.container {
width: 100%;
max-width: 1200px;
margin: 0 auto;
padding: 20px;
}
/* Header styles */
.header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 30px;
flex-wrap: wrap;
}
.header-title {
display: flex;
align-items: center;
font-size: 28px;
font-weight: bold;
color: #2d3748;
}
.header-title i {
color: #f7931a;
margin-right: 10px;
}
.header-controls {
display: flex;
align-items: center;
}
.refresh-btn {
background-color: #3182ce;
color: white;
border: none;
padding: 8px 16px;
border-radius: 6px;
cursor: pointer;
display: flex;
align-items: center;
margin-right: 15px;
transition: background-color 0.3s;
}
.refresh-btn:hover {
background-color: #2c5282;
}
.refresh-btn i {
margin-right: 5px;
}
.last-updated {
font-size: 14px;
color: #718096;
}
.header-subtitle {
width: 100%;
margin-top: 10px;
color: #4a5568;
font-size: 14px;
}
/* Prediction cards */
.predictions-container {
display: flex;
flex-wrap: wrap;
gap: 20px;
margin-bottom: 30px;
}
.prediction-card {
flex: 1;
min-width: 200px;
background: white;
border-radius: 10px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
padding: 20px;
transition: transform 0.3s, box-shadow 0.3s;
}
.prediction-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}
.prediction-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 15px;
}
.prediction-title {
font-size: 16px;
font-weight: 600;
color: #2d3748;
}
.prediction-badge {
font-size: 12px;
padding: 3px 8px;
border-radius: 20px;
}
.badge-1h {
background-color: #ebf8ff;
color: #3182ce;
}
.badge-8h {
background-color: #faf5ff;
color: #805ad5;
}
.badge-12h {
background-color: #fff5f5;
color: #e53e3e;
}
.badge-24h {
background-color: #f0fff4;
color: #38a169;
}
.prediction-price {
font-size: 24px;
font-weight: 700;
color: #2d3748;
margin-bottom: 5px;
}
.prediction-stats {
display: flex;
flex-direction: column;
gap: 5px;
font-size: 14px;
color: #4a5568;
}
.prediction-row {
display: flex;
justify-content: space-between;
}
.prediction-label {
color: #718096;
}
.prediction-value {
font-weight: 500;
}
.price-up {
color: #38a169;
}
.price-down {
color: #e53e3e;
}
/* Main chart */
.chart-container {
background: white;
border-radius: 10px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
padding: 20px;
margin-bottom: 30px;
}
.chart-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
}
.chart-title {
font-size: 20px;
font-weight: 600;
color: #2d3748;
}
.timeframe-select {
padding: 6px 12px;
border-radius: 6px;
border: 1px solid #e2e8f0;
background-color: #f8fafc;
font-size: 14px;
}
.chart-wrapper {
height: 400px;
position: relative;
}
/* History table */
.history-container {
background: white;
border-radius: 10px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
padding: 20px;
margin-bottom: 30px;
}
.history-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
}
.history-title {
font-size: 20px;
font-weight: 600;
color: #2d3748;
}
.history-controls {
display: flex;
gap: 10px;
}
.history-btn {
background-color: #e2e8f0;
color: #4a5568;
border: none;
padding: 6px 12px;
border-radius: 6px;
cursor: pointer;
display: flex;
align-items: center;
font-size: 14px;
transition: background-color 0.3s;
}
.history-btn:hover {
background-color: #cbd5e0;
}
.history-btn i {
margin-right: 5px;
}
.history-table {
width: 100%;
border-collapse: collapse;
}
.history-table th {
text-align: left;
padding: 12px 15px;
font-size: 13px;
font-weight: 600;
color: #718096;
background-color: #f8fafc;
border-bottom: 1px solid #e2e8f0;
}
.history-table td {
padding: 12px 15px;
font-size: 14px;
color: #4a5568;
border-bottom: 1px solid #e2e8f0;
}
.history-table tr:nth-child(even) {
background-color: #f8fafc;
}
/* Accuracy colors */
.accuracy-high {
color: #38a169;
}
.accuracy-medium {
color: #d69e2e;
}
.accuracy-low {
color: #e53e3e;
}
/* Direction colors */
.direction-correct {
color: #38a169;
}
.direction-incorrect {
color: #e53e3e;
}
/* Responsive adjustments */
@media (max-width: 768px) {
.prediction-card {
min-width: 100%;
}
.header-title {
font-size: 24px;
margin-bottom: 10px;
}
.header-controls {
width: 100%;
justify-content: space-between;
}
.chart-wrapper {
height: 300px;
}
.history-controls {
flex-direction: column;
width: 100%;
}
.history-btn {
width: 100%;
justify-content: center;
}
}
</style>
</head>
<body>
<div class="container">
<header class="header">
<div class="header-title">
<i class="fab fa-bitcoin"></i> Bitcoin Price Predictor
</div>
<div class="header-controls">
<button id="refreshBtn" class="refresh-btn">
<i class="fas fa-sync-alt"></i> Actualizar
</button>
<span id="lastUpdated" class="last-updated"></span>
</div>
<div class="header-subtitle">
Predicciones para diferentes horizontes temporales
</div>
</header>
<!-- Prediction Cards -->
<div class="predictions-container">
<!-- 1h Prediction -->
<div class="prediction-card">
<div class="prediction-header">
<div class="prediction-title">Predicción 1h</div>
<span class="prediction-badge badge-1h">1 hora</span>
</div>
<div class="prediction-price" id="prediction-1h-price">$--</div>
<div class="prediction-stats">
<div class="prediction-row">
<span class="prediction-label">Confianza:</span>
<span class="prediction-value" id="prediction-1h-confidence">--%</span>
</div>
<div class="prediction-row">
<span class="prediction-label">Dirección:</span>
<span class="prediction-value" id="prediction-1h-direction">--</span>
</div>
<div class="prediction-row">
<span class="prediction-label">Precisión:</span>
<span class="prediction-value" id="prediction-1h-accuracy">--%</span>
</div>
</div>
</div>
<!-- 8h Prediction -->
<div class="prediction-card">
<div class="prediction-header">
<div class="prediction-title">Predicción 8h</div>
<span class="prediction-badge badge-8h">8 horas</span>
</div>
<div class="prediction-price" id="prediction-8h-price">$--</div>
<div class="prediction-stats">
<div class="prediction-row">
<span class="prediction-label">Confianza:</span>
<span class="prediction-value" id="prediction-8h-confidence">--%</span>
</div>
<div class="prediction-row">
<span class="prediction-label">Dirección:</span>
<span class="prediction-value" id="prediction-8h-direction">--</span>
</div>
<div class="prediction-row">
<span class="prediction-label">Precisión:</span>
<span class="prediction-value" id="prediction-8h-accuracy">--%</span>
</div>
</div>
</div>
<!-- 12h Prediction -->
<div class="prediction-card">
<div class="prediction-header">
<div class="prediction-title">Predicción 12h</div>
<span class="prediction-badge badge-12h">12 horas</span>
</div>
<div class="prediction-price" id="prediction-12h-price">$--</div>
<div class="prediction-stats">
<div class="prediction-row">
<span class="prediction-label">Confianza:</span>
<span class="prediction-value" id="prediction-12h-confidence">--%</span>
</div>
<div class="prediction-row">
<span class="prediction-label">Dirección:</span>
<span class="prediction-value" id="prediction-12h-direction">--</span>
</div>
<div class="prediction-row">
<span class="prediction-label">Precisión:</span>
<span class="prediction-value" id="prediction-12h-accuracy">--%</span>
</div>
</div>
</div>
<!-- 24h Prediction -->
<div class="prediction-card">
<div class="prediction-header">
<div class="prediction-title">Predicción 24h</div>
<span class="prediction-badge badge-24h">24 horas</span>
</div>
<div class="prediction-price" id="prediction-24h-price">$--</div>
<div class="prediction-stats">
<div class="prediction-row">
<span class="prediction-label">Confianza:</span>
<span class="prediction-value" id="prediction-24h-confidence">--%</span>
</div>
<div class="prediction-row">
<span class="prediction-label">Dirección:</span>
<span class="prediction-value" id="prediction-24h-direction">--</span>
</div>
<div class="prediction-row">
<span class="prediction-label">Precisión:</span>
<span class="prediction-value" id="prediction-24h-accuracy">--%</span>
</div>
</div>
</div>
</div>
<!-- Main Chart -->
<div class="chart-container">
<div class="chart-header">
<div class="chart-title">Precio de Bitcoin</div>
<div>
<select id="timeframe" class="timeframe-select">
<option value="1">1 hora</option>
<option value="4">4 horas</option>
<option value="12">12 horas</option>
<option value="24" selected>24 horas</option>
<option value="168">7 días</option>
</select>
</div>
</div>
<div class="chart-wrapper">
<canvas id="priceChart"></canvas>
</div>
</div>
<!-- Historical Predictions -->
<div class="history-container">
<div class="history-header">
<div class="history-title">Historial de Predicciones</div>
<div class="history-controls">
<button id="exportBtn" class="history-btn">
<i class="fas fa-download"></i> Exportar JSON
</button>
<button id="importBtn" class="history-btn">
<i class="fas fa-upload"></i> Importar JSON
</button>
<input type="file" id="importFile" style="display: none;" accept=".json">
</div>
</div>
<div style="overflow-x: auto;">
<table class="history-table">
<thead>
<tr>
<th>Fecha</th>
<th>Horizonte</th>
<th>Predicción</th>
<th>Real</th>
<th>Diferencia</th>
<th>Precisión</th>
<th>Dirección</th>
</tr>
</thead>
<tbody id="historyTable">
<!-- Rows will be added dynamically -->
</tbody>
</table>
</div>
</div>
</div>
<script>
// Global variables
let priceChart;
let historicalData = [];
let predictionHistory = JSON.parse(localStorage.getItem('predictionHistory')) || [];
let autoRefreshInterval;
// Initialize the app when DOM is loaded
document.addEventListener('DOMContentLoaded', function() {
fetchData();
setupAutoRefresh();
renderHistoryTable();
// Set up manual refresh button
document.getElementById('refreshBtn').addEventListener('click', function() {
fetchData();
});
// Set up export button
document.getElementById('exportBtn').addEventListener('click', exportHistory);
// Set up import button
document.getElementById('importBtn').addEventListener('click', function() {
document.getElementById('importFile').click();
});
document.getElementById('importFile').addEventListener('change', importHistory);
// Set up timeframe selector
document.getElementById('timeframe').addEventListener('change', function() {
fetchData();
});
});
// Fetch data from CoinGecko API
async function fetchData() {
try {
// Show loading state
const refreshBtn = document.getElementById('refreshBtn');
refreshBtn.disabled = true;
refreshBtn.innerHTML = '<i class="fas fa-spinner fa-spin"></i> Actualizando...';
// Get selected timeframe
const timeframe = document.getElementById('timeframe').value;
// Fetch price data
const response = await axios.get(`https://api.coingecko.com/api/v3/coins/bitcoin/market_chart?vs_currency=usd&days=${timeframe}`);
const prices = response.data.prices;
// Process data
historicalData = prices.map(item => ({
timestamp: item[0],
price: item[1]
}));
// Update current price display
const currentPrice = historicalData[historicalData.length - 1].price;
const previousPrice = historicalData[historicalData.length - 2].price;
const priceChange = ((currentPrice - previousPrice) / previousPrice) * 100;
// Generate predictions for all timeframes
generatePredictions(currentPrice);
// Update chart
updateChart();
// Update last updated time
const now = new Date();
document.getElementById('lastUpdated').textContent = `Última actualización: ${now.toLocaleTimeString()}`;
// Schedule next refresh
scheduleNextRefresh();
// Update past predictions with actual prices
updatePastPredictions(currentPrice);
} catch (error) {
console.error('Error fetching data:', error);
alert('Error al obtener datos. Por favor intenta nuevamente.');
} finally {
// Reset button state
const refreshBtn = document.getElementById('refreshBtn');
refreshBtn.disabled = false;
refreshBtn.innerHTML = '<i class="fas fa-sync-alt"></i> Actualizar';
}
}
// Generate predictions for all timeframes
function generatePredictions(currentPrice) {
const timeframes = [1, 8, 12, 24];
timeframes.forEach(timeframe => {
// Generate random predictions (in a real app, this would be your prediction logic)
const prediction = currentPrice * (1 + (Math.random() * 0.02 - 0.01));
const confidence = 70 + Math.random() * 20;
const direction = prediction > currentPrice ? 'Alcista' : 'Bajista';
const accuracy = 75 + Math.random() * 20;
// Update prediction cards
updatePredictionCard(timeframe, prediction, confidence, direction, accuracy);
// Save prediction to history (only if it's a new prediction)
savePredictionToHistory(timeframe, currentPrice, prediction, confidence, direction);
});
}
// Update prediction card UI
function updatePredictionCard(timeframe, prediction, confidence, direction, accuracy) {
document.getElementById(`prediction-${timeframe}h-price`).textContent = `$${prediction.toFixed(2)}`;
document.getElementById(`prediction-${timeframe}h-confidence`).textContent = `${confidence.toFixed(0)}%`;
document.getElementById(`prediction-${timeframe}h-direction`).textContent = direction;
document.getElementById(`prediction-${timeframe}h-accuracy`).textContent = `${accuracy.toFixed(0)}%`;
// Color direction based on prediction
const directionElement = document.getElementById(`prediction-${timeframe}h-direction`);
if (direction === 'Alcista') {
directionElement.className = 'prediction-value price-up';
} else {
directionElement.className = 'prediction-value price-down';
}
}
// Save prediction to history
function savePredictionToHistory(timeframe, currentPrice, prediction, confidence, direction) {
const now = new Date();
// Check if we already have a prediction for this timeframe that hasn't been resolved
const existingPredictionIndex = predictionHistory.findIndex(p =>
p.timeframe === timeframe &&
p.actualPrice === null
);
if (existingPredictionIndex === -1) {
// Create new prediction entry
const newPrediction = {
timestamp: now.getTime(),
date: now.toISOString(),
currentPrice: currentPrice,
prediction: prediction,
confidence: confidence,
direction: direction,
timeframe: timeframe,
actualPrice: null,
accuracy: null,
directionCorrect: null
};
// Add to history
predictionHistory.unshift(newPrediction);
// Keep only the last 100 predictions per timeframe
const timeframePredictions = predictionHistory.filter(p => p.timeframe === timeframe);
if (timeframePredictions.length > 100) {
const toRemove = timeframePredictions.length - 100;
predictionHistory = predictionHistory.filter((p, index) =>
p.timeframe !== timeframe || index >= toRemove
);
}
// Save to localStorage
localStorage.setItem('predictionHistory', JSON.stringify(predictionHistory));
// Update history table
renderHistoryTable();
}
}
// Update actual prices for past predictions
function updatePastPredictions(currentPrice) {
const now = new Date();
[1, 8, 12, 24].forEach(timeframe => {
const timeframeMs = timeframe * 60 * 60 * 1000;
const predictionTime = now.getTime() - timeframeMs;
// Find the prediction made at the prediction time for this timeframe
const prediction = predictionHistory.find(p =>
p.timeframe === timeframe &&
p.timestamp <= predictionTime &&
p.actualPrice === null
);
if (prediction) {
prediction.actualPrice = currentPrice;
// Calculate accuracy
if (prediction.prediction && prediction.actualPrice) {
const priceDifference = Math.abs(prediction.prediction - prediction.actualPrice);
const accuracy = 100 - (priceDifference / prediction.actualPrice * 100);
prediction.accuracy = Math.max(0, Math.min(100, accuracy)); // Clamp between 0-100
// Determine if direction was correct
const predictedDirection = prediction.direction === 'Alcista' ? 1 : -1;
const actualDirection = prediction.actualPrice > prediction.currentPrice ? 1 : -1;
prediction.directionCorrect = predictedDirection === actualDirection;
}
}
});
// Save updated history
localStorage.setItem('predictionHistory', JSON.stringify(predictionHistory));
// Update UI
renderHistoryTable();
}
// Render history table
function renderHistoryTable() {
const tableBody = document.getElementById('historyTable');
tableBody.innerHTML = '';
// Sort by timestamp descending
const sortedHistory = [...predictionHistory].sort((a, b) => b.timestamp - a.timestamp);
sortedHistory.forEach((prediction, index) => {
const row = document.createElement('tr');
// Date cell
const dateCell = document.createElement('td');
dateCell.textContent = new Date(prediction.timestamp).toLocaleString();
// Timeframe cell
const timeframeCell = document.createElement('td');
timeframeCell.textContent = `${prediction.timeframe}h`;
// Prediction cell
const predictionCell = document.createElement('td');
predictionCell.textContent = prediction.prediction ? `$${prediction.prediction.toFixed(2)}` : '--';
// Actual price cell
const actualCell = document.createElement('td');
if (prediction.actualPrice !== null) {
actualCell.textContent = `$${prediction.actualPrice.toFixed(2)}`;
} else {
actualCell.textContent = '--';
}
// Difference cell
const differenceCell = document.createElement('td');
if (prediction.prediction && prediction.actualPrice !== null) {
const difference = prediction.actualPrice - prediction.prediction;
const absDifference = Math.abs(difference);
const differenceText = `$${absDifference.toFixed(2)} (${(absDifference / prediction.prediction * 100).toFixed(2)}%)`;
if (difference > 0) {
differenceCell.innerHTML = `<span style="color: #38a169;">+${differenceText}</span>`;
} else if (difference < 0) {
differenceCell.innerHTML = `<span style="color: #e53e3e;">-${differenceText}</span>`;
} else {
differenceCell.textContent = differenceText;
}
} else {
differenceCell.textContent = '--';
}
// Accuracy cell
const accuracyCell = document.createElement('td');
if (prediction.accuracy !== null) {
const accuracyText = `${prediction.accuracy.toFixed(1)}%`;
let accuracyClass = '';
if (prediction.accuracy >= 90) accuracyClass = 'accuracy-high';
else if (prediction.accuracy >= 70) accuracyClass = 'accuracy-medium';
else accuracyClass = 'accuracy-low';
accuracyCell.innerHTML = `<span class="${accuracyClass}">${accuracyText}</span>`;
} else {
accuracyCell.textContent = '--';
}
// Direction cell
const directionCell = document.createElement('td');
if (prediction.directionCorrect !== null) {
if (prediction.directionCorrect) {
directionCell.innerHTML = `<span class="direction-correct">Correcta</span>`;
} else {
directionCell.innerHTML = `<span class="direction-incorrect">Incorrecta</span>`;
}
} else {
directionCell.textContent = '--';
}
// Add cells to row
row.appendChild(dateCell);
row.appendChild(timeframeCell);
row.appendChild(predictionCell);
row.appendChild(actualCell);
row.appendChild(differenceCell);
row.appendChild(accuracyCell);
row.appendChild(directionCell);
tableBody.appendChild(row);
});
}
// Update price chart
function updateChart() {
const ctx = document.getElementById('priceChart').getContext('2d');
const timeframe = document.getElementById('timeframe').value;
// Prepare data for chart
const labels = historicalData.map(item => new Date(item.timestamp));
const prices = historicalData.map(item => item.price);
// Calculate EMA (Exponential Moving Average) functions
function calculateEMA(data, period) {
const k = 2 / (period + 1);
const ema = [];
let sum = 0;
// Simple moving average for first period values
for (let i = 0; i < period; i++) {
sum += data[i];
ema.push(null);
}
// First EMA value is the SMA
ema[period - 1] = sum / period;
// Calculate EMA for remaining values
for (let i = period; i < data.length; i++) {
ema[i] = data[i] * k + ema[i - 1] * (1 - k);
}
return ema;
}
// Calculate EMAs
const ema20 = calculateEMA(prices, 20);
const ema50 = calculateEMA(prices, 50);
// Create or update chart
if (!priceChart) {
priceChart = new Chart(ctx, {
type: 'line',
data: {
labels: labels,
datasets: [
{
label: 'Precio BTC',
data: prices,
borderColor: '#3182ce',
backgroundColor: 'rgba(49, 130, 206, 0.05)',
borderWidth: 2,
fill: true,
tension: 0.4
},
{
label: 'EMA 20',
data: ema20,
borderColor: '#d69e2e',
borderWidth: 1.5,
pointRadius: 0,
tension: 0.4
},
{
label: 'EMA 50',
data: ema50,
borderColor: '#805ad5',
borderWidth: 1.5,
pointRadius: 0,
tension: 0.4
}
]
},
options: {
responsive: true,
maintainAspectRatio: false,
scales: {
x: {
type: 'time',
time: {
unit: timeframe <= 1 ? 'hour' :
timeframe <= 24 ? 'day' : 'week',
displayFormats: {
hour: 'HH:mm',
day: 'MMM d',
week: 'MMM d'
}
},
grid: {
display: false
}
},
y: {
beginAtZero: false,
grid: {
color: 'rgba(0, 0, 0, 0.05)'
},
ticks: {
callback: function(value) {
return '$' + value.toLocaleString();
}
}
}
},
plugins: {
tooltip: {
mode: 'index',
intersect: false,
callbacks: {
label: function(context) {
let label = context.dataset.label || '';
if (label) {
label += ': ';
}
if (context.parsed.y !== null) {
label += '$' + context.parsed.y.toLocaleString('en-US', {minimumFractionDigits: 2, maximumFractionDigits: 2});
}
return label;
}
}
},
legend: {
position: 'top',
align: 'end'
}
},
interaction: {
mode: 'nearest',
axis: 'x',
intersect: false
}
}
});
} else {
priceChart.data.labels = labels;
priceChart.data.datasets[0].data = prices;
priceChart.data.datasets[1].data = ema20;
priceChart.data.datasets[2].data = ema50;
// Update time unit based on timeframe
priceChart.options.scales.x.time.unit = timeframe <= 1 ? 'hour' :
timeframe <= 24 ? 'day' : 'week';
priceChart.update();
}
}
// Set up auto-refresh
function setupAutoRefresh() {
const autoRefreshCheckbox = document.getElementById('autoRefresh');
autoRefreshCheckbox.addEventListener('change', function() {
if (this.checked) {
scheduleNextRefresh();
} else {
clearTimeout(autoRefreshInterval);
}
});
// Initial schedule
scheduleNextRefresh();
}
// Schedule next refresh
function scheduleNextRefresh() {
clearTimeout(autoRefreshInterval);
autoRefreshInterval = setTimeout(() => {
fetchData();
scheduleNextRefresh();
}, 15 * 60 * 1000); // 15 minutes
}
// Export history as JSON
function exportHistory() {
const dataStr = JSON.stringify(predictionHistory, null, 2);
const dataUri = 'data:application/json;charset=utf-8,'+ encodeURIComponent(dataStr);
const exportFileDefaultName = `bitcoin-predictions-${new Date().toISOString().slice(0, 10)}.json`;
const linkElement = document.createElement('a');
linkElement.setAttribute('href', dataUri);
linkElement.setAttribute('download', exportFileDefaultName);
linkElement.click();
}
// Import history from JSON file
function importHistory(event) {
const file = event.target.files[0];
if (!file) return;
const reader = new FileReader();
reader.onload = function(e) {
try {
const importedData = JSON.parse(e.target.result);
if (Array.isArray(importedData)) {
predictionHistory = importedData;
localStorage.setItem('predictionHistory', JSON.stringify(predictionHistory));
// Update UI
renderHistoryTable();
alert('Datos importados correctamente!');
} else {
alert('El archivo no contiene datos válidos.');
}
} catch (error) {
console.error('Error importing data:', error);
alert('Error al importar datos. El archivo puede estar corrupto.');
}
// Reset file input
event.target.value = '';
};
reader.readAsText(file);
}
</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=note6/btcpro7" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Bitcoin Price Predictor</title>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/luxon@2.0.2"></script>
<script src="https://cdn.jsdelivr.net/npm/chartjs-adapter-luxon@1.0.0"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
<style>
* {
box-sizing: border-box;
margin: 0;
padding: 0;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
body {
background-color: #f5f7fa;
color: #333;
line-height: 1.6;
}
.container {
width: 100%;
max-width: 1200px;
margin: 0 auto;
padding: 20px;
}
/* Header styles */
.header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 30px;
flex-wrap: wrap;
}
.header-title {
display: flex;
align-items: center;
font-size: 28px;
font-weight: bold;
color: #2d3748;
}
.header-title i {
color: #f7931a;
margin-right: 10px;
}
.header-controls {
display: flex;
align-items: center;
}
.refresh-btn {
background-color: #3182ce;
color: white;
border: none;
padding: 8px 16px;
border-radius: 6px;
cursor: pointer;
display: flex;
align-items: center;
margin-right: 15px;
transition: background-color 0.3s;
}
.refresh-btn:hover {
background-color: #2c5282;
}
.refresh-btn i {
margin-right: 5px;
}
.last-updated {
font-size: 14px;
color: #718096;
}
.header-subtitle {
width: 100%;
margin-top: 10px;
color: #4a5568;
font-size: 14px;
}
/* Prediction cards */
.predictions-container {
display: flex;
flex-wrap: wrap;
gap: 20px;
margin-bottom: 30px;
}