We want to show time-based data in our UI. The time-based data would be updated at fixed intervals, e.g., every 10 minutes to be the basis for graphs like this one:
We could store a mapping of exchange rates for the tokens we are interested in a separate table and query this periodically, e.g., every 10 minutes.
We could then map the current portfolios, volumes, ... (stored only as native tokens with an tillTimestamp) to the exchange rates to store them in a mapping that gives us a time-based view on the portfolio, volumes, ...
Consideration
Ideally, the time-based query does not run inside the squid processor to prevent slowing down block processing
We use squid to create the mapping/tables to be able to serve the data via the same graphql endpoint
Questions
Can we implement this as an extra worker/thread/... in squid?
What we want
We want to show time-based data in our UI. The time-based data would be updated at fixed intervals, e.g., every 10 minutes to be the basis for graphs like this one:
Desired example query:
Desired example return:
What we have
Squid is able to easily store the amounts of tokens in a pool (or the tokens a user owns) with a timestamp on when the amounts where updated, see e.g., here: https://github.com/interlay/interbtc-squid/blob/master/src/model/generated/cumulativeDexTradingVolumePerPool.model.ts#L24
Investigation
Possible approach
tillTimestamp
) to the exchange rates to store them in a mapping that gives us a time-based view on the portfolio, volumes, ...Consideration
Questions