A simple version of a Twitter bot checking CMC Market Data to return requested Coin's prices.
The list of Coins to retrieve is dynamic, and it will list everything accordingly after changing CryptoSlugstoretrieve
̀ just make sure to enter the Coin's Slug's seperated by ","!
This is a minimalistic implementation for a Bot that does 1 simple lookup and an according Post. This can be heavily expanded upon, for example by supplying an "easy" way to create a templatefile externally for easy edits, currently this template needs to be edited "in script"
Also I'm sure there are some edge cases I ignored for now =>
f.E what happens if a twitter message is longer than twitters char limmit?
What if CMC API Limit is reached?
How many requests will that take etc...
This Software is to take "as is"
Setup
sudo apt-get install python-pip python-py
̀pip install git tweepy requests
̀- Create API Key's for twitter on the Dev Portal https://developer.twitter.com/en/portal
- Create API Key on CMC https://developer.twitter.com/en/portal
sudo git clone [email protected]:MrCryptoT/Crypto_Pricebot.git
̀cd Crypto_Pricebot
̀sudo nano pricebot.py
̀python pricebot.py
̀- Remove the comment
̀#
̀ from thèapi.update_status(status=twittertemplate)
̀ Line at the end to "go live" and actually tweet out
Variables
CryptoSlugstoretrieve
List of all Coinnames to retrieve, Example => 'bitcoin,ethereum,mimblewimblecoin,compound'
convertto
Name of Coin to convert to (show price in) Example => 'USD'
slugorname
Set's Displaystyle of Coins, either their 'symbol' 'slug' or 'name' (Only in dynamic Template, manual template needs hardcoding)
seperatorstring
Is what's between the Coins Name and it's price in the template, by Default ' = '
timebetweentweets
Time between Tweets, by default 14400 in seconds
emotionthreeshold
= 10 #after what % should emojis change
coingeckoenabled
= True #accepts True or False
debug
= False
Credits
to ryanc20(https://github.com/ryanc20/crypto-twitter-bot/blob/master/crypto_bot_no_key.py) as I saw how easy such a small wrapper should be, although in the end no Code is copied (as they are the official tweepy API doc examples)