Skip to content

Commit 725cf73

Browse files
committed
Updated
1 parent aad6afa commit 725cf73

4 files changed

Lines changed: 106 additions & 8 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.venv
2+
.vscode
23
dist
34
dextools_python/__pycache__
45
tests/__pycache__

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# Version 0.3
2+
+ Asynchronous support using asyncio
3+
+ Added support for Python 3.8
4+
+ New logo
5+
16
# Version 0.2.4
27
+ Added support for "trial" plan
38

README.md

Lines changed: 100 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,66 @@
1+
<p align="center">
2+
<img width="350" height="350" src="/assets/dextools-python.png">
3+
</p>
4+
15
# DEXTools Python
26
[![Python application](https://github.com/alb2001/dextools-python/actions/workflows/python-app.yml/badge.svg)](https://github.com/alb2001/dextools-python/actions/workflows/python-app.yml)
37
[![Downloads](https://static.pepy.tech/badge/dextools-python)](https://pepy.tech/project/dextools-python)
48
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
59
[![PyPI](https://img.shields.io/pypi/v/dextools-python)](https://pypi.org/project/dextools-python/)
610

711
A simple Python API wrapper for DEXTools.
8-
Supports [Dextools API v1](https://api.dextools.io/docs) and [Dextools API v2](https://api.dextools.io/blobr/v2/docs)
12+
Supports [Dextools API v1](https://api.dextools.io/docs) and [Dextools API v2](https://developer.dextools.io/docs/start)
13+
14+
1. [Installation](#installation)
15+
2. [Obtaining API Key](#obtaining-api-key)
16+
3. [Getting Started](#getting-started)
17+
1. [Version 1](#version-1)
18+
2. [Version 2](#version-2)
19+
1. [Available plans - Setting your plan](#available-plans---setting-your-plan)
20+
4. [Version 1 Queries](#version-1-queries)
21+
1. [Get pairs of a token](#get-pairs-of-a-token)
22+
2. [Get token details](#get-token-details)
23+
3. [Get chain list](#get-chain-list)
24+
4. [Get exchange list](#get-exchange-list)
25+
5. [Version 2 Queries](#version-2-queries)
26+
1. [Blockchain](#blockchain)
27+
1. [Get blockchain info](#get-blockchain-info)
28+
2. [Get blockchains sorted by default settings](#get-blockchains-sorted-by-default-settings)
29+
3. [Get blockchains sorted by default settings and descending order](#get-blockchains-sorted-by-default-settings-and-descending-order)
30+
2. [Exchange](#exchange)
31+
1. [Get dex factory info](#get-dex-factory-info)
32+
2. [Get dexes on a specific chain](#get-dexes-on-a-specific-chain)
33+
3. [Get dexes on a specific chain sorted by name and descending order](#get-dexes-on-a-specific-chain-sorted-by-name-and-descending-order)
34+
3. [Pool](#pool)
35+
1. [Get pool info](#get-pool-info)
36+
2. [Get pool liquidity](#get-pool-liquidity)
37+
3. [Get pool score](#get-pool-score)
38+
4. [Get pool price](#get-pool-price)
39+
5. [Get pools](#get-pools)
40+
6. [Get pools sorted by `creationBlock` and descending order and providing block numbers instead](#get-pools-sorted-by-creationblock-and-descending-order-and-providing-block-numbers-instead)
41+
4. [Token](#token)
42+
1. [Get token](#get-token)
43+
2. [Get token locks](#get-token-locks)
44+
3. [Get token score](#get-token-score)
45+
4. [Get token info](#get-token-info)
46+
5. [Get token price](#get-token-price)
47+
6. [Get tokens](#get-tokens)
48+
7. [Get tokens sorted by `creationBlock` and descending order and providing block numbers instead in descending order](#get-tokens-sorted-by-creationblock-and-descending-order-and-providing-block-numbers-instead-in-descending-order)
49+
8. [Get tokens sorted by `socialsInfoUpdated` and descending order and datetimes in descending order](#get-tokens-sorted-by-socialsinfoupdated-and-descending-order-and-datetimes-in-descending-order)
50+
9. [Get token pools](#get-token-pools)
51+
10. [Get token pools sorted by `creationBlock` and descending order and providing block numbers instead in descending order](#get-token-pools-sorted-by-creationblock-and-descending-order-and-providing-block-numbers-instead-in-descending-order)
52+
5. [Rankings](#rankings)
53+
1. [Get hot pools](#get-hot-pools)
54+
2. [Get gainers](#get-gainers)
55+
3. [Get losers](#get-losers)
56+
6. [Page and PageSize arguments](#page-and-pagesize-arguments)
57+
7. [Asynchronous support with asyncio](#asynchronous-support-with-asyncio)
58+
8. [Examples](#examples)
59+
9. [Testing](#testing)
60+
10. [Supported Blockchains](#supported-blockchains)
61+
11. [Authors](#authors)
62+
12. [More information](#more-information)
63+
964

1065
## Installation
1166

@@ -18,7 +73,7 @@ To obtain an API key, head to the [Developer Portal](https://developer.dextools.
1873

1974

2075
## Getting Started
21-
There are 2 versions of the Dextools API. [Dextools API v1](https://api.dextools.io/docs) and [Dextools API v2](https://api.dextools.io/blobr/v2/docs)
76+
There are 2 versions of the Dextools API. [Dextools API v1](https://api.dextools.io/docs) and [Dextools API v2](https://developer.dextools.io/docs/start)
2277

2378
### Version 1
2479
To get started, import the package, and initiate a `DextoolsAPI` instance object by passing your API key:
@@ -107,7 +162,7 @@ print(exchange_list)
107162
```
108163

109164
## Version 2 Queries
110-
Below are a set of queries supported by the [Dextools API v2](https://api.dextools.io/blobr/v2/docs). All data is returned as a Python dictionary for easy data handling.
165+
Below are a set of queries supported by the [Dextools API v2](https://developer.dextools.io/docs/start). All data is returned as a Python dictionary for easy data handling.
111166

112167
### Blockchain
113168
#### Get blockchain info
@@ -264,11 +319,47 @@ losers = dextools.get_ranking_losers("ether")
264319
print(losers)
265320
```
266321

267-
### Page and PageSize arguments
268-
Some methods support the `page` and `pageSize` arguments. Check out the [Dextools API v2](https://api.dextools.io/v2/docs) documentation for more information.
322+
## Page and PageSize arguments
323+
Some methods support the `page` and `pageSize` arguments. Check out the API documentation for more information.
324+
325+
## Asynchronous support with asyncio
326+
Asynchronous support has been added through [asyncio](https://docs.python.org/3/library/asyncio.html).
327+
328+
Through a context manager (session will close automatically when the context manager ends):
329+
```
330+
import asyncio
331+
from dextools_python import AsyncDextoolsAPIV2
332+
333+
api_key = "YOUR_API_KEY"
334+
335+
async def main():
336+
async with AsyncDextoolsAPIV2(api_key, plan="partner") as dextools:
337+
response = await dextools.get_blockchains()
338+
print(response)
339+
340+
asyncio.run(main())
341+
```
342+
343+
Creating an instance and then closing the session explicitly at the end:
344+
```
345+
import asyncio
346+
from dextools_python import AsyncDextoolsAPIV2
347+
348+
api_key = "YOUR_API_KEY"
349+
350+
async def main():
351+
dextools = AsyncDextoolsAPIV2(api_key, plan="partner")
352+
353+
response = await dextools.get_blockchains()
354+
print(response)
355+
356+
await dextools.close()
357+
358+
asyncio.run(main())
359+
```
269360

270361
## Examples
271-
Check out the `examples` folder for some example scripts.
362+
Check out the `examples` folder for some synchronous and asynchronous example scripts.
272363

273364
## Testing
274365
A set of tests have been included inside `tests` folder. You will need to set an environment variable as `DextoolsAPIKey` using your API key.
@@ -284,5 +375,6 @@ Dextools adds support for new blockchains from time to time. `dextools.get_block
284375
* [dextools-python on PyPI](https://pypi.org/project/dextools-python)
285376
* [DEXTools](https://www.dextools.io)
286377
* [Dextools API v1](https://api.dextools.io/docs)
287-
* [Dextools API v2](https://api.dextools.io/blobr/v2/docs)
288-
* [Developer Portal](https://developer.dextools.io/)
378+
* [Dextools API v2](https://developer.dextools.io/docs/start)
379+
* [Developer Portal](https://developer.dextools.io/)
380+
* [asyncio](https://docs.python.org/3/library/asyncio.html)

assets/dextools-python.png

44.6 KB
Loading

0 commit comments

Comments
 (0)