Make it do simple optimizations on multiple parameters, and you'll grow old waiting for the <zip> finish line. And I fully agree with Python being best for <faster base processing, traditional program syntax friendly, and better generalized programming>. Installing a Desktop Algorithmic Trading Research Environment using Ubuntu Linux and Python. By Michael Halls- Moore on October 1. In this article I want to discuss how to set up a robust, efficient and interactive development environment for algorithmic trading strategy research making use of Ubuntu Desktop Linux and the Python programming language. We will utilise this environment for nearly all subsequent algorithmic trading articles. I've also put together a video on You.
When testing trading strategies a common approach is to divide the initial data set into in sample data. Unzip the contain of the.zip file onto that new folder. Change the paths in the runShinyApp file to match your setings To run the app, you just have launch. Zipline is a Pythonic algorithmic trading library. It is an event-driven system that supports both backtesting and live-trading. Zipline is currently used in production as the backtesting and live-trading engine powering Quantopian – a free, community-centered, hosted platform for building and. In order to build the C extensions, pip needs access to the CPython header files for your Python installation. Zipline depends on numpy. You can then run this algorithm using the Zipline CLI. From the command line, run: zipline run -f dual Tube explaining the whole process, so if you prefer a visual medium, then you might want to take a look: To create the research environment we will install the following software tools, all of which are open- source and free to download: Oracle Virtual. Box - For virtualisation of the operating system. Ubuntu Desktop Linux - As our virtual operating system. Python - The core programming environment. Num. Py/Sci. Py - For fast, efficient array/matrix calculation. IPython - For visual interactive development with Pythonmatplotlib - For graphical visualisation of datapandas - For data . Pandas is designed for . Num. Py/Sci. Py running underneath keeps the system extremely well optimised. IPython/matplotlib (and the qtconsole described below) allow interactive visualisation of results and rapid iteration. Virtual. Box allows us to create a . This allows experimentation with Ubuntu and the Python tools before committing to a full installation. For those who already have Ubuntu Desktop installed, you can skip to the section on . Once Virtual. Box has been installed the procedure will be the same for any underlying host operating system. Before we begin installing the software we need to go ahead and download both Ubuntu and Virtual. Box. Downloading the Ubuntu Desktop disk image. Open up your favourite web browser and navigate to the Ubuntu Desktop homepage then select Ubuntu 1. Download Ubuntu 1. You will be asked to contribute a donation although this is optional. Once you have reached the download page make sure to select Ubuntu 1. You'll need to choose whether you want the 3. It is likely you'll have a 6. On a Mac OSX system the Ubuntu Desktop ISO disk image will be stored in your Downloads directory. We will make use of it later once we have installed Virtual. Box. Downloading and Installing Virtual. Box. Now that we've downloaded Ubuntu we need to go and obtain the latest version of Oracle's Virtual. Box software. Click here to visit the website and select the version for your particular host (for the purposes of this tutorial we need Mac OSX): Oracle Virtual. Box download page. Once the file has been downloaded we need to run it and click on the package icon (this will vary somewhat in Windows but will be a similar process): Double- click the package icon to install Virtual. Box. Once the package has opened, we follow the installation instructions, keeping the defaults as they are (unless you feel the need to change them!). Now that Virtual. Box has been installed we can open it from the Applications folder (which can be found with Finder). It puts Virtual. Box on the icon dock while running, so you may wish to keep it there permanently if you want to examine Ubuntu Linux more closely in the future before committing to a full install: Virtual. Box with no disk images yet. We are now going to create a new 'virtual box' (i. I've kept it at 5. Mb since this is only a . A 'real' backtesting engine would likely use a native installation (and thus allocate significantly more memory) for efficiency reasons: Choose the amount of RAM for the virtual disk. Create a virtual hard drive and use the recommended 8. Gb, with a Virtual. Box Disk Image, dynamically allocated, with the same name as the Virtual. Box Image above: Choosing the type of hard disk used by the image. You will now see a complete system with listed details: The virtual image has been created. We now need to tell Virtual. Box to include a virtual 'CD drive' for the new disk image so that we can pretend to boot our new Ubuntu disk image from this CD drive. Head to the Settings section, click on the . You will need to navigate to the Ubuntu Disk image ISO file stored in your Downloads directly (or wherever you downloaded Ubuntu to). Select it and then save the settings: Choosing the Ubuntu Desktop ISO on first boot. Now we are ready to boot up our Ubuntu image and get it installed. Note that on my Mac OSX, the host capture key is the Left Cmd key (i. You will now be presented with the Ubuntu Desktop installation screen. Don't panic about the . It does NOT mean that it will erase your normal hard disk! It actually refers to the virtual disk it is using to run Ubuntu in, which is safe to erase (there isn't anything on there anyway, as we've just created it). Carry on with the install and you will be presented with a screen asking for your location and subsequently, your keyboard layout: Select your geographical location. Enter in your user credentials, making sure to remember your password as you'll need it later on for installing packages: Enter your username and password (this password is the administrator password)Ubuntu will now install the files. It should be relatively quick as it is just copying from the hard disk to the hard disk! Eventually it will complete and the Virtual. Box will restart. If it doesn't restart on its own, you can go to the menu and force a Shutdown. You will be brought back to the Ubuntu Login Screen: The Ubuntu Desktop login screen. Login with your username and password from above and you will see your shiny new Ubuntu desktop: The Unity interface to the Ubuntu Desktop after logging in. The last thing to do is click on the Firefox icon to test that the internet/networking functionality is correct by visiting a website (I picked Quant. Start. com, funnily enough!): The Ubuntu Desktop login screen. Now that the Ubuntu Desktop is installed we can begin installing the algorithmic trading research environment packages. Installing the Python Research Environment Packages on Ubuntu. Click on the search button at the top- left of the screen and type . Double- click the terminal icon to launch the Terminal: The Ubuntu Desktop login screen. All subsequent commands will need to be typed into this terminal. The first thing to do on any brand new Ubuntu Linux system is to update and upgrade the packages. The former tells Ubuntu about new packages that are available, while the latter actually performs the process of replacing older packages with newer versions. Run the following commands (you will be prompted for your passwords). Note that the - y prefix tells Ubuntu that you want to accept 'yes' to all yes/no questions. Since we are installing our packages sitewide, we need 'root access' to the machine and thus must make use of 'sudo'. You may get an error message here. E: Could not get lock /var/lib/dpkg/lock - open (1. Resource temporarily unavailable). To remedy it just run . We will start by installing the Python development packages and compilers needed to compile all of the software. Once the necessary packages are installed we can go ahead and install Num. Py via pip, the Python package manager. Pip will download a zip file of the package and then compile it from the source code for us. Bear in mind that it will take some time to compile, probably 1. If you look in the terminal you'll see your username followed by your computer name. In my case it is mhallsmoore@algobox, which is followed by the prompt. At the prompt type python and then try importing Num. Py. We will test that it works by calculating the mean average of a list. Python 2. 7. 4 (default, Sep 2. However it has a few package dependencies of its own including the ATLAS library and the GNU Fortran compiler. We are ready to install Sci. Py now, with pip. This will take quite a long time (approx 2. Phew! Sci. Py has now been installed. Let's test it out by calculating the standard deviation of a list of integers. Python 2. 7. 4 (default, Sep 2. Since matplotlib is a Python package, we cannot use pip to install the underlying libraries for working with PNGs, JPEGs and freetype fonts, so we need Ubuntu to install them for us. Now we can install matplotlib. We're now going to install the data analysis and machine learning libraries pandas and scikit- learn. We don't need any additional dependencies at this stage as they're covered by Num. Py and Sci. Py. sudo pip install - U scikit- learn. We should test scikit- learn. Python 2. 7. 4 (default, Sep 2. This is an interactive Python interpreter that provides a significantly more streamlined workflow compared to using the standard Python console. In later tutorials I will outline the full usefulness of IPython for algorithmic trading development. While IPython is sufficiently useful on its own, it can be made even more powerful by including the qtconsole, which provides the ability to inline matplotlib visualisations. However, it takes a little bit more work to get this up and running. First, we need to install the the Qt library. For this you may need to update your packages again (I did!). Now we can install Qt. The qtconsole has a few additional packages, namely the ZMQ and Pygments libraries. Finally we are ready to launch IPython with the qtconsole. Then we can make a (rather simple!) plot by typing the following commands (I've included the IPython numbered input/outut which you do not need to type). In . We now have an extremely robust, efficient and interactive algorithmic trading research environment at our fingertips. In subsequent articles I will be detailing how IPython, matplotlib, pandas and scikit- learn can be combined to successfully research and backtest quantitative trading strategies in a straightforward manner. Michael Halls- Moore. Mike is the founder of Quant. Start and has been involved in the quantitative finance industry for the last five years, primarily as a quant developer and later as a quant trader consulting for hedge funds. Visit Michael's Linked. In Profile. Related Articlescomments powered by.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
October 2016
Categories |