Algorithmic Trading with Visualization Interface

tldr; Trading algorithmically can be difficult. Visualization tools can help in system implementation, but may bear emotional stress after deployment.


So why are you trading algorithmically?

Because as a human I am an irrational being that makes choices due to curiosity and imperfect market knowledge.

Other reasons for developing:

1. To understand financial markets.
2. To debunk the crypto talk -- and to join in on the conversations at a local Bart train stop or Philz Coffee.
3. Visually see how the algorithmic trading program was executing trades. Also, charting libraries can be fun.

Technology Stack


What does this tool do? What problem does this solve?

The trading visualization tool allowed me to see recent trades, two trend lines, and a few more statistics around the market condition. One benefit to visualizing came early on in the development of the trading algorithm. I caught a number of human errors by being able to see each trade in real-time and the associated market conditions -- in my case the closing price and two simple moving averages. Without the visualization piece, I would have been lost in my search for bugs or worse missed a bug completely. The paper trading (simulated trading) phase was an order of magnitude faster given I was visually and programmatically confident in the system. 


Prior to building this tool, I looked around for modular trading frontends, however, came up short. There are a number of backtesting libraries including bt available which I used to select and optimize an algorithm to trade on. I chose a forty-four minute and four minute simple moving average to gauge where to enter and exit the ethereum market. This trading strategy is known as moving average crossovers. All trading was done through the Binance API. I spent a short period of time backtesting and turned my attention to the visualization portion.  

 Backtesting results for a number of simple moving averages. 

Backtesting results for a number of simple moving averages. 

Aside: Fundamentally I don't believe that algorithms are the answer to predicting future market states without access to proprietary information. Six days a week I believe in highly diversified positions. See Warren Buffet's recent $1M bet that he could beat major hedge funds by simply investing in the S&P500. However, today is one of the days I dabble elsewhere.

    The hard truth in numbers

    Initial Investment: $617

    Profit/Loss (human)*: -$34.15

    Profit/Loss (algorithm): - $107.86

    ROI*: -18.42%

    Market Baseline*: -6.36%

    * Profit/Loss (human) -- This includes bugs in my code that resulted in trades executed that weren't in line with the algorithms' intended criteria.
    * ROI: Calculated without human losses -- describing only the algorithmic trading results.
    * Market Baseline -- During the timespan of investing programmatically the market dropped 6.36%.

    Obviously, these weren't the results I had hoped for, but the process was a learning experience I don't regret. I met interesting people and used tools that I'll be coming back to in the future. Overall it was a ~$100 investment to begin to understand the psyche of a short-term trader, and markets they operate in.

    What I learned:

    • Losing money is easy, by contrast making money is difficult.
    • The barrier to enter traditional markets (not crypto) is higher than expected. Historical data engines such as Yahoo Finance no longer provide simple ways to enter these markets. This (potentially by design) allows a select few the ability to work efficiently in the markets. I'm excited about companies such as Quantopian for creating tools to make this easier for us novices.

    • You may only hear about the ones that made it in the industry. For each success story, there may be 10x the number of failures. Confirmation bias may reinforce this belief.  

    • Visualizing an algorithmic trading system might not be the best idea. As an emotional species watching a program buy and sell on your behalf isn't soothing. There were countless nights where I fell asleep thinking, "Hopefully, my algo hasn't lost all my money." This does not lead to a restful night sleep.

    Special thanks to my good friend Jed, who has recently taken to algorithmic trading. He was an inspiration to a number of the features and the initial design.

    If you would like to roast me for my noob trading algorithm please email me at

    everyone else can connect with me here.

    Brendon GeilsComment