tdex-network / tdex-analytics

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

If market with quote asset different than a knonwn asset (ie. does not have coingecko id) will break market prices API #42

Closed tiero closed 2 years ago

tiero commented 2 years ago

REQ

curl --location --request POST 'https://stage-tdex-analytics.xdex.ch/v1/prices' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data-raw '{
  "time_range": {
    "predefined_period": 1
  },
  "market_ids": ["1", "2", "9", "10", "11", "12", "182"],
  "reference_currency": "usd",
  "page": {
    "page_number": 0,
    "page_size": 20
  }
}'

RES

{
  "error": "13 INTERNAL: asset 399c110cfb2ae53e91bacedad366522276ce7be4b3a7e5859f274bf9247d1704 not found"
}

At bare minimum we should check if other asset (ie. base) has a coingecko ID, if yes we use that to calculate the price in fiat.

If not, we should at least not return error and ignore the price FIAT conversion