top of page

September 24, 2018

Overview of Programming Languages

 

    If it is your first time learning about programming languages, the only thing you need to know is what a programing language is and what it looks like. If you already do, then skip to the information about Anaconda below. If you don’t read this page

​

    To give you an idea of what python looks like, consider a step in a cooking recipe.

 

    Pour oil in  bowl

 

    To convert this instruction from English to python, you would have a function (the action you're performing) that takes what you're pouring (the oil) and where you're pouring it (the bowl). So, in python, it could look something like this:

 

    pour(oil, bowl)

Overview of Anaconda​

 

    Most of the work we are going to do in the club will need some form of environment to work in. We will work with Microsoft Excel and Python. Python is a coding language that comes with many packaged libraries (collection of code that is easily called) which perform most of the things you will need to do with a single line of code. To use this language, you need to download it, and for that, we highly recommend Anaconda. Anaconda handles both the language and also helps with those libraries.

 

    To download Anaconda go to this link

Just click on the operating system you have and follow the installer. Check this box when you install Anaconda

Capture.JPG

Hypothetically you don’t need to check the box, but you will find your work extremely difficult if you don’t. If you missed it, just uninstall the program and try again, it won’t hurt anything.

 

Now that you have downloaded and installed you need something to edit it in

Overview of Atom

 

    Anyone who has used Python before may be used to using an IDE which will work fine for backtesting. For anyone new to Python we recommend Atom. Atom is a souped-up text editor. The main reasons we recommend Atom are:

 

    A) there are fewer options, so it doesn’t overwhelm you 

    B) it doesn’t try and do all the work for you (so you learn).

 

    Atom is my preferred work environment for just about everything because you can put almost everything on it from python to assembly and even a web browser! However, I’m getting ahead of myself. Let’s start by getting it on your computer. Follow the link below and hit download.

 

    https://atom.io/

 

     If you're going to do some research that will involve producing several graphs, tables, or charts, consider using Jupyter Notebooks. "The Jupyter Notebook is an open-source web application that allows you to create and share documents that contain live code, equations, visualizations, and narrative text. Uses include: data cleaning and transformation, numerical simulation, statistical modeling, data visualization, machine learning, and much more." Jupyter comes with Anaconda. So to access Jupyter, search your computer with the keyword "Jupyter" or open the Anaconda desktop application and usually, the first page you see when Anaconda opens up contains a button to open Jupyter. For more information visit 

 

    http://jupyter.org/

 

 

 

Overview of Backtesters

 

    There are plenty of backtesters available, but some can cost several hundreds or even thousands of dollars. Some of these backtesters are written in proprietary programming languages (easy languages) which can limit you from being able to test complex strategies. There are three main backtesters that we will use: Backtrader, Quantopian, and Excel.

 

  • Backtrader

    • Backtrader is a backtesting engine that you can run from your own computer. To use this backtesting engine, I highly recommend you download Anaconda and Atom first. The website and docs for backtrader can be found at https://www.backtrader.com/

    • Download backtrader at https://github.com/backtrader/backtrader

    • Once you have downloaded backtrader you will need to install it. run this line of code: pip install backtrader

    • Pros:

      • Very Fast

      • Event-driven (avoids a lookahead bias)

      • Can handle data from any financial market

      • Used by a few hedge funds for research

      • An active community forum for support

      • Well documented

      • Free

    • Cons:

      • Requires substantial knowledge of python to be used efficiently  and effectively

      • You must supply your own data to test on

  • Quantopian

    • https://www.quantopian.com/

    • Quantopian is a crowd-sourced hedge fund. They provide you with all the tools and historical data necessary to backtest your own strategies. Quantopian explicitly states that you own any algorithm you create. They do not have the right to look at your code unless you give them explicit permission to do so. If you decide to submit an algorithm for evaluation by Quantopian and they like it then they will allocate anywhere from $500,000 to $50 million and you receive 10% of profits The backtesting and research are performed in python.

    • Pros:

      • Free Data - historical pricing data and fundamental data for all stocks currently listed and previously delisted (avoids survivorship bias)

      • Premium data available i.e. sentiment data, earnings surprise data, etc.

      • Much easier to learn than backtrader. A beginner could learn to work effectively and efficiently in Quantopian if they spent an hour to a few hours each day learning for about three to four weeks

      • Active, highly academic, and professional forum for support

      • Excellent support from Quantopian Staff

      • Easy to follow tutorials

      • Extensive Documentation

      • Free to use

      • An excellent section with lectures about math and finance

    • Cons:

      • Very slow backtesting

      • Only supports equities, ETFs, and futures (futures can be difficult to test on)

      • Data only goes back to 2002 (this may not be enough data for long-term strategies)

  • Excel

    • Most people do not realize that its possible to backtest a strategy using Excel. In fact, David Harding, a billionaire investment manager, used an Excel spreadsheet to test trend-following strategies and run a hedge fund for several years.

    • Pros:

      • Easy to learn

      • Plenty of tutorials on the internet

    • Cons:

      • As a strategy’s logic becomes more complex, Excel becomes increasingly difficult to use

      • Must supply your own data

      • Must be purchased ($5-$10 with enrollment at A&M)

      • Possiblity of making mistakes while backtesting which could cause the strategy to appear much better than it actually is.

 

 

 

Important Libraries

    The two most useful libraries you will use for backtesting and research are Numpy and Pandas. We highly recommend going through the tutorials for Numpy and Pandas which will make your time spent performing research and backtesting much more productive. â€‹You can find out more information about these libraries at. Numpy and Pandas come with Anaconda

​

    http://www.numpy.org/

​

    https://pandas.pydata.org/

bottom of page