GithubHelp home page GithubHelp logo

isabella232 / openexchangerates-adapter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from smartcontractkit/openexchangerates-adapter

0.0 0.0 0.0 470 KB

License: MIT License

JavaScript 94.19% Dockerfile 5.81%

openexchangerates-adapter's Introduction

Chainlink Open Exchange Rates External Adapter

Input Params

  • base or from: The currency symbol to convert from
  • quote or to: The currency symbol to convert to
  • endpoint: The endpoint to use (default: latest.json)

Output

{
   "jobRunID":"278c97ffadb54a5bbb93cfec5f7b5503",
   "data":{
      "disclaimer":"Usage subject to terms: https://openexchangerates.org/terms",
      "license":"https://openexchangerates.org/license",
      "timestamp":1585137600,
      "base":"XAU",
      "rates":{
         "AED":5922.474149,
         "AFN":123112.658665,
         "ALL":184991.213445,
         "AMD":802709.63406,
         "ANG":2901.530234,
         "AOA":836259.140313,
         "ARS":102667.743512,
         "AUD":2684.710984,
         "AWG":2902.459821,
         "AZN":2745.243241,
         "BAM":2918.095976,
         "BBD":3224.955349,
         "BDT":137506.657469,
         "BGN":2915.13792,
         "BHD":609.982414,
         "BIF":3078234.254974,
         "BMD":1612.477674,
         "BND":2347.128394,
         "BOB":11152.243041,
         "BRL":8224.119148,
         "BSD":1612.477674,
         "BTC":0.24688627452,
         "BTN":123107.944016,
         "BWP":19285.874737,
         "BYN":4213.404703,
         "BZD":3267.298075,
         "CAD":2321.452762,
         "CDF":2770225.961535,
         "CHF":1580.832838,
         "CLF":50.343165,
         "CLP":1365929.838,
         "CNH":11477.390301,
         "CNY":11453.267674,
         "COP":6768118.351572,
         "CRC":934340.922105,
         "CUC":1612.477674,
         "CUP":41521.300116,
         "CVE":165278.961628,
         "CZK":40918.174897,
         "DJF":287101.64993,
         "DKK":11137.552685,
         "DOP":87235.042186,
         "DZD":198370.816262,
         "EGP":25396.845868,
         "ERN":24186.400802,
         "ETB":52760.292787,
         "EUR":1491.584761,
         "FJD":3751.832252,
         "FKP":1356.990415,
         "GBP":1356.990415,
         "GEL":5264.739607,
         "GGP":1356.990415,
         "GHS":9166.541036,
         "GIP":1356.990415,
         "GMD":82042.864074,
         "GNF":15466572.446964,
         "GTQ":12508.171537,
         "GYD":338401.830362,
         "HKD":12502.4584,
         "HNL":40071.351669,
         "HRK":11350.626407,
         "HTG":153222.209937,
         "HUF":528197.225126,
         "IDR":26025389.665116,
         "ILS":5870.547122,
         "IMP":1356.990415,
         "INR":122624.903147,
         "IQD":1935122.585658,
         "IRR":67892808.07551,
         "ISK":226569.216085,
         "JEP":1356.990415,
         "JMD":220066.403249,
         "JOD":1143.24666,
         "JPY":179406.68477233,
         "KES":171406.890411,
         "KGS":127194.818922,
         "KHR":6570287.311425,
         "KMF":736902.378599,
         "KPW":1451229.906977,
         "KRW":1987910.851353,
         "KWD":508.327639,
         "KYD":1350.675225,
         "KZT":726378.20662,
         "LAK":14483061.146746,
         "LBP":2438658.70658,
         "LKR":303199.150179,
         "LRD":318867.497986,
         "LSL":28513.325365,
         "LYD":2326.004598,
         "MAD":15877.701879,
         "MDL":29019.811659,
         "MGA":6067431.268965,
         "MKD":92048.861949,
         "MMK":2274195.899335,
         "MNT":4452579.487301,
         "MOP":12947.386963,
         "MRO":575654.529767,
         "MRU":60161.542033,
         "MUR":63541.803169,
         "MVR":24832.156932,
         "MWK":1192336.768263,
         "MXN":39596.146896,
         "MYR":7076.518708,
         "MZN":107278.139679,
         "NAD":28444.106177,
         "NGN":616782.740714,
         "NIO":55154.501403,
         "NOK":17493.780596,
         "NPR":196976.740973,
         "NZD":2762.440124,
         "OMR":620.410227,
         "PAB":1612.477674,
         "PEN":5727.686985,
         "PGK":5624.491346,
         "PHP":82406.47779,
         "PKR":256839.884691,
         "PLN":6816.099795,
         "PYG":10733809.779324,
         "QAR":5871.031259,
         "RON":7215.999205,
         "RSD":175123.13783,
         "RUB":126877.322068,
         "RWF":1541389.985491,
         "SAR":6056.149293,
         "SBD":13331.95314,
         "SCR":22107.565103,
         "SDG":89170.015395,
         "SEK":16334.98386,
         "SGD":2330.836524,
         "SHP":1356.990415,
         "SLL":12252946.693661,
         "SOS":937737.563228,
         "SRD":12025.858496,
         "SSP":210041.34187,
         "STD":35691821.348843,
         "STN":36925.738744,
         "SVC":14183.071558,
         "SYP":829699.697232,
         "SZL":28514.220513,
         "THB":52873.142944,
         "TJS":16533.882279,
         "TMT":5643.671498,
         "TND":4682.23197,
         "TOP":3862.943661,
         "TRY":10389.766033,
         "TTD":10965.689844,
         "TWD":48794.381475,
         "TZS":3736411.049722,
         "UAH":44970.362629,
         "UGX":6334718.44215,
         "USD":1612.477674,
         "UYU":72252.687943,
         "UZS":15438008.259435,
         "VEF":400680775.481912,
         "VES":113510838.765289,
         "VND":38226386.958602,
         "VUV":195538.132337,
         "WST":4443.651463,
         "XAF":978415.464819,
         "XAG":113.76307129,
         "XAU":1,
         "XCD":4357.801539,
         "XDR":1196.129489,
         "XOF":978415.464819,
         "XPD":0.80909992,
         "XPF":177993.408187,
         "XPT":2.25160695,
         "YER":403603.247384,
         "ZAR":28083.389119,
         "ZMW":28348.013,
         "ZWL":519217.812775
      },
      "result":1612.477674
   },
   "result":1612.477674,
   "statusCode":200
}

