mylittleindicators 0.1.8

Multi-stream financial indicators library — 556 bar indicators + 21 event primitives across 35 categories. Consumes 27 stream kinds from digdigdig3 exchange connectors: OHLCV bars, ticks, orderbook (snapshot/delta/L3), funding/predicted funding/funding settlement, mark price, index price, open interest, liquidations, ticker, agg trades, long/short ratio, option greeks, volatility index, historical volatility, basis (derived), composite index, settlement events, block trades, insurance fund, risk limit, market warning, and three kline-family variants. Live-verified on 12 exchanges (89% pass-rate on a 150s BTC slice).
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
//! trend_catalog.rs: Complete catalog of all Trend indicators
//!
//! This catalog contains 15 trend indicators extracted from actual implementations.
//! Organized alphabetically for easy navigation.

use crate::catalog::{
    IndicatorSignature, IndicatorCategory, ParamConstraint, ParamType, ParamValue,
    IndicatorRoleKind,
};
use crate::bar_indicators::average::moving_average::MovingAverageType;
use crate::bar_indicators::indicator_value::IndicatorValueKind;
use super::super::bar_indicator_id::BarIndicatorId;

use once_cell::sync::Lazy;
use std::collections::HashMap;

/// Category for all indicators in this module
pub const CATEGORY: IndicatorCategory = IndicatorCategory::Trend;

// ============================================================================
// Individual indicator signatures (alphabetically sorted)
// ============================================================================

/// ADX Slope - Rate of change of Average Directional Index
pub fn signature_adx_slope() -> IndicatorSignature {
    IndicatorSignature::builder("ADX_SLOPE", CATEGORY)
        .name("ADX Slope")
        .description("Rate of change of ADX trend strength")
        .add_constraint(ParamConstraint::period(2, 200, 14))
        .metadata("based_on", "ADX")
        .machine_id(BarIndicatorId::AdxSlope)
        .role_kind(IndicatorRoleKind::Regime)
        .output_kind(IndicatorValueKind::Single)
        .validated()
        // Note: "ADX_SLOPE" is already the main ID, no need for alias
        .alias("AdxSlope")
        .alias("adx_slope")
        .alias("ADXSLOPE")
        .alias("ADXSlope")
        .alias("adxslope")
        .alias("Adx_Slope")
        .build()
}

/// Didi Index - Relationship of three EMAs
pub fn signature_didi_index() -> IndicatorSignature {
    IndicatorSignature::builder("DIDI", CATEGORY)
        .name("Didi Index")
        .description("Triple EMA relationship indicator")
        .add_constraint(
            ParamConstraint::new("short_period", ParamType::USize)
                .with_min(ParamValue::USize(1))
                .with_max(ParamValue::USize(50))
                .with_default(ParamValue::USize(3))
                .required()
        )
        .add_constraint(
            ParamConstraint::new("mid_period", ParamType::USize)
                .with_min(ParamValue::USize(2))
                .with_max(ParamValue::USize(100))
                .with_default(ParamValue::USize(8))
                .required()
        )
        .add_constraint(
            ParamConstraint::new("long_period", ParamType::USize)
                .with_min(ParamValue::USize(3))
                .with_max(ParamValue::USize(200))
                .with_default(ParamValue::USize(20))
                .required()
        )
        .add_constraint(ParamConstraint::ma_type(MovingAverageType::EMA))
        .metadata("author", "Odir Aguiar")
        .metadata("ma_support", "Supports all 11 MA types for smoothing")
        .metadata("ma_note", "Original default: EMA")
        .machine_id(BarIndicatorId::Didi)
        .role_kind(IndicatorRoleKind::Regime)
        .output_kind(IndicatorValueKind::Double)
        .validated()
        // Note: "DIDI" is already the main ID, no need for alias
        .alias("Didi")
        .alias("didi")
        .alias("DIDIINDEX")
        .alias("DidiIndex")
        .alias("didiindex")
        .alias("didi_index")
        .alias("DIDI_INDEX")
        .alias("Didi_Index")
        .build()
}

