Case Study
April 12, 2021

How Scottfree Analytics Applies Machine Learning to Financial Data

Scottfree Analytics combines the power of machine learning with financial data from IEX Cloud to help investors work smarter, not harder.

Cloud icon

Marc Conway

Scottfree Analytics combines the power of machine learning with financial data from IEX Cloud to help investors work smarter, not harder.

Introducing Scottfree Analytics and AlphaPy

Scottfree Analytics LLC is a creator of prediction algorithms for finance and gaming. Its mission is to develop advanced machine learning software for trading market strategies. Currently, we have an open-source product AlphaPy that leverages IEX Cloud for both real-time* and historical data.

AlphaPy is a machine learning framework for both speculators and data scientists. It’s written in Python mainly with the scikit-learn and pandas libraries, as well as many other helpful packages for feature engineering and visualization.

Here are just some of the things you can do with AlphaPy:

  • Run machine learning models using scikit-learn, Keras, xgboost, LightGBM, and CatBoost.
  • Generate blended or stacked ensembles.
  • Create models for analyzing the markets with MarketFlow.
  • Predict sporting events with SportFlow.
  • Develop trading systems and analyze portfolios using MarketFlow and Quantopian's pyfolio.

Check out AlphaPy in GitHub.

Applying Machine Learning to the World of Investing

Many traders spend their lives chasing the Holy Grail: a system that will make them rich simply by detecting common patterns and executing trades just by following a special recipe. Technical analysis often produces visually appealing charts, but there isn’t always statistical evidence that all the techniques actually work.

Once you conclude that there is no master algorithm, then you can move to the next level. Collectively, technical analysis is really just an infinite set of features to use in training machine learning models. Scottfree’s perspective is that all the systems you need have already been invented. It applies machine learning to decide which is the best system to trade with at any given moment.

Once the model is trained, all the trading signals are automatically generated, along with portfolio performance.

Drawdown periods

One system in action: This graph shows the top five drawdown periods, i.e., the amount of time it takes for a new portfolio high to be attained. For example, the top drawdown period lasted from mid-February 2020 to nearly the beginning of May 2020, when the portfolio rose to a new high.

Underwater plot

Another system in action: This graph is called an underwater plot because it shows the percentage decline in a portfolio over time. Here, the portfolio declined approximately 8% at its low before recovering to a new high, as shown in the first plot.

Feeding the Machine with a Financial Data Source

To ensure model continuity, there are two important components:

  • Model Training with access to historical financial data with depth,
  • Model Prediction (Scoring) that depends on continuous and reliable real-time data.

The challenge was to find a financial data platform that delivered on both promises, as we frequently had to switch providers because of consistency and latency issues. Since we maintain an open-source repo on GitHub, we searched for data sources and found IEX Cloud’s iexfinance package, created by Addison Lynch.

While many users integrate using the IEX Cloud API directly, the community creates and supports a range of third-party libraries, one of which is iexfinance. The migration to IEX Cloud was seamless because of three major factors:

  1. The API is clearly and fully documented.
  2. Free unlimited sandbox testing Deprecated made it easy for us to experiment with the API.
  3. With IEX Cloud, we can manage our plan all within a single subscription, rather than purchasing multiple plans at once.

For Scottfree Analytics, it was helpful to explore the IEX Cloud API by beginning with sandbox testing as provided in the API Docs. These sandbox endpoints return free testing data and are well suited for a Python starter program or some sort of sample project.

Eventually, you’ll want to abstract your starter code into a data management module like Scottfree did with AlphaPy here. Make sure that your API Token is configurable and not embedded in the code itself; you can find an example here.

Up Next from AlphaPy

As IEX Cloud expands into more instruments and adds new datasets, the plan is to also expand the capabilities of AlphaPy. Scottfree already aims to develop trading systems with machine learning for:

  • Cryptocurrencies
  • Forex and currencies
  • Commodities
  • Options

Scottfree Analytics is also developing an open-source language for feature engineering, where the trader will be able to define and compare market variables across all time frames. We resample the IEX Cloud data using “pandas” time series offsets and then apply AutoML (Automated Machine Learning) to discover the best trading models.

In the past, we always had to cross our fingers, hoping that our pipeline passed the data collection stage. We can now focus on building and maintaining the models themselves, as IEX Cloud has become an invaluable and trusted partner.

Marc Conway is the Lead Data Scientist for Scottfree Analytics and a contributor to AlphaPy. You can reach Robert or Marc at or telephone (567) 698-3889.
Scottfree Analytics was founded by Robert D. Scott II.

Find them on LinkedIn:
Robert D. Scott II
Marc Conway

*Real-time stock data from IEX Cloud is different from real-time data available via direct connection from IEX Exchange. Learn more.

IEX Cloud Services LLC makes no promises or guarantees herein regarding results from particular products and services, and neither the information, nor any opinion expressed here, constitutes a solicitation or offer to buy or sell any securities or provide any investment advice or service.

Still looking?

Have question about our platform and how to get started?