Update to the Automated Trading Platform

Hey guys, I hope you all had a tasty Thanksgiving, and I hope everyone is looking forward to the holiday season. I thought it would be a great time to give an update that we’ve all been looking forward to concerning the automated trading platform that the team has been working on. There are a couple new features I would like to talk about.

Most notably, we found that adding a fourth state to the state machine allowed the system to respond more fully to perceived market trends. If  you remember I told you all last time about the math put forward by George Lane in the 1950’s – The Stochastic Oscillator.

As a reminder,


The algorithm at that time of the last post was largely built around buying and selling based on the relationship between %K and %D. However, I came to appreciate that %D is inherently a reflection of what is happening with %K because it’s a moving average of %K. Keeping this in mind, I shrunk the %K and %D buffers in order for them to be a more pure reflection of the current more short-term momentum (as opposed to a more traditional daily momentum that George Lane discusses). Our %D now being a reflection of what one could call a more instantaneous market trend, can be used to dictate commitments to our purchases based on market trends rather than pricing data.

Essentially the algorithm used now buys when %D is low (and increasing), then sells once %D starts to fall indicating a shift in the market trend. Shrinking the buffers allowed quicker reactions to these perceived trends. That’s where this fourth state comes into play. The algorithm won’t even consider selling after buying in while the momentum of the commodity’s value is increasing. This allows you to ignore noise in the price data that may have triggered a sale with a more traditional “trailing sale” algorithm. Once the engine senses that change in momentum the algorithm will still wait for a certain loss threshold to be met before selling the assets. Let’s consider the following graph.



From November 22 to November 30 we see nothing but growth. Upon closer inspection however we see several dips in price during this growth spurt. A traditional trailing sale algorithm would have sold and bought back in several times along this period of growth racking up extra sales fees that the current algorithm avoids. Thus, now we capture more of the gains during this week of bitcoin data than we previously were. This new state is shown on the graph as yellow. That’s why the graph will often go back and forth between yellow and red before switching back to green indicating you’ve bought in, or it will often go back and forth between green and yellow before switching back to red indicating that you’ve cashed out. This yellow phase is something we’ve been referring to as ‘a honing phase’ as in a missile honing in on it’s target. The engine has sensed a market trend and is now using new rules to dictate when a sale or purchase will occur.

Let’s also take a look at just the last weeks worth of bitcoin data.


EMA_with_Trailing_Sale-217.632921319 (1)

Here we see another period of rapid growth being sensed by the engine triggering a purchase and eventually selling at a large profit as %D starts to plunge. Pretty exciting, right? If you include the last month of data on bitcoin you actually see an 88% return on investment – that actually beats the underlying market growth that the market yields in the same time frame. However, this system isn’t perfect. There can be false starts if you will in %D that cause a purchase that will result in a loss but if you note, we are exiting the market before sharper dives that would have caused a larger loss of profits. As an example of this see how late in the day on December 8th where it looks like the market might start to go back up before taking a sharp nose dive. We are exiting before what would have cost us nearly 15% of our total earnings thus far.

The team was curious what it would look like when we applied this engine and algorithm to the ethereum cyrptocurrency and we were quite pleased with the results. I must note, we did not have very dense data, and as this was only exploratory we did not have the time nor energy to create graphs for what could be considered an incomplete experiment. The only historical data that could be found on ethereum had pricing data stored every hour from the last two years. Obviously a period of 1 hour is not often enough for the nuances of these trends to be captured and reacted to appropriately but even so, the team saw a 1280% return on investment over the last two years. I don’t want to do the math for you, but often that is precisely why people read this blog so I will proceed anyways. At an investment of $10,000 in 2015 in just two years you could have seen a return of $128,000. You can extrapolate from there…

Now I know a lot of you crypto-nerds are thinking, why would you be excited by a 1280% return on investment when the market itself saw an increase of over 39000% in just the last two years. Well, that’s a very good question. And that question is what drives future work efforts regarding the trading platform. I will note the previous graph concerning the last week of bitcoin data that with the volatility of cryptocurrencies and many other commodities, we can see much of these returns disappear over night. Also worth mentioning is that the platform itself is automated. For not having to actually do anything, is the difference in the return on investment an insurance policy that can ensure peace of mind? That’s how we see it – this added safety in trading these commodities brings many of us great excitement.

