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
TODO
[ ] uses custom polars utility functions to help convert from graphql response to polars dataframe. This is currently done, but need to work out importing functions from polars_utils.py
Related to this issue - https://github.com/0xPlaygrounds/subgrounds/issues/29
Features
TODO
polars_utils.py