PancakeTrade - Limit orders and more for PancakeSwap on Binance Smart Chain

Overview

PancakeTrade - Limit orders and more for PancakeSwap on Binance Smart Chain

Docker Image CI Linting

PancakeTrade helps you create limit orders and more for your BEP-20 tokens that swap against BNB on PancakeSwap. The bot is controlled by Telegram so you can interact from anywhere.

screenshot

DISCLAIMER

This software is for educational purposes only. Do not risk money which you are afraid to lose. USE THE SOFTWARE AT YOUR OWN RISK. THE AUTHORS AND ALL AFFILIATES ASSUME NO RESPONSIBILITY FOR YOUR TRADING RESULTS.

We strongly recommend you to have coding and Python knowledge. Do not hesitate to read the source code and understand the mechanism of this bot.

Features

The bot provides a lot of convenience trading features including:

  • Tokens balance and price shown in status messages
  • Price tracking relative to buy transaction
  • Ability to make buy and sell limit orders including trailing stop loss
  • Automatic smart price selection in case PancakeSwap v1 and v2 LPs are available
  • Automatic approval for selling
  • Assign emoji to each token to differentiate them easily
  • Default slippage set on a token basis for faster order creation
  • Chart link for each token

Requirements

In order to use this bot, you will need the following:

  • A server or computer that can run the script continuously (linux or macOS, as well as WSL have been tested)
  • A Telegram bot token (interact with @BotFather)
  • Your Telegram chat ID/user ID (interact with @userinfobot)

If you choose to use the Docker image, you'll just need docker installed, see the section below.

If you choose to run the script with Python, you'll need the following:

  • Python version between 3.7.1 and 3.9.x
  • Poetry
  • Optional: git to clone this repository, you can also download the source from the github website.

Quick Start

Before you start, make sure you have your Telegram Bot token + user ID available. Initiate the chat with your bot on Telegram (click the "Start" button) to initialize the chat ID before you start the bot the first time.

Run the following commands

git clone https://github.com/beeb/pancaketrade.git
cd pancaketrade
poetry install --no-dev
cp user_data/config.example.yml user_data/config.yml

Next, open the config.yml file inside the user_data folder with a text editor and populate the secrets section.

The bot needs your wallet's private key in order to sign and execute orders on your behalf. You can either run the command below and enter your private key in the prompt that will be shown, or you can provide an environment variable named WALLET_PK that will be used by the bot. The private key is not the same as the seed words/mnemonic. You need the 64-characters hexadecimal private key.

Your wallet address will be inferred from the private key and doesn't need to be provided.

Run the bot:

poetry run trade

You will receive a notification in the Telegram chat after entering your private key. You can then start by adding your tokens with the /addtoken chat command.

The other most useful command is the /status command that will display all your tokens and the existing orders.

Configuration file

The script looks for a file named config.yml located inside the user_datafolder by default. You can pass another file path to the trade command as a positional argument.

The only parameter that is not self-explanatory is min_pool_size_bnb. Since PancakeSwap migrated to version 2, some tokens have Liquidity Pairs (LP) on both v1 and v2. As a result, the price might be better for buying or selling on one version versus the other. However, sometimes the LP on a given version has very little liquidity, which means that the price is very volatile. In order to avoid swapping on the version that has little liquidity, the bot checks that at least min_pool_size_bnb is staked in the LP. If that's not the case, the bot will use the other version even if the price is worse.

The update_messages parameter will update the status messages every 30 seconds if set to true. If you have trouble with the inline buttons not working, this means this bot token is not able to update messages anymore. It's unclear what the reason is, but it happened a few times to the developer and testers of this bot. The solution is to create a new bot token and try again, or disable update_messages (not ideal).

---
bsc_rpc: 'https://bsc-dataseed.binance.org:443' # you can use any BSC RPC url you want
min_pool_size_bnb: 25 # PancakeSwap LPs that have less than 25 BNB will not be considered
monitor_interval: 5 # the script will check the token prices with this interval in seconds
update_messages: true # status messages will update periodically to show current values
secrets:
  telegram_token: 'enter_your:bot_token' # enter your Telegram Bot token
  admin_chat_id: 123456 # enter your chat ID/user ID to prevent other users to use the bot

Updating the bot

When a new version is released, if you cloned the repository with git, you can simply perform a git pull on the master branch. After that, run the poetry install --no-dev command again to update dependencies.

Use docker

This bot now gets published as docker images on Docker Hub.

Before you start, make sure you have your Telegram Bot token + user ID available. Initiate the chat with your bot on Telegram (click the "Start" button) to initialize the chat ID before you start the bot the first time.

Steps to use docker:

  1. Copy the example docker-compose.example.yml file in this repository, rename it to docker-compose.yml
  2. Create a file named .env next to your docker-compose file and insert your private key: WALLET_PK=123abc...
  3. Create a user_data folder if it doesn't already exist, and create your config.yml file inside (see previous section).
  4. Run the service with docker-compose up -d or docker compose up -d depending on your docker version.

