Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CCI returns different results every time is runs #11

Open
yarimiz opened this issue Jul 22, 2024 · 2 comments
Open

CCI returns different results every time is runs #11

yarimiz opened this issue Jul 22, 2024 · 2 comments

Comments

@yarimiz
Copy link

yarimiz commented Jul 22, 2024

I've been facing weird issue when trying to calculate CCI (ta.cci).
Each time I run the exact same code, on the same data, and same arguments, I get different values for the feature.

the code:

raw_data.with_columns(cci=pl.col("adjusted_close").ta.cci(pl.col("adjusted_high"), pl.col("adjusted_low"), timeperiod=7).over("ticker")).collect())

I've attached a screen recording of the issue as it's the most simple way to display it.

Recording.2024-07-22.130315.mp4

where raw_data is a lazyframe with simple structure of row per day per ticker, nothing special.
The raw data is sorted.

I tried with and without filtering the lazyframe to only one ticker, sorting by date asc and desc, but nothing helped.

@Yvictor
Copy link
Owner

Yvictor commented Jul 23, 2024

I use this example
Polars TA Extension - Basic Example

Here is the code snippet I am working with:

p.filter(
    pl.col("Symbol") == "TSLA"
).with_columns(
    plta.cci(pl.col("high"), pl.col("low"), pl.col("close"), 7).over("Symbol").alias("cci_plta"),
    pl.col("close").ta.cci(pl.col("high"), pl.col("low"), 7).over("Symbol").alias("cci_ta"),
).collect()

the result is always same
image

@xopheS
Copy link

xopheS commented Sep 17, 2024

I think the lazy dataframe is not automatically sorted so the rolling operations wouldn't be accurate

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

No branches or pull requests

3 participants