feat(data-layer): Resampler (candle resampling) in all 10 languages (#310)

* feat(data-layer): Resampler (candle resampling) in all 10 languages

Second data-layer feature (F3): resample candles into a higher timeframe.

- Native (Node.js/WASM): new Resampler(timeframe) -> update(o,h,l,c,v,ts):
  Candle|null + flush(): Candle|null. Python the same -> tuple|None.
- C ABI: wickra_resampler_new/update/flush/free (update has the multi-output
  shape so the generators auto-emit it; flush is bespoke). Go Update -> (Candle,
  bool) + Flush; C# Candle? Update/Flush; Java Candle update/flush; R update()
  generic + a flush() S3 method (extends base::flush); C/C++ direct.
- Cross-language golden (testdata/golden/data_resampled.csv): the shared input
  candles resampled into 5-unit buckets, the final partial bucket via flush,
  pinned bit-for-bit across every binding.

Verified locally in all 10 (3 candles for the 5-unit smoke; 16 for the golden).
The WickraCandle output record is shared with the tick aggregator (deduped).

* test(node): exclude data-layer types from the indicator completeness contract

The Resampler exposes update(), so the completeness test flagged it as an
indicator and required batch/reset/isReady/warmupPeriod, which a data-layer type
does not have. Exclude TickAggregator and Resampler like the bar builders.
This commit is contained in:
kingchenc
2026-06-15 22:36:16 +02:00
committed by GitHub
parent 8a103ef920
commit cb6da4d737
30 changed files with 901 additions and 4 deletions
+17
View File
@@ -0,0 +1,17 @@
open,high,low,close,volume,timestamp
99,112.90403177129735,98,111.32039085967226,5187.008623739826,0
113.27609348158748,115.1642566915892,107.76539185209613,108.7737988023383,5473.238103468329,5
106.12753789513545,107.73969337995807,96.34710045689485,98.28424227586412,5324.374653317379,10
97.378063505514,106.32510161131832,95.93821562552817,103.99314457402363,5150.941358775185,15
108.04491654708718,121.38046215528227,105.7105413401633,119.93667863849153,5456.9835954080345,20
120.88220148856881,124.2878498649492,119.39438848583472,121.12969230082183,5371.101223522536,25
119.8808727652764,121.29920058454442,108.51535390119264,110.00125312406458,5128.47088205189,30
108.48360243707184,113.29382811110736,106.26786689008574,111.88016416080967,5431.582557578566,35
114.22618875818226,130.20955349568973,113.09073586402833,127.92073514707224,5410.400200215731,40
131.41114890560974,135.065460892756,129.49585703767033,132.95746831142935,5120.058973527027,45
130.5116755897077,132.71696973631924,121.2254215875191,122.27578013601534,5397.543391924787,50
121.09703354508844,122.45602084147426,117.25536324735009,120.37417550208815,5441.485014111252,55
122.33587608239566,136.79793765689536,120.87761530843784,135.43314928819893,5132.5539248008245,60
138.08766685694894,146.57143212166807,136.58837142074304,144.11152724502116,5355.547392578692,65
144.27024859045207,145.7471249168318,132.66155074344638,134.9266357939324,5463.733502447633,70
131.6480122345848,134.02210748888697,127.39947545719488,129.59514479102842,5163.946538828373,75
1 open high low close volume timestamp
2 99 112.90403177129735 98 111.32039085967226 5187.008623739826 0
3 113.27609348158748 115.1642566915892 107.76539185209613 108.7737988023383 5473.238103468329 5
4 106.12753789513545 107.73969337995807 96.34710045689485 98.28424227586412 5324.374653317379 10
5 97.378063505514 106.32510161131832 95.93821562552817 103.99314457402363 5150.941358775185 15
6 108.04491654708718 121.38046215528227 105.7105413401633 119.93667863849153 5456.9835954080345 20
7 120.88220148856881 124.2878498649492 119.39438848583472 121.12969230082183 5371.101223522536 25
8 119.8808727652764 121.29920058454442 108.51535390119264 110.00125312406458 5128.47088205189 30
9 108.48360243707184 113.29382811110736 106.26786689008574 111.88016416080967 5431.582557578566 35
10 114.22618875818226 130.20955349568973 113.09073586402833 127.92073514707224 5410.400200215731 40
11 131.41114890560974 135.065460892756 129.49585703767033 132.95746831142935 5120.058973527027 45
12 130.5116755897077 132.71696973631924 121.2254215875191 122.27578013601534 5397.543391924787 50
13 121.09703354508844 122.45602084147426 117.25536324735009 120.37417550208815 5441.485014111252 55
14 122.33587608239566 136.79793765689536 120.87761530843784 135.43314928819893 5132.5539248008245 60
15 138.08766685694894 146.57143212166807 136.58837142074304 144.11152724502116 5355.547392578692 65
16 144.27024859045207 145.7471249168318 132.66155074344638 134.9266357939324 5463.733502447633 70
17 131.6480122345848 134.02210748888697 127.39947545719488 129.59514479102842 5163.946538828373 75