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

ta.Category list value gets truncated #788

Open
MattBJ opened this issue May 9, 2024 · 1 comment
Open

ta.Category list value gets truncated #788

MattBJ opened this issue May 9, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@MattBJ
Copy link

MattBJ commented May 9, 2024

This is sort of a secondary bug I am running into. I have been trying out the df.ta.strategy method, and I tried with df.ta.strategy("all") as a test, only to see it fails. Well, after some digging I realized it was ta.Category["overlap"] that is failing to be calculated with the strategy method.

So, to debug this further, I decided to try the following python code:

for use_single_indicator in ta.Category["overlap"]:
    print(f"Trying {exclude_tracker}")
    try:
        x = deepcopy(ta.Category["overlap"])
        x.remove(use_single_indicator)
        candle_df.ta.strategy("overlap",exclude=x)
        print(f"{use_single_indicator} tested and strategy calculation succeeded")
    except:
        print(f"{use_single_indicator} tested and strategy calculation failed")

This only ends up looping once, even though len(ta.Category["overlap"] is 32.
In my python terminal I decided to check ta.Category["overlap"] after the loop finishes, and it only returns ['alma'] now, which is the exact exclude_tracker indicator I tried removing from my deepcopy.

So essentially, I cannot loop through each indicator to exclude them in my strategy to see which one fails computation. This is some very odd behavior, I'm not sure why my copy, then removal of 'alma' from the copied list to exclude from results in this overwriting of ta.Category["overlap"].

ETA: it seems as though any use of exclude will overwrite this ta.Category; this doesn't seem like intended behavior? After excluding from a strategy once, I can no longer use the indicator again in that strategy?

ETA: I have made some "hacks" on my end to circumvent this behavior, in order to aid my own debugging. . .

overlap_indicator_list = deepcopy(ta.Category["overlap"])
for use_single_indicator in ta.Category["overlap"]:
    # should not have to do this every time, but I have to overwrite the global variable
    ta.Category["overlap"] = deepcopy(overlap_indicator_list)
    print(f"Trying {exclude_tracker}")
    try:
        x = deepcopy(ta.Category["overlap"])
        x.remove(use_single_indicator)
        candle_df.ta.strategy("overlap",exclude=x)
        print(f"{use_single_indicator} tested and strategy calculation succeeded")
    except:
        print(f"{use_single_indicator} testeed and strategy calculation failed")
@MattBJ MattBJ added the bug Something isn't working label May 9, 2024
@twopirllc twopirllc removed their assignment May 21, 2024
@twopirllc
Copy link
Owner

Hello @MattBJ,

Please try the development version as it has many bug fixes and improvements. Curious if that resolves the issue

You can also see the study/strategy tests and test results under Run tests and updated documentation.

Kind Regards,
KJ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants