geckoterminal-api


Namegeckoterminal-api JSON
Version 0.7.6 PyPI version JSON
download
home_pagehttps://github.com/dineshpinto/geckoterminal-api
SummaryRESTful (sync + async) Python client for GeckoTerminal API
upload_time2024-01-12 05:51:38
maintainer
docs_urlNone
authordineshpinto
requires_python>=3.10,<4.0
licenseMIT
keywords geckoterminal coingecko rest api async cryptocurrency bitcoin ethereum solana
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![PyPi version](https://img.shields.io/pypi/v/geckoterminal-api)](https://pypi.python.org/pypi/geckoterminal-api/)
[![Downloads](https://static.pepy.tech/badge/geckoterminal-api)](https://pepy.tech/project/geckoterminal-api)
[![Python 3.10](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/release/python-3100/)
[![codecov](https://codecov.io/gh/dineshpinto/geckoterminal-api/graph/badge.svg?token=JQLPDDAFX0)](https://codecov.io/gh/dineshpinto/geckoterminal-api)
[![API unittest](https://github.com/dineshpinto/geckoterminal-api/actions/workflows/unittests.yml/badge.svg)](https://github.com/dineshpinto/geckoterminal-api/actions/workflows/unittests.yml)

# GeckoTerminal API

## RESTful (sync + async) Python client for GeckoTerminal API

Wrapper around the [GeckoTerminal](https://www.geckoterminal.com) 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

```bash
pip install geckoterminal-api
```

## Docs

See the [GeckoTerminal API docs](https://www.geckoterminal.com/dex-api) for more
details.

## Usage

### Synchronous API

```python
from geckoterminal_api import GeckoTerminalAPI

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

### Asynchronous API

```python
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

```ipython
# 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)

```text
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

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

(truncated output)

```json
{
  "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

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

(truncated output)

```json
{
  "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...

## 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.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/dineshpinto/geckoterminal-api",
    "name": "geckoterminal-api",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10,<4.0",
    "maintainer_email": "",
    "keywords": "geckoterminal,coingecko,rest,api,async,cryptocurrency,bitcoin,ethereum,solana",
    "author": "dineshpinto",
    "author_email": "annual.fallout_0z@icloud.com",
    "download_url": "https://files.pythonhosted.org/packages/38/97/185564a4075eef1b20736e09661aeef5697ab73695bd5fce70070bed75a1/geckoterminal_api-0.7.6.tar.gz",
    "platform": null,
    "description": "[![PyPi version](https://img.shields.io/pypi/v/geckoterminal-api)](https://pypi.python.org/pypi/geckoterminal-api/)\n[![Downloads](https://static.pepy.tech/badge/geckoterminal-api)](https://pepy.tech/project/geckoterminal-api)\n[![Python 3.10](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/release/python-3100/)\n[![codecov](https://codecov.io/gh/dineshpinto/geckoterminal-api/graph/badge.svg?token=JQLPDDAFX0)](https://codecov.io/gh/dineshpinto/geckoterminal-api)\n[![API unittest](https://github.com/dineshpinto/geckoterminal-api/actions/workflows/unittests.yml/badge.svg)](https://github.com/dineshpinto/geckoterminal-api/actions/workflows/unittests.yml)\n\n# GeckoTerminal API\n\n## RESTful (sync + async) Python client for GeckoTerminal API\n\nWrapper around the [GeckoTerminal](https://www.geckoterminal.com) DeFi and DeX\naggregator operating across 90+ chains and 500+ dexes.\nFeatures both synchronous and asynchronous APIs.\n\nFeatures:\n\n- Get the market data (price, volume, historical chart) of any token\n- Find all the pools that are trading a specific token\n- Plot a candlestick chart using OHLCV when given a pool address\n\nThe API is currently in beta and is subject to change, please report any issues you\nfind.\n\n## Installation\n\n```bash\npip install geckoterminal-api\n```\n\n## Docs\n\nSee the [GeckoTerminal API docs](https://www.geckoterminal.com/dex-api) for more\ndetails.\n\n## Usage\n\n### Synchronous API\n\n```python\nfrom geckoterminal_api import GeckoTerminalAPI\n\ngt = GeckoTerminalAPI()\n# Get a list of supported networks and their IDs\ngt.networks()\n```\n\n### Asynchronous API\n\n```python\nimport asyncio\nfrom geckoterminal_api import AsyncGeckoTerminalAPI\n\nagt = AsyncGeckoTerminalAPI()\n# Get a list of supported networks and their IDs\nasyncio.run(agt.networks())\n```\n\n## Examples\n\n### Get trades for a specific pool\n\n```ipython\n# Query $ANALOS pool on Solana\n>>> trades = gt.network_pool_trades(network=\"solana\", pool=\"69grLw4PcSypZnn3xpsozCJFT8vs8WA5817VUVnzNGTh\")\n>>> for trade_data in trades[\"data\"]:\n>>>     trade = trade_data[\"attributes\"]\n>>>     print(f'{trade[\"block_timestamp\"]} -- {trade[\"kind\"]}: {float(trade[\"volume_in_usd\"]):.2f} USD')\n```\n\n(truncated output)\n\n```text\n2023-12-27T08:27:24Z -- buy: 0.06 USD\n2023-12-27T08:27:22Z -- buy: 54.73 USD\n2023-12-27T08:27:22Z -- sell: 43.11 USD\n2023-12-27T08:27:22Z -- sell: 105.08 USD\n2023-12-27T08:27:20Z -- sell: 552.80 USD\n2023-12-27T08:27:17Z -- buy: 1116.88 USD\n2023-12-27T08:27:14Z -- sell: 1110.02 USD\n2023-12-27T08:27:12Z -- buy: 52.44 USD\n2023-12-27T08:27:02Z -- buy: 41.72 USD\n2023-12-27T08:26:59Z -- sell: 15.31 USD\n```\n\n### Get pools trending on a network\n\n```ipython\n# Query trending pools on Solana\n>>> gt.network_trending_pools(network=\"solana\")\n```\n\n(truncated output)\n\n```json\n{\n  \"id\": \"solana_EP2ib6dYdEeqD8MfE2ezHCxX3kP3K2eLKkirfPm5eyMx\",\n  \"type\": \"pool\",\n  \"attributes\": {\n    \"base_token_price_usd\": \"0.216341\",\n    \"address\": \"EP2ib6dYdEeqD8MfE2ezHCxX3kP3K2eLKkirfPm5eyMx\",\n    \"name\": \"$WIF / SOL\",\n    \"fdv_usd\": \"214518552\",\n    \"market_cap_usd\": \"201410163.369506\",\n    \"price_change_percentage\": {\n      \"h1\": \"2.75\",\n      \"h24\": \"-11.76\"\n    },\n    \"transactions\": {\n      \"h1\": {\n        \"buys\": 1143,\n        \"sells\": 494,\n        \"buyers\": 282,\n        \"sellers\": 249\n      },\n      \"h24\": {\n        \"buys\": 33874,\n        \"sells\": 21413,\n        \"buyers\": 6790,\n        \"sellers\": 5363\n      }\n    },\n    \"volume_usd\": {\n      \"h1\": \"782023.141511\",\n      \"h24\": \"41413570.131944\"\n    }\n  }\n}\n```\n\n### Get new pools on a network\n\n```ipython\n# Query new pools on Arbitrum\n>>> gt.network_new_pools(network=\"arbitrum\")\n```\n\n(truncated output)\n\n```json\n{\n  \"id\": \"arbitrum_0x9405117878d3a7ff7968b3d6f322bf428c168ca7\",\n  \"type\": \"pool\",\n  \"attributes\": {\n    \"base_token_price_usd\": \"0.000463649357219151\",\n    \"address\": \"0x9405117878d3a7ff7968b3d6f322bf428c168ca7\",\n    \"name\": \"JUPITER / WETH\",\n    \"pool_created_at\": \"2023-12-23T22:19:36Z\",\n    \"fdv_usd\": \"9736.64\",\n    \"price_change_percentage\": {\n      \"h1\": \"55.09\",\n      \"h24\": \"55.09\"\n    },\n    \"transactions\": {\n      \"h1\": {\n        \"buys\": 24,\n        \"sells\": 4,\n        \"buyers\": 24,\n        \"sellers\": 4\n      },\n      \"h24\": {\n        \"buys\": 24,\n        \"sells\": 4,\n        \"buyers\": 24,\n        \"sellers\": 4\n      }\n    },\n    \"volume_usd\": {\n      \"h1\": \"3191.9671827550049\",\n      \"h24\": \"3191.9671827550049\"\n    },\n    \"reserve_in_usd\": \"14348.4777\"\n  }\n}\n```\n\nand many more...\n\n## Disclaimer\n\nThis project is for educational purposes only. You should not construe any such\ninformation or other material as legal, tax, investment, financial, or other advice.\nNothing contained here constitutes a solicitation, recommendation, endorsement, or\noffer by me or any third party service provider to buy or sell any securities or other\nfinancial instruments in this or in any other jurisdiction in which such solicitation or\noffer would be unlawful under the securities laws of such jurisdiction.\n\nUnder no circumstances will I be held responsible or liable in any way for any claims,\ndamages, losses, expenses, costs, or liabilities whatsoever, including, without\nlimitation, any direct or indirect damages for loss of profits.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "RESTful (sync + async) Python client for GeckoTerminal API",
    "version": "0.7.6",
    "project_urls": {
        "Homepage": "https://github.com/dineshpinto/geckoterminal-api",
        "Repository": "https://github.com/dineshpinto/geckoterminal-api"
    },
    "split_keywords": [
        "geckoterminal",
        "coingecko",
        "rest",
        "api",
        "async",
        "cryptocurrency",
        "bitcoin",
        "ethereum",
        "solana"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "85789b7f2f5572cbd50b38b6f95c6348c3ab34da486e17ff2814bf1125f5c005",
                "md5": "fb4fa54882e286e8d59719af48f882ca",
                "sha256": "8521a7ddb6e8cb28963f98f4fd03e3b7296b8b5162817a8e2a0a9c1e9899369e"
            },
            "downloads": -1,
            "filename": "geckoterminal_api-0.7.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "fb4fa54882e286e8d59719af48f882ca",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10,<4.0",
            "size": 11644,
            "upload_time": "2024-01-12T05:51:35",
            "upload_time_iso_8601": "2024-01-12T05:51:35.906252Z",
            "url": "https://files.pythonhosted.org/packages/85/78/9b7f2f5572cbd50b38b6f95c6348c3ab34da486e17ff2814bf1125f5c005/geckoterminal_api-0.7.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3897185564a4075eef1b20736e09661aeef5697ab73695bd5fce70070bed75a1",
                "md5": "cacbe5ae55f4ffda12f7be7e2b1b70d1",
                "sha256": "363df6db9ed2f874f59d6de07a916a087fa93c8834b2b4d382f0ee7c2bb117cf"
            },
            "downloads": -1,
            "filename": "geckoterminal_api-0.7.6.tar.gz",
            "has_sig": false,
            "md5_digest": "cacbe5ae55f4ffda12f7be7e2b1b70d1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10,<4.0",
            "size": 10316,
            "upload_time": "2024-01-12T05:51:38",
            "upload_time_iso_8601": "2024-01-12T05:51:38.230671Z",
            "url": "https://files.pythonhosted.org/packages/38/97/185564a4075eef1b20736e09661aeef5697ab73695bd5fce70070bed75a1/geckoterminal_api-0.7.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-12 05:51:38",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "dineshpinto",
    "github_project": "geckoterminal-api",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "geckoterminal-api"
}
        
Elapsed time: 0.15995s