Skip to main content

A Pythonic data access layer for applications querying data from The Graph Network.

Project description

Subgrounds

PyPI PyPI - Python Version Code style: black

Discord Twitter Follow

Open Notebook in Binder Github Codepsaces

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 extra modules that may require extra libraries. You can get all functionality of subgrounds via the following:
pip install subgrounds[all].

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 is a data solutions company providing 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

subgrounds-1.5.1.tar.gz (58.2 kB view details)

Uploaded Source

Built Distribution

subgrounds-1.5.1-py3-none-any.whl (66.9 kB view details)

Uploaded Python 3

File details

Details for the file subgrounds-1.5.1.tar.gz.

File metadata

  • Download URL: subgrounds-1.5.1.tar.gz
  • Upload date:
  • Size: 58.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/37.3 requests/2.28.2 requests-toolbelt/0.10.1 urllib3/1.26.14 tqdm/4.64.1 importlib-metadata/6.0.0 keyring/23.13.1 rfc3986/2.0.0 colorama/0.4.6 CPython/3.10.11

File hashes

Hashes for subgrounds-1.5.1.tar.gz
Algorithm Hash digest
SHA256 ddf6f1e69a5b2bd8af8c6139a0018f547e46a9669027780d38ae739efba34796
MD5 c2469e6ecd6859de9ed8ef7e6c81f170
BLAKE2b-256 522d87bb7e58cb72bcc1dd38c462549b485debc2b8d812631255e2e55b060d8e

See more details on using hashes here.

File details

Details for the file subgrounds-1.5.1-py3-none-any.whl.

File metadata

  • Download URL: subgrounds-1.5.1-py3-none-any.whl
  • Upload date:
  • Size: 66.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/37.3 requests/2.28.2 requests-toolbelt/0.10.1 urllib3/1.26.14 tqdm/4.64.1 importlib-metadata/6.0.0 keyring/23.13.1 rfc3986/2.0.0 colorama/0.4.6 CPython/3.10.11

File hashes

Hashes for subgrounds-1.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 60aeb08970257f4b169a2b885d0d20eba0ade08cb16b59c31643339089b88d52
MD5 938dfdc22b0facd17e6eddd856f30196
BLAKE2b-256 7eeb8231e95053ea27829bc3d84b9a5a13c9e5a5c0ecd61ed760143e0565d509

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page