31 lines
1.0 KiB
TypeScript
31 lines
1.0 KiB
TypeScript
|
|
import fs from 'fs';
|
|
|
|
const state = JSON.parse(fs.readFileSync('bot_state.json', 'utf8'));
|
|
const btc = state.symbols['BTC/USDT'];
|
|
|
|
console.log('--- BTC/USDT LIVE STATE ---');
|
|
console.log(`Current Price: $${btc.price}`);
|
|
console.log(`Current Signal: ${btc.signal}`);
|
|
console.log('\n--- Indicators ---');
|
|
console.log(`RSI (1H): ${btc.indicators.rsi_1h.toFixed(2)}`);
|
|
console.log(`EMA20 (1H): $${btc.indicators.ema20_1h.toFixed(2)}`);
|
|
|
|
console.log('\n--- Rule Breakdown ---');
|
|
const rules = btc.rules;
|
|
if (rules) {
|
|
Object.entries(rules).forEach(([name, data]: [string, any]) => {
|
|
console.log(`[${name}] Passed: ${data.passed} | Reason: ${data.reason}`);
|
|
});
|
|
} else {
|
|
console.log('No rules found in state.');
|
|
}
|
|
|
|
// Check recent price history in state (last 5 entries)
|
|
const history = btc.priceHistory || [];
|
|
const recent = history.slice(-5);
|
|
console.log('\n--- Recent Prices (v. Recent) ---');
|
|
recent.forEach((h: any) => {
|
|
console.log(` ${new Date(h.timestamp).toLocaleTimeString()}: $${h.price}`);
|
|
});
|