zeitgeistpm / zeitgeist-subsquid

Zeitgeist chain block indexer and processor that provides data sets for powerful GraphQL queries.
7 stars 4 forks source link

Add historical prices for `ZTG/USD`, `ZTG/EUR`, `DOT/USD`, `DOT/EUR` (later `USDC/USD`, `USDC/EUR`) for a capital gain export #492

Open Chralt98 opened 9 months ago

Chralt98 commented 9 months ago

I realised that the following query only returns the most recent price of today:

query MyQuery {
  assetPrice(base: ZTG, target: USD) {
    price
    timestamp
    pair
  }
}

Additionally I noticed there exists the priceHistory query, but this only accounts for the historical prices of outcome assets denominated in the base asset of the market.

priceHistory(marketId: 10) {
  timestamp
  prices {
    assetId
    price
  }
}

I desired to see the price history of all market base assets in USD and EUR. In example: ZTG/USD, ZTG/EUR, DOT/USD, DOT/EUR for now, since there are no other base assets used right now. I would also need the same output for added base assets later on e. g. USDC.

It would be mandatory for users in the European Union to add the price history of the base asset for markets in EUR. This would allow a capital gain export for EU citizens. Since the European Union is positively regulated and doesn't forbid transactions using ZeitgeistPM explicitly like the USA, it would increase the ease of use for EU-citizens, because I could automatically generate an export in the EUR currency (which is required to specify the total EUR amount of unspecified asset prices for the outcome tokens).

Chralt98 commented 8 months ago

Added to high priority, because hutch also wanted to see a ZTG/USD historical chart on our main-app on a separate statistics page.