Skip to main content

PyPi version Downloads Python 3.10 codecov API unittest

GeckoTerminal API

RESTful (sync + async) Python client for GeckoTerminal API

Wrapper around the GeckoTerminal DeFi and DeX aggregator operating across 90+ chains and 500+ dexes. Features both synchronous and asynchronous APIs.

Features:

  • Get the market data (price, volume, historical chart) of any token
  • Find all the pools that are trading a specific token
  • Plot a candlestick chart using OHLCV when given a pool address

The API is currently in beta and is subject to change, please report any issues you find.

Installation

pip install geckoterminal-api

Docs

See the GeckoTerminal API docs for more details.

Usage

Synchronous API

from geckoterminal_api import GeckoTerminalAPI

gt = GeckoTerminalAPI()
# Get a list of supported networks and their IDs
gt.networks()

Asynchronous API

import asyncio
from geckoterminal_api import AsyncGeckoTerminalAPI

agt = AsyncGeckoTerminalAPI()
# Get a list of supported networks and their IDs
asyncio.run(agt.networks())

Examples

Get trades for a specific pool

# Query $ANALOS pool on Solana
>>> trades = gt.network_pool_trades(network="solana", pool="69grLw4PcSypZnn3xpsozCJFT8vs8WA5817VUVnzNGTh")
>>> for trade_data in trades["data"]:
>>>     trade = trade_data["attributes"]
>>>     print(f'{trade["block_timestamp"]} -- {trade["kind"]}: {float(trade["volume_in_usd"]):.2f} USD')

(truncated output)

2023-12-27T08:27:24Z -- buy: 0.06 USD
2023-12-27T08:27:22Z -- buy: 54.73 USD
2023-12-27T08:27:22Z -- sell: 43.11 USD
2023-12-27T08:27:22Z -- sell: 105.08 USD
2023-12-27T08:27:20Z -- sell: 552.80 USD
2023-12-27T08:27:17Z -- buy: 1116.88 USD
2023-12-27T08:27:14Z -- sell: 1110.02 USD
2023-12-27T08:27:12Z -- buy: 52.44 USD
2023-12-27T08:27:02Z -- buy: 41.72 USD
2023-12-27T08:26:59Z -- sell: 15.31 USD

Get pools trending on a network

# Query trending pools on Solana
>>> gt.network_trending_pools(network="solana")

(truncated output)

{
  "id": "solana_EP2ib6dYdEeqD8MfE2ezHCxX3kP3K2eLKkirfPm5eyMx",
  "type": "pool",
  "attributes": {
    "base_token_price_usd": "0.216341",
    "address": "EP2ib6dYdEeqD8MfE2ezHCxX3kP3K2eLKkirfPm5eyMx",
    "name": "$WIF / SOL",
    "fdv_usd": "214518552",
    "market_cap_usd": "201410163.369506",
    "price_change_percentage": {
      "h1": "2.75",
      "h24": "-11.76"
    },
    "transactions": {
      "h1": {
        "buys": 1143,
        "sells": 494,
        "buyers": 282,
        "sellers": 249
      },
      "h24": {
        "buys": 33874,
        "sells": 21413,
        "buyers": 6790,
        "sellers": 5363
      }
    },
    "volume_usd": {
      "h1": "782023.141511",
      "h24": "41413570.131944"
    }
  }
}

Get new pools on a network

# Query new pools on Arbitrum
>>> gt.network_new_pools(network="arbitrum")

(truncated output)

{
  "id": "arbitrum_0x9405117878d3a7ff7968b3d6f322bf428c168ca7",
  "type": "pool",
  "attributes": {
    "base_token_price_usd": "0.000463649357219151",
    "address": "0x9405117878d3a7ff7968b3d6f322bf428c168ca7",
    "name": "JUPITER / WETH",
    "pool_created_at": "2023-12-23T22:19:36Z",
    "fdv_usd": "9736.64",
    "price_change_percentage": {
      "h1": "55.09",
      "h24": "55.09"
    },
    "transactions": {
      "h1": {
        "buys": 24,
        "sells": 4,
        "buyers": 24,
        "sellers": 4
      },
      "h24": {
        "buys": 24,
        "sells": 4,
        "buyers": 24,
        "sellers": 4
      }
    },
    "volume_usd": {
      "h1": "3191.9671827550049",
      "h24": "3191.9671827550049"
    },
    "reserve_in_usd": "14348.4777"
  }
}

and many more...

Proxy support

You can use the proxies parameter to pass a dictionary of proxy URLs to the synchronous API

from geckoterminal_api import GeckoTerminalAPI

proxies = {
    'http': 'http://10.10.10.10:8000',
    'https': 'http://10.10.10.10:8000',
}
gt = GeckoTerminalAPI(proxies=proxies)

For the asynchronous API, you can use the proxy parameter:

from geckoterminal_api import AsyncGeckoTerminalAPI

proxy = "http://proxy.com"
agt = AsyncGeckoTerminalAPI(proxy=proxy)

Disclaimer

This project is for educational purposes only. You should not construe any such information or other material as legal, tax, investment, financial, or other advice. Nothing contained here constitutes a solicitation, recommendation, endorsement, or offer by me or any third party service provider to buy or sell any securities or other financial instruments in this or in any other jurisdiction in which such solicitation or offer would be unlawful under the securities laws of such jurisdiction.

Under no circumstances will I be held responsible or liable in any way for any claims, damages, losses, expenses, costs, or liabilities whatsoever, including, without limitation, any direct or indirect damages for loss of profits.

Release files for geckoterminal-api 0.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for geckoterminal-api 0.9.0
File Size Uploaded
geckoterminal_api-0.9.0.tar.gz 88.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for geckoterminal-api 0.9.0
File Interpreter ABI Platform
geckoterminal_api-0.9.0-py3-none-any.whl Python 3 none any Details

Total release size: 100.4 kB

Release files / geckoterminal_api-0.9.0.tar.gz

Download URL geckoterminal_api-0.9.0.tar.gz
Size 88.1 kB
Tags Source
SHA-256 checksum
How to use checksums
46e927785394bc9b2464312c6bacd9a5a840914be8f2615e1082065d0de92d10
BLAKE2b-256 checksum
How to use checksums
0c1dc5b255571ef76c77baa635382254716ce1b594b84f8a615ba03e3db7d7e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.4.30

Release files / geckoterminal_api-0.9.0-py3-none-any.whl

Download URL geckoterminal_api-0.9.0-py3-none-any.whl
Size 12.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
df1ae713a5fb9095e10cf66cf4cee1621f11d216e667b92308025311fec24e70
BLAKE2b-256 checksum
How to use checksums
a2e6754b36ce598233ad0f4899a981cb4a4a170f039a0c80bb12f593c4c2cefc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.4.30

Release history Release notifications | RSS feed

This release

0.9.0 This release

2 release files

0.8.2

2 release files

0.8.0

2 release files

0.7.6

2 release files

0.7.5

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.2.5

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page