- Built with TelegramBots in
Java
- Track Coingecko Portfolio (create it here, copy the public address and save it in the bot with
/saveportfolio
, or delete it with/deleteportfolio
) - MongoDB Integration (save your coins buy price with
/save
,/delete
,/deleteall
and see their multipliers after have saved a portfolio) - Coingecko Trending coins with
/trend
command - Caching System
- Telegram Authorization
- Maven Build
- Dockerized image
- Deployable on VPS
- Full CI/CD Flow with Actions
- Withdraw funds/check chains/check balance/trade/deposit with Kucoin
- Command (to handle the Telegram commands)
- Singleton (to reuse objects and spare memory and for the caching system)
- Decorator (authorization check for some commands)
- Proxy (caching system)
- Flyweight (caching system)
- Facade (to hide Coingecko operations to build the portfolio)
- Factory (to create the right strategy)
- Strategy (to change behaviour based on add/delete/deleteall actions)
- Observer (to notify observers of a added/removed portfolio)
- Visitor (to validate commands)
To run the bot, you need to clone this prokect and define the following Environmental Variables:
TELEGRAM_BOT_NAME
= Ask BotFather in TelegramTELEGRAM_BOT_TOKEN
= Ask BotFather in TelegramMONGO_DB_URI
= Optional, To connect to MongoDB. Some commands requires this to be set, list is belowTG_ADMIN
= Optional, Telegram username of the owner, you have to set yours otherwise some commands will not be authorized. Check below for a full listCOINS_COLLECTION
= Optional, name of the collection of your saved coins, defaultcoins
PORTFOLIO_LINKS_COLLECTION
= Optional, name of the collection of your coingecko portfolios, defaultportfolio_links
KUCOIN_API_KEY
= Optional, set it if you want to use Kucoin functions. Create Kucoin KeysKUCOIN_SECRET_KEY
= Optional, set it if you want to use Kucoin functionsKUCOIN_PASSPHRASE
= Optional, set it if you want to use Kucoin functions
You can start the bot with the command docker-compose up --build -d
Then go to your instance of the Telegram bot and type /start
.
Go here and create a public portfolio, like in the image below:
Here is the list of commands that do not require authorization, so every user can run these commands:
/start
: welcome message/help
: lists of all available commands/trend
: shows Coingecko trending coins/<name of the saved portfolio>
: shows the list of the coins saved in the coingecko portfolio/chains
: it checks which chains are available for deposit/withdraw for a specific coin, for a specific platform/deposit
: it gives the deposit addresses, based on the platform specified and ticker
Here is the list of commands that require authorization, defined by setting the TG_ADMIN
environmental variable:
/save
: it saves a coin buy price, for example/save BTC 15000
. Prices are in $ so that they can be compared with the coingecko current prices, when you run the/<portfolio name>
command. (requiresMONGO_DB_URI
)/delete
: it deletes a coin buy price (requiresMONGO_DB_URI
)/saveportfolio
: it saves a coingecko portfolio, then you can fetch it by executing/<portfolio name>
(requiresMONGO_DB_URI
)/deleteportfolio
: it deletes a portfolio (requiresMONGO_DB_URI
)/prices
: it lists all saved coins' buy prices (requiresMONGO_DB_URI
)/withdraw
: it withdraw funds from different platforms. Right now only Kucoin is available/balance
: it checks balance for the specified exchange (platform)/trade
: it performs a buy/sell action, by specifying the type (limit/market), ticker, amount and optionally the limit price
First, you add your coingecko portfolio to the bot, like this:
After that, you can call the portfolio command to show coins present in the coingecko portfolio, with some additional information: