Node-RED select sqlite db and transform the date into an object with arrays

Hi,

To start with, i'm not a pro coder and rather love it to try new things. So some things that i'm saying here could be completly wrong or maybe i'm trying things that are not seen as best practice. :wink:

I'm filling a sqlite DB (called test.db) with some cryptocurrency data:

Now my goal is to export that data from SQLite into a Object with arrays (high, low, close) like seen in this printscreen:
image

I'm using another Node-Red module called "node-red-contrib-talib" to calculate indicators from specific cryptocurrency coins. Node-Red-contrib-talib expects to receive data like the above printscreen.

Anyone here that can help me or can give me some hints how to achieve this?

Thanks!

Is it always 15 values? I assume that is 1 day's worth?

Hi,

not necessary. It depends on which Indicator you want to calculate. But most of the times I need the last 5 a 15 values from each column.

Thanks!

Well, just a guess but I think that I'd probably write 3 SQL queries, 1 for each column then combine the output.

Hi Argon

I did it using a query for each column, second using the node Join I load all them into an array, next I wrote a function to format the array in string with json format and finally I use the node Json to parse it.

Good luck !