Giter Site home page Giter Site logo

elyx0 / btc-kalichkin-nvt-fetcher Goto Github PK

View Code? Open in Web Editor NEW
2.0 0.0 0.0 9.15 MB

Fetches the current network value to transactions (NVT) of the BTC market using character recognition on a canvas element

Dockerfile 7.66% TypeScript 92.34%
typescript pupeteer ocr-recognition chrome-headless btc nvt sqlite3 nodejs

btc-kalichkin-nvt-fetcher's Introduction

GitHub license

Simple Kalichkin NVT Fetcher for BTC market

The Network Value to Transactions (NVT) ratio measures the dollar value of cryptoasset transaction activity relative to network value. This is a simple way to compare how the market prices one unit of on-chain transactions across different networks.

Generally speaking, a โ€œlowโ€ market to transaction value denotes an asset which is more cheaply valued per unit of on-chain transaction volume.

Network value consists of the total market value of all tokens in circulation. The transaction element is an estimate of the value of on-chain transaction activity drawn from block explorers and blockchains.


How does it work

The code is build with Typescript

  • It fetches the queries from sqlite3 database

  • conditions

  • It uses chrome headless with puppeteer to grab the canvas rendered screenshot at the last interval

  • conditions

  • enlarges it with sharp then

  • extracts the text from tesseract image recognition models

  • Saves it into history table

  • saved

  • sends the results by email using mailgun


Development

You will need the following env vars or using a .env file:

PORT=8888
MAILGUN_API_KEY=239e8293e72398whateverwhatever
MAILGUN_DOMAIN=sandbox23892y3e82whatever.mailgun.org
[email protected]
  • Edit the seed.ts to your liking

Then after npm install install run once: npm run seed

Locally:

npm install && npm run build && npm run fastLocal

To get the code coverage: npm run coverage

To run the tests in watch mode: npm run watch

Debugging

.vscode launch options are provided for debugging locally

On Docker:

  • Build the image: npm run docker-build
  • Run the image: npm run docker-run

Alternatively: docker-compose up


Ideally run on a daily basis with cron, ex: 2am every day:

0 2 * * * /usr/local/node /your/code/path/build/server.js

Ex on my mac local:

* 2 * * * /usr/local/bin/node /Sites/nvt/build/server.js >> /Sites/nvt/cron.log 2>&1

btc-kalichkin-nvt-fetcher's People

Contributors

elyx0 avatar

Stargazers

 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.