Forum Academy Marketplace Showcase Pricing Features

API Connector - separate API result data

Hello :slight_smile:

Im trying out bubble at the moment and am therefore trying to build a small crypto portfolio tracker.

At the moment im trying to integrate the Coingecko API to get some data about the market, and thus far im getting the prices of a lot coins without problems. Now i wanted to get the prices of the last 7 days of each coin, saved in this datastructure:

image

Where i want “asset” to point to the corresponding cryptocurrency (e.g. Cardano) and price/timestamps to be two lists where e.g. the 5th element in “price” is the price that Cardano had on the 5th timestamp. (i thought this might be a good way to save this information?).

The API call and result looks like this (screenshot from coingecko’s doc):

and i also get this result in bubble as you can see here:

As you can see in the result each entry represents 2 values, the timestamp (UNIX) and the price. I would like to get each of them in their own list, but cant get that to work as i only have this option:

and therefore end up with values like:
1629716422223, 2.8117550861033367
1629720072520, 2.8261194230304287

tldr
What i get:

What i want:

Is there an easier way than copying all the data in a buffer list and when that is done copying every 2nd item into their real list? Is there a way to extract the data directly into their own column?

Greetings :slight_smile:

No, that is not a good way, and is the

Create a new datatype called PriceTime (or whatever) and have two fields

Price
Date

Then have a list of PriceTime on your assetPriceHistory.

You then save the JSON list in this. You don’t need to mess about with “item 7 in this list matches with item 7 in the other”.

HTH

Thank you for your feedback, i will definitely try this out!

So, for my undertanding:

I created this datatype

image

which represents the price on a specific timestamp. Now each asset gets a list of this datatype, like this (some other fields are still missing):

image

But how do i get the data

“prices”: [
[
1629795623181,
2.9089070139622364
],

in it now, as i dont have access to each value (timestamp & price) individually but only a string " 1629795623181, 2.9089070139622364". How would i split that one up from the api call to get the data into each field?

Thank you for your help!
Greetings