Skip to content

Latest commit

 

History

History
142 lines (125 loc) · 3.34 KB

README.md

File metadata and controls

142 lines (125 loc) · 3.34 KB

GeckoTerminal

Python wrapper for GeckoTerminal's API. Access DEX data across >100 networks through an easy-to-use library.

Installation

pip3 install geckoterminal

GeckoTerminal Docs

https://www.geckoterminal.com/dex-api

Quick Start

import geckoterminal

Get networks

networks = geckoterminal.get_networks(page=1)

Get prices

Supports up to 30 token addressses.

prices = geckoterminal.get_prices(
    network='eth',
    token_addresses=[
        '0xdac17f958d2ee523a2206206994597c13d831ec7', # USDT
        '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', # USDC
        '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', # WETH
    ]    
)

Get DEXes

dexes = geckoterminal.get_dexes(
    network='eth',
    page=1
)

Get pool

weth_usdc = geckoterminal.get_pool(
    network='eth',
    pool_address='0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640', # WETH/USDC Uniswap v3 0.05%
    include=['base_token', 'quote_token', 'dex']
)

Get pool info

weth_usdc_info = geckoterminal.get_pool_info(
    network='eth',
    pool_address='0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640', # WETH/USDC Uniswap v3 0.05%
)

Get multiple pools

solana_pools = geckoterminal.get_pools(
    network='solana',
    pool_addresses=[
        'FpCMFDFGYotvufJ7HrFHsWEiiQCGbkLCtwHiDnh7o28Q', # SOL/USDC Orca
        '3ne4mWqdYuNiYrYZC9TrA3FcfuFdErghH97vNPbjicr1', # BONK/SOL Orca
        'EP2ib6dYdEeqD8MfE2ezHCxX3kP3K2eLKkirfPm5eyMx', # $WIF/SOL Raydium
    ]
)

Get top pools on a network

polygon_top_pools = geckoterminal.get_top_pools(
    network='polygon_pos',
    include=['base_token', 'quote_token', 'dex'],
    page=1,
)

Get top pools on a DEX by network

blast_thruster_top_pools = geckoterminal.get_top_pools(
    network='blast',
    dex='thruster-v3', # Get id through geckoterminal.get_dexes(),
    include=['base_token', 'quote_token', 'dex']
)

Get new pools

new_pools = geckoterminal.get_new_pools(
    network=None, # If None, returns latest pools from all networks.
    include=['base_token', 'quote_token', 'dex'],
    page=1
)

Search pools

pools_with_cat = geckoterminal.search_pools(
    query='cat',
    network=None, # If None, searches all networks
    include=['base_token', 'quote_token', 'dex'],
    page=1
)

Get token

weth = geckoterminal.get_token(
    network='eth',
    token_address='0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', # WETH
    include=['top_pools']
)

Get trades

weth_usdc_trades = geckoterminal.get_trades(
    network='eth',
    pool_address='0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640', # WETH/USDC Uniswap v3 0.05%
    trade_volume_in_usd_greater_than=10000
)

Get pool OHLCV

Gets OHLCV data up to 6 months ago.

wbtc_weth_ohlcv = geckoterminal.get_pool_ohlcv(
    network='eth',
    pool_address='0xcbcdf9626bc03e24f779434178a73a0b4bad62ed', # WBTC/WETH Uniswap v3
    timeframe='day', # One of day, hour, or minute
    aggregate=1,
    before_timestamp=None, # Unix timestamp in seconds
    limit=100, # Default 100, max is 1000
    currency='usd', # One of usd or token
    token='base', # One of base, quote, or a specific token address
    df=False # Returns a pandas DataFrame if true, raises ValueError if data cannot be converted
)