Coder Social home page Coder Social logo

yearn-exporter-api's Introduction

yearn-exporter-api

Light-weight API in front of yearn.vision that makes some data available for external sites.

Usage

Start the API with docker-compose up or docker-compose up -d for detached mode. This will expose it at http://localhost:5000.

Rebuild

Rebuild the docker container with docker build -t ghcr.io/yearn/yearn-exporter-api .

Configuration

You can export the following environment variables if you want to override the defaults:

  • FLASK_RUN_PORT: the listening port for the api, default: 5000
  • BASE_URL: the URL pointing to the grafana instance, default: "https://yearn.vision"

Routes

/tvl

returns the summed TVLs grouped by network and a summed total:

$ curl localhost:5000/tvl
{
  "ts":1642600346,
  "tvl_eth":5101043121.68,
  "tvl_ftm":533590588.63,
  "tvl_total":533590588.63,
  "unit":"USD"
}

/tvl/<network>

returns the tvl for the given network, e.g. for ETH:

$ curl localhost:5000/tvl/eth
{
  "ts":1642600393,
  "tvl_eth":5101041358.88,
  "unit":"USD"
}

supported networks are:

  • ETH
  • FTM
  • OPI
  • ARB

/tvl/total

returns the sum of the TVLs of all networks:

$ curl localhost:5000/tvl/total
{
  "ts":1642600475,
  "tvl_total":534919919.17,
  "unit":"USD"
}

/partners/{query}

returns b2b fee-sharing partners' info

/partners/total

returns the total fees to be paid out to date, measured in USD value from all chains:

$ curl localhost:5000/partners/total
{
  "partners_total": 2601705.85,
  "ts": 1665017101,
  "unit": "USD"
}

/partners/count

returns the number of partners to-date from all chains:

$ curl localhost:5000/partners/count
{
  "partners_count": 22,
  "ts": 1665017986,
  "unit": ""
}

/partners/<partner>/<param>

returns for a specific partner the parameter you specify:

  • parameters are: allowed_params: balance, payout_daily, payout_weekly, payout_monthly, payout_total
  • partners are the names of the b2b partners
$ curl localhost:5000/partners/sturdy/payout_total
 "partners_indiv_sturdy_payout_total": {
   "FTM": {
     "0x0DEC85e74A92c52b7F708c4B10207D9560CEFaf0": {
       "balance": 2238.09,
       "bucket": "Other short term assets",
       "token": "yvWFTM",
       "tvl": 1732.48
     },
     "0x0fBbf9848D969776a5Eb842EdAfAf29ef4467698": {
       "balance": 15.17,
       "bucket": "Other short term assets",
       "token": "yvBOO",
       "tvl": 123.41
     },
     "0x1e2fe8074a5ce1Bb7394856B0C618E75D823B93b": {
       "balance": 1714.68,
       "bucket": "Other short term assets",
       "token": "yvfBEETS",
       "tvl": 389.16
     },
     "0xf2d323621785A066E64282d2B407eAc79cC04966": {
       "balance": 5.92,
       "bucket": "Other short term assets",
       "token": "yvLINK",
       "tvl": 66.84
     }
   }
 },
 "ts": 1671244960,
 "unit": "USD"
}

Optional Query Params

  • ts
curl localhost:5000/tvl?ts=1642664109
{
  "ts":1642664109,
  "tvl_eth":5081490281.98,
  "tvl_ftm":574308185.62,
  "tvl_total":5655798467.6,
  "unit":"USD"
}

set a ts (millis) for retrieving the data at that specific timestamp

yearn-exporter-api's People

Contributors

mariuspod avatar darkghost7 avatar bobthebuidler avatar kyhoon avatar

Stargazers

Roman 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.