Twitter Cryptoasset Trading Bot (TCTBot)

While pandemic-distancing, I’ve been spending a lot of time at home behind my computer.  Given that I haven’t written any code in probably close to a decade at this point, I decided to spend some of my available time relearning a programming language and coding up some simple projects.  The first of these projects is the Twitter Cryptoasset Trading Bot (TCTBot), written in Ruby.

TCTBot is a fairly simple Twitter bot what’s purpose is to poll its followers every day and determine from majority group vote whether it should BUY, SELL, or HODL (hold) some of its Bitcoin.  This is a little social experiment I’m running, to determine whether or not The Mob can successfully trade Bitcoin democratically.  To participate, all you need to do is follow the bot on Twitter and reply to its polls with your vote.

How the TCTBot Works

Unfortunately the Twitter API currently doesn’t support use of their really nice polling system, so for the TCTBot to poll its followers, it currently has to employ a more primitive method.  At this time, it simply posts a new vote prompt tweet each hour, and then at 5 minutes till the end of the hour it tallies the replies to that tweet and counts up the votes based on keywords found in the replies.  The keywords used to vote are BUY, SELL, or HODL.  The bot will count your most recent valid reply as your vote, allowing followers to change their minds over the course of the polling period and update their vote with a new reply should they so choose.  Multiple keywords in a single response will cause that response to be ignored.

Around mid-afternoon (United States) each day, once the bot has tallied the polling results, if the minimum number of votes (currently, 3) has been achieved then the bot takes the directed action.  If the vote is a tie in any way, the bot will HODL this cycle.  If HODL received the most votes, the bot will HODL and not make a trade this cycle.  If BUY or SELL received the most votes, the bot employs the Blockhenge Cryptomnio cryptoasset exchange trading gateway to BUY or SELL some Bitcoin on the BitStamp cryptoasset exchange.  The amount traded is determined by how confident the votes in favor of the trade were, so for example if 65% of the votes voted to BUY or SELL, the trade volume would be 65% of the available balance.

After placing an order or deciding to HODL, the TCTBot then posts the results of the trade and the bot’s new account balances after the trade has cleared.  At the top of the hour after the most recent polling period, the bot posts a new poll tweet.

Where to Find TCTBot

You can find the TCTBot live on Twitter at the username @TCTBot_BTC.  It has been initially funded with 0.5 BTC and $5000.00 USD, held and traded at BitStamp, however by the time you’re reading this it’s probable that the bot has already made some trades and those balances may be different.  Will you lend your voice to help the bot determine how it will trade?

The TCTBot code is open-source and available via Github.  You’re welcome to set up your own instance of TCTBot if you like, however keep in mind that in order for it to trade it requires a Cryptomnio account, or you’ll have to rewrite the trading code to interface with an exchange of your choice directly.  If you choose to use Cryptomnio, you’ll also need my ruby-cryptomnio gem.

Leave a Reply