Skip to content

feat(helper): implement IsRising utility#376

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

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

Conversation

@SAY-5

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

Copy link
Copy Markdown

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

github-actions Bot commented May 25, 2026

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@SAY-5

SAY-5 commented Jun 20, 2026

Copy link
Copy Markdown
Author

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

@SAY-5

SAY-5 commented Jun 20, 2026

Copy link
Copy Markdown
Author

recheck

github-actions Bot added a commit that referenced this pull request Jun 20, 2026
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