How improve performance in the calculation of a portfolio data

Hi guys,

I am currently calculating the portfolio of an address this way:

First I get all the tokens with balance from a particular wallet.

Once I have the list of token addresses, I get all the trades in the last 6 month for those tokens. This queries take usually more than 15 seconds for just one wallet and array of tokens. I need some help to improve the performance of that.

Finally I get init token balance, current price and price in the last 24 hours.

What can I do to improve or even aggregate these queries in one or two, in order to get a better performance?

Thank you,

Okay, if you are querying data which is not realtime, use "dataset": "archive" , it speeds up the query. combined is costlier and takes time since it queries both realtime & archive

Let me check and come back on other optimizations.

I tried with archive and took more time, 39 seconds D:

took 25 secs for me. archive is faster than combined in general.