finished symbol info

This commit is contained in:
Boki 2025-06-29 10:41:12 -04:00
parent 5640444c47
commit 77bba31456
4 changed files with 73 additions and 54 deletions

View file

@ -106,6 +106,14 @@ export async function updateIntradayBars(
['symbol', 'timestamp'] // Unique keys
);
// Update operation tracking
const tracker = await getOperationTracker(this);
await tracker.updateSymbolOperation(qmSearchCode, 'intraday_bars', {
status: 'success',
lastRecordDate: targetDate,
recordCount: barsData.length
});
this.logger.info('Intraday bars updated successfully', {
symbol,
date: targetDate,
@ -124,6 +132,15 @@ export async function updateIntradayBars(
} else {
// No data for this date (weekend, holiday, or no trading)
this.logger.info('No intraday data for date', { symbol, date: targetDate });
// Still update operation tracking as successful (no data is a valid result)
const tracker = await getOperationTracker(this);
await tracker.updateSymbolOperation(qmSearchCode, 'intraday_bars', {
status: 'success',
lastRecordDate: targetDate,
recordCount: 0
});
return {
success: true,
symbol,
@ -146,6 +163,12 @@ export async function updateIntradayBars(
error: error instanceof Error ? error.message : 'Unknown error'
});
// Update operation tracking for failure
const tracker = await getOperationTracker(this);
await tracker.updateSymbolOperation(qmSearchCode, 'intraday_bars', {
status: 'failure'
});
return {
success: false,
symbol,
@ -256,14 +279,7 @@ export async function scheduleIntradayUpdates(
jobsQueued++;
}
// Update crawl state
await tracker.updateSymbolOperation(doc.qmSearchCode, 'intraday_bars', {
status: 'partial',
crawlState: {
finished: false,
oldestDateReached: new Date(startDate.getTime() - daysToFetch * 24 * 60 * 60 * 1000),
}
});
// Note: Crawl state will be updated when the actual jobs run
} else {
// For update mode, just fetch today's data
await this.scheduleOperation('update-intraday-bars', {