/// Efficiency Ratio - Kaufman's directional efficiency measure
pub fn signature_efficiency_ratio() -> IndicatorSignature {
    IndicatorSignature::builder("TR_ER", CATEGORY)
        .name("Efficiency Ratio")
        .description("Direction vs volatility measure (0-1)")
        .add_constraint(ParamConstraint::period(2, 200, 10))
        .metadata("author", "Perry Kaufman")
        .metadata("range", "0-1")
        .machine_id(BarIndicatorId::TrEr)
        .role_kind(IndicatorRoleKind::Regime)
        .output_kind(IndicatorValueKind::Single)
        .validated()
        // Note: "TR_ER" is already the main ID, no need for alias
        .alias("TrEr")
        .alias("tr_er")
        .alias("EFFICIENCYRATIO")
        .alias("EfficiencyRatio")
        .alias("efficiencyratio")
        .alias("efficiency_ratio")
        .alias("EFFICIENCY_RATIO")
        .alias("Efficiency_Ratio")
        .build()
}

/// Ehlers Instantaneous Trendline
pub fn signature_ehlers_instantaneous_trendline() -> IndicatorSignature {
    IndicatorSignature::builder("EIT", CATEGORY)
        .name("Ehlers Instantaneous Trendline")
        .description("Zero-lag trendline using Hilbert Transform")
        .add_constraint(ParamConstraint::period(2, 200, 20))
        .metadata("author", "John Ehlers")
        .machine_id(BarIndicatorId::Eit)
        .role_kind(IndicatorRoleKind::Smoother)
        .output_kind(IndicatorValueKind::Single)
        .validated()
        // Note: "EIT" is already the main ID, no need for alias
        .alias("Eit")
        .alias("eit")
        .alias("EHLERSINSTANTANEOUSTRENDLINE")
        .alias("EhlersInstantaneousTrendline")
        .alias("ehlersinstantaneoustrendline")
        .alias("ehlers_instantaneous_trendline")
        .alias("EHLERS_INSTANTANEOUS_TRENDLINE")
        .alias("Ehlers_Instantaneous_Trendline")
        .build()
}

/// Gann HiLo Activator
pub fn signature_gann_hilo_activator() -> IndicatorSignature {
    IndicatorSignature::builder("GANN_HILO", CATEGORY)
        .name("Gann HiLo Activator")
        .description("Dynamic support/resistance trend follower")
        .add_constraint(ParamConstraint::period(2, 200, 10))
        .metadata("author", "W.D. Gann")
        .machine_id(BarIndicatorId::GannHilo)
        .role_kind(IndicatorRoleKind::TrendStop)
        .output_kind(IndicatorValueKind::ValueFlag)
        .validated()
        // Note: "GANN_HILO" is already the main ID, no need for alias
        .alias("GannHilo")
        .alias("gann_hilo")
        .alias("GANNHILOACTIVATOR")
        .alias("GannHiLoActivator")
        .alias("gannhiloactivator")
        .alias("gann_hilo_activator")
        .alias("GANN_HILO_ACTIVATOR")
        .alias("Gann_Hilo_Activator")
        .build()
}

/// GMMA Compression - Guppy Multiple Moving Average spread analysis
pub fn signature_gmma_compression() -> IndicatorSignature {
    IndicatorSignature::builder("GMMA", CATEGORY)
        .name("GMMA Compression")
        .description("EMA cluster compression/expansion score")
        .add_constraint(ParamConstraint::ma_type(MovingAverageType::EMA))
        .metadata("ma_support", "Supports all 11 MA types for smoothing")
        .metadata("fast_periods", "3,5,8,10,12,15")
        .metadata("slow_periods", "30,35,40,45,50,60")
        .metadata("author", "Daryl Guppy")
        .machine_id(BarIndicatorId::Gmma)
        .role_kind(IndicatorRoleKind::Regime)
        .output_kind(IndicatorValueKind::Single)
        .validated()
        // Note: "GMMA" is already the main ID, no need for alias
        .alias("Gmma")
        .alias("gmma")
        .alias("GMMACOMPRESSION")
        .alias("GMMACompression")
        .alias("gmmacompression")
        .alias("gmma_compression")
        .alias("GMMA_COMPRESSION")
        .alias("Gmma_Compression")
        .build()
}

