#!/usr/bin/env bun /** * Main database initialization script * Sets up the database schema and populates with initial data */ import { getLogger } from '@stock-bot/logger'; import { setupIB } from './setup-ib'; const logger = getLogger('db-init'); async function main() { logger.info('Starting database initialization'); try { // Step 1: Setup Interactive Brokers (schema + data) logger.info('Setting up Interactive Brokers (schema + data)'); await setupIB(); logger.info('IB setup completed'); // Future providers can be added here: // await setupAlpaca(); // await setupPolygon(); logger.info('Database initialization completed successfully'); } catch (error) { logger.error('Database initialization failed', { error }); process.exit(1); } } // Run the script if (import.meta.main) { main().catch((error) => { console.error('Init script failed:', error); process.exit(1); }); } export { main as initDatabase };