tulip_rs_shared 0.1.0

Shared constants and helpers for the TulipRS technical analysis library
Documentation
  • Coverage
  • 11.34%
    11 out of 97 items documented0 out of 5 items with examples
  • Size
  • Source code size: 13.13 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 647.55 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 2s Average build duration of successful builds.
  • all releases: 2s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • me60732/tulip_rs
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • me60732

tulip_rs_shared

Shared constants and helper functions for candlestick bitmask encoding.

This crate provides the single source of truth for bit positions and encoding used by build.rs, proc macros, and runtime code.

CandleBits layout

CandleBits is split into two separate fields:

mandatory: u32 (always computed at bar creation, 27 bits used)

Tight-packed — no byte-boundary waste:

  Bits  0– 5   Basic variants      (6 types, 1-hot)
  Bits  6–10   Doji variants       (5 types, 1-hot)
  Bits 11–16   Marubozu variants   (6 types, 1-hot)
  Bits 17–19   SpinningTop variants(3 types, 1-hot)
  Bit  20      OTHER
  Bit  21      COLOUR   (GREEN=1, RED=0)
  Bit  22      FILL     (HOLLOW=1, FILLED=0)
  Bit  23      TREND    (UP=1, DOWN=0)
  Bit  24      LINE_HEIGHT (LONG=1, SHORT=0)
  Bit  25      LOWER_WICK_LT_BODY  (lower wick < body height)
  Bit  26      UPPER_WICK_LT_BODY  (upper wick < body height)
  Bit  27      BODY_HEIGHT         (LONG=1, SHORT=0)
  Bits 28–31  4 spare

lazy_value / lazy_computed: u16 (computed on demand, all 16 bits used)

  Bit  0   OPEN_ABOVE_PREV_BODY_MID  (my open > prev body midpoint)
  Bit  1   OPEN_IN_PREV_BODY     (my open ∈ prev body)
  Bit  2   CLOSE_ABOVE_PREV_BODY_MID (my close > prev body midpoint)
  Bit  3   CLOSE_IN_PREV_BODY    (my close ∈ prev body)
  Bit  4   HIGH_ABOVE_PREV_BODY_MID  (my high > prev body midpoint)
  Bit  5   HIGH_IN_PREV_BODY     (my high ∈ prev body)
  Bit  6   HIGH_IN_PREV_LINE     (my high ∈ [prev LOW, prev HIGH])
  Bit  7   LOW_ABOVE_PREV_BODY_MID   (my low > prev body midpoint)
  Bit  8   LOW_IN_PREV_BODY      (my low ∈ prev body)
  Bit  9   LOW_IN_PREV_LINE      (my low ∈ [prev LOW, prev HIGH])
  Bit 10   I_ENGULF_PREV_BODY    (prev open AND prev close both ∈ my body)
  Bit 11   PREV_HIGH_IN_MY_BODY  (prev bar's high ∈ my body)
  Bit 12   PREV_LOW_IN_MY_BODY   (prev bar's low ∈ my body)
  Bit 13   LOWER_WICK_LONG_2X    (lower wick ≥ 2× body height)
  Bit 14   UPPER_WICK_LONG_2X    (upper wick ≥ 2× body height)
  Bit 15   BODY_GT_PREV_BODY     (body height > previous bar's body height)