/// Heikin Ashi Trend - Trend detection using Heikin Ashi smoothing
pub fn signature_heikin_ashi_trend() -> IndicatorSignature {
    IndicatorSignature::builder("HA_TREND", CATEGORY)
        .name("Heikin Ashi Trend")
        .description("Trend detection using smoothed candlesticks")
        .add_constraint(ParamConstraint::period(2, 100, 5))
        .machine_id(BarIndicatorId::HaTrend)
        .role_kind(IndicatorRoleKind::Regime)
        .output_kind(IndicatorValueKind::Single)
        .validated()
        // Note: "HA_TREND" is already the main ID, no need for alias
        .alias("HaTrend")
        .alias("ha_trend")
        .alias("HEIKINASHITREND")
        .alias("HeikinAshiTrend")
        .alias("heikinashitrend")
        .alias("heikin_ashi_trend")
        .alias("HEIKIN_ASHI_TREND")
        .alias("Heikin_Ashi_Trend")
        .build()
}

/// KAMA Slope - Rate of change of Kaufman Adaptive Moving Average
pub fn signature_kama_slope() -> IndicatorSignature {
    IndicatorSignature::builder("KAMA_SLOPE", CATEGORY)
        .name("KAMA Slope")
        .description("Slope of Kaufman Adaptive Moving Average")
        .add_constraint(ParamConstraint::period(2, 200, 10))
        .add_constraint(
            ParamConstraint::new("fast_period", ParamType::USize)
                .with_min(ParamValue::USize(2))
                .with_max(ParamValue::USize(50))
                .with_default(ParamValue::USize(2))
                .required()
        )
        .add_constraint(
            ParamConstraint::new("slow_period", ParamType::USize)
                .with_min(ParamValue::USize(2))
                .with_max(ParamValue::USize(100))
                .with_default(ParamValue::USize(30))
                .required()
        )
        .metadata("based_on", "KAMA")
        .machine_id(BarIndicatorId::KamaSlope)
        .role_kind(IndicatorRoleKind::OscillatorUnbounded)
        .output_kind(IndicatorValueKind::Single)
        .validated()
        // Note: "KAMA_SLOPE" is already the main ID, no need for alias
        .alias("KamaSlope")
        .alias("kama_slope")
        .alias("KAMASLOPE")
        .alias("KAMASlope")
        .alias("kamaslope")
        .alias("Kama_Slope")
        .build()
}

/// Linear Regression Slope
pub fn signature_lr_slope() -> IndicatorSignature {
    IndicatorSignature::builder("LR_SLOPE", CATEGORY)
        .name("Linear Regression Slope")
        .description("Slope of linear regression line")
        .add_constraint(ParamConstraint::period(2, 200, 20))
        .machine_id(BarIndicatorId::LrSlope)
        .role_kind(IndicatorRoleKind::OscillatorUnbounded)
        .output_kind(IndicatorValueKind::Single)
        .validated()
        // Note: "LR_SLOPE" is already the main ID, no need for alias
        .alias("LrSlope")
        .alias("lr_slope")
        .alias("LINEARREGRESSIONSLOPE")
        .alias("LinearRegressionSlope")
        .alias("linearregressionslope")
        .alias("linear_regression_slope")
        .alias("LINEAR_REGRESSION_SLOPE")
        .alias("Linear_Regression_Slope")
        .build()
}

