subgrounds
subgrounds copied to clipboard
feat: custom subgrounds client for polars
Related to this issue, #29
from polars_client import SubgroundsPolars
from subgrounds.subgraph import FieldPath, Subgraph
# from polars_utils.py import *
import polars as pl
sg = SubgroundsPolars()
snx_endpoint = "https://api.thegraph.com/subgraphs/name/synthetix-perps/perps"
snx = sg.load_subgraph(
url=snx_endpoint,
)
trades_json = sg.query_json(
[
# set the first parameter to a larger size to query more rows.
snx.Query.futuresTrades(
first=2500,
orderBy="timestamp",
orderDirection="desc",
# where=[{"timestamp_lte": "1694131200"}], # 1694131200 = 9/8/23
)
]
)
Features
- create a custom subgrounds client to support polars dataframes
Originally #43