work on postgress / will prob remove and work on ib exchanges and symbols
This commit is contained in:
parent
cce5126cb7
commit
a20a11c1aa
16 changed files with 1441 additions and 95 deletions
41
database/postgres/scripts/init.ts
Normal file
41
database/postgres/scripts/init.ts
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
#!/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 };
|
||||
Loading…
Add table
Add a link
Reference in a new issue