chart data fixes
This commit is contained in:
@@ -16,7 +16,6 @@ import {
|
||||
type SnapshotMessage,
|
||||
type PatchMessage,
|
||||
} from '../workspace/index.js';
|
||||
import { resolutionToSeconds } from '../types/ohlc.js';
|
||||
|
||||
/**
|
||||
* Safe JSON stringifier that handles BigInt values
|
||||
@@ -487,7 +486,7 @@ export class WebSocketHandler {
|
||||
}
|
||||
const history = await ohlcService.fetchOHLC(
|
||||
payload.symbol,
|
||||
resolutionToSeconds(payload.resolution),
|
||||
payload.period_seconds,
|
||||
payload.from_time,
|
||||
payload.to_time,
|
||||
payload.countback
|
||||
|
||||
@@ -525,9 +525,9 @@ export class DuckDBClient {
|
||||
// Check if we have continuous data
|
||||
// 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;
|
||||
const periodNanos = BigInt(period_seconds) * 1_000_000_000n;
|
||||
// end_time is exclusive, so expected count = (end - start) / period (no +1)
|
||||
const expectedBars = Number((end_time - start_time) / periodMicros);
|
||||
const expectedBars = Number((end_time - start_time) / periodNanos);
|
||||
|
||||
if (data.length < expectedBars * 0.95) { // Allow 5% tolerance
|
||||
this.logger.debug({
|
||||
|
||||
Reference in New Issue
Block a user