Note: the bot will create a file for the database named pancaketrade.db inside the user_data folder on your local machine. Do not delete or move that file because it holds all your token configurations and orders data. This is the file to back up if you want to move the bot elsewhere, etc.

Run as a service

On systems that support systemd, you can use the included pancaketrade.service file to run this script as a service.

cp pancaketrade.service ~/.config/systemd/user/
# edit the new file in .config/systemd/user with your wallet private key
systemctl --user start pancaketrade.service
systemctl --user enable pancaketrade.service # run at launch

Donations

If you feel like this project has helped you and you wish to donate to the developer, you can do so on the Ethereum or Binance Smart Chain networks at the address:

0x026E539B566DcFF02af980d938deCcb11255d519

Thanks for your contribution!

Comments
  • Request: Disable PK input every run poetry trade

    Request: Disable PK input every run poetry trade

    Every time i'm start this bot it always ask Private key.. and for me this annoying ,, i try to change the code but it failed ,,

    i think the best way is to acess .env WALLET_PK as docker do ,,

    as in readme.md i have try created .env file with WALLET_PK=MYPK

    in root and user_data ,,, the prompt asked for pk is still exist,,,

    is this should be tagged as bug?

    enhancement 
    opened by geeks121 13
  • Different LPs on Pancake

    Different LPs on Pancake

    Hi, First of all, nice job on the bot. One question I have is: is it possible to support different LP on the pancake swap? (maybe a silly question) Also, I'm not very sure, but I think for example MTV/BNB and MTV/USDT are different LP for a single coin? (see screen)

    Proposal: when you add a coin you can select which LP to use.

    enhancement 
    opened by yocovn 9
  • Adding unit tests?

    Adding unit tests?

    • [X] I have searched the issues of this repo and believe that this is not a duplicate.
    • [X] I have read the Readme and believe that my question is not covered.

    Feature Request

    I tried to write my own a DeFi bot but I failed because testing the code with BSC testnet was not working. Forking mainnet in Ganache, Hardhat was also problematic. LP pairs on testnets were always giving weird errors.

    How do you test your code? Would you like to share your unit tests (if any)?

    enhancement help wanted 
    opened by sinancetinkaya 7
  • Error while running

    Error while running "poetry run trade"

    I'm getting this error on running poetry run trade.

    2021-11-14 13:50:17 INFO |Bye! Traceback (most recent call last): File "", line 1, in File "C:\Users\HACKER\Desktop\beeb-pancaketrade-558a540.venv\lib\site-packages\click\core.py", line 829, in call return self.main(*args, **kwargs) File "C:\Users\HACKER\Desktop\beeb-pancaketrade-558a540.venv\lib\site-packages\click\core.py", line 782, in main rv = self.invoke(ctx) File "C:\Users\HACKER\Desktop\beeb-pancaketrade-558a540.venv\lib\site-packages\click\core.py", line 1066, in invoke return ctx.invoke(self.callback, **ctx.params) File "C:\Users\HACKER\Desktop\beeb-pancaketrade-558a540.venv\lib\site-packages\click\core.py", line 610, in invoke return callback(*args, **kwargs) File "C:\Users\HACKER\Desktop\beeb-pancaketrade-558a540\pancaketrade\trade.py", line 28, in main config = read_config(config_file) File "C:\Users\HACKER\Desktop\beeb-pancaketrade-558a540\pancaketrade\utils\config.py", line 82, in read_config data = yamale.make_data(config_file_path) File "C:\Users\HACKER\Desktop\beeb-pancaketrade-558a540.venv\lib\site-packages\yamale\yamale.py", line 29, in make_data raw_data = readers.parse_yaml(path, parser, content=content) File "C:\Users\HACKER\Desktop\beeb-pancaketrade-558a540.venv\lib\site-packages\yamale\readers\yaml_reader.py", line 35, in parse_yaml return parse(f) File "C:\Users\HACKER\Desktop\beeb-pancaketrade-558a540.venv\lib\site-packages\yamale\readers\yaml_reader.py", line 11, in pyyaml return list(yaml.load_all(f, Loader=Loader)) File "C:\Users\HACKER\Desktop\beeb-pancaketrade-558a540.venv\lib\site-packages\yaml_init.py", line 130, in load_all yield loader.get_data() File "C:\Users\HACKER\Desktop\beeb-pancaketrade-558a540.venv\lib\site-packages\yaml\constructor.py", line 45, in get_data return self.construct_document(self.get_node()) File "yaml_yaml.pyx", line 699, in yaml._yaml.CParser.get_node File "yaml_yaml.pyx", line 725, in yaml._yaml.CParser._compose_document File "yaml_yaml.pyx", line 776, in yaml._yaml.CParser._compose_node File "yaml_yaml.pyx", line 892, in yaml._yaml.CParser._compose_mapping_node File "yaml_yaml.pyx", line 905, in yaml._yaml.CParser._parse_next_event yaml.scanner.ScannerError: while scanning a simple key in "user_data\config.yml", line 6, column 1 could not find expected ':' in "user_data\config.yml", line 7, column 17

    Can you clarify what's this??? image

    bug help wanted 
    opened by DjdjHacks 7
  • Config monitor interval

    Config monitor interval

    I noticed an issue when you change the monitor_interval in the config file to 1 the bot crashes and gives a typerror File "C:\Users\migue\Documents\GitHub\pancaketrade\.venv\lib\site-packages\apscheduler\job.py", line 196, in _modify raise TypeError('misfire_grace_time must be either None or a positive integer') TypeError: misfire_grace_time must be either None or a positive integer

    image

    bug 
    opened by DigiTecK3D 7
  • Add feature: trailing SL in % from ATH since entry (refresh each X seconds)

    Add feature: trailing SL in % from ATH since entry (refresh each X seconds)

    Hi, first of all, awesome work and thanks a lot!

    I think would be fine to set a SL trailing of a x% under the maximum value of the token since the entry.

    E.j.

    Entry 0.1 SL 10% 0.09 Trainling SL 5% ... 1h later Value 0.3 SL 0.25

    opened by alejandrobailo 6
  • HTTPError Message

    HTTPError Message

    Hello, so I've been using this for a time and I get this over a long period of time and usage. not exactly sure what causes it or why it occurs but I do know it's something that shows up after a long time of running the bot.

    2021-07-18 04:35:47 ERROR |Exception during message update: urllib3 HTTPError ('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None)) 2021-07-18 06:54:37 ERROR |Error while getting Updates: urllib3 HTTPError ('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None)) 2021-07-18 06:54:37 ERROR |Exception while handling an update 2021-07-18 06:54:37 ERROR |urllib3 HTTPError ('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None)) 2021-07-18 06:54:37 ERROR |An uncaught error was raised while handling the error. Traceback (most recent call last): File "C:\Users\migue\Documents\GitHub\pancaketrade\.venv\lib\site-packages\telegram\ext\dispatcher.py", line 536, in process_update self.dispatch_error(None, update) File "C:\Users\migue\Documents\GitHub\pancaketrade\.venv\lib\site-packages\telegram\ext\dispatcher.py", line 810, in dispatch_error callback(update, context) File "C:\Users\migue\Documents\GitHub\pancaketrade\pancaketrade\bot.py", line 407, in error_handler chat_message(update, context, text=f'⛔️ Exception while handling an update\n{context.error}', edit=False) File "C:\Users\migue\Documents\GitHub\pancaketrade\pancaketrade\utils\generic.py", line 74, in chat_message assert update.effective_chat AttributeError: 'NoneType' object has no attribute 'effective_chat' 2021-07-18 06:54:47 ERROR |Exception during message update: urllib3 HTTPError ('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None)) 2021-07-18 06:55:09 ERROR |Error while getting Updates: urllib3 HTTPError ('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None)) 2021-07-18 06:55:09 ERROR |Exception while handling an update 2021-07-18 06:55:09 ERROR |urllib3 HTTPError ('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None)) 2021-07-18 06:55:09 ERROR |An uncaught error was raised while handling the error. Traceback (most recent call last): File "C:\Users\migue\Documents\GitHub\pancaketrade\.venv\lib\site-packages\telegram\ext\dispatcher.py", line 536, in process_update self.dispatch_error(None, update) File "C:\Users\migue\Documents\GitHub\pancaketrade\.venv\lib\site-packages\telegram\ext\dispatcher.py", line 810, in dispatch_error callback(update, context) File "C:\Users\migue\Documents\GitHub\pancaketrade\pancaketrade\bot.py", line 407, in error_handler chat_message(update, context, text=f'⛔️ Exception while handling an update\n{context.error}', edit=False) File "C:\Users\migue\Documents\GitHub\pancaketrade\pancaketrade\utils\generic.py", line 74, in chat_message assert update.effective_chat AttributeError: 'NoneType' object has no attribute 'effective_chat'

    image

    help wanted 
    opened by DigiTecK3D 6
  • Add Passphrase when starting the bot.

    Add Passphrase when starting the bot.

    Add Passphrase when starting the bot.

    it would be interesting if the user, when interacting with the bot, was asked for the passphrase of the wallet to initiate transactions..

    I understand that when starting the project on linux the passphrase is passed or via the conf file... but the bot could request this information (giving a little more sense of security for those who will use the bot).

    Example:

    to /start - bot prompts for wallet passphrase....

    question wontfix 
    opened by alexiusstrauss 6
  • (ERROR) Giant slippage

    (ERROR) Giant slippage

    I requested a sell order and then this happened: It was supposed to swap for $106 dollars but swapped for $85 Dollars. This would be a very high slippage which was set for 1%! Was it a bug?

    Screenshot_2021-10-13-19-16-46-621_io metamask Screenshot_2021-10-13-19-16-59-166_org telegram messenger

    invalid 
    opened by kalilfagundes 5
  • Show position % increase/decrease in status?

    Show position % increase/decrease in status?

    Love the work you've done so far!

    Would you consider adding the % increase/decrease of an open position in the status?

    Also are pull requests welcome, or would you prefer to work on this alone?

    Thanks!

    enhancement 
    opened by thewelshrich 5
  • Error when using sell_token method from Network class

    Error when using sell_token method from Network class

    I can't sell tokens using Network.sell_tokens (error 'web3.exceptions.ContractLogicError: execution reverted: TransferHelper: TRANSFER_FROM_FAILED'). Buying tokens is successful.

    opened by emelyanko 4
  • ConnectTimeoutError, NewConnectionError, Network.update_nonce

    ConnectTimeoutError, NewConnectionError, Network.update_nonce

    Hello king! I hope you are doing very well! sorry for the inconvenience. i have a little error

    WARNING |Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<telegram.vendor.ptb_urllib3.urllib3.connectionpool.HTTPSConnectionPool object at 0x>, 'Connect timed out. (connect timeout=5.0)')': /bot/setMyCommands

    WARNING |Execution of job "Network.update_nonce (trigger: interval[0:00:10], next run at: 2022-08-31 12:16:23 -03)" skipped: maximum number of running instances reached (1) WARNING |Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<telegram.vendor.ptb_urllib3.urllib3.connection.VerifiedHTTPSConnection object at 0x>: Failed to establish a new connection: [Errno -2] Name or service not known')': /bot/getUpdates WARNING |Execution of job "Network.update_nonce (trigger: interval[0:00:10], next run at: 2022-08-31 12:16:33 -03)" skipped: maximum number of running instances reached (1) WARNING |Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x>: Failed to establish a new connection: [Errno -2] Name or service not known')': / WARNING |Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<telegram.vendor.ptb_urllib3.urllib3.connection.VerifiedHTTPSConnection object at 0x>: Failed to establish a new connection: [Errno -2] Name or service not known')': /bot/getUpdates WARNING |Execution of job "Network.update_nonce (trigger: interval[0:00:10], next run at: 2022-08-31 12:16:43 -03)" skipped: maximum number of running instances reached (1) WARNING |Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<telegram.vendor.ptb_urllib3.urllib3.connection.VerifiedHTTPSConnection object at 0x>: Failed to establish a new connection: [Errno -2] Name or service not known')': /bot/getUpdates

    why tell me this ?

    bug 
    opened by jazzlifepro 4
  • API endpoint

    API endpoint

    • [x] I have searched the issues of this repo and believe that this is not a duplicate.
    • [x] I have read the Readme and believe that my question is not covered.

    Feature Request

    @beeb first of all, thanks for your work, I'm using it and works like a charm. What I would like to know if there is any chance to get and API endpoint or so in order to create an Angular / React whatever front-end to interact with your application. Otherwise I'll try to create the back-end myself, but dunno if you're planning to do it.

    Thanks!

    enhancement help wanted 
    opened by dferrandizmont 2
  • sqlalchemy support

    sqlalchemy support

    • [ x] I have searched the issues of this repo and believe that this is not a duplicate.
    • [ x] I have read the Readme and believe that my question is not covered.

    Feature Request

    I'm running bot in heroku and it work and running ,, but i have problem ,, the bot run in worker and the database is sqlite.

    heroku has restarted the bot every 24 hours and the data is loss because it not permanent.. the best way is to provide the sqlalchemy or there's other way to connect mysql or postgresql db with current code..

    heroku has 1gb free for postgresql db ,, and it enought to use for bot,,

    i'll push the simple workflow for heroku,,

    enhancement help wanted 
    opened by geeks121 1
  • Track max and min of tokens

    Track max and min of tokens

    • [x] I have searched the issues of this repo and believe that this is not a duplicate.
    • [x] I have read the Readme and believe that my question is not covered.

    Feature Request

    As we are reading price every 5s can we have record of max and min during last x? Being x something configurable per token perhaps?

    enhancement 
    opened by osatien 11
  • Add enabled/disabled status in orders instead of deleting on failure

    Add enabled/disabled status in orders instead of deleting on failure

    • [x ] I have searched the issues of this repo and believe that this is not a duplicate.
    • [x ] I have read the Readme and believe that my question is not covered.

    Feature Request

    It would be nice to have the possibility of disable and enable orders, so we can have many orders and enable when we need them. And if the order fails disabling it makes the order trackeable.

    So it would be nice to have this done.

    enhancement 
    opened by osatien 1
  • Is it possible to add multiple chat admin?

    Is it possible to add multiple chat admin?

    Hi beep,

    Thanks for the great job. Is it possible to add multiple admin chat id into the config file to manage the wallet and use the bot simultaneously?

    Thanks in advance

    enhancement 
    opened by huseyincotuk 1
