GithubHelp home page GithubHelp logo

phx / pancakeswap-quickstats Goto Github PK

View Code? Open in Web Editor NEW
10.0 2.0 3.0 16 KB

a set of command line tools for displaying your personal pancakeswap stats in the terminal.

License: MIT License

Python 100.00%
pancakeswap yieldwatch yield-farming cryptocurrency cryptocurrency-prices cryptocurrency-portfolio command-line command-line-tool script python

pancakeswap-quickstats's Introduction

pancakeswap-quickstats

This is a set of scripts that I wrote over the course of a weekend which will return PancakeSwap stats from the command line.

I was thinking about tweaking a local version of it to use BetterTouchTool in order to display some stats on my Macbook's Touch Bar, but I ended up writing a small shell script plugin for xbar that parses the output of cake.py and displays the output in my menu bar like so:

CAKE: [POOL YIELD] + [FARM YIELD] = [TOTAL YIELD] ([TOTAL PENDING USD])

This is one of the great benefits of being able to grab this data from the command line.

After searching high and low for a PancakeSwap command line tool, I was never satisfied with the results, so these two scripts are what I came up with.

UPDATE (2021-04-25)

cake.py may need to be updated to support the new LP token contracts after the recent PancakeSwap LP v2 token migration. It was a fun project to work on that allowed me to interact with smart contracts and query them directly, but watch.py is more reliable in the long run and automatically provides data for multiple farms and pools without having to manually program them into the script.

cake.py

I was looking for resources, and cake.py was the first script that I created. It interacts directly with smart contracts on the Binance Smart Chain and relies on the Coingecko API via a built-in python module. Some of the code was appropriated from another project I found, details below:

I found a Telegram bot that gives most of the relevant info I was looking for, but the developer was kind of a dick didn't want to share any tips on how to generate that info, and the bot was closed source because it is monetized.

Not to be confused with the Telegram bot referenced above, this originally started out as refactoring of the code from PancakeSwapInfo_bot, but instead of forking it, I just made this its own project since very little of the source code remained the same after I was finished.

That being said, PancakeSwapInfo_bot is still a good resource if you are looking to gain insight into multiple syrup pools and aren't worried about farm info. You just may have to do a little translation, because a lot of the code content is not in English.

Currently, this script only supports the CAKE syrup pool and the DFT/BNB farm info, but feel free to tweak as necessary to grab all of your relevant info.

watch.py

This is a script that only relies on the yieldwatch API. It offers a bit more informative data, and this one is scripted in a way that I think it should be able to work with multiple farms and pools straight out of the gate, but feel free to customize as necessary.

That being said, if you are just looking for results in the browser, yieldwatch.net is probably the best resource.

Installation and Usage

Replace the value of wallet_addr with your actual wallet address.

git clone https://github.com/phx/pancakeswap-quickstats
cd pancakeswap-quickstats
pip install -r requirements.txt
python3 cake.py
[OR]
python3 watch.py

Example Output for cake.py

====================================================
๐Ÿฅž CURRENT CAKE PRICE: $22.19
====================================================
DFT-BNB FARM:
----------------------------------------------------
๐Ÿ”น staked lp tokens: 8.552
๐Ÿ’ต pending cake rewards: 0.859 ($19.07)
====================================================
SYRUP POOL:
----------------------------------------------------
๐Ÿ”น staked cake: 3.775 ($83.77)
๐Ÿ’ต pending cake rewards: 0.073 ($1.62)
====================================================
๐Ÿฅž READY TO HARVEST: 0.932 CAKE ($20.69)
====================================================

Example Output for watch.py

============================================================
LP Farms Staking:
deposited: $303.04
yield: $23.24
total: $326.27
------------------------------------------------------------
name: DFT-WBNB Pool
current price: $23.87
harvested: 1.422 CAKE ($33.94)
pending rewards: 0.973 CAKE ($23.23)
total rewards: 2.395 CAKE ($57.17)
============================================================
Syrup Pool Staking:
deposited: $90.11
yield: $1.98
total: $92.09
------------------------------------------------------------
name: Cake-Cake Staking
current price: $23.87
deposited tokens: 3.775 Cake ($90.11)
harvested: 0.141 Cake ($3.37)
pending rewards: 0.083 Cake ($1.98)
total rewards: 0.224 Cake ($5.35)
============================================================
total deposited: $393.15
total harvested: $37.31
total yield: $62.52
break even: $330.63
pending rewards: $25.21
============================================================
current wallet balance: $27.98
============================================================

Contributing

Feel free to fork the repo and submit a PR, and I will merge it as soon as I get around to it.

This is all under the MIT License, so feel free to do whatever you want with it and use it however you see fit.

Change it up, redistribute it as your own, I don't care.

I just wanted to share my knowledge with the community.

pancakeswap-quickstats's People

Contributors

phx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.