Smartphone Trading Bot


This is a thread associated with the trading bot being developed by @Mike_Fishy and others at Mike Fishy and Automation System Programming (Bots).

About 9 months ago I built a smartphone “app” which notified me when specific cryptographic digital assets (CDA) reached my target BUY or SELL price. Alerts were sent out by Super Push notifications (overrides phone silent settings), email and SMS.

At the time I didn’t set up the system to actually trade the CDA’s automatically but having followed the bot thread I have now set up automatic trading. After each automatic BUY or SELL order is placed with a leading CDA exchange I receive a PUSH confirmation of the trade.

As shown in the configuration screen the app is currently in simulation mode so it doesn’t actually trade with the exchange. SHA256 cryptographic signature verification is used even for the simulated trades and live trading is enabled by clicking the LIVE button and entering a six digit PIN.

The main screen is shown below and covers the period just prior to the latest Bitcoin pump.

The app charts the data for moving averages and RSI which can also be exported as CSV files for further analysis in Excel etc.

The graphs are also available in landscape mode.

The short term RSI gave a good correlation of price movements as shown below.

The app runs on Android or iPhone but I am NOT an app developer.

Someone who sings is a singer, someone who runs is a runner so someone that uses the “Blynk easy iOT smartphone app builder” is a Blynker (hence my username). Other than using their app to build iOT projects I have no association with the company.

Links for the Blynk app in the Apple and Google Play stores are available from their website

I converted the PHP scripts provided in the bot thread to C++ and added the code to my original CDA price alerts projects. Added the API calls for actually trading and flashed a $3 WiFi enabled MCU with the C++ code.

The WiFi enabled MCU performs the trading calculations and acts as a bridge between my cloud server and my smartphone.

Once a project is built with the Blynk tools you simply generate a QR code image in the project and make it available to anyone that wants a clone of your project.

Some of the Blynk widgets like video streaming and GPS work without an MCU but as we need to perform the trading calculations it’s an essential part of the project.

Further updates in due course.

Mike Fishy and Automation System Programming (Bots)

Binance general API: as documented at

The general public can pull an enormous amount of CDA data from the Binance servers even without having an account with the exchange.

The basic allowance is 100,000 calls per day or a call every 1157 ms. For heavy duty data analysis Binance also provides Web Sockets Streams as documented at

For now we are working with the general API so pasting the following into a browser

Returns the latest Bitcoin price as:

Once you decide to enable your API keys on the Binance exchange you can move on to automated trading but ensure you follow all the recommended security warnings. By default enabling the API keys will not permit funds to be withdrawn via an API call.

This only offers a certain amount of protection though as we saw from the successful phishing attack on the exchange earlier this year. The phishing hack enabled / used API keys to trade a lesser known CDA without the account holders consent. This has the same effect as withdrawing your funds as the hackers can sell your CDA’s for next to nothing.

I have now added “one click” manual trading to the bot project. The option is off the bottom of the main page so it can’t be activated by mistake. Prior to using the feature you also have to follow the process of switching from simulated to live trades.

So if I see a trade set up that the bot hasn’t spotted or I simply wish to BUY / SELL a CDA I can trade with a single click. Might also be useful for people wanting to do their regular DCA buys.

For those following the “real” bot thread you will notice the manual trades are available before the trend analysis has completed i.e. as soon as you boot up the app. Also the ST RSI and MT RSI is available without waiting for LT trend analysis to finish. SMA and MMA could also be processed prior to having the MMA data.

This leads on to my next task which is the “replay” / data harvesting / logging routines. If the MCU is connected to a PC it already provides a log as shown below (using Termite or similar).

The normal expectation is that the MCU operates in standalone mode, without a PC, so I am looking to add logging / data harvesting on the MCU. Hopefully this will be handled with SPIFFS (SPI Flash File System).

This is the latest QR code image for the project but you will also need our server details which are available via PM.


Very nice :smiley:

Staying Fishy


In my copy of the PHP bot script I have switched from serialize to json_encode (and from unserialize to json_decode).

Also changed data file name to data001.txt, which becomes /data001.txt in SPIFFS 8.3 file format (note 1 character for /).

This allows for “automatic” upload of the data to the MCU.

Reading about 12 minutes of data (which is only about 140 data points for each of the 430 tickers on Binance) from SPIFFS takes about 420 ms.