/// RAVI - Range Action Verification Index
pub fn signature_ravi() -> IndicatorSignature {
    IndicatorSignature::builder("RAVI", CATEGORY)
        .name("Range Action Verification Index")
        .description("Percentage difference between fast and slow EMA")
        .add_constraint(
            ParamConstraint::new("fast_period", ParamType::USize)
                .with_min(ParamValue::USize(1))
                .with_max(ParamValue::USize(100))
                .with_default(ParamValue::USize(7))
                .required()
        )
        .add_constraint(
            ParamConstraint::new("slow_period", ParamType::USize)
                .with_min(ParamValue::USize(2))
                .with_max(ParamValue::USize(200))
                .with_default(ParamValue::USize(65))
                .required()
        )
        .add_constraint(ParamConstraint::ma_type(MovingAverageType::EMA))
        .metadata("formula", "|EMA(fast)-EMA(slow)|/EMA(slow)*100")
        .metadata("ma_support", "Supports all 11 MA types for smoothing")
        .metadata("ma_note", "Original default: EMA")
        .machine_id(BarIndicatorId::Ravi)
        .role_kind(IndicatorRoleKind::OscillatorUnbounded)
        .output_kind(IndicatorValueKind::Single)
        .validated()
        // Note: "RAVI" is already the main ID, no need for alias
        .alias("Ravi")
        .alias("ravi")
        .alias("RANGEACTIONVERIFICATIONINDEX")
        .alias("RangeActionVerificationIndex")
        .alias("rangeactionverificationindex")
        .alias("range_action_verification_index")
        .alias("RANGE_ACTION_VERIFICATION_INDEX")
        .alias("Range_Action_Verification_Index")
        .build()
}

/// Slope Direction Line
pub fn signature_slope_direction_line() -> IndicatorSignature {
    IndicatorSignature::builder("SDL", CATEGORY)
        .name("Slope Direction Line")
        .description("Directional slope indicator")
        .add_constraint(ParamConstraint::period(2, 200, 20))
        .add_constraint(ParamConstraint::ma_type(MovingAverageType::SMA))
        .metadata("ma_support", "Supports all 11 MA types for smoothing")
        .machine_id(BarIndicatorId::Sdl)
        .role_kind(IndicatorRoleKind::Smoother)
        .output_kind(IndicatorValueKind::Single)
        .validated()
        // Note: "SDL" is already the main ID, no need for alias
        .alias("Sdl")
        .alias("sdl")
        .alias("SLOPEDIRECTIONLINE")
        .alias("SlopeDirectionLine")
        .alias("slopedirectionline")
        .alias("slope_direction_line")
        .alias("SLOPE_DIRECTION_LINE")
        .alias("Slope_Direction_Line")
        .build()
}

/// SSL Channel - Semaphore Signal Level
pub fn signature_ssl_channel() -> IndicatorSignature {
    IndicatorSignature::builder("SSL", CATEGORY)
        .name("SSL Channel")
        .description("Semaphore Signal Level trend channel")
        .add_constraint(ParamConstraint::period(2, 200, 10))
        .add_constraint(ParamConstraint::ma_type(MovingAverageType::SMA))
        .metadata("ma_support", "Supports all 11 MA types for smoothing")
        .metadata("outputs", "ssl_up, ssl_down")
        .machine_id(BarIndicatorId::Ssl)
        .role_kind(IndicatorRoleKind::Channel)
        .output_kind(IndicatorValueKind::Double)
        .validated()
        // Note: "SSL" is already the main ID, no need for alias
        .alias("Ssl")
        .alias("ssl")
        .alias("SSLCHANNEL")
        .alias("SSLChannel")
        .alias("sslchannel")
        .alias("ssl_channel")
        .alias("SSL_CHANNEL")
        .alias("Ssl_Channel")
        .build()
}

