Skip to content

Latest commit

 

History

History
111 lines (93 loc) · 6.27 KB

File metadata and controls

111 lines (93 loc) · 6.27 KB

Chainlink Token Allocation Price Adapter

This adapter accepts a list of currencies and quantities, and returns the total value in the chosen quote currency (defaulting to USD).

Configuration

The adapter takes the following environment variables:

To be functional at least one of the following underyling adapter locations will need to be provided.

Required? Name Description Options Defaults to
AMBERDATA_ADAPTER_URL The location of an Amberdata external adapter
BLOCKSIZE_CAPITAL_ADAPTER_URL The location of a BlocksizeCapital external adapter
CFBENCHMARKS_ADAPTER_URL The location of a CFBenchmarks external adapter
COINAPI_ADAPTER_URL The location of a CoinAPI external adapter
COINGECKO_ADAPTER_URL The location of a CoinGecko external adapter
COINMARKETCAP_ADAPTER_URL The location of a CoinMarketCap external adapter
COINMETRICS_ADAPTER_URL The location of a CoinMetrics external adapter
COINPAPRIKA_ADAPTER_URL The location of a CoinPaprika external adapter
COINRANKING_ADAPTER_URL The location of a CoinRanking external adapter
CRYPTOCOMPARE_ADAPTER_URL The location of a CryptoCompare external adapter
FINAGE_ADAPTER_URL The location of a Finage external adapter
KAIKO_ADAPTER_URL The location of a Kaiko external adapter
NCFX_ADAPTER_URL The location of a NCFX external adapter
TIINGO_ADAPTER_URL The location of a Tiingo external adapter

Optionally the default behavior of the composite adapter can be configured

Required? Name Description Options Defaults to
DEFAULT_QUOTE Currency that the price will be fetched by default. USD
DEFAULT_METHOD Method that will be used by default price, marketCap price
DEFAULT_SOURCE The default source to be used if not specified in request

Running

See the Composite Adapter README for more information on how to get started.

Input Params

Required? Name Description Options Defaults to
source The data provider to query data from. This is required if not specified in config. amberdata, blocksize_capital, cfbenchmarks, coinapi, coingecko, coinmarketcap, coinmetrics, coinpaprika, coinranking, cryptocompare, finage, kaiko, ncfx, tiingo
quote Currency we want the price on. The DEFAULT_QUOTE environment variable
method Method we want the total value calculation be based on. price, marketCap The DEFAULT_METHOD environment variable
allocations Array of allocations (see below)

Allocation Params

Parameters for each allocation in the allocations array

Required Name Description Default
symbol Token symbol
balance Token balance 1e18
decimals Token decimals 18

Sample Input

{
  "jobID": "1",
  "data": {
    "source": "coingecko",
    "allocations": [
      {
        "symbol": "wBTC",
        "balance": 100000000,
        "decimals": 8
      },
      {
        "symbol": "DAI",
        "balance": "1000000000000000000"
      }
    ],
    "quote": "USD",
    "method": "price"
  }
}

Sample Output

{
  "jobRunID": "1",
  "data": {
    "sources": [],
    "payload": {
      "WBTC": {
        "quote": {
          "USD": {
            "price": "34148.75913338036"
          }
        }
      },
      "DAI": {
        "quote": {
          "USD": {
            "price": "1.000837177435277"
          }
        }
      }
    },
    "result": 34149.759970557796
  },
  "result": 34149.759970557796,
  "statusCode": 200
}