
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/
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.
Although you cant use the code of the Backtester, you have it incase you want to use it later.
I noticed during the filming I made some small mistakes, I have added the corrected versions in the resources.
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.