fractal.loaders.thegraph package

Subpackages

Submodules

fractal.loaders.thegraph.base_graph_loader module

class fractal.loaders.thegraph.base_graph_loader.ArbitrumGraphLoader(api_key: str, subgraph_id: str, loader_type: LoaderType)[source]

Bases: BaseGraphLoader

Graph Loader with arbitrum gateway

ROOT_URL = 'https://gateway-arbitrum.network.thegraph.com/api'
loader_type: LoaderType
class fractal.loaders.thegraph.base_graph_loader.BaseGraphLoader(root_url: str, api_key: str, subgraph_id: str, loader_type: LoaderType)[source]

Bases: Loader

Base class for The Graph loaders.

Each graph loader should inherit from this class. It should have the following attributes: - subgraph_id: The ID of the subgraph - root_url: The root URL of the graph - api_key: The API key to access

_make_request()[source]

Make a request to the graph with a given query

exception fractal.loaders.thegraph.base_graph_loader.GraphLoaderException[source]

Bases: Exception

fractal.loaders.thegraph.lido module

class fractal.loaders.thegraph.lido.StETHLoader(api_key: str, loader_type: LoaderType)[source]

Bases: ArbitrumGraphLoader

StETH (Lido) Loader. https://thegraph.com/explorer/subgraphs/Sxx812XgeKyzQPaBpR5YZWmGV5fZuBaPdh7DFhzSwiQ?view=Query&chain=arbitrum-one

SUBGRAPH_ID: Sxx812XgeKyzQPaBpR5YZWmGV5fZuBaPdh7DFhzSwiQ

SUBGRAPH_ID = 'Sxx812XgeKyzQPaBpR5YZWmGV5fZuBaPdh7DFhzSwiQ'
extract()[source]
load()[source]
loader_type: LoaderType
read(with_run: bool = False) RateHistory[source]
transform()[source]

Module contents

class fractal.loaders.thegraph.ArbitrumGraphLoader(api_key: str, subgraph_id: str, loader_type: LoaderType)[source]

Bases: BaseGraphLoader

Graph Loader with arbitrum gateway

ROOT_URL = 'https://gateway-arbitrum.network.thegraph.com/api'
loader_type: LoaderType
class fractal.loaders.thegraph.ArbitrumUniswapV3Loader(api_key: str, loader_type: LoaderType)[source]

Bases: ArbitrumGraphLoader

Loader for Uniswap V3 Arbitrum. The Graph: https://thegraph.com/explorer/subgraphs/FQ6JYszEKApsBpAmiHesRsd9Ygc6mzmpNRANeVQFYoVX?view=Query&chain=arbitrum-one SUBGRAPH_ID = “FQ6JYszEKApsBpAmiHesRsd9Ygc6mzmpNRANeVQFYoVX”

SUBGRAPH_ID = 'FQ6JYszEKApsBpAmiHesRsd9Ygc6mzmpNRANeVQFYoVX'
get_pool_decimals(address: str) Tuple[int, int][source]

Get pool input tokens decimals

Parameters:

address (str) – Pool address

Returns:

Decimals of input tokens (token0, token1)

Return type:

Tuple[int, int]

class fractal.loaders.thegraph.BaseGraphLoader(root_url: str, api_key: str, subgraph_id: str, loader_type: LoaderType)[source]

Bases: Loader

Base class for The Graph loaders.

Each graph loader should inherit from this class. It should have the following attributes: - subgraph_id: The ID of the subgraph - root_url: The root URL of the graph - api_key: The API key to access

_make_request()[source]

Make a request to the graph with a given query

class fractal.loaders.thegraph.EthereumUniswapV2Loader(api_key: str, loader_type: LoaderType)[source]

Bases: ArbitrumGraphLoader

Loader for Uniswap V2 Ethereum. The Graph: https://thegraph.com/explorer/subgraphs/EYCKATKGBKLWvSfwvBjzfCBmGwYNdVkduYXVivCsLRFu?view=Query&chain=arbitrum-one SUBGRAPH_ID = “EYCKATKGBKLWvSfwvBjzfCBmGwYNdVkduYXVivCsLRFu”

SUBGRAPH_ID = 'EYCKATKGBKLWvSfwvBjzfCBmGwYNdVkduYXVivCsLRFu'
class fractal.loaders.thegraph.EthereumUniswapV2PoolDataLoader(api_key: str, pool: str, fee_tier: float, loader_type: LoaderType)[source]

Bases: EthereumUniswapV2Loader

Loader for Uniswap V2 PoolData

extract()[source]
load()[source]
read(with_run: bool = False) PoolHistory[source]
transform()[source]
class fractal.loaders.thegraph.EthereumUniswapV3Loader(api_key: str, loader_type: LoaderType)[source]

Bases: ArbitrumGraphLoader

Loader for Uniswap V3 Ethereum. The Graph: https://thegraph.com/explorer/subgraphs/5zvR82QoaXYFyDEKLZ9t6v9adgnptxYpKpSbxtgVENFV?view=Query&chain=arbitrum-one SUBGRAPH_ID = “5zvR82QoaXYFyDEKLZ9t6v9adgnptxYpKpSbxtgVENFV”

SUBGRAPH_ID = '5zvR82QoaXYFyDEKLZ9t6v9adgnptxYpKpSbxtgVENFV'
exception fractal.loaders.thegraph.GraphLoaderException[source]

Bases: Exception

class fractal.loaders.thegraph.StETHLoader(api_key: str, loader_type: LoaderType)[source]

Bases: ArbitrumGraphLoader

StETH (Lido) Loader. https://thegraph.com/explorer/subgraphs/Sxx812XgeKyzQPaBpR5YZWmGV5fZuBaPdh7DFhzSwiQ?view=Query&chain=arbitrum-one

SUBGRAPH_ID: Sxx812XgeKyzQPaBpR5YZWmGV5fZuBaPdh7DFhzSwiQ

SUBGRAPH_ID = 'Sxx812XgeKyzQPaBpR5YZWmGV5fZuBaPdh7DFhzSwiQ'
extract()[source]
load()[source]
loader_type: LoaderType
read(with_run: bool = False) RateHistory[source]
transform()[source]
class fractal.loaders.thegraph.UniswapV3ArbitrumPoolDayDataLoader(api_key: str, pool: str, loader_type: LoaderType)[source]

Bases: ArbitrumUniswapV3Loader

extract()[source]
load()[source]
read(with_run: bool = False) PoolHistory[source]
transform()[source]
class fractal.loaders.thegraph.UniswapV3ArbitrumPoolHourDataLoader(api_key: str, pool: str, loader_type: LoaderType)[source]

Bases: UniswapV3ArbitrumPoolDayDataLoader

transform()[source]
class fractal.loaders.thegraph.UniswapV3ArbitrumPricesLoader(api_key: str, pool: str, loader_type: LoaderType, **kwargs)[source]

Bases: ArbitrumUniswapV3Loader

extract()[source]
load()[source]
read(with_run: bool = False) PriceHistory[source]
transform()[source]
class fractal.loaders.thegraph.UniswapV3EthereumPoolDayDataLoader(api_key: str, pool: str, loader_type: LoaderType)[source]

Bases: EthereumUniswapV3Loader

extract()[source]
load()[source]
read(with_run: bool = False) PoolHistory[source]
transform()[source]
class fractal.loaders.thegraph.UniswapV3EthereumPoolHourDataLoader(api_key: str, pool: str, loader_type: LoaderType)[source]

Bases: UniswapV3EthereumPoolDayDataLoader

transform()[source]