Merge branch 'cleanup' of https://git.d-popov.com/popov/gogo2 into cleanup
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -99,6 +99,18 @@ class LiveUpdatesWebSocket {
|
||||
console.error('Prediction error:', data);
|
||||
});
|
||||
|
||||
this.socket.on('executed_trade', (data) => {
|
||||
console.log('Executed trade received:', data);
|
||||
if (this.onExecutedTrade) {
|
||||
this.onExecutedTrade(data);
|
||||
}
|
||||
});
|
||||
|
||||
this.socket.on('training_update', (data) => {
|
||||
console.log('Training update received:', data);
|
||||
// Training feedback from incremental learning
|
||||
});
|
||||
|
||||
// Error events
|
||||
this.socket.on('connect_error', (error) => {
|
||||
console.error('WebSocket connection error:', error);
|
||||
@@ -230,6 +242,26 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
}
|
||||
};
|
||||
|
||||
window.liveUpdatesWS.onExecutedTrade = function(data) {
|
||||
// Visualize executed trade on chart
|
||||
if (window.appState && window.appState.chartManager) {
|
||||
window.appState.chartManager.addExecutedTradeMarker(data.trade, data.position_state);
|
||||
}
|
||||
|
||||
// Update position state display
|
||||
if (typeof updatePositionStateDisplay === 'function') {
|
||||
updatePositionStateDisplay(data.position_state, data.session_metrics);
|
||||
}
|
||||
|
||||
// Log trade details
|
||||
console.log('Executed Trade:', {
|
||||
action: data.trade.action,
|
||||
price: data.trade.price,
|
||||
pnl: data.trade.pnl ? `$${data.trade.pnl.toFixed(2)} (${data.trade.pnl_pct.toFixed(2)}%)` : 'N/A',
|
||||
position: data.position_state.has_position ? `${data.position_state.position_type.toUpperCase()} @ $${data.position_state.entry_price}` : 'CLOSED'
|
||||
});
|
||||
};
|
||||
|
||||
// Auto-connect
|
||||
console.log('Auto-connecting to WebSocket...');
|
||||
window.liveUpdatesWS.connect();
|
||||
|
||||
Reference in New Issue
Block a user