Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Python Trading Strategy in Quantiacs Platform

By Milind Paradkar

Algorithmic trading has seen great traction in recent years and the numbers of students, engineering graduates, and finance professionals looking to explore this lucrative domain has been growing exponentially with each passing year.

Are you among the ones looking to learn quant skills and also make money with your trading ideas? Let us explore the Quantiacs platform which allows one to create, run and implement your Python trading strategy. Quantiacs offers great earning opportunities for successful quants.

Quantiacs Toolbox

The Quantiacs toolbox is free and open-source. Quantiacs provides up to 25 years of free data for 49 futures and S&P 500 stocks. The toolkit allows the user to create a trading strategy and backtest it with data all the way back to 1990.  In addition to futures data, Quantiacs has recently added macro-economic data which can be used in conjunction with the price time series data to improve the trading algorithms. Quantiacs supports both Python and Matlab. In this post, we will explore the Python toolbox and illustrate a toy strategy using it.

Quantiacs Python Toolbox

Quantiacs has created a simple yet powerful Python framework which can be used to create different types of algorithmic strategies. It provides for defining trading system settings like loading market data, trading costs, custom fields, capital etc. Others features of the Python toolbox include evaluating the trading system, optimization, visualization of results etc. Let us explore some features of the Python framework here.

Loading the market data:

Quantiacs trades in both stock and futures markets. Here is what the data fields look like for a stock:


Source: Quantiacs.com

We can load the stock data in Python using the quantiacsToolbox.loadData function.

As can be seen, the data is in the form of a Python dictionary. Let us check the data type of the key-value pairs.

To create a Python trading strategy we will have to manipulate the numpy array and it is required that you have a good understanding of Python numpy arrays and the myriad functions that it supports. Here’s a list of some useful functions – https://docs.scipy.org/doc/numpy/reference/arrays.ndarray.html

Candle High-Low Python Strategy

Now let us take a very simple candle high-low strategy and try to code it using the Quantiacs toolbox. The step-by step process has been illustrated below.

Step 1: Define the Settings

We test our sample strategy on Apple Inc. (AAPL) and Amazon Inc. (AMZN) stocks. The backtest period is defined in settings[‘beginInSample’] and  settings[‘endInSample’]  variables. We also define the lookback days, capital and the slippage.

Step 2: Python Trading Strategy

We have kept our strategy simple. In the first step, we define the number of candles which represent the number of the previous prices that will be considered for generating a buy/sell signal. We then compute the price difference of the last ‘n’ candles. If all the price differences are positive we go short expecting a mean reversion behavior. If all the price differences are negative we go long.

The long position is indicated by the value 1, while the short position takes value of -1.

Step 3: Run the Strategy

To execute our strategy, we use the quantiacsToolbox.runts command and specify the respective Python file.

Step 4: Visualize the results

Upon execution, the Python framework displays a very informative chart which includes the markets, an option to select the exposure type, various performance metrics etc.

As can be seen the Quantiacs Python framework is easy to use and can be used to develop varied trading strategies.

Next Step

Quantinsti™ is hosting an exclusive webinar with Quantiacs, “Introduction to Machine Learning for Quantitative Finance” which will be held on Tuesday, 15th June 2017 (8:30 PM IST | 8:00 AM PST | 11:00 AM EST). The webinar will be conducted by Eric Hamer, Chief Technology Officer at Quantiacs.

Webinar participants will get to learn the various features of the Quantiacs toolkit, an overview of Machine Learning, applying machine learning to Futures data using Quantiacs, and will learn how to evaluate the results. Click here to Register for the exciting webinar.

The post Python Trading Strategy in Quantiacs Platform appeared first on .



This post first appeared on Best Algo Trading Platforms Used In Indian Market, please read the originial post: here

Share the post

Python Trading Strategy in Quantiacs Platform

×

Subscribe to Best Algo Trading Platforms Used In Indian Market

Get updates delivered right to your inbox!

Thank you for your subscription

×