getPriceIn method

double getPriceIn(
  1. String vsCurrency
)

used to obtain price of an instance of this crypto-token object in a currency of choice whose data is available in this instance

currencies available can be checked by calling token.pricesAvailableIn()

invalid {token:currency} combo represented by -1 price value;

Implementation

double getPriceIn(String vsCurrency) {
  if (dataAvailableIn().contains(vsCurrency)) {
    return data[vsCurrency] ?? 0; //fallback
  } else {
    ///data not available for requested currency in this instance
    return -1;
  }
}