48 lines
974 B
Markdown
48 lines
974 B
Markdown
# Quick Start: BlackBox Stocks API Sync
|
|
|
|
## 1. Add API Token to .env
|
|
|
|
```bash
|
|
# In backend/.env file
|
|
BLACKBOX_API_TOKEN=your_bearer_token_here
|
|
```
|
|
|
|
## 2. Run Sync Script
|
|
|
|
```bash
|
|
cd backend
|
|
node scripts/syncBlackBoxFlow.js
|
|
```
|
|
|
|
## 3. Verify Data
|
|
|
|
```sql
|
|
SELECT COUNT(*) FROM "OptionsFlow_monthly";
|
|
SELECT * FROM "OptionsFlow_monthly" ORDER BY "CreatedDate" DESC LIMIT 10;
|
|
```
|
|
|
|
## Common Commands
|
|
|
|
```bash
|
|
# Sync today's data
|
|
node scripts/syncBlackBoxFlow.js
|
|
|
|
# Sync specific date range
|
|
node scripts/syncBlackBoxFlow.js --start-date 2024-01-15 --end-date 2024-01-16
|
|
|
|
# Limit records
|
|
node scripts/syncBlackBoxFlow.js --count 100
|
|
|
|
# Filter by symbol
|
|
node scripts/syncBlackBoxFlow.js --symbol AAPL
|
|
```
|
|
|
|
## Troubleshooting
|
|
|
|
- **Token Error**: Make sure `BLACKBOX_API_TOKEN` is in `.env`
|
|
- **401 Unauthorized**: Check if token is expired or invalid
|
|
- **No Data**: Try different date range or check API response structure
|
|
|
|
See `BLACKBOX_SYNC_GUIDE.md` for detailed documentation.
|
|
|