Debug code to view window stats
still no logic to actually use it
Refactor binary search module
Algorithm itself is unchanged:

This refactor of the code does one thing:
Array wrapper to get a per-instance scope
Refactor to use new BinarySearch wrapper & Sanitize prices
The prices sometimes have rounding errors...
... kinda?

Javascript's floating point is only 15 digits!!!

It's more significant digits than needed.
Volume-Weighted Average Price (VWAP) should
only need 8 decimal places, more is just
going to be that much more likely to have
a rounding error or other issue which might
cause unspecified behavior to occur.

Enough for most things, but let's not push it.

Only other changes are a refactor and corected the
few spots where the wrong array was referenced.

oops. really do need to sort the right array

This all works correctly now with good performance:
Last thing to do is actually use the new code...

"moving median" (and various percentiles) will
allow for a good "sanity check" to make sure the
prices are actually good before reinvesting :)
Merge branch 'master' of github.com:kuzetsa/gekko into portfolio.debug