Hackernoon logoHow I Built a Bot to Help Buy Doge or BTC When Elon Musk’s Tweets About Them by@krissanawat101

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

image
krissanawat  Hacker Noon profile picture

@krissanawat101krissanawat

React native Developer ,Coffee addict

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:

image

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:

image

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

image

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

image

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:

image

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

image

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

image

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:

image

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

image

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

image

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

image

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

image

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

image

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:

image

We can see our blank app below:

image

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

image

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

image

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:

image

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

image

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:

image

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

image

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:

image

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

image

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

image

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:

image

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.

image

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

image

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:

image

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

image

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

image

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

image

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:

image

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

image

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:

image

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

image

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:

image

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

image

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:

image

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

image

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.
image

Creating Binance API key

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

image

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

image

For security verification, you can use your own credentials:

image

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

image

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:

image

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

image

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

image

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

image

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

image

Tags

Join Hacker Noon

Create your free account to unlock your custom reading experience.