GithubHelp home page GithubHelp logo

papasotiriou / subgrounds Goto Github PK

View Code? Open in Web Editor NEW

This project forked from 0xplaygrounds/subgrounds

0.0 0.0 0.0 3.21 MB

A Pythonic data access layer for applications querying data from subgraphs

Home Page: http://docs.playgrounds.network/

License: Apache License 2.0

Shell 0.14% Python 99.86%

subgrounds's Introduction

Subgrounds

PyPI PyPI - Python Version Code style: black

Discord Twitter Follow

An intuitive python library for interfacing with Subgraphs.

Features

  • Simple: Leverage a Pythonic API to easily build queries and transformations without the need for raw GraphQL manipulation.
  • Automated: Automatically handle pagination and schema introspection for effortless data retrieval.
  • Powerful: Create sophisticated queries using the SyntheticFields transformation system.

Resources

Installation

Subgrounds requires atleast Python 3.10+

Subgrounds is available on PyPi. To install it, run the following:
pip install subgrounds.

Subgrounds also comes bundled with some handy dash wrappers. To use those wrappers, you can install the extra dash dependencies.
pip install subgrounds[dash].

Simple example

>>> from subgrounds import Subgrounds

>>> sg = Subgrounds()

>>> # Load
>>> aave_v2 = sg.load_subgraph('https://api.thegraph.com/subgraphs/name/messari/aave-v2-ethereum')

>>> # Construct the query
>>> latest = aave_v2.Query.markets(
  orderBy=aave_v2.Market.totalValueLockedUSD,
  orderDirection='desc',
  first=5,
)

>>> # Return query to a dataframe
>>> sg.query_df([
  latest.name,
  latest.totalValueLockedUSD,
])
                  markets_name  markets_totalValueLockedUSD
0  Aave interest bearing STETH                 1.522178e+09
1   Aave interest bearing WETH                 1.221299e+09
2   Aave interest bearing USDC                 8.140547e+08
3   Aave interest bearing WBTC                 6.615692e+08
4   Aave interest bearing USDT                 3.734017e+08

About Us

Playgrounds Analytics was started by web3 data enthusiasts to build open source tooling for The Graph Network as part of its grants program. Playgrounds Analytics are a data solutions company leveraging The Graph to provide serverless on-chain data infrastructures and services for data teams, analysts, and engineers. Checkout us out here to learn more!

Acknowledgments

This software project would not be possible without the support of The Graph Foundation. You can learn more about The Graph and its mission here.

subgrounds's People

Contributors

cvauclair avatar 0xmochan avatar mateobelanger avatar thierrybleau avatar tachikoma000 avatar actions-user 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.