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

Higher order differences for diff function #350

Merged
merged 9 commits into from
Dec 17, 2017

Conversation

iht
Copy link
Contributor

@iht iht commented Dec 15, 2017

This pull request adds a new parameter differences to the diff function, to calculate higher order differences. The default value is 1, so this change is backwards compatible.

You can calculate higher order differences by using the keyword
parameter `differences`, accepting a positive integer. The default
value is `differences=1`. For instance, passing `differences=2` is
equivalent to doing `diff(diff(cl)`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:trollface:

julia> diff(diff(cl)
                                                                        
ERROR: syntax: incomplete: premature end of input

test/apply.jl Outdated
@test diff(diff(diff(op))).timestamp == diff(op, padding=false, differences=3).timestamp
@test diff(diff(diff(op))).values == diff(op, padding=false, differences=3).values
@test diff(op, padding=true, differences=3).values[4] == diff(op, differences=3).values[1]
end
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add some test cases for multi-column TimeArray ohlc?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I will push a new commit with more tests.

@JuliaStats JuliaStats deleted a comment from coveralls Dec 15, 2017

```@repl diff
diff(cl)
```
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, this rendering failed. you have to add using statement. it's a restriction of Documenter :(

using TimeSeries
using MarketData

@coveralls
Copy link

Coverage Status

Coverage increased (+0.03%) to 85.957% when pulling 15930d1 on iht:diff_higher_order into d3081c7 on JuliaStats:master.

@JuliaStats JuliaStats deleted a comment from coveralls Dec 15, 2017
@coveralls
Copy link

Coverage Status

Coverage increased (+0.03%) to 85.957% when pulling 350bdfe on iht:diff_higher_order into d3081c7 on JuliaStats:master.

@iblislin iblislin added this to the 0.12.0 milestone Dec 15, 2017
@iblislin iblislin merged commit 761d19a into JuliaStats:master Dec 17, 2017
@iblislin
Copy link
Collaborator

Thanks for your contribution!

@iht iht deleted the diff_higher_order branch December 18, 2017 16:01
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.

3 participants