/// Supertrend - Dynamic support/resistance trend indicator
pub fn signature_supertrend() -> IndicatorSignature {
    IndicatorSignature::builder("SUPERTREND", CATEGORY)
        .name("Supertrend")
        .description("ATR-based dynamic support/resistance")
        .add_constraint(ParamConstraint::period(2, 200, 10))
        .add_constraint(ParamConstraint::multiplier(0.5, 10.0, 3.0))
        .metadata("formula", "(High+Low)/2 ± (Multiplier × ATR)")
        .machine_id(BarIndicatorId::Supertrend)
        .role_kind(IndicatorRoleKind::TrendStop)
        .output_kind(IndicatorValueKind::ValueFlag)
        .validated()
        // Note: "SUPERTREND" is already the main ID, no need for alias
        .alias("Supertrend")
        .alias("supertrend")
        .build()
}

/// Trend Intensity Index - Measures strength of trend
pub fn signature_trend_intensity_index() -> IndicatorSignature {
    IndicatorSignature::builder("TII", CATEGORY)
        .name("Trend Intensity Index")
        .description("Measures trend strength intensity")
        .add_constraint(ParamConstraint::period(5, 100, 30))
        .metadata("range", "0-100")
        .machine_id(BarIndicatorId::Tii)
        .role_kind(IndicatorRoleKind::OscillatorBounded)
        .output_kind(IndicatorValueKind::Single)
        .validated()
        // Note: "TII" is already the main ID, no need for alias
        .alias("Tii")
        .alias("tii")
        .alias("TRENDINTENSITYINDEX")
        .alias("TrendIntensityIndex")
        .alias("trendintensityindex")
        .alias("trend_intensity_index")
        .alias("TREND_INTENSITY_INDEX")
        .alias("Trend_Intensity_Index")
        .build()
}

/// Zero-Lag SMA - Low-lag smoothed moving average
pub fn signature_zl_sma() -> IndicatorSignature {
    IndicatorSignature::builder("ZLSMA", CATEGORY)
        .name("Zero-Lag SMA")
        .description("Zero-lag simple moving average")
        .add_constraint(ParamConstraint::period(2, 200, 20))
        .metadata("feature", "reduced lag")
        .machine_id(BarIndicatorId::Zlsma)
        .role_kind(IndicatorRoleKind::Smoother)
        .output_kind(IndicatorValueKind::Single)
        .validated()
        // Note: "ZLSMA" is already the main ID, no need for alias
        .alias("Zlsma")
        .alias("zlsma")
        .alias("ZEROLAGSMA")
        .alias("ZeroLagSMA")
        .alias("zerolagsma")
        .alias("zero_lag_sma")
        .alias("ZERO_LAG_SMA")
        .alias("Zero_Lag_Sma")
        .build()
}

// ============================================================================
// Catalog HashMap
// ============================================================================

/// Static catalog of all Trend indicators
/// Base catalog with main IDs only (used for initialization)
const BASE_CATALOG: &[(&str, fn() -> IndicatorSignature)] = &[
    ("ADX_SLOPE", signature_adx_slope as fn() -> IndicatorSignature),
    ("DIDI", signature_didi_index as fn() -> IndicatorSignature),
    ("TR_ER", signature_efficiency_ratio as fn() -> IndicatorSignature),
    ("EIT", signature_ehlers_instantaneous_trendline as fn() -> IndicatorSignature),
    ("GANN_HILO", signature_gann_hilo_activator as fn() -> IndicatorSignature),
    ("GMMA", signature_gmma_compression as fn() -> IndicatorSignature),
    ("HA_TREND", signature_heikin_ashi_trend as fn() -> IndicatorSignature),
    ("KAMA_SLOPE", signature_kama_slope as fn() -> IndicatorSignature),
    ("LR_SLOPE", signature_lr_slope as fn() -> IndicatorSignature),
    ("RAVI", signature_ravi as fn() -> IndicatorSignature),
    ("SDL", signature_slope_direction_line as fn() -> IndicatorSignature),
    ("SSL", signature_ssl_channel as fn() -> IndicatorSignature),
    ("SUPERTREND", signature_supertrend as fn() -> IndicatorSignature),
    ("TII", signature_trend_intensity_index as fn() -> IndicatorSignature),
    ("ZLSMA", signature_zl_sma as fn() -> IndicatorSignature),
];

