Skip to content

internet-court/internet-court-skill / vendored/sendaifun/birdeye

birdeye

Verified

Complete Birdeye API integration for real-time DeFi data across Solana and 15 other chains. Use for token prices, OHLCV charts, market discovery, on-chain trader intelligence, holder analysis, wallet portfolio & P&L, and WebSocket streams for live prices and whale alerts.

examples/wallet-intelligence/wallet-pnl.ts

View on GitHub
/**
 * Wallet P&L Summary — Birdeye /wallet/v2/pnl/summary
 *
 * PRO-only endpoint. Returns 403 on Standard/Lite tier.
 * Optional param: duration = 'all' | '90d' | '30d' | '7d' | '24h'
 *
 * Run: BIRDEYE_API_KEY=xxx npx ts-node examples/wallet-intelligence/wallet-pnl.ts [wallet] [duration]
 */

import BirdeyeClient from '../../templates/birdeye-client';

async function run() {
    const client   = BirdeyeClient.create('solana');
    const wallet   = process.argv[2] || '9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM';
    const duration = (process.argv[3] as any) || 'all';

    console.log(`\n⏳ Fetching P&L for ${wallet} (duration: ${duration})…\n`);

    try {
        const data = await client.wallet.getPnL(wallet, duration);
        const { counts, pnl, cashflow_usd } = data.summary;

        console.log('--- P&L Summary ---');
        console.log(`Realized Profit:  $${pnl.realized_profit_usd?.toFixed(2)}`);
        console.log(`Profit %:         ${pnl.realized_profit_percent?.toFixed(2)}%`);
        console.log(`Win Rate:         ${(counts.win_rate * 100).toFixed(1)}%`);
        console.log(`Total Trades:     ${counts.total_trade}`);
        console.log(`  Buys:           ${counts.total_buy}`);
        console.log(`  Sells:          ${counts.total_sell}`);
        console.log(`Total Invested:   $${cashflow_usd.total_invested?.toFixed(2)}`);
        console.log(`Total Sold:       $${cashflow_usd.total_sold?.toFixed(2)}`);
    } catch (e: any) {
        console.error('[Error]', e.message);
        if (e.statusCode === 403) {
            console.error('→ PRO tier required. This endpoint returns 403 on Standard/Lite.');
        }
    }
}

run().catch(err => console.error('Fatal:', err));
receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementationStars: 322kUpdated Claude CodeCodexVerifiedInstall
requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirementsStars: 322kUpdated Claude CodeCodexVerifiedInstall
using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallbackStars: 322kUpdated Claude CodeCodexVerifiedInstall
verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions alwaysStars: 322kUpdated Claude CodeCodexVerifiedInstall