pikers / piker

(e2e) foss trading for non-tinas
GNU Affero General Public License v3.0
103 stars 17 forks source link

Try `m4` algo for OHLC flattened line tracer? #324

Open goodboy opened 2 years ago

goodboy commented 2 years ago

Currently our OHLC sampling (bars) graphics convert to a line curve when the user zooms out enough that you can't visually distinguish a bar's shape (uppx is way too high to represent them per horizonal pixel).

To convert to this line we currently use a structured array flattener routine which uses np.recfunctions.structure_to_unstructured(): ohlc_to_line().

In theory we can actually just use our m4 implementation to post-process either this flattened output or write an OHLC aware version which iterates the ['high', 'low'] fields of the input array when computing max/min values. In other words the y input could be pre-processed from another (numba) routine which flattens only the high/low values from the OHLC struct array and then feeds them into this same function. The caveat will be making sure the x input is sized to match 🤔

This is definitely not a high priority task but may be interesting to tinker with especially in the context of overloading ds_m4() for other types of aggregation schemes (eg. as we still need with vlm in #326).

goodboy commented 1 year ago

As follow up after the huge rework in #420 and it's derivative child PRs (ending in https://github.com/pikers/piker/pull/455), the 2 main spots that pertain to this are: