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
@@ -678,6 +678,8 @@ typedef struct RenkoBars RenkoBars;
typedef struct RenkoTrailingStop RenkoTrailingStop;
typedef struct Resampler Resampler;
typedef struct RickshawMan RickshawMan;
typedef struct RisingThreeMethods RisingThreeMethods;
@@ -13719,6 +13721,21 @@ intptr_t wickra_tick_aggregator_drain(struct TickAggregator *handle,
void wickra_tick_aggregator_free(struct TickAggregator *handle);
struct Resampler *wickra_resampler_new(int64_t timeframe);
bool wickra_resampler_update(struct Resampler *handle,
double open,
double high,
double low,
double close,
double volume,
int64_t timestamp,
struct WickraCandle *out);
bool wickra_resampler_flush(struct Resampler *handle, struct WickraCandle *out);
void wickra_resampler_free(struct Resampler *handle);
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus