Blueprint for making $1,000,000 in cryptocurrency algorithmic trading

Yes, you read that correctly.

And no, not through a ponzi scheme, following a sleezy Telegram group, or some anonymous yahoo shilling delisted coins. Instead, this article will guide you in using data science methods powered by freely available data, and most of all your brain, to think outside the norms and build a very effective trading algorithm to predict price trends in alternative coins (altcoins).

When deciding when to puchase an altcoin, a common (and often naive) approach is to blindly hunt for technical analysis (TA) and/or fundamental analysis (FA) patterns in historical price data. To be honest, TA/FA can work, however, TA is widely subjective, and I personally can find “bull patterns” on just about any chart. And without understanding the meaning of why patterns form, the information is mostly useless in predicting future price trends. The process of charting stressed me out, because it seems only slightly better than just randomly picking a coin to invest in. Instead, I wanted a bombproof way to buy and sell coins for profit when I sleep, when I’m reading a book,, when I’m eating dinner, and when I’m doing anything other than looking at crypto.

So how can you make $1,000,000 in crypto passively? To start, we need to go back to the basics of what market exchanges represent: Economics 101, supply-and-demand. The higher a demand for a coin, the higher the price is driven. The more supply of a coin being sold, the lower the price goes. Simple concept right?

In my algorithmic trading research, I hadn’t seen anyone using a “supply-and-demand indicator. (Okay, maybe, RSI, could fall into this category? Maybe.) But more concrete, instantaneous “supply-and-demand” information is open and freely available, right? And directly available.

Orderbook visually illustrating the supply-and-demand of a coin.

Above is the orderbook (from Bittrex), that an average user crypto trader has seen many times, which visualizes the amount of available coins to purchase and sell at and surrounding the market price. Ok, nothing new here; onto the data science! Why not hook into this information and use it as an input feature set when building a Machine learned price trend prediction model.

Algorithmic Results

Before I outline the algorithm, here is the short of it. The TLDR. Read the below summaries if nothing else. I’m posted the “results” before the details because people don’t like to read. So if the results spike your interest, keep reading the rest of the article and walk away thinking of the opportunities.

Bull Market (December 2017) Summary

December of 2017 was pretty decent for altcoins. Maybe not all coins, and there were some more dips, but generally, it was pretty good month for cryptocurrency overall. Starting on December 1, 2017 through today (February 20, 2018), a 1.5 BTC investment in the below crypto algotrading algorithm of would have (and has) yielded 4.19 BTC in profit. That’s ~280% profit in a little under 3 months. The algorithm closed triggered 60 trades, averaging 20% profit on each trade.

Bear Market (January 1, 2018 — February 20, 2018) Summary

Counter to December, January and February 2018 were a little rougher. However, starting on Jan 1, 2018 through today (February 20, 2018), a 1.5 BTC investment in the below crypto algotrading algorithm of would have (and has) yielded 1.71 BTC in profit. That’s ~115% profit in a bear’ish market (however you define this past month and a half, I think we should agree it wasn’t a “great” month for altcoins). That profit only came from following the signals of the artificially intelligent (AI), machine learned (ML) algorithm outlined below.

(All buy sell results are shown below, so you can see this is not snake oil. Or tulips.)

Modeling a coin’s price trend from its order book

The entire success of this ML altcoin prediction algorithm is based upon ingesting the number of buys and sells for every coin on an exchange and building a low-resolution, quantitative bin for the ratio of outstanding number of buys to outstanding number of sells for each coin. Since historical order book data for coins doesn’t appear to be easily accessible, a custom crawler scraped order book information for each coin and stored the information for a period of 3 months — enough time to cover bear and bull activity for the majority of coins. The buy and sell information was binned into groups defined as the the ratio of buys to sells at 5%, 10%, 15%, 25%, and 50% surrounding the current price (see figure below).

Qualitatively, these ratios defines the supply-and-demand at any instantaneous moment for a coin within a range of the current price. One testable hypothesis is that coins with higher ratio vales around the 5% and 10% ranges may have more immediate price impact. Additionally, another testable hypothesis is that coins with a higher 25% and 50% ratio value may have more impact on longer term price gains. Both hypothesis are testable by building a machine learned model using these order book ratio ranges as model input features.

Machine learned model features

To properly build a machine learning model derived from the order book binned ratio data that was reflective of price increase, a model was trained to search for price trends for each coin using input features:

Market (Coin), Ratio 5%, Ratio 10%, Ratio 15%, Ratio 25%, Ratio 50%, 5 Minute Past Change (%), 15 Minute Past Change (%), 60 Minute Past Change (%), 60 Future Minute Change (%) (label used for training and validation)


Market (Coin): Symbol of the coin (categorical feature).

Ratio 5%: The normalized ratio of outstanding buy orders (in BTC) to outstanding sell orders (in BTC) within a 5% margin surrounding the current price. (Numerical feature).

Ratio 10%: Same as Ratio 5%, only within a 10% margin surrounding the current price. (Numerical feature).

Ratio 15%: Same as Ratio 5%, only within a 15% margin surrounding the current price. (Numerical feature).

Ratio 25%: Same as Ratio 5%, only within a 25% margin surrounding the current price. (Numerical feature).

Ratio 50%: Same as Ratio 5%, only within a 50% margin surrounding the current price. (Numerical feature).

5 Minute Past Change: The decimal percentage of the price change over the past 5 minutes. (Numerical feature).

15 Minute Past Change: The decimal percentage of the price change over the past 15 minutes. (Numerical feature).

60 Minute Past Change: The decimal percentage of the price change over the past 60 minutes. (Numerical feature).

60 Minute Future Change: The decimal percentage of the price change over the future 30 minutes. This is the label feature to be predicted by the model. (Numerical label).

Building the model

The models were built and trained using Microsoft Azure Machine Learning Studio (see figure below). The graphical interface made it really quick and simple to iteratively test training algorithms, and optimize parameters. (There’s my shameless Azure ML promotion — do with it what you will).

Data for 176 coins were trained independently using a boosted decision tree regression algorithm on data prior to December 2017. Arguably boosted decision trees can overfit models, however, in the given scenario, we are forward testing using new data that has never been seen by the model, and results are pretty decent (full results below). In addition, boosted decision tree training was vastly quicker than a neural network regression algorithm, with approximately the same test results. Wrapping each altcoin model into a trading bot, such as Freqtrade, will let the buys and sells run in the background as you go about your day.

Buy/Sell Signals from December 2017 — Present

Below is a fully transparent list of executed trades from December 2017 on.

So where is my $1,000,000 crypto bucks?

While there is absolutely no guarantee of where the crypto market will go (if there was, this post would be moot), the algorithm above has found some pretty striking profits by solely following buy signals triggered from the novel ML model. By only following the buy/sell signal from the above ML algorithm I found a 280% profit in 2.5 just months. Starting from 1.5 BTC, and compounding the profits every time a profitable trade is made yields $921,984 by October 2018. Now, its also important to note, that simulations and future forecasting as far as one year out assume no market influence and/or slippage; two assumptions that are known to be untrue, and at that point, this becomes a gedankenexperiment. However, given enough time, and if the value of BTC remains around $10,000 — $15,000 range, I see the $1,000,000 goal as very obtainable when using the ML in conjuncture with order book information to signal coins buys.

You don’t want to build it yourself

Ok, I understand that. And this post isn’t to give you a full how-to tutorial anyhow, but more to get you to think about cryptocurrency machine learning using non-traditional features, such as order book information, to connect real-world supply-and-demand to predict price trends. I don’t want to open source the code, but I have built this entire algorithm into a public facing API accessible to the world. Contact me on medium for more information.