This may be the last update on the trading platform for a while. The next steps in incorporating other currencies into the ring and perfecting the algorithm will be a time intensive process and require a large amount of work. In the coming weeks the team and I will be very busy with this and we will update you at an appropriate bench mark. I also, personally, have a lot of work on my plate concerning new projects that I am very excited to start working on. As always, thanks for reading, and I look forward to relaying your comments back to the team!




An Object In Motion Will Stay In Motion

As we watch with excitement the price of bitcoin tumble up and down I wanted to give an update on the cryptocurrency trading platform that I have been developing. I know, I know, there’s a lot of comments I haven’t responded to as of yet from the last couple weeks, but there’s been some breakthroughs on the platform I wanted to tell everyone about. Let me know what you think about the update, and as always thanks for reading.

After roughly the last three weeks of work the platform itself has reached a stable point in development. What we’re working with is an engine that can reliably look up the value of bitcoin on a loop, or be passed bitcoin values in a simulation using the past month of actual market data. In both of these cases selling and buying decisions are made according to an algorithm defined by the user and imported into the engine.

As development continues the scripts will create a graph to track the progress of different user defined algorithms. Currently the algorithm that performs the best over the amount of data we have involves the implementation of a slow stochastic oscillator. The slow stochastic oscillator method of investment and trading was developed by Dr. George Lane in the 1950s. The oscillator involves the tracking of two variables, referred to as %K, and %D.


In this case, %D is a moving average of the past three periods of %K. Where %K indicates the momentum of a commodity’s current value. To quote George Lane, who sums it up nicely, “Stochastics measures the momentum of price. If you visualize a rocket going up in the air – before it can turn down, it must slow down. Momentum always changes direction before price.” By this rule we can say when %K rises above the trend being observed in %D, one can predict a rise in the commodity’s value.

This with minor changes represents my user defined algorithm. Where the output graphs from a recent simulation can be seen below.


The red shaded areas on the graph represent periods where the user defined algorithm would have pulled the money out of the bitcoin market. The green shaded regions represent periods where the user defined algorithm would have bought into the bitcoin market. Note the relationship to the overlaid slow stochastic oscillator. At first this graph may look complicated, but the graphing library I use – plotly – allows for zooming in that scales the graph accordingly.


This second graph shows a rather profitable moment during the simulation. Thanks to plotly, when we zoom in on important moments in the simulation we’re provided a clear picture of what trends are being observed in the market and what the algorithm does in response.

All in all this approach is in some cases matching the growth of the market. As one might be able to tell from the graph the oscillator data isn’t very dense as its period is nearly twelve hours. Future work will involve decreasing that period to give the algorithm a better chance to respond quickly to emerging market trends. There’s a lot of work to go! Stay tuned for more updates!



Bitcoin Hits New High


Great news for bitcoin and cryptocurrencies. One of the projects that I am working on currently and want to bring some attention to is a bit of a spin off from my consultation work I did on an equity trading platform. I am working on retooling it to work for various cryptocoins. As of right now we have a great engine for conducting trades within a real time market or a simulated market using actual bitcoin price data to track performance gains for any investment kept. Currently the focus of my work has been on simulating different algorithms and tracking their performance. In this phase I will begin a fine tuning process for various attributes of these algorithms to further maximize their returns on investment. For some algorithms this is as simple as running a steepest ascent algorithm against the parameters used for decision making in the state machine. You can check out the work done so far in the projects section of the blog. More to come, stay tuned.

News source from CNBC.

Bitcoin price smashes through $6,300 to hit another record high

Bitcoin broke through the $6,300 mark for the first time late on Sunday to hit a new record high. The price of the cryptocurrency hit $6,306.58 just 10 days after first breaching the $6,300 handle. Investors appear to be shrugging off some of the negative news in the bitcoin world.


Machine Learning

An Endorsement

Hey everyone, I may not be the right guy to ask about machine learning lecture series, but I do know a thing or two about machine learning. And if you ask me, which you really didn’t, Professor Andrew Ng makes this a great course. The information is easily approachable and well presented. It’s also free and online! We can finally tell our parents we’re taking classes at Standford!