Install

yarn

Test

yarn test

Create the zip

zip -r cl-openexchangerates.zip .

Docker

If you wish to use Docker to run the adapter, you can build the image by running the following command:

docker build . -t openexchangerates-adapter

Then run it with:

docker run -p 8080:8080 -e API_KEY='YOUR_API_KEY' -it openexchangerates-adapter:latest

Install to AWS Lambda

  • In Lambda Functions, create function
  • On the Create function page:
    • Give the function a name
    • Use Node.js 12.x for the runtime
    • Choose an existing role or create a new one
    • Click Create Function
  • Under Function code, select "Upload a .zip file" from the Code entry type drop-down
  • Click Upload and select the cl-openexchangerates.zip file
  • Handler should remain index.handler
  • Add the environment variable (repeat for all environment variables):
    • Key: API_KEY
    • Value: Your_API_key
  • Save

Install to GCP

  • In Functions, create a new function, choose to ZIP upload
  • Click Browse and select the cl-openexchangerates.zip file
  • Select a Storage Bucket to keep the zip in
  • Function to execute: gcpservice
  • Click More, Add variable (repeat for all environment variables)
    • NAME: API_KEY
    • VALUE: Your_API_key

openexchangerates-adapter's People

Contributors

thodges-gh avatar boxhock avatar dependabot[bot] 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.