Coder Social home page Coder Social logo

coinapi-cl-ea's Introduction

CoinAPI.io Python 3.x External Adapter for Chainlink

Adapter Formats: Google Cloud Function, AWS Lambda and Docker

Supported Endpoints: exchanges, assets, symbols, exchangerate, ohlcv, trades, quotes

Unsupported Endpoints: subscriptions

API Mapping: A path parameter has been introduced to specify historical/current/latest/ for certain endpoints

Cloud Installation:

Make the bash script executable

chmod +x ./create_zip.bsh

Create the adapter zip for your cloud provider ( gcs or aws )

./create_zip.bsh aws

Upload the created zip to your provider and set the appropriate handler ( gcs_handler or aws_handler ) to be triggered by a HTTP event.

Create an API_KEY environment variable and set it to your CoinAPI.io api key

Docker Installation:

Build the image

docker build -t coinapi-cl-ea .

Run the container while passing in your API_KEY

docker run -e API_KEY=XXXXXXXX-XXXX-XXX-XXXX-XXXXXXXXXXX -p 5000:5000 coinapi-cl-ea

The adapter endpoint will be accessable from http://localhost/:5000/coinapi-cl-ea

Sample Job Spec

Chainlink normalises all api parameters to camelcase ( eg assetIdBase will map to asset_id_base in the actual api query)

{
  "initiators": [
    {
      "type": "web",
      "params": {
      }
    }
  ],
  "tasks": [
    {
      "type": "coinapi-cl-ea-docker",
      "confirmations": 0,
      "params": {
        "endpoint": "exchangerate",
        "assetIdBase": "BTC",
        "assetIdQuote": "USD"
      }
    }
  ],
  "startAt": null,
  "endAt": null

Sample Job Spec Result

{
  "id": "ceda5ccb18ee4effacacff3a451cfdd3",
  "jobId": "c0b6ebcf849b4ca7b7e14c3cc682bf27",
  "result": {
    "jobRunId": "ceda5ccb18ee4effacacff3a451cfdd3",
    "data": {
      "assetIdBase": "BTC",
      "assetIdQuote": "USD",
      "endpoint": "exchangerate",
      "rate": 3440.9833656611113,
      "time": "2018-12-10T21:48:03.9455953Z"
    },
    "status": "completed",
    "error": null
  },
  "status": "completed",
  "taskRuns": [
    {
      "id": "33ac1506792640579034f6d770b89221",
      "result": {
        "jobRunId": "ceda5ccb18ee4effacacff3a451cfdd3",
        "data": {
          "assetIdBase": "BTC",
          "assetIdQuote": "USD",
          "endpoint": "exchangerate",
          "rate": 3440.9833656611113,
          "time": "2018-12-10T21:48:03.9455953Z"
        },
        "status": "completed",
        "error": null
      },
      "status": "completed",
      "task": {
        "type": "coinapi-cl-ea-docker",
        "confirmations": 0,
        "params": {
          "assetIdBase": "BTC",
          "assetIdQuote": "USD",
          "endpoint": "exchangerate"
        }
      },
      "minimumConfirmations": 0
    }
  ],
  "createdAt": "2018-12-10T21:48:03.822052017Z",
  "completedAt": "2018-12-10T21:48:03.97080798Z",
  "creationHeight": null,
  "observedHeight": null,
  "overrides": {
    "jobRunId": "",
    "data": {
    },
    "status": "",
    "error": null
  },
  "initiator": {
    "type": "web",
    "params": {

Other Examples

test_data.json contains example payloads for all supported endpoints, paths and their parameters.

Full documentation for CoinAPI.io API can be found here

coinapi-cl-ea's People

Contributors

stepsal avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.