funhi-chart 1.4.3 → 1.4.5

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.
@@ -6,6 +6,7 @@ export interface ChartProps {
6
6
  socket?: any;
7
7
  isConnected?: boolean;
8
8
  currentPrice?: number;
9
+ currentVolume?: number;
9
10
  analyticsConnected?: boolean;
10
11
  analyticsLoading?: boolean;
11
12
  }
@@ -14,7 +14,7 @@ export declare class CandleManager {
14
14
  /**
15
15
  * Main method: Creates a new candle or updates the current one
16
16
  */
17
- createOrUpdate(price: number, timestamp: number): CandleUpdateResult | null;
17
+ createOrUpdate(price: number, timestamp: number, tradeSize?: number): CandleUpdateResult | null;
18
18
  /**
19
19
  * Creates a new candle at bucket boundary
20
20
  * Detects gaps and logs them (gaps should be filled by loading from database)
@@ -14,8 +14,6 @@ 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;
19
17
  constructor(config: ControllerConfig);
20
18
  /**
21
19
  * Initializes the chart and loads initial data
@@ -29,7 +27,7 @@ export declare class FunhiChartController {
29
27
  /**
30
28
  * Updates price for all timeframes
31
29
  */
32
- updatePrice(price: number): void;
30
+ updatePrice(price: number, tradeSize?: number): void;
33
31
  /**
34
32
  * Handles WebSocket update
35
33
  */
@@ -57,26 +55,6 @@ export declare class FunhiChartController {
57
55
  * Resizes the chart
58
56
  */
59
57
  resize(): void;
60
- /**
61
- * Checks for gaps in candles and loads missing ones from database for current timeframe
62
- */
63
- private checkAndFillGaps;
64
- /**
65
- * Checks for gaps in candles and loads missing ones from database for a specific timeframe
66
- */
67
- private checkAndFillGapsForTimeframe;
68
- /**
69
- * Checks for gaps in all timeframes and loads missing candles
70
- */
71
- private checkAndFillGapsForAllTimeframes;
72
- /**
73
- * Starts periodic gap checking
74
- */
75
- private startGapChecking;
76
- /**
77
- * Stops periodic gap checking
78
- */
79
- private stopGapChecking;
80
58
  /**
81
59
  * Destroys the controller and cleans up resources
82
60
  */
@@ -14,7 +14,7 @@ export declare class TimeframeManager {
14
14
  /**
15
15
  * Updates all timeframes with new price data
16
16
  */
17
- updateAll(price: number, timestamp: number): void;
17
+ updateAll(price: number, timestamp: number, tradeSize?: number): void;
18
18
  /**
19
19
  * Gets candles for a specific timeframe
20
20
  */
@@ -8,6 +8,9 @@ export interface CandleData {
8
8
  low: number;
9
9
  close: number;
10
10
  volume: number;
11
+ tradeCount?: number;
12
+ isSingleTrade?: boolean;
13
+ isWeakSignal?: boolean;
11
14
  }
12
15
  export interface TimeFrame {
13
16
  label: string;
@@ -10,7 +10,7 @@ export declare class RealTimeUpdateHandler {
10
10
  /**
11
11
  * Handles price update from real-time data
12
12
  */
13
- handlePriceUpdate(price: number, timestamp: number): void;
13
+ handlePriceUpdate(price: number, timestamp: number, tradeSize?: number): void;
14
14
  /**
15
15
  * Handles WebSocket update with pre-calculated candles
16
16
  */
@@ -0,0 +1 @@
1
+ export {};
@@ -35,11 +35,6 @@ declare class CandleAggregation {
35
35
  * Get timeframe in seconds from label
36
36
  */
37
37
  getTimeframeSeconds(label: string): number;
38
- /**
39
- * Fill gaps in candles with flat candles (same OHLC)
40
- * This ensures continuous chart rendering
41
- */
42
- fillGaps(candles: CandleData[], timeframe: number): CandleData[];
43
38
  /**
44
39
  * Get the current incomplete candle for a timeframe
45
40
  * This is used for real-time updates
@@ -17,8 +17,8 @@ export declare class CandleValidator {
17
17
  */
18
18
  static validate(candle: CandleData): boolean;
19
19
  /**
20
- * Ensures candle has minimum body size for visibility
21
- * DISABLED: Returns candle as-is to display exact prices without modifications
20
+ * Ensures candle has minimum body size for visibility // CHANGED
21
+ * NOTE: This is a visual adjustment only and does not imply extra volume. // ADDED
22
22
  */
23
23
  static ensureMinimumBodySize(candle: CandleData, minBodySize?: number): CandleData;
24
24
  /**
@@ -34,8 +34,8 @@ export declare class CandleValidator {
34
34
  */
35
35
  static validatePrice(price: number): boolean;
36
36
  /**
37
- * Calculates minimum body size for a given price
38
- * Returns 0 to prevent any price modifications
37
+ * Calculates minimum body size for a given price // CHANGED
38
+ * Returns a tiny value for visual body only // CHANGED
39
39
  */
40
40
  static calculateMinBodySize(price: number): number;
41
41
  }
package/dist/index.d.ts CHANGED
@@ -9,6 +9,7 @@ interface ChartProps {
9
9
  socket?: any;
10
10
  isConnected?: boolean;
11
11
  currentPrice?: number;
12
+ currentVolume?: number;
12
13
  analyticsConnected?: boolean;
13
14
  analyticsLoading?: boolean;
14
15
  }
@@ -252,11 +253,6 @@ declare class CandleAggregation {
252
253
  * Get timeframe in seconds from label
253
254
  */
254
255
  getTimeframeSeconds(label: string): number;
255
- /**
256
- * Fill gaps in candles with flat candles (same OHLC)
257
- * This ensures continuous chart rendering
258
- */
259
- fillGaps(candles: CandleData[], timeframe: number): CandleData[];
260
256
  /**
261
257
  * Get the current incomplete candle for a timeframe
262
258
  * This is used for real-time updates