31.07.2021 Views

Ultimate Algorithmic Trading System

Using automated systems for trading in stock markets

Using automated systems for trading in stock markets

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

disadvantages to dynamic typing and this is a subject of much controversy in the

programming arena.

Python is free and has a very large user’s group. The code is open source and free to

use in commercial and personal applications as long as the copyright information

is prominently displayed. Almost any question about how to do something in

Python can be answered by simply Googling it.

Python is perfect for our purposes. All the trading system tracking/bookkeeping/

analysis has already been programmed. All you need to do is use Python language

and the PSB tools to create the perfect mousetrap.

Python has no foo bar. Most other languages use the words foo and bar as variable

names in example code snippets. Their origination is from the military acronym

fubar and was probably first used at MIT. Python uses the words spam and

eggs instead. The creators of Python wanted it to be fun, so they named the

language after Monty Python, the British comedy group. Most people wouldn’t put

the words ‘‘fun’’ and ‘‘programming’’ together, but some of us would. Spam

and eggs come from Monty Python’s Flying Circus.

■ Python Installation

You will need to install Python on your computer before we can do anything. This is

another benefit of Python—it is very easy to install. Go to the website www.python

.org and click on Downloads. You will be provided links for different operating

systems. As of the writing of this chapter the latest version was 3.5. The PSB was

written in 3.4 and is upwardly compatible. Download the installer and run it. Just

click through the prompts—the default values will be fine. This installer should

install both IDLE (Python GUI) and Python (command line). If you are using a

Windows operating system, a folder with the Python programs and manuals will be

installed in your Apps screen. I use Classic Shell on my Windows 8 machine and

both applications flow to the Start menu. Of course, if you are using Windows 7, it

goes without saying you will find Python on the Start menu.

■ PSB Installation

Download the PSB.zip file from this book’s companion website (www.wiley.com/

go/ultimatealgotoolbox). Unzip it to your C: drive or to another convenient

location.

169

USING PYTHON TO BACKTEST YOUR ALGORITHM

IDLE

The PSB was programmed exclusively with IDLE, the standard Python development

environment. Its name is an acronym of ‘‘Integrated DeveLopment Environment.’’

www.rasabourse.com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!