Coder Social home page Coder Social logo

crypto-scraper's Introduction

Crypto Scraper

A tool to periodically scrape your crypto currency rates.

Setup

You have to configure some environment variables before deploying this project.

In a .env file put these variables:

COINLAYER_ENDPOINT= coinlayer api link
COINLAYER_ACCESS_KEY= your secret access key
SCRAP_DELAY= delay in minute

Deploy

You can deploy this project on AWS with the serverless framework

serverless deploy --stage anyStageName

If you are using AWS vault:

aws-vault exec account -- serverless deploy --stage anyStageName

Usage

There are 4 different routes in the API:

POST /tokens

Takes token names in body

Input

Example of body:

{
    "tokens": ["BTC", "LTC", "ETH"]
}

Response

On success

{
    "message": "Tokens successfully added"
}

GET /tokens

Get all tokens and their last values

Response

Example of response

{
  "tokens": [
    {
      "evolutionRate": -0.05086613401331756,
      "tokenId": "LTC",
      "exchangeRate": 55.3014,
      "timestamp": "1664923686"
    },
    {
      "evolutionRate": 0.049762546777313656,
      "tokenId": "ETH",
      "exchangeRate": 1357.34,
      "timestamp": "1664923686"
    },
    {
      "evolutionRate": 0.026646140005250903,
      "tokenId": "BTC",
      "exchangeRate": 20209.067784,
      "timestamp": "1664923686"
    }
  ]
}

GET /tokens/{id}

Get a specific token and get all its value history

Input

limit can be set as an optional query parameter to limit history size

Response

Example of response

{
    "tokenHistory": [
        {
            "evolutionRate": 0.026646140005250903,
            "tokenId": "BTC",
            "exchangeRate": 20209.067784,
            "timestamp": "1664923686"
        },
        {
            "evolutionRate": 1,
            "tokenId": "BTC",
            "exchangeRate": 20203.684282,
            "timestamp": "1664923162016"
        }
    ]
}

DELETE /tokens/{id}

Delete a specific token

Response

On success

{
    "message": "Token successfully deleted"
}

crypto-scraper's People

Contributors

thyodas avatar

Watchers

 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.