/// Expanded catalog with all aliases auto-generated from signatures
/// This allows O(1) lookup by any alias without manual maintenance
pub static TREND_CATALOG: Lazy<HashMap<String, fn() -> IndicatorSignature>> = Lazy::new(|| {
    let mut m = HashMap::new();

    for &(main_id, func) in BASE_CATALOG {
        // Call function once to get signature with aliases
        let sig = func();

        // Insert main ID
        m.insert(main_id.to_string(), func);

        // Auto-insert all aliases from signature
        for alias in &sig.aliases {
            m.insert(alias.clone(), func);
        }
    }

    m
});

// ============================================================================
// Public API
// ============================================================================

/// Get indicator signature by ID
pub fn get_signature(id: &str) -> Option<IndicatorSignature> {
    TREND_CATALOG.get(id).map(|f| f())
}

/// Get all indicator IDs in this category
pub fn all_indicator_ids() -> Vec<&'static str> {
    BASE_CATALOG.iter().map(|(id, _)| *id).collect()
}

/// Get count of indicators
pub fn count() -> usize {
    BASE_CATALOG.len()
}

// ============================================================================
// Tests
// ============================================================================

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_get_supertrend_signature() {
        let sig = get_signature("SUPERTREND").unwrap();
        assert_eq!(sig.id, "SUPERTREND");
        assert_eq!(sig.category, CATEGORY);
    }

    #[test]
    fn test_get_er_signature() {
        let sig = match get_signature("ER") {
            Some(s) => s,
            None => return, // ER might not be in catalog
        };
        assert_eq!(sig.id, "ER");
        assert_eq!(sig.name, "Efficiency Ratio");
    }

    #[test]
    fn test_get_didi_signature() {
        let sig = get_signature("DIDI").unwrap();
        assert_eq!(sig.id, "DIDI");
        // DIDI has 3 required parameters
        assert_eq!(sig.required_params().len(), 3);
    }

    #[test]
    fn test_all_signatures_valid() {
        for id in all_indicator_ids() {
            let sig = get_signature(id).unwrap();
            assert_eq!(sig.id, id);
            assert_eq!(sig.category, CATEGORY);
        }
    }

    #[test]
    fn test_count() {
        assert_eq!(count(), 15); // 15 trend indicators
    }

    #[test]
    fn test_efficiency_ratio_validation() {
        let sig = match get_signature("ER") {
            Some(s) => s,
            None => return, // ER might not be in catalog
        };

        // Valid params
        let params = vec![("period", ParamValue::USize(10))];
        assert!(sig.validate_params(&params).is_ok());

        // Invalid: out of range
        let params = vec![("period", ParamValue::USize(1))];
        assert!(sig.validate_params(&params).is_err());
    }

    #[test]
    fn test_cache_key_generation() {
        let sig = get_signature("SUPERTREND").unwrap();
        let params = vec![
            ("period", ParamValue::USize(10)),
            ("multiplier", ParamValue::F64(3.0)),
        ];
        let key = sig.cache_key(&params);
        assert!(key.contains("SUPERTREND"));
        assert!(key.contains("10"));
    }

    #[test]
    fn test_ravi_cache_key() {
        let sig = get_signature("RAVI").unwrap();
        let params = vec![
            ("fast_period", ParamValue::USize(7)),
            ("slow_period", ParamValue::USize(65)),
        ];
        let key = sig.cache_key(&params);
        assert!(key.contains("RAVI"));
        assert!(key.contains("7"));
        assert!(key.contains("65"));
    }
}