Skip to content

feat(helper): implement IsRising utility#376

Open
SAY-5 wants to merge 1 commit into
cinar:masterfrom
SAY-5:feature/is-rising-helper
Open

feat(helper): implement IsRising utility#376
SAY-5 wants to merge 1 commit into
cinar:masterfrom
SAY-5:feature/is-rising-helper

Conversation

@SAY-5
Copy link
Copy Markdown

@SAY-5 SAY-5 commented May 25, 2026

Description

Implements the IsRising helper function as specified in #369.

Returns 1 if the current value is strictly greater than the value n periods ago, and 0 otherwise.

$$\text{IsRising}_t = \begin{cases} 1 & \text{if } P_t > P_{t-n} \ 0 & \text{otherwise} \end{cases}$$

Implementation

  • Generic helper function in the helper package.
  • Signature: func IsRising[T Number](c <-chan T, period int) <-chan T
  • Reuses Duplicate, Buffered, Skip, and Operate from the existing helper primitives.
  • No new dependencies.

Tests

Five test cases covering: mixed input, default period (1), all-rising, all-falling, and equal values. Coverage: 100% on is_rising.go.

--- PASS: TestIsRising (0.00s)
--- PASS: TestIsRisingDefaultPeriod (0.00s)
--- PASS: TestIsRisingAllRising (0.00s)
--- PASS: TestIsRisingNoneRising (0.00s)
--- PASS: TestIsRisingEqual (0.00s)
PASS
coverage: 100.0% (is_rising.go)

Closes #369

Adds IsRising[T Number](c <-chan T, period int) <-chan T to the helper
package. Returns 1 when the current value strictly exceeds the value
n periods ago, 0 otherwise. 100% test coverage.

Closes cinar#369

Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
@github-actions
Copy link
Copy Markdown


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Is Rising Utility

1 participant