paint-brush
How I Built a Bot to Help Buy Doge or BTC When Elon Musk’s Tweets About Themby@krissanawat101
4,134 reads
4,134 reads

How I Built a Bot to Help Buy Doge or BTC When Elon Musk’s Tweets About Them

by krissanawat March 11th, 2021
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

How I Built a Bot to Help Buy Doge or BTC When Elon Musk’s Tweets About Them is simple. We are especially waiting for Elon Mush to tweet about some crypto-currency or company so that its value goes up in the market. There are two sides: server-side and client-side. Server-side sends the buy signal to the client when detecting the tweet containing some hint of Doge. Client-side works in passive mode. It waits for the signal from the server on Doge to analyze the info. Then finally, the client can decide on which coin to buy.

Companies Mentioned

Mention Thumbnail
Mention Thumbnail

Coins Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - How I Built a Bot to Help Buy Doge or BTC When Elon Musk’s Tweets About Them
krissanawat  HackerNoon profile picture

this post contains a lot of affiliate link because all tools that I recommend are necessary to run the bot and provide a simple indirect way to funding the project without charging end-user.

Now, we do not need to wait for Elon Musk to tweet something. We are especially waiting for Elon Mush to tweet about some crypto-currency or company so that its value goes up in the market.

Why don’t we create a bot that will analyze Elon Musk’s tweet and inform us about the tweet?

The bot is fairly simple. There are two sides: server-side and client-side.

The server-side works in active mode. It monitors Elon Musk’s tweet and sends the buy signal to the client when detecting the tweet containing some hint of Doge or Bitcoin word.

The client-side works in passive mode. It waits for the signal from the server on Doge or Bitcoin so that the client can analyze the info. Then finally, the client can decide on which coin to buy.

The exact interpretation of the client and server-side is demonstrated in the flow image below:

Roadmap

  1. Detect only Doge or Bitcoin words from the tweets. ( already done)
  2. Buy in the Future market. ( not done yet )
  3. Detect Doge and Bitcoin logo from the tweet image. ( on the way on train model)
  4. Perform sentiment analysis on the stock. only for people located in the USA that can use Alpaca or Robinhood. ( also not start yet that feature benefit only people in the USA may be kept on a paid plan)

If you have any Queries…

You can join our Facebook group and ask.

Now, if you want to start implementing the bot then follow the instructions provided in the steps below:

Setup Server for Client

In order to run the bot on a server, we require a cheap server. For that, I recommend Cloudways because they provide a 10$/Month VPS server.

The pricing plan is shown in the screenshot below:

First, we need to go to the registration page to sign up as shown in the screenshot below:

Then, we need to set the password as shown in the screenshot below:

After successful signup, we will be redirected to the dashboard screen. In the dashboard, we need to change the fields specifying Your Application, Your Server, Your project as shown in the screenshot below:

Then, we need to pick the Laravel as a server application as shown in the screenshot below:

Now to create a new server instance, we need to pick the server size and location as directed in the screenshot below:

Here, we can see how much we get charged hourly and monthly.

Next, we simply need to click on the LAUNCH NOW button as directed in the screenshot below:

The launch operation will take some time. Hence, we may need to wait for around 5 minutes for the setup process to complete:

After successful setup, we will get access to the server dashboard as shown in the screenshot below:

Next, we need to go to the Setting & Package menu and select the Advanced tab as directed in the screenshot below:

Now, we need to scroll down the same tab and enabled the Access Application VIA IP as directed in the screenshot below:

Lastly, we need to SAVE CHANGES as directed in the screenshot below:

Now, we need to go to set up our BOT. For that, we need to go to the Applications tab as shown in the screenshot below:

We can see our blank app below:

Now, we need to go to Deployment via Git from the sidebar as directed in the screenshot below:

Here, we need to click on GENERATE SSH KEY as directed in the screenshot below:

Register on GitHub to auto-update the bot

For this tutorial, I chose to host source code on GitHub. It will make the server easier to upgrade.

Also, make sure that you have a GitHub account. If you don’t, you can go ahead and Sign up as directed in the screenshot below:

The registration process is simple in GitHub, we just need to fill the credentials as directed in the screenshot below:

After successful registration with an email, we need to go to account settings and navigate to SSH and GPG keys tab as shown in the screenshot below:

Then, we need to hit the New SSH key as directed in the screenshot below:

Now we need to come back to Cloudways and click on the View SSH KEY tab. Here, we can get the SSH key and add it to GitHub. The exact location to get the key is shown in the screenshot below:

From the SSH KEY dialog, we need to copy the SSH KEY:

And then, we need to paste the SSH key to GitHub as shown in the image below:

Next, we need to come back to Cloudways and add the bot URL to [email protected]:krissnawat/elonbot_client.git

Then, we need to hit the PULL button as directed in the image below:

Now, if everything works fine then it means that the download was successful.

Now our next step is to set up the bot. For that, we need to have a Chrome extension called Secure Shell App. We can simply search for it in google from Chrome browser and add it.

After the successful installation, we can hit Launch App which will redirect us to the following screen:

Here, we need to paste the username and Server IP address.

But first, we need to know where to get these credentials.

For that, we need to go to our app as shown in the screenshot below:

If we navigate inside the app, we will see the credentials as highlighted in the screenshot below:

For now, we can connect and access the inside server as shown in the terminal screenshot below:

The terminal for the server is shown in the image below:

Now next quick thing is to run some commands in the terminal. We need to execute the composer install.

After the successful execution, we need to run nano .env command as shown in the terminal screenshot below:

Now inside the .env file, we need to update the database credential as highlighted in the image below:

Now, we need to head back to Cloudways dashboard where we need to locate the DB Name, Username, Password. We just need to copy and replace in the .env file:

When done, we need to hit CTRL+X to save as directed in the screenshot below:

Next, we need to execute the command shown in the snippet below:

php artisan migrate --seed

The exact execution of the command in the terminal is shown in the screenshot below:

Hence, we have completed the installation for now. We can access our app with URL in the Cloudways dashboard:

If we navigate to the URL, we will be redirected to the login page. But first, we need to register as directed in the image below:

We need to type in our credentials and hit the REGISTER button:

After successful sign-up, we need to perform the following task:

  • Find and create an API key and Secret Key on Binance.
  • Choose which coin that you need to buy.
  • Start bot.
  • Finally, we need to prepare USDT in the Binance wallet.

Creating Binance API key

First, we need to go to the Binance API Management page as shown in the screenshot below:

Then, we need to fill the key label as directed in the image below:

For security verification, you can use your own credentials:

Then, we will get the key as shown in the screenshot below:

Activate 2FA for secure our bot

In this step, we are going to activate the 2-factor authentication service to secure our bot.

For that, we need to head to the Profile tab as shown in the screenshot below:

Then, we need to enable the 2FA by hitting the ENABLE button:

To enable, it will ask you for your password which you can enter and hit the CONFIRM button:

Here, we must make sure not to forgot to save our recovery code for using Google Authenticator:

Now in order to log in, we will need to perform 2-factor authentication as shown in the screenshot below: