Backtest Your Trading Strategy With Binance Historical Data

2020-10-23

Key Takeaways:

  • Backtesting is a process of evaluating a trading strategy based on historical prices.

  • A successful backtest is typically evaluated for two key objectives: overall profitability and the amount of risk taken.

  • Traders use backtesting as a means of evaluating and comparing different trading strategies without risking capital

Binance Historical Data enables users to backtest, research and optimize crypto trading strategies and integrate them into the Binance ecosystem. 

Backtesting is the backbone of strategy development, and it is an essential tool in a trader's toolbox. A backtest, which is usually performed by reconstructing trades based on historical data, can give valuable information on how a trading strategy might perform in the future.

Before buying a car, you would consider factors such as the history of the brand, safety features, etc. And finally, test drive to see if the vehicle is a good fit for you. Ultimately, you want to know whether it is worth your money. The same principle extends to trading. 

What Is Backtesting?

Simply put, backtesting is a process of evaluating a trading strategy based on historical prices. 

Suppose you want to backtest how a simple moving average crossover strategy would perform on Bitcoin. To do so, you would need to gather Bitcoin's historical data and test the strategy's parameters. The backtest would assess which lengths of moving averages produce the best results based on Bitcoin's historical performance.

How Backtesting Works

Traders use backtesting as a means of evaluating and comparing different trading strategies without risking capital. If a backtest shows promising results, traders may have the confidence to deploy the tested strategy in real-time. 

While the market never moves precisely the same, backtesting relies on the assumption that markets move in similar patterns as they did historically.

A successful backtest is typically evaluated for two key objectives: overall profitability and the amount of risk taken. A backtest should also consider all trading costs. These can add up throughout the backtesting period and have a significant impact on a strategy's performance. Thus, traders should ensure that their backtesting software accounts for these costs.

4 Essentials of Backtesting in Crypto Futures Markets

1. Picking the Right Futures Market - Binance Futures offers a vast selection of crypto derivatives, each with varying characteristics. Certain crypto assets experience higher volatility than others but can produce higher returns and vice versa. Two assets with varying degrees of volatility will produce different backtest results. Therefore, you must ensure that your strategy's parameters match the crypto asset's underlying characteristics.   

2. Historical Data Covering Different Market Conditions - Market factors and major announcements often dictate the price of cryptocurrencies, including protocol upgrades, strategic partnerships, and even macroeconomic trends. This means market movements can be unpredictable and will not always behave in the same way. For instance, a backtest during the dramatic crash in March 2020 would yield different results to a backtest in a bull market. As such, traders need to assess trading strategies under various market conditions to understand how they perform.

3. Backtesting Platform - Many platforms provide the functionality to perform backtesting on historical data. Choose a platform that supports the markets you want to trade in and study the sources of market data it supports. Most backtesting platforms require users to have a basic knowledge of programming to code a backtest. Therefore, you must familiarize yourself with the native programming languages that are used on each platform. 

4. Benchmark Performance - Results from backtests should be assessed based on key performance metrics such as maximum profit vs. maximum drawdown, win/loss ratios, Sharpe ratio, etc. This enables you to compare one backtested strategy with another.

What Do You Need To Begin Backtesting?

Backtesting Software - There is plenty of backtesting software available on the internet. Some softwares are free to use but with limited capacity for backtesting. On the other hand, some softwares are paid but offers comprehensive and advanced features to support complex trading strategies.

Historical Data -Historical data is a critical component of backtesting, which can be used to simulate varying market conditions at different points in time. Historical data is divided into two types: Tick data and Order-book data.

What Is Tick Data and What Is It Used For?

Tick data refers to market data that shows the price and volume of every print. In crypto markets, professional traders use crypto futures tick data to analyze trading activity at its most detailed level. This means tick data displays each trade as it happens. Hence, transactions that occurred in a fraction of a second would be recorded and aggregated for analysis. Crypto futures tick data contains various useful information about each trade and the crypto futures market as a whole.

When tick data is incorporated into backtesting a strategy, it can realistically simulate market participants' buying and selling activities. Analyzing tick data may provide insights into trading behaviors that are usually not shown in a price chart. For example, large-volume trades may represent institutional investors, while small-volume trades may indicate retail-trading activity. 

Tick data can also be used as leading indicators for short-term price movements. For example, constant buying or selling activity within a narrow price range is often a precursor to a technical breakout of resistance or support levels.

What Is Order-book Data and What Is It Used For?

Order-book data contains all outstanding buy or sell orders for a futures contract, organized by price level. The order book shows the depth of liquidity there is in a particular market. Market liquidity is essential for high-frequency traders as it impacts transaction costs.

Order-book data is often used to better identify latency and slippage, thereby enhancing trading and operational performance. Order-book data shows the level of market liquidity present at any given time. A market that lacks liquidity will cause slippages and increase transaction costs. Additionally, it can be used to analyze slippage patterns at specific periods, especially in lull markets. 

Downloading Binance Historical Data 

Binance's Historical Data service provides an extensive collection of crypto futures historical data for all contracts, enabling you to backtest and optimize trading strategies. Users can access real-time and historical market data on all crypto derivatives products listed on the exchange. 

In one consolidated place, you will have easy access to all raw data, including tick data and order-book snapshots on both spot and futures markets. Binance Historical data is publicly available for direct download — not limited to API users only. However, order book data requires a whitelisted futures account and is downloadable by API.

We’ve also channeled more efforts to enhance the quality of data, for instance, our team has actively begun identifying gaps in past data (i.e order book data) and backfilling them. This allows users to accurately backtest with consistent and reliable data.

We provide derivatives data aggregations, including Candle data (via API), funding rate history, open interest, and trade volume for futures and perpetual futures contracts across multiple time periods. Binance also provides comprehensive consolidated developer documentation on Github.

Binance Historical Data Service is now available for spot and futures markets. For access, click on the link here to register! 

Read the following helpful articles for more information about Binance Futures:

Disclaimer: Crypto assets are volatile products with a high risk of losing money quickly. Prices can fluctuate significantly on any given day. Due to these price fluctuations, your holdings may significantly increase or decrease in value at any given moment, which can result in a loss of all the capital you have invested in a transaction.

Therefore, you should not trade or invest money you cannot afford to lose. It is crucial that you fully understand the risks involved before deciding to trade with us in light of your financial resources, level of experience, and risk appetite. If required, you should seek advice from an independent financial advisor. The actual returns and losses experienced by you will vary depending on many factors, including, but not limited to, market behavior, market movement, and your trade size. Past performance is not a guide to future performance. The value of your investments may go up or down. Learn more here