
download the link from below:
https://ln5.sync.com/dl/ca5764b70/t2u2wevm-p5i35vvr-6zc7th23-w3ght4ck
Some further links regarding the if __name__ == '__main__: statement.
- https://codefather.tech/blog/if-name-main-python/
- https://stackoverflow.com/questions/419163/what-does-if-name-main-do
Setting up the class for Cross Over backtester and setting up the constructor method.
Second part of the coding of the backtester. Creating the Handle data method. This method is designed to create the signals, and obtain the profits determined from each position created.
Third part of the coding of the backtester. Creating the Backtester mathod that recursively updates the necessary attributes to for the eventual final part of getting the results
Fourth and final lecture on the coding of the backtester class. Code provided in the resources.
Implementing the Cross Over strategy on a single ticker: Tesla.
Some useful links:
- https://stackoverflow.com/questions/21971449/how-do-i-increase-the-cell-width-of-the-jupyter-ipython-notebook-in-my-browser
- https://www.geeksforgeeks.org/python-sys-module/
Conduct a long-term backtest study of the Russell 3000 index versus SPY, exploring moving averages and exponential moving averages within a robust simulation pipeline and data quality checks.
Backtest a long term crossover strategy on an index and compare it with the S&P 500 ETF (SPY) over about two and a half years, showing 92% return.
Run and compare a simulation study of high volatility stocks versus low volatility stocks, assessing two-year returns against a buy-and-hold S&P 500 benchmark and visualizing distributions with histograms.
Hello everyone. Welcome to the last section of this course and to the introduction of this section. Please go through the reader and the referenced paper, it is a good guide where to start and how to things work in the Pairs trading literature. Also dont forget to add PART 3 to the already existing directories we have so far. Please make sure that all your directories are in order. Ofcourse, this is advice, if you have done things differently that is up to you :). Hope you enjoy, and please give me as much feed back as possible and lets start more discussions in the comment sections in any findings that you may have.
Set up data pipeline to backtest quantitative trading strategies by building a stock universe, filtering by high correlations, and using formation period with a squared distance metric to evaluate pairs.
Implement augmented filters with the ADF approach on a large stock-data dataset, check unit roots, model y with X, compute residuals, and identify stationary relationships via P-values and SSD.
Although you cant use the code of the Backtester, you have it incase you want to use it later.
define the orders class to track positions for each security, allocate capital via a target percentage, and support long or short entries with entry price for backtesting.
Develop and backtest an orders class, managing long and short positions, first trades, capital allocation, closing positions, price points, and profit calculations for quantitative trading.
Build the backtester package by inheriting from the oldest class to create an empty canvas for any trading strategy, implementing data handling, signals, and results.
Develop data handling in the backtester by implementing exponential moving averages and price data derivations, and compute the spread and z-score with normalization for signals and results.
I noticed during the filming I made some small mistakes, I have added the corrected versions in the resources.
Backtest quantitative trading strategies from scratch by exploring crossing over with short term and long term trends, moving day parameters, and signals in a notebook.
Once you have completed this Task send me your results to cemal.arican@gmx.com.
Remember this is a real assignment at a large trading institution. Hint: this outside the box, and improvise outside the classical pairs trading strategy. For example, rather a fixed standard deviation from mean, why not consider moving averages. From my own experience, short or long term averages work best i.e. 15 or 30 days, or, 125 to 252 days.
See: https://www.researchgate.net/publication/343981808_Bachelor_Thesis_-_Determining_Profitable_Pairs_Trading_Strategies_under_Cointegration
The essence of this course is a 'from the group up movement' type of course. You will be given a very large dataset with over 30 million rows of data of all tradable equities on the US stock markets from 2001 up until October 2021 - at daily intervals.
Having having said that, we will show how to build your own backtester step by step and apply it to two well known trading algorithms: Moving Average Cross Over strategy and Pairs trading. With a brief reader on time series is also provided in order to help understand some of the mathematical concepts behind pairs trading such as pairs unit root and cointegration.
Besides the implementation of the algorithms, we also look at large scale implementations of the algorithms using a pipeline which allows you to create a stock universe. Which is a class we will go over step by step as well. Moreover, we also look at
Finally we end this section with a take home assignment that is a real life example of an assignment at a trading firm using high frequency data, where data sort and cleaning has to be implemented, determining a cointegrated relationship and determining how you would trade these two instruments.