This commit is contained in:
zhutoutoutousan
2026-02-13 08:03:25 +01:00
parent 09c2f54c71
commit 98a87a69ca
134 changed files with 20003 additions and 253 deletions
@@ -0,0 +1,39 @@
/**
* Notification Utility
* Global notification system
*/
export class Notification {
static show(message, type = 'info') {
console.log(`[${type.toUpperCase()}] ${message}`);
const notification = document.createElement('div');
notification.style.cssText = `
position: fixed;
top: 20px;
right: 20px;
padding: 15px 25px;
background: rgba(0, 255, 255, 0.1);
border: 2px solid var(--neon-cyan);
color: var(--neon-cyan);
font-family: 'Orbitron', sans-serif;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.1em;
z-index: 10000;
box-shadow: 0 0 20px var(--neon-cyan);
animation: slideIn 0.3s ease;
`;
notification.textContent = message;
document.body.appendChild(notification);
setTimeout(() => {
notification.style.animation = 'slideOut 0.3s ease';
setTimeout(() => notification.remove(), 300);
}, 3000);
}
}
// Make it globally available
window.showNotification = Notification.show;
@@ -0,0 +1,71 @@
/**
* WebSocket Manager
* Handles all WebSocket connections and events
*/
export class WebSocketManager {
constructor(socket) {
this.socket = socket;
this.handlers = new Map();
this.setup();
}
setup() {
this.socket.on('connect', () => {
console.log('[WebSocket] Connected to server');
});
this.socket.on('disconnect', () => {
console.log('[WebSocket] Disconnected from server');
});
// Backtest events
this.socket.on('backtest_log', (data) => {
this.emit('backtest_log', data);
});
this.socket.on('backtest_trade', (data) => {
this.emit('backtest_trade', data);
});
this.socket.on('backtest_equity', (data) => {
this.emit('backtest_equity', data);
});
this.socket.on('backtest_complete', (data) => {
this.emit('backtest_complete', data);
});
this.socket.on('backtest_error', (data) => {
this.emit('backtest_error', data);
});
// Strategy events
this.socket.on('strategy_update', (data) => {
this.emit('strategy_update', data);
});
}
on(event, handler) {
if (!this.handlers.has(event)) {
this.handlers.set(event, []);
}
this.handlers.get(event).push(handler);
}
off(event, handler) {
if (this.handlers.has(event)) {
const handlers = this.handlers.get(event);
const index = handlers.indexOf(handler);
if (index > -1) {
handlers.splice(index, 1);
}
}
}
emit(event, data) {
if (this.handlers.has(event)) {
this.handlers.get(event).forEach(handler => handler(data));
}
}
}