error in README's running example ???
This is from the README:
Whoa. So the best single-gain day was 2018-02-02: the dow gained 1175.21 points between closing on Feb 1 and Feb 2. But it actually lost ground that day!
But that is not the case
$ cat dji.vnl | vnl-filter -p Date,Close 'Date ~ /2018-02-0[12345]/'
# Date Close
2018-02-05 24345.75
2018-02-02 25520.96
2018-02-01 26186.71
The Dow actually lost 26186.71-25520.96 = 665.75 between closing on Feb 1 and 2. It then lost a further 25520.96-24345.75 = 1175.21 the next trading day.
Don't you need to sort by Date ascending first for diff(Close) to be meaningful?
Or did I misunderstand something?
Oh good. I'm glad SOMEBODY is paying attention :)
Yes. As noted earlier in the README, the data is in reverse order, as you say, so yeah, it should be sorted before the diff:
$ < dji.vnl vnl-sort -k Date | vnl-filter -p '.,d=diff(Close)' | vnl-sort -rgk d | head -n2 | vnl-align
Date Open High Low Close AdjClose Volume d
2018-03-26 23825.74 24232.30 23741.22 24202.60 24202.60 479540000 669.4
I just updated the docs. Also, in this case vnl-sort is overkill; I should make a "vnl-tac" for cases like this.
I updated the docs. Let me know if something still looks wrong. And thank you for finding this.