Skip to content
This repository was archived by the owner on Nov 20, 2022. It is now read-only.

Latest commit

History

13 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

THIS MODULE IS DEPRECATED

11/20/2022: Pancakeswap has recently discontinued their info API.. this module will no longer be maintained.


🐍 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

frompythonpancakesimportPancakeSwapAPIps=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, //UNIXtimestamp"data": {
"0x..._0x...": { //BEP20tokenaddresses, joinedbyanunderscore"price": "...", //pricedenominatedintoken1/token0"base_volume": "...", //last24hvolumedenominatedintoken0"quote_volume": "...", //last24hvolumedenominatedintoken1"liquidity": "...", //liquiditydenominatedinUSD"liquidity_BNB": "..."//liquiditydenominatedinBNB
},
// ...
}
}

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, //UNIXtimestamp"data": {
"0x...": { //theaddressoftheBEP20token"name": "...", //notnecessarilyincludedforBEP20tokens"symbol": "...", //notnecessarilyincludedforBEP20tokens"price": "...", //pricedenominatedinUSD"price_BNB": "...", //pricedenominatedinBNB
},
// ...
}
}

Example invocation with address:

token=ps.tokens('0x00000000000...')

Example output with address:

# output
{
"updated_at": 1234567, //UNIXtimestamp"data": {
"name": "...", //notnecessarilyincludedforBEP20tokens"symbol": "...", //notnecessarilyincludedforBEP20tokens"price": "...", //pricedenominatedinUSD"price_BNB": "...", //pricedenominatedinBNB
}
}

pairs()

Returns data for the top ~1000 PancakeSwap pairs, sorted by reserves.

Example invocation:

pairs=ps.pairs()

Example output

{
"updated_at": 1234567, //UNIXtimestamp"data": {
"0x..._0x...": { //theassetidsofBNBandBEP20tokens, joinedbyanunderscore"pair_address": "0x...", //pairaddress"base_name": "...", //token0name"base_symbol": "...", //token0symbol"base_address": "0x...", //token0address"quote_name": "...", //token1name"quote_symbol": "...", //token1symbol"quote_address": "0x...", //token1address"price": "...", //pricedenominatedintoken1/token0"base_volume": "...", //volumedenominatedintoken0"quote_volume": "...", //volumedenominatedintoken1"liquidity": "...", //liquiditydenominatedinUSD"liquidity_BNB": "..."//liquiditydenominatedinBNB
},
// ...
}
}

About

Basic Python3 request wrapper for the PancakeSwap API

Topics

Resources

Stars

28 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages