Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering Python for Finance

You're reading from   Mastering Python for Finance Understand, design, and implement state-of-the-art mathematical and statistical applications used in finance with Python

Arrow left icon
Product type Paperback
Published in Apr 2015
Publisher Packt
ISBN-13 9781784394516
Length 340 pages
Edition 1st Edition
Languages
Arrow right icon
Toc

Table of Contents (12) Chapters Close

Preface 1. Python for Financial Applications FREE CHAPTER 2. The Importance of Linearity in Finance 3. Nonlinearity in Finance 4. Numerical Procedures 5. Interest Rates and Derivatives 6. Interactive Financial Analytics with Python and VSTOXX 7. Big Data with Python 8. Algorithmic Trading 9. Backtesting 10. Excel with Python Index

Designing and implementing a backtesting system


Now that we have an idea of designing a video game for creating a backtesting trading system, we can begin our object-oriented approach by first defining the required classes for the various components in our trading system.

We are interested in implementing a simple backtesting system to test a mean-reverting strategy. Using the daily historical prices from Google Finance, we will take the closing price of each day to compute the volatility of price returns for a particular stock, using the ticker symbol AAPL as an example. We want to test a theory that if the standard deviation of returns for an elapsed number of days is far from the mean of zero by a particular threshold, a buy or sell signal is generated. When such a signal is indeed generated, a market order is sent to the exchange to be executed at the opening price of the next trading day.

As soon as we open a position, we would like to track our unrealized and realized profits till date...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime