Book Image

Mastering Python for Finance

Book Image

Mastering Python for Finance

Overview of this book

Table of Contents (17 chapters)
Mastering Python for Finance
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Summary


A backtest is a simulation of a model-driven investment strategy's response to historical data. The purpose of performing experiments with backtests is to make discoveries about a process or system and to compute various factors related to either risk or return. The factors are typically used together to find a combination that is predictive of return.

While working on designing and developing a backtester, to achieve functionalities, such as simulated market pricing, ordering environment, order matching engine, order book management, as well as account and position updates, we can explore the concept of an event-driven backtesting system.

In this chapter, we designed and implemented an event-driven backtesting system using the TickData class, the MarketDataSource class, the Order class, the Position class, the Strategy class, the MeanRevertingStrategy class, and the Backtester class. We plotted our resulting profits and losses onto a graph to help us visualize the performance of our...