🐍 Python Pancakes 🥞
A simple request wrapper for the Pancake-Swap API.
Installation
Install package
# Using pip
$ pip install pythonpancakes
# Or from source
$ git clone https://github.com/scottburlovich/pythonpancakes.git pythonpancakes
$ cd pythonpancakes
$ python3 setup.py install
Import module into your project and initialize API class
from pythonpancakes import PancakeSwapAPI
ps = PancakeSwapAPI()
Usage
Please note, the API functionality currently exposed by PancakeSwap is quite basic. This package will be updated as they add new functionality.
summary()
Returns a dictionary containing data for the top ~1000 PancakeSwap pairs, sorted by reserves.
Example invocation:
summary = ps.summary()
Example output:
# output:
{
"updated_at": 1234567, // UNIX timestamp
"data": {
"0x..._0x...": { // BEP20 token addresses, joined by an underscore
"price": "...", // price denominated in token1/token0
"base_volume": "...", // last 24h volume denominated in token0
"quote_volume": "...", // last 24h volume denominated in token1
"liquidity": "...", // liquidity denominated in USD
"liquidity_BNB": "..." // liquidity denominated in BNB
},
// ...
}
}
tokens(address)
If address parameter is specified, returns the token information, based on address. Otherwise, returns the tokens in the top ~1000 pairs on PancakeSwap, sorted by reserves.
Example invocation without address:
tokens = ps.tokens()
Example output without address:
{
"updated_at": 1234567, // UNIX timestamp
"data": {
"0x...": { // the address of the BEP20 token
"name": "...", // not necessarily included for BEP20 tokens
"symbol": "...", // not necessarily included for BEP20 tokens
"price": "...", // price denominated in USD
"price_BNB": "...", // price denominated in BNB
},
// ...
}
}
Example invocation with address:
token = ps.tokens('0x00000000000...')
Example output with address:
# output
{
"updated_at": 1234567, // UNIX timestamp
"data": {
"name": "...", // not necessarily included for BEP20 tokens
"symbol": "...", // not necessarily included for BEP20 tokens
"price": "...", // price denominated in USD
"price_BNB": "...", // price denominated in BNB
}
}
pairs()
Returns data for the top ~1000 PancakeSwap pairs, sorted by reserves.
Example invocation:
pairs = ps.pairs()
Example output
{
"updated_at": 1234567, // UNIX timestamp
"data": {
"0x..._0x...": { // the asset ids of BNB and BEP20 tokens, joined by an underscore
"pair_address": "0x...", // pair address
"base_name": "...", // token0 name
"base_symbol": "...", // token0 symbol
"base_address": "0x...", // token0 address
"quote_name": "...", // token1 name
"quote_symbol": "...", // token1 symbol
"quote_address": "0x...", // token1 address
"price": "...", // price denominated in token1/token0
"base_volume": "...", // volume denominated in token0
"quote_volume": "...", // volume denominated in token1
"liquidity": "...", // liquidity denominated in USD
"liquidity_BNB": "..." // liquidity denominated in BNB
},
// ...
}
}
Metadata
Release files for pythonpancakes 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pythonpancakes-1.0.1.tar.gz | 4.0 kB | Without provenance | Details for pythonpancakes-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pythonpancakes-1.0.1-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for pythonpancakes-1.0.1-py2.py3-none-any.whl |
Total release size: 8.2 kB
Release files / pythonpancakes-1.0.1.tar.gz
| Download URL | pythonpancakes-1.0.1.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bd628d2ab264b8df71590474efcbb041d009b2eb23cd6e28a5340b2da77de8c5
|
|
BLAKE2b-256 checksum How to use checksums |
9d40a97f4822a6c5afe1794d04090e3ddcd7fa81757b981bc75c9fcfe65be36e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.10
|
Release files / pythonpancakes-1.0.1-py2.py3-none-any.whl
| Download URL | pythonpancakes-1.0.1-py2.py3-none-any.whl |
|---|---|
| Size | 4.1 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
e9fe5c62689144fda3d4d3721e8f02f6c46574d07d492ffd76b3146c7b093f28
|
|
BLAKE2b-256 checksum How to use checksums |
aa0a8609a11e6d3cd5f37e161f884789849736bccc042e6ffc10a17774ee301f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.10
|
Security for pythonpancakes 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.