Releases(v0.7.2)
  • v0.7.2(May 30, 2022)

    The price impact calculation was not normalizing token decimals, so it could produce wrong results for tokens that have less or more than 18 decimals. This has been fixed in this release.

    Source code(tar.gz)
    Source code(zip)
  • v0.7.1(May 18, 2022)

    This small update adds a feature that will warn if the price impact of a transaction is predicted to be high (configurable via max_price_impact, default 5%).

    If the price impact is above this value when the order executes, the transaction will be skipped and order removed, to prevent trading at a very unfavorable price.

    Before upgrading, add the max_price_impact entry in your config file (see README or example config file).

    Source code(tar.gz)
    Source code(zip)
  • v0.7.0(Mar 24, 2022)

    This substantial release adds long-await features requested by users.

    After pulling this update, please run poetry install --no-dev to upgrade all dependencies!

    • A new setting price_in_usd allows to display, input and track prices in USD/token instead of BNB/token
      • All existing order prices will be automatically updated when the bot is restarted after changing this parameter (using current BNB price)
      • Orders are still buying using BNB, and selling for BNB. Customization of this behavior will come in a later update.
    • Orders can now be edited with the /editorder command. Price, trailing stop loss callback, amount, gas and slippage can be edited for an existing order.
    • Codebase has been cleaned up and pre-commit hooks are now available to format code before allowing a commit. Install using pre-commit install after upgrading the dependencies if you wish to contribute to this repository.
    Source code(tar.gz)
    Source code(zip)
  • v0.6.2(Jan 25, 2022)

    Make sure to run poetry install --no-dev if you upgrade from a previous version.

    This version changes the following:

    • the behaviour when a high gas estimate is returned by the RPC: instead of proceeding with an acceptable gas limit which would likely be exceeded, leading to a failed transaction, the order is now cancelled when gas usage would reach above 2.5M gas units. Gas-expensive tokens should thus be traded manually on pancakeswap to allow for fine-tuning of the gas price.
    • dependencies have been updated, which removes some warning messages about deprecated features
    • added support for a .env file in the root directory (same folder as the pyproject.toml file) to define the wallet private key, instead of using other means like prepending it to the poetry command or inserting it in the service file
    • added chart link for DexScreener
    Source code(tar.gz)
    Source code(zip)
  • v0.6.1(Nov 9, 2021)

    This version builds up on the last release and adds support for USDT pairs on Binance Smart Chain.

    Now, whenever a buy or sell order is triggered, the following swap paths are compared, and the one with the largest output is chosen:

    • For buying:
      • BNB -> Token (using BNB liq)
      • BNB -> BUSD -> Token (using BUSD liq)
      • BNB -> USDT-> Token (using USDT liq)
    • For selling:
      • Token -> BNB (using BNB liq)
      • Token -> BUSD -> BNB (using BUSD liq)
      • Token -> USDT -> BNB (using USDT liq)
    Source code(tar.gz)
    Source code(zip)
  • v0.6.0(Oct 14, 2021)

    This release adds support to trade against both BNB and BUSD liquidity (more tokens could be added easily if needed) via https://github.com/beeb/pancaketrade/pull/25 .

    The price displayed in status messages is taken from the largest LP, counted by number of tokens in the pool. It is believed that this represents the most stable price for this token and thus is the better one to use for visual representation. At the moment when the script buys or sells, the price for each of the following swapping paths will be compared, and the best will be selected (which maximizes the output):

    • For buying:
      • BNB -> Token (using BNB liq)
      • BNB -> BUSD -> Token (using BUSD liq)
    • For selling:
      • Token -> BNB (using BNB liq)
      • Token -> BUSD -> BNB (using BUSD liq)

    Please note that the script still uses your BNB to buy, and still gives you back BNB when selling. Only the swapping path (which liquidity is used) has changed. When using non-BNB liquidity, the script automatically does 2 swaps in one single transaction, exactly like the official PancakeSwap client does.

    Support for PcS v1 has been dropped to keep complexity down.

    Source code(tar.gz)
    Source code(zip)
  • v0.5.2(Aug 31, 2021)

    This update adds the following:

    • Each token has now a BSCScan link that shows the token transaction history for your wallet
    • Dollar value is shown in the confirmation message after a successful sell
    • Decimal slippage is now supported, with up to 2 digits after the decimal point
    Source code(tar.gz)
    Source code(zip)
  • v0.5.1(Aug 4, 2021)

    This release tweaks a few mechanics that should improve performance when the network is congested:

    • Increased default gas offset for "Buy/Sell" (+10.1 gwei) and "Sell all" (+20.1 gwei) commands.
    • Increased default gas offset for approval (+0.1 gwei), previously was network default which could be very slow these days
    • Added link to wallet's BSCScan page in the summary message
    • Removed deprecated PancakeSwap function swapExactETHForTokens and swapExactTokensForETH as they do not respect slippage when token has transaction taxes.
    Source code(tar.gz)
    Source code(zip)
  • v0.5.0(Jul 9, 2021)

    This release adds the following new features:

    • Added manual approval command /approve to be used at any time (to approve for selling on pancakeswap). It will use the best pancakeswap version for selling at the time of the command. A button to manually trigger approval also shows when a new unapproved token is added.

    Improvements:

    • The artificial waiting time after approval has been reduced from 10s to 3s. This delay is to ensure the transaction propagated and that a subsequent approval check will return true.
    • The nonce for a new transaction is checked just before the transaction is sent, minimizing the risk to use the wrong nonce if there was a transaction shortly before.
    • The gas price gwei value in the new order confirmation message was shown in scientific notation, now it's floating point.

    Bugfixes:

    • Fixed "0e-35" BNB balance value in status messages when the balance is zero tokens.
    Source code(tar.gz)
    Source code(zip)
  • v0.4.7(Jul 6, 2021)

    This version brings the following changes and improvements:

    • The bot now supports listing WBNB holdings (special case due to absence of LP), but wrapping/unwrapping is not yet supported
    • The swapExactETHForTokens method is now preferred over the swapExactETHForTokensSupportingFeeOnTransferTokens if gas estimation works.
    • The gas limit failsafe has been raised to 2,000,000 gas units to accommodate new contracts with complex reflection schemes
    • Logging when gas estimation failed is now more verbose and indicates the potential reason being insufficient slippage
    Source code(tar.gz)
    Source code(zip)
  • v0.4.6(Jun 28, 2021)

    This release improves on some small things and fixes a minor bug:

    • Added support for Basic HTTP Auth when using a custom RPC URI (see user_data/config.example.yml)
    • Fixed dex.guru links which did not support URIs without the -bsc suffix anymore
    • Added link for DEXT (dextools.io)
    • Normalized amounts display in status messages to have the code markup everywhere (easier to copy-paste on some clients)
    • Added BNB price in summary status message
    • Fixed orders' type icon in /removeorder conversation and added list of orders at order selection step.
    Source code(tar.gz)
    Source code(zip)
  • v0.4.5(Jun 14, 2021)

    This released focused on ironing out a few bugs that were discovered.

    Fixed:

    • A bug was present when the configurable monitor_interval was set to a value not divisible by 5. https://github.com/beeb/pancaketrade/issues/9
    • The config's RPC-URI validation regex did not accept URIs without a port number https://github.com/beeb/pancaketrade/commit/45a24e270a43ebe5b55442f639a9313fd39c5189
    • When an token returns a zero price, due to not having a PcS LP or the LP being empty, creating and order would spam messages in the chat every monitor_interval seconds. This message is now only logged in console. https://github.com/beeb/pancaketrade/commit/db5d03d7e58bd48076d2dda9abf715a817edb06e
    • The prompt for the wallet's private key, when not defined in environment, was displaying the now removed wallet address config item, resulting in a cyclic dependency. This has been fixed. https://github.com/beeb/pancaketrade/commit/08f1b985f2daf7e685140ddf74623e4a75c63833
    • There was a division by zero error when user edits effective buy price for a token that has zero balance https://github.com/beeb/pancaketrade/commit/2687e8bef20d89b66c9ca42610cdd699f6ce525f

    Modified:

    • The python-telegram-bot library dependency has been upgraded to latest
    • Added emojis to the buttons for order type selection and display https://github.com/beeb/pancaketrade/issues/4#issuecomment-859256552
    Source code(tar.gz)
    Source code(zip)
  • v0.4.4(Jun 3, 2021)

    This version includes the following changes:

    • The summary status message now includes the wallet's BNB balance, total balance of tokens in BNB, and the sum of both
    • The status messages have been optimized to make fewer network requests, thus being overall faster now
    • The way the bot handles transaction receipts has been improved, to use the event data defined in the ABI for each contract (this is used to extract the amount of received tokens/BNB).
    • The config file doesn't include the wallet address anymore, as it can be inferred from the private key which is anyway provided. You can remove the wallet item in your config file. This item, as well as bscscan_api_key, are deprecated and will raise an error in version 1.0.0.
    Source code(tar.gz)
    Source code(zip)
  • v0.4.3(Jun 1, 2021)

    This version now adds automatic docker builds. Refer to the Readme for instructions on how to run this bot using docker.

    A bug was also fixed, whereby the effective buy price after a transaction was not shown in the token status message until another order was added to that token, or the bot was restarted. This is now fixed.

    Source code(tar.gz)
    Source code(zip)
  • v0.4.2(Jun 1, 2021)

    This version fixes a critical bug where status messages would not update anymore.

    Links to Poocoin, Bogged and Dex.Guru charts are now displayed for each token.

    Source code(tar.gz)
    Source code(zip)
  • v0.4.1(May 31, 2021)

    IMPORTANT MIGRATION NOTE

    If you are updating from 0.3.x, please note that you need to move your config.yml and pancaketrade.db files inside the new user_data directory before starting the bot. This was done in preparation for the release of docker images.

    This version comes with a few very nice changes:

    • Added missing /sellall command to the commands list dropdown
    • Prepared files for future docker release, please don't use yet as it's not been thoroughly tested
    • Approval requests now check proper gas limit estimate before submitting transaction (in the past, a hardcoded value was used)
    • Revamped /edittoken command to have a branching flow instead of linear.
    • Added option to manually edit the effective buy price for each token, via the /edittoken command. Can be calculated from BNB amount or directly input as price value (https://github.com/beeb/pancaketrade/issues/2)
    • Total value of all tokens is shown in the last message of the status command.
    Source code(tar.gz)
    Source code(zip)
  • v0.3.0(May 26, 2021)

    This version adds price tracking to the bot (https://github.com/beeb/pancaketrade/issues/2).

    When making a buy order, the effective buy price (after tax) gets saved together with the token record in the database. In the status message, the effective buy price, as well as difference to current price (in percent), is shown, allowing to see if the position increased or decreased since buy.

    When a sell order is made, this price is not changed. However, if a second buy order happens, a weighted average between the new effective price and old effective price is calculated and replaces the old price.

    Source code(tar.gz)
    Source code(zip)
  • v0.2.4(May 23, 2021)

    This update and 0.2.3 from earlier today improve and normalize the token amounts rendering.

    What's more, BscScan API is no longer needed as the script now uses local default ABIs for all contracts. This should be faster and more reliable. We only use a couple of functions for tokens and these are defined in the BEP-20 token interface so all tokens should have them implemented. This makes it seamless to interact with proxy contracts also.

    If you have the bscscan_api_key entry in your config file, you can remove it now.

    Source code(tar.gz)
    Source code(zip)
  • v0.2.2(May 22, 2021)

    The auto-approval process is now smarter. If a buy order is placed, the tokens are first bought, then the wallet is approved for selling. If a sell order is placed while the address is not yet approved, it's mandatory to approve first, before selling.

    This is only done once per token and per pancakeswap version. The process is smart and only approves on the version that will be used for selling at the best price (when both versions are available).

    Added "Buy/sell now" and "Create order" buttons to the "Token added" confirmation message, for even faster buy after adding a new token.

    Source code(tar.gz)
    Source code(zip)
  • v0.2.1(May 21, 2021)

  • v0.2.0(May 21, 2021)

    Version 0.2.0 brings a lot of small changes to how interaction works:

    Added:

    • Command to edit token icon and default slippage

    Fixed:

    • Incorrect BNB output after sale due to multiple withdrawals within one function was fixed. Now only considering the last "Withdraw" call.
    • Added missing order ID in order creation confirmation message

    Modified:

    • Removed 10 or 5 minutes timeout on conversations. Conversations now persist as long as the bot runs. Restart removes all ongoing conversations.
    • Inline buttons are now only shown on the last status message to make the list more compact
    • All commands now ask for the token to use in the first step.
    • After a successful transaction, the order that was deleted in shown before the output amount is displayed. This way, the last message is the transaction outcome.
    • Red and green icons for orders in the status messages are now displayed next to the order type. A more discreet transaction icon is shown at the start of each order line to indent them
    • Better instruction when the command /order is used with missing argument
    Source code(tar.gz)
    Source code(zip)
  • v0.1.6(May 19, 2021)

    This version adds a new command /buysell as a shortcut to the various "Buy/sell now..." buttons on each token status message. The command shows a list of buttons with all tokens.

    When creating an order, the amount of tokens to sell or BNB to use for buying can be specified in percentage of the balance when using the % symbol as a suffix.

    The LP selection code had a problem where tokens with a small amount of liquidity (as defined in the config file) returned a price of zero instead of forcing the use of whatever liquidity is available. This has been fixed.

    A new config item update_messages allows to turn on periodical update of status messages (currently every 15 seconds).

    Source code(tar.gz)
    Source code(zip)
  • v0.1.4(May 19, 2021)

    This version adds the /addorder and /address commands.

    • /addorder: allows to start order creation process for any token. The first prompt asks for which token, the rest of the process is identical to clicking one of the "Create order..." buttons.
    • /address: used to get the contract address for a token, which needs to be selected in the first prompt. The address can be copied to clipboard by simply clicking/tapping on it on most Telegram clients.

    Some UI improvements, orders for a token are now sorted by activation price.

    Source code(tar.gz)
    Source code(zip)
  • v0.1.3(May 18, 2021)

    This version adds the option to input the limit price for an order as a multiple of the current token price.

    This is useful when creating orders just after buying, to sell at a given profit target.

    Example: the token price is 0.01 BNB per token. The user inputs 2.5x as the limit price. The order will activate when the price is 0.025 BNB per token.

    Various improvements to the message formatting.

    Source code(tar.gz)
    Source code(zip)
  • v0.1.2(May 18, 2021)

    This version now correctly handles gas price estimates for swap transactions.

    The script now also uses swapExactTokensForETHSupportingFeeOnTransferTokens and the reverse equivalent if possible, and falls back to swapExactTokensForETH if gas price estimation fails.

    Source code(tar.gz)
    Source code(zip)
  • v0.1.1(May 18, 2021)

  • v0.1.0(May 18, 2021)

Owner
Valentin Bersier
Valentin Bersier
A Pancakeswap v2 trading client (and bot) with limit orders, stop-loss, custom gas strategies, a GUI and much more.

Pancakeswap v2 trading client A Pancakeswap trading client (and bot) with limit orders, stop-loss, custom gas strategies, a GUI and much more. If you

null 571 Mar 15, 2022
Andrei 1.4k Dec 24, 2022
A python API for BSCScan (Binance Smart Chain Explorer), available on PyPI.

bscscan-python A complete Python API for BscScan.com, available on PyPI. Powered by BscScan.com APIs. This is a gently modified fork of the etherscan-

Panagiotis Kotsias 246 Dec 31, 2022
Aio-binance-library - Async library for connecting to the Binance API on Python

aio-binance-library Async library for connecting to the Binance API on Python Th

GRinvest 10 Nov 21, 2022
Web3 Ethereum DeFi toolkit for smart contracts, Uniswap and PancakeSwap trades, Ethereum JSON-RPC utilities, wallets and automated test suites.

Web3 Ethereum Defi This project contains common Ethereum smart contracts and utilities, for trading, wallets,automated test suites and backend integra

Trading Strategy 222 Jan 4, 2023
VoiceMaster-Discord-Bot - Fork from original Discord bot with max channel limit, staff role and more

VoiceMaster VoiceMaster is a discord bot created to change the way servers work,

null 2 Feb 28, 2022
Tools for use in DeFi. Impermanent Loss calculations, staking and farming strategies, coingecko and pancakeswap API queries, liquidity pools and more

DeFi open source tools Get Started Instalation General Tools Impermanent Loss, simple calculation Compare Buy & Hold with Staking and Farming Complete

Juan Pablo Pisano 467 Jan 8, 2023
The smart farm is an idea that designing Smart Farm by IoT

The smart farm is an idea that designing Smart Farm by IoT. Using Raspberry Pi 4 detect the data from different sensors(Raindrop sensor and DHT22 sensor), and push the data to Azure IoT central.

Jiage 1 Jan 11, 2022
A slack bot that notifies you when a restaurant is available for orders

Slack Wolt Notifier A Slack bot that notifies you when a Wolt restaurant or venue is available for orders. How does it work? Slack supports bots that

Gil Matok 8 Oct 24, 2022
Fetch tracking numbers of Amazon orders, for the ease of the logistics.

Amazon-Tracking-Number Fetch tracking numbers of Amazon orders, for the ease of the logistics. Read Me First (How to use this code): Get Amazon "Items

Tony Yao 1 Nov 2, 2021
Quickly and efficiently delete your entire tweet history with the help of your Twitter archive without worrying about the pointless 3200 tweet limit imposed by Twitter.

Twitter Nuke Quickly and efficiently delete your entire tweet history with the help of your Twitter archive without worrying about the puny and pointl

Mayur Bhoi 73 Dec 12, 2022
A Discord bot to allow people to create lists of random characters, with limit reroll options.

Mugen Bot A small bot I made to practice python and allow people to publically select random characters on a discord server. Uses py-cord, as that is

Haley 2 Feb 6, 2022
Defi PancakeSwap bot is programmed in Python to buy and sell tokens in seconds once the target is hit.

Defi PancakeSwap BOT A BOT that will make easy your life in Trading. Watch tutorial on Youtube Table of Contents About The Project Built With Getting

Zain Ullah 208 Jan 5, 2023
Basic Python3 request wrapper for the PancakeSwap API

?? Python Pancakes ?? A simple request wrapper for the Pancake-Swap API. Installation Install package # Using pip $ pip install pythonpancakes # Or f

Scott Burlovich 30 Nov 20, 2022
Web3 Pancakeswap Sniper & honeypot detector Take Profit/StopLose bot written in python3, For ANDROID WIN MAC & LINUX

Pancakeswap BSC Sniper Bot web3 with honeypot detector (ANDROID WINDOWS MAC LINUX) First SNIPER BOT for ANDROID with honeypot detector Web3 Pancakeswa

HYDRA 1 Dec 23, 2021
Web3 Pancakeswap Sniper & honeypot detector Take Profit/StopLose bot written in python3, For ANDROID WIN MAC & LINUX

?? Pancakeswap BSC Sniper Bot web3 with honeypot detector (ANDROID WINDOWS MAC LINUX) ?? ⭐️ ⭐️ ⭐️ First SNIPER BOT for ANDROID & WINDOWS with honeypot

HYDRA 2 Dec 24, 2021
Web3 Pancakeswap Sniper & honeypot detector Take Profit/StopLose bot written in python3, For ANDROID WIN MAC & LINUX

Web3 Pancakeswap Sniper & honeypot detector Take Profit/StopLose bot written in python3, For ANDROID WIN MAC & LINUX

HYDRA 3 Dec 27, 2021