funhi-chart 1.3.6 → 1.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,6 +17,7 @@ export declare class CandleManager {
17
17
  createOrUpdate(price: number, timestamp: number): CandleUpdateResult | null;
18
18
  /**
19
19
  * Creates a new candle at bucket boundary
20
+ * Detects gaps and logs them (gaps should be filled by loading from database)
20
21
  */
21
22
  private createNewCandle;
22
23
  /**
@@ -58,8 +59,18 @@ export declare class CandleManager {
58
59
  getCandles(): CandleData[];
59
60
  getCurrentCandle(): CandleData | null;
60
61
  getLastCandleTime(): number;
62
+ /**
63
+ * Detects gaps in candles and returns information about missing time periods
64
+ * Returns array of missing time ranges that should be loaded from database
65
+ */
66
+ detectGaps(): Array<{
67
+ startTime: number;
68
+ endTime: number;
69
+ missingCount: number;
70
+ }>;
61
71
  /**
62
72
  * Loads candles from storage
73
+ * Merges with existing candles to preserve real-time data
63
74
  */
64
75
  loadCandles(candles: CandleData[]): void;
65
76
  /**
@@ -14,6 +14,8 @@ export declare class FunhiChartController {
14
14
  private updateHandler;
15
15
  private currentTimeframe;
16
16
  private config;
17
+ private gapCheckInterval;
18
+ private readonly GAP_CHECK_INTERVAL_MS;
17
19
  constructor(config: ControllerConfig);
18
20
  /**
19
21
  * Initializes the chart and loads initial data
@@ -21,6 +23,7 @@ export declare class FunhiChartController {
21
23
  initialize(): Promise<void>;
22
24
  /**
23
25
  * Loads candles for a specific timeframe
26
+ * Safeguard: Only loads if we don't have candles, or merges with existing ones
24
27
  */
25
28
  loadTimeframeData(timeframeSeconds: number): Promise<void>;
26
29
  /**
@@ -54,6 +57,18 @@ export declare class FunhiChartController {
54
57
  * Resizes the chart
55
58
  */
56
59
  resize(): void;
60
+ /**
61
+ * Checks for gaps in candles and loads missing ones from database
62
+ */
63
+ private checkAndFillGaps;
64
+ /**
65
+ * Starts periodic gap checking
66
+ */
67
+ private startGapChecking;
68
+ /**
69
+ * Stops periodic gap checking
70
+ */
71
+ private stopGapChecking;
57
72
  /**
58
73
  * Destroys the controller and cleans up resources
59
74
  */