learning_ai_invt_trdg/backend/verify_signals_live.ts

32 lines
1.1 KiB
TypeScript

import axios from 'axios';
async function verify() {
try {
const res = await axios.get('http://localhost:5000/api/status');
const state = res.data;
console.log('\n--- 🎯 SYMBOLS & SIGNALS ---');
Object.entries(state.symbols).forEach(([symbol, data]: [string, any]) => {
console.log(`${symbol}: Signal=[${data.signal}] Price=${data.price}`);
Object.entries(data.rules).forEach(([rule, res]: [string, any]) => {
if (res.passed) console.log(`${rule}: ${res.reason}`);
else console.log(`${rule}: ${res.reason}`);
});
});
console.log('\n--- 💼 ACTIVE POSITIONS ---');
state.positions.forEach((pos: any) => {
console.log(`[${pos.symbol}] ${pos.side} Size:${pos.size} PnL:${pos.unrealizedPnl} Profile:${pos.profileId}`);
});
if (state.positions.length === 0) {
console.log('No active positions found.');
}
} catch (err: any) {
console.error('Failed to connect to bot:', err.message);
}
}
verify();