tdex-network / tdex-analytics

Analytics and Historical data feed about TDEX Network
MIT License
0 stars 6 forks source link

reference currency conversion #24

Closed tiero closed 2 years ago

tiero commented 2 years ago

At the moment we not supporting converting to a reference currency (ie. FIAT).

What we should do is mapping market to specific formula with URL

Example:

We have a pair like COIN-USDt, where COIN is any asset that is not "stable" in value against FIAT (like L-BTC) we know that to get the reference price in EUR for each we need

  1. convert base asset to quote asset (using latest price for that market we have locally)
  2. convert quote asset to chosen fiat currency using a dedicated external price feed URL

The conversion is still valid if the quote asset is not a stablecoin, we only need to be sure there is a direct price feed QUOTE > FIAT, if not we can't return reference price conversion (maybe we should return empty?)

tiero commented 2 years ago

Example for L-BTC-USDt