-
Notifications
You must be signed in to change notification settings - Fork 69
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
Conversation
docs/src/apply.md
Outdated
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)`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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.
docs/src/apply.md
Outdated
|
||
```@repl diff | ||
diff(cl) | ||
``` |
There was a problem hiding this comment.
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
Thanks for your contribution! |
This pull request adds a new parameter
differences
to thediff
function, to calculate higher order differences. The default value is1
, so this change is backwards compatible.