A quant fund manager + A HFT prop desk founder + A quant teacher = a session worth watching
On 9 April, we hosted Kelvin Foo, Dr Gaurav Raizada, and Vivek Krishnamoorthy for a workshop on Algorithmic Trading & Options Risk Management.
Watch the recording:
www.quantinsti.com/articles/algorithmic-trading-python-ai-options-risk-management-webinar/
.
. A quant fund manager + A HFT prop desk founder + A quant teacher = a session worth watching
On 9 April, we hosted Kelvin Foo, Dr Gaurav Raizada, and Vivek Krishnamoorthy for a workshop on Algorithmic Trading & Options Risk Management.
Watch the recording:
www.quantinsti.com/articles/algorithmic-trading-python-ai-options-risk-management-webinar/
.
. FREE PREVIEW! ** Decision Tree for Trading: https://quantra.quantinsti.com/course... **
In this section, we will code a classification decision tree model in Python. We will use the scikit-learn library which is a comprehensive Python library for creating machine learning algorithms.
The problem statement for our decision tree model is to predict the next day’s trend of the daily returns of a stock. Following are the steps involved in the process.
In this video, we will cover the first three steps.
Import the data
We will input raw data of a stock from a csv file. You can get raw data in csv format from different online sources. The data consists of Open-High-Low-Close prices and Volume data. Predictor and target variables are created using this raw data. Create and Define predictor variables and target variable The predictor variables which we need to create are Average Directional Index, Relative Strength Index, Simple Moving Average. To create these indicators, we will use the TA-Lib package that has the in-built functions for various technical indicators.
The target variable is the 1-day future returns. We will classify it in two labels 0 for negative returns and 1 for positive returns. We label the predictor variables as X and the target data label as y.
As you can see, we have defined certain time periods for each indicator. You can modify these numbers to say 7 days instead of 14 days and check the changes in model predictions. The dropna method is used to drop all the NaNs or missing data rows from the python dataframe df.
Split the data into train and test dataset
Before we build a decision tree model, we need to split the data set into train and test data. A decision tree model uses the train data to learn the properties of data and the test data to estimate the model’s accuracy of the predictions. We get the train and test data by splitting the feature matrix and target variable such that the training feature matrix, X_train and the target variable, y_train are the first 80% of the original dataset. The test feature matrix, X_test and the target variable, y_test are last 20%"
Class Weight
It is possible that our target variable has too many data points of a single class. For example, say, there are 100 of 1’s and 5 of 0’s in ‘y’, or too many incidences of positive returns and too few of negative returns. If this data goes into the model, our model would
not learn well, since it would get skewed data of more 1s than 0s.
To avoid this, we modify the train data using the class weight parameter. You can learn more about the same in the IPython notebook available in this section.
This concludes the video. In this video, we covered the first three steps.
Quantra is an online education portal that specializes in Algorithmic and Quantitative trading. Quantra offers various bite-sized, self-paced and interactive courses that are perfect for busy professionals, seeking implementable knowledge in this domain.
Find more info on - https://quantra.quantinsti.com/
Like us on Facebook: / goquantra
Follow us on Twitter: / goquantra