Exchange Rate

crypto/exchange-rate@1.0.1
Supported by 1 provider
B

Get Exchange Rate

Get exchange rate between two currencies

Input
From
To
Result
Rate

1.Choose a provider

2.Use GetExchangeRate with mock in your code

npm i @superfaceai/one-sdk
const { SuperfaceClient } = require('@superfaceai/one-sdk');

const sdk = new SuperfaceClient();

async function run() {
  // Load the profile
  const profile = await sdk.getProfile('crypto/exchange-rate@1.0.1');

  // Use the profile
  const result = await profile
    .getUseCase('GetExchangeRate')
    .perform({
      from: '',
      to: ''
    }, {
      provider: 'mock'
    });

  // Handle the result
  try {
    const data = result.unwrap();
    console.log(data);
  } catch (error) {
    console.error(error);
  }
}

run();

Structure details

Input (object)

from
Code of the source currency, e.g.: "ETH"
to
Code of the target currency, e.g.: "BTC"

Example

{
  "from": "",
  "to": ""
}

Result (object)

rate
Exchange rate, e.g.: "0.06249100"

Example

{
  "rate": ""
}

Implementation details

Provider
mock
Use case
GetExchangeRate
Author
@superface
Source
Verified