data fixes; indicator=>workspace sync

This commit is contained in:
2026-03-31 20:29:12 -04:00
parent 998f69fa1a
commit cd28e18e52
45 changed files with 1324 additions and 1239 deletions

View File

@@ -420,7 +420,7 @@ export class DuckDBClient {
WHERE ticker = ?
AND period_seconds = ?
AND timestamp >= ?
AND timestamp <= ?
AND timestamp < ?
ORDER BY timestamp ASC
`;
@@ -441,10 +441,11 @@ export class DuckDBClient {
count: rows.length
}, 'Loaded OHLC data from Iceberg');
// Convert timestamp strings to numbers (microseconds as Number is fine for display)
// Keep timestamp as bigint to preserve full microsecond precision.
// Convert to seconds (divide first) only when producing TradingView bars.
return rows.map((row: any) => ({
...row,
timestamp: Number(row.timestamp)
timestamp: BigInt(row.timestamp)
}));
} catch (error: any) {
this.logger.error({
@@ -484,7 +485,7 @@ export class DuckDBClient {
WHERE ticker = ?
AND period_seconds = ?
AND timestamp >= ?
AND timestamp <= ?
AND timestamp < ?
`;
const params = [
@@ -525,6 +526,7 @@ export class DuckDBClient {
// For now, simple check: if we have any data, assume complete
// TODO: Implement proper gap detection by checking for missing periods
const periodMicros = BigInt(period_seconds) * 1000000n;
// end_time is exclusive, so expected count = (end - start) / period (no +1)
const expectedBars = Number((end_time - start_time) / periodMicros);
if (data.length < expectedBars * 0.95) { // Allow 5% tolerance