2.2 KiB
2.2 KiB
✅ Data Import Successful!
Summary
Your local PostgreSQL database has been set up and populated with CSV data:
Imported Data
-
OptionsFlow_monthly: 12,578 records
- 856 unique symbols
- Contains: Symbol, CallPut, Strike, Spot, Premium, Volume, OI, ExpirationDate, etc.
-
OptionsVolume: 100 records
- Contains: SYMBOL, VOL, C VOL, P VOL, P/C ratio, RATIO, COI, POI, etc.
-
OptionsOpenInterest: 100 records
- Contains: SYMBOL, EXP, C/P, STRIKE, OI, DOI
Total: 12,778 records imported
Database Status
✅ Local PostgreSQL database: institutional_trader
✅ All tables created
✅ All indexes created
✅ Data imported and verified
✅ Server ready to run
Next Steps
1. Start the Server
cd backend
npm run dev
The server should start on http://localhost:3010 and show:
📦 Using local PostgreSQL database
✅ Database connection successful (PostgreSQL direct)
🚀 Server running on http://localhost:3010
2. Test API Endpoints
Options Flow:
curl "http://localhost:3010/api/options/flow?startDate=2024-12-10&endDate=2024-12-10"
Health Check:
curl http://localhost:3010/health
3. Verify Data
npm run verify-data
Available Commands
npm run setup-local-db- Set up database and tablesnpm run import-csv- Import CSV filesnpm run verify-data- Verify imported datanpm run dev- Start development server
Database Connection
Your .env file should have:
USE_LOCAL_DB=true
LOCAL_DB_HOST=localhost
LOCAL_DB_PORT=5432
LOCAL_DB_USER=postgres
LOCAL_DB_PASSWORD=your_password
LOCAL_DB_NAME=institutional_trader
Troubleshooting
If you see "relation does not exist" errors:
- Run:
npm run setup-local-db(creates tables) - Run:
npm run import-csv(imports data) - Restart server
Data Access
You can query the data directly:
-- Connect to database
psql -U postgres -d institutional_trader
-- Query examples
SELECT COUNT(*) FROM "OptionsFlow_monthly";
SELECT * FROM "OptionsFlow_monthly" WHERE "Symbol" = 'AAPL' LIMIT 10;
SELECT "SYMBOL", "VOL", "RATIO" FROM "OptionsVolume" ORDER BY "RATIO" DESC LIMIT 10;
Your trading system is now ready to use with local data! 🎉