data fixes; indicator=>workspace sync
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user