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

Good First Issue >> Strictly Increasing / Decreasing #162

Closed
RajeshDhalange opened this issue Nov 17, 2020 · 6 comments · Fixed by #164
Closed

Good First Issue >> Strictly Increasing / Decreasing #162

RajeshDhalange opened this issue Nov 17, 2020 · 6 comments · Fixed by #164
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@RajeshDhalange
Copy link

RajeshDhalange commented Nov 17, 2020

Thanks for Pandas-Ta
Can you add a "strictly" boolean parameter to the Increasing / Decreasing function?
Now you are checking the difference between the current value with a length value ie. increasing = close.diff(length) > 0
But I want to check continuous increasing / decreasing condition like

test_list = [1, 4, 5, 7, 8, 10] 
res = all(i < j for i, j in zip(test_list, test_list[1:])) 
which result True

test_list = [1, 8, 5, 4, 8, 10] 
result = False
@RajeshDhalange RajeshDhalange added the enhancement New feature or request label Nov 17, 2020
@twopirllc twopirllc changed the title Strictly Increasing / Decreasing Good First Issue >> Strictly Increasing / Decreasing Nov 17, 2020
@twopirllc twopirllc added the good first issue Good for newcomers label Nov 17, 2020
@twopirllc
Copy link
Owner

Hello @RajeshDhalange,

Thanks for using Pandas TA!

I think this is a good idea. Do you want to try and make the changes and submit a Pull Request?

Thanks,
KJ

@RajeshDhalange
Copy link
Author

Beginner in python if you still want to try I can.

@RajeshDhalange
Copy link
Author

I tried the following code

    def increasing(close, length=None, asint=True, strictly=False, offset=None, **kwargs):
    # Validate Arguments
    close = verify_series(close)
    length = int(length) if length and length > 0 else 1
    offset = get_offset(offset)

    # Calculate Result
    if strictly:
        increasing = all(i < j for i, j in zip(close[-length:], close[1:]))
    else:
        increasing = close.diff(length) > 0
    
    if asint:
        increasing = increasing.astype(int)

Can you help me to how to execute the test which I found in test_indicator_trend.py file

@twopirllc
Copy link
Owner

@RajeshDhalange

Code looks good.

To run the test:

$ python -m unittest -v tests/test_indicator_trend.py

If not sure or how to do the test stuff, I can take care of that.

Thanks,
KJ

@RajeshDhalange
Copy link
Author

Submitted pull request
Thanks for encouraging

Thanks

Rajesh

@twopirllc twopirllc linked a pull request Nov 19, 2020 that will close this issue
@twopirllc
Copy link
Owner

No worries. Thanks for contributing.

Regards,
KJ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants