Comment

Comment by TheTank

There isn't any library for the trading UI or graphics elements. The only library in this case was the display graphics library which allows to draw simple primitives such as squares, lines, circles, text, etc. [1]

The UI is a bunch of elements you would see on various trading systems (orderbook, trade blotter, market depth chart, intraday rolling chart, scrolling news ticker etc). But they had to be implemented from scratch using these primitive shapes and coordinates on screen.

For example, the chart element is rendered by looping over the recent prices, calculating the min/max values to derive a range and adding a buffer on either side. Then calculating the price interval of each pixel (difference min-max divided by the number of pixels of my chart area). I then iterate over the prices, calculate their positions on the display in pixels, and draw series of lines between consecutive prices.

[1] https://github.com/pimoroni/pimoroni-pico/blob/main/micropyt...

parent TheTank 2 years ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton