import { AlpacaConnector } from '../src/connectors/alpaca.js';
import { config } from '../src/config/index.js';

async function test() {
    const connector = new AlpacaConnector(config.ALPACA_API_KEY, config.ALPACA_API_SECRET, config.PAPER_TRADING);

    console.log("--- ALPACA DIAGNOSTIC ---");
    try {
        const allPos = await (connector as any).client.getPositions();
        console.log(`Global Positions Count: ${allPos.length}`);
        allPos.forEach((p: any) => {
            console.log(`Symbol: ${p.symbol}, Side: ${p.side}, Size: ${p.qty}, Price: ${p.avg_entry_price}`);
        });
    } catch (e: any) {
        console.error("Failed to fetch global positions:", e.message);
    }
}

test();
