live trading options
This commit is contained in:
@@ -64,6 +64,19 @@
|
||||
<!-- Real-Time Inference -->
|
||||
<div class="mb-3">
|
||||
<label class="form-label small">Real-Time Inference</label>
|
||||
|
||||
<!-- Primary Timeframe Selector -->
|
||||
<div class="mb-2">
|
||||
<label for="primary-timeframe-select" class="form-label small text-muted">Primary Timeframe</label>
|
||||
<select class="form-select form-select-sm" id="primary-timeframe-select">
|
||||
<option value="1s">1 Second</option>
|
||||
<option value="1m" selected>1 Minute</option>
|
||||
<option value="5m">5 Minutes</option>
|
||||
<option value="15m">15 Minutes</option>
|
||||
<option value="1h">1 Hour</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<button class="btn btn-success btn-sm w-100" id="start-inference-btn">
|
||||
<i class="fas fa-play"></i>
|
||||
Start Live Inference
|
||||
@@ -74,6 +87,18 @@
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Multi-Step Inference Control -->
|
||||
<div class="mb-3" id="inference-controls" style="display: none;">
|
||||
<label for="prediction-steps-slider" class="form-label small text-muted">
|
||||
Prediction Steps: <span id="prediction-steps-value">1</span>
|
||||
</label>
|
||||
<input type="range" class="form-range" id="prediction-steps-slider"
|
||||
min="1" max="15" value="1" step="1">
|
||||
<div class="small text-muted" style="font-size: 0.7rem;">
|
||||
Chain predictions (each feeds back as last candle)
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Inference Status -->
|
||||
<div id="inference-status" style="display: none;">
|
||||
<div class="alert alert-success py-2 px-2 mb-2">
|
||||
@@ -86,7 +111,15 @@
|
||||
<div class="small">
|
||||
<div>Signal: <span id="latest-signal" class="fw-bold">--</span></div>
|
||||
<div>Confidence: <span id="latest-confidence">--</span></div>
|
||||
<div class="text-muted" style="font-size: 0.7rem;">Charts updating every 1s</div>
|
||||
<div class="text-muted" style="font-size: 0.7rem;">Predicting <span id="active-steps">1</span> step(s) ahead</div>
|
||||
</div>
|
||||
|
||||
<!-- Last 5 Predictions -->
|
||||
<div class="mt-2 pt-2 border-top">
|
||||
<div class="small fw-bold mb-1">Last 5 Predictions:</div>
|
||||
<div id="prediction-history" class="small" style="font-size: 0.7rem; max-height: 120px; overflow-y: auto;">
|
||||
<div class="text-muted">No predictions yet...</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -285,6 +318,13 @@
|
||||
showSuccess(`${modelName} loaded successfully`);
|
||||
// Refresh model list to update states
|
||||
loadAvailableModels();
|
||||
|
||||
// AUTO-SELECT: Keep the loaded model selected in dropdown
|
||||
setTimeout(() => {
|
||||
const modelSelect = document.getElementById('model-select');
|
||||
modelSelect.value = modelName;
|
||||
updateButtonState();
|
||||
}, 100);
|
||||
} else {
|
||||
showError(`Failed to load ${modelName}: ${data.error}`);
|
||||
loadBtn.disabled = false;
|
||||
@@ -426,6 +466,14 @@
|
||||
// Real-time inference controls
|
||||
let currentInferenceId = null;
|
||||
let signalPollInterval = null;
|
||||
let predictionHistory = []; // Store last 5 predictions
|
||||
|
||||
// Prediction steps slider handler
|
||||
document.getElementById('prediction-steps-slider').addEventListener('input', function() {
|
||||
const steps = this.value;
|
||||
document.getElementById('prediction-steps-value').textContent = steps;
|
||||
document.getElementById('active-steps').textContent = steps;
|
||||
});
|
||||
|
||||
document.getElementById('start-inference-btn').addEventListener('click', function () {
|
||||
const modelName = document.getElementById('model-select').value;
|
||||
@@ -435,13 +483,19 @@
|
||||
return;
|
||||
}
|
||||
|
||||
// Get primary timeframe and prediction steps
|
||||
const primaryTimeframe = document.getElementById('primary-timeframe-select').value;
|
||||
const predictionSteps = parseInt(document.getElementById('prediction-steps-slider').value);
|
||||
|
||||
// Start real-time inference
|
||||
fetch('/api/realtime-inference/start', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
model_name: modelName,
|
||||
symbol: appState.currentSymbol
|
||||
symbol: appState.currentSymbol,
|
||||
primary_timeframe: primaryTimeframe,
|
||||
prediction_steps: predictionSteps
|
||||
})
|
||||
})
|
||||
.then(response => response.json())
|
||||
@@ -453,6 +507,11 @@
|
||||
document.getElementById('start-inference-btn').style.display = 'none';
|
||||
document.getElementById('stop-inference-btn').style.display = 'block';
|
||||
document.getElementById('inference-status').style.display = 'block';
|
||||
document.getElementById('inference-controls').style.display = 'block';
|
||||
|
||||
// Clear prediction history
|
||||
predictionHistory = [];
|
||||
updatePredictionHistory();
|
||||
|
||||
// Show live mode banner
|
||||
const banner = document.getElementById('live-mode-banner');
|
||||
@@ -489,6 +548,7 @@
|
||||
document.getElementById('start-inference-btn').style.display = 'block';
|
||||
document.getElementById('stop-inference-btn').style.display = 'none';
|
||||
document.getElementById('inference-status').style.display = 'none';
|
||||
document.getElementById('inference-controls').style.display = 'none';
|
||||
|
||||
// Hide live mode banner
|
||||
const banner = document.getElementById('live-mode-banner');
|
||||
|
||||
Reference in New Issue
Block a user