Skip to content

Latest commit

 

History

History
213 lines (178 loc) · 4.96 KB

File metadata and controls

213 lines (178 loc) · 4.96 KB

Chainlink External Adapter for MetalsAPI

Version: 1.6.25

This document was generated automatically. Please see README Generator for more info.

Environment Variables

Required? Name Description Type Options Default
API_KEY string
API_ENDPOINT string https://some_endpoint.com

Input Parameters

Required? Name Description Type Options Default
endpoint The endpoint to use string convert, forex, latest forex

Convert Endpoint

Supported names for this endpoint are: convert, forex.

Input Params

Required? Name Aliases Description Type Options Default Depends On Not Valid With
base coin, from The symbol of the currency to query
quote market, to The symbol of the currency to convert to
amount The amount of the base currency number 1

Example

Request:

{
  "id": "1",
  "data": {
    "endpoint": "convert",
    "base": "XAU",
    "quote": "USD",
    "amount": 1
  },
  "rateLimitMaxAge": 58823529
}

Response:

{
  "jobRunID": "1",
  "data": {
    "success": true,
    "query": {
      "from": "XAU",
      "to": "USD",
      "amount": 1
    },
    "info": {
      "timestamp": 1637949420,
      "rate": 1785.0181286441143
    },
    "historical": false,
    "date": "2021-11-26",
    "result": 1785.0181286441143,
    "unit": "per ounce"
  },
  "result": 1785.0181286441143,
  "statusCode": 200,
  "providerStatusCode": 200
}

Latest Endpoint

Returns a batched price comparison from one currency to a list of other currencies.

latest is the only supported name for this endpoint.

Input Params

Required? Name Aliases Description Type Options Default Depends On Not Valid With
base coin, from The symbol of the currency to query string
quote market, to The symbol of the currency to convert to

Example

Request:

{
  "id": "1",
  "data": {
    "endpoint": "latest",
    "base": "XAU",
    "quote": "USD"
  },
  "rateLimitMaxAge": 117647058
}

Response:

{
  "jobRunID": "1",
  "data": {
    "success": true,
    "timestamp": 1641990900,
    "date": "2022-01-12",
    "base": "XAU",
    "rates": {
      "USD": 1817.0552439305814
    },
    "unit": "per ounce",
    "result": 1817.0552439305814
  },
  "result": 1817.0552439305814,
  "statusCode": 200,
  "debug": {
    "batchablePropertyPath": [
      {
        "name": "quote"
      }
    ]
  },
  "providerStatusCode": 200
}
Additional Examples

Request:

{
  "id": "1",
  "data": {
    "endpoint": "latest",
    "base": "BTC",
    "quote": ["USD", "XAU"]
  },
  "rateLimitMaxAge": 176470588
}

Response:

{
  "jobRunID": "1",
  "data": {
    "success": true,
    "timestamp": 1641990180,
    "date": "2022-01-12",
    "base": "BTC",
    "rates": {
      "XAU": 0.04228229144046888,
      "USD": 42968.36778447169
    },
    "unit": "per ounce",
    "results": [
      [
        {
          "id": "1",
          "data": {
            "endpoint": "latest",
            "base": "BTC",
            "quote": "USD"
          },
          "rateLimitMaxAge": 176470588
        },
        42968.36778447169
      ],
      [
        {
          "id": "1",
          "data": {
            "endpoint": "latest",
            "base": "BTC",
            "quote": "XAU"
          },
          "rateLimitMaxAge": 176470588
        },
        0.04228229144046888
      ]
    ]
  },
  "statusCode": 200,
  "debug": {
    "batchablePropertyPath": [
      {
        "name": "quote"
      }
    ]
  },
  "providerStatusCode": 200
}