Prerequisites

This book is written for readers who have basic programming experience and a willingness to engage with mathematical concepts at an intermediate level. You do not need to be an expert in any particular domain — we develop specialized knowledge from first principles as it is needed. However, arriving with the following foundations will allow you to focus on the prediction-market-specific material rather than struggling with background skills.

Required Knowledge

Python Programming

You should be comfortable with the core features of Python. Specifically, you should be able to:

  • Declare and use variables of standard types (integers, floats, strings, booleans, lists, dictionaries).
  • Write functions with parameters, return values, and default arguments.
  • Use control flow structures: if/elif/else statements, for and while loops, and list comprehensions.
  • Define and instantiate classes with __init__, instance methods, and attributes.
  • Import and use modules from the standard library and from third-party packages installed via pip.
  • Read and handle files (opening, reading, writing, closing).
  • Understand error handling with try/except blocks at a basic level.

You do not need experience with advanced Python features such as metaclasses, decorators, or asynchronous programming. When we use these features in later chapters, we introduce them in context.

Basic Statistics and Probability

You should have a working understanding of the following concepts:

  • Probability fundamentals: the concept of a probability as a number between 0 and 1, the addition and multiplication rules, conditional probability, and Bayes' theorem at an introductory level.
  • Descriptive statistics: mean, median, variance, standard deviation, and how to compute them.
  • Distributions: a general awareness that random variables follow distributions (normal, binomial, uniform). You do not need to have memorized their formulas — we reintroduce them when needed.
  • Correlation: an intuitive understanding that two variables can be positively correlated, negatively correlated, or independent.

If you have taken an introductory course in statistics or probability at the university level, or worked through an equivalent self-study resource, you have sufficient background. We build substantially on these foundations in Chapters 4--6, where we develop the specific probabilistic tools used in prediction market analysis.

Command Line Comfort

You should be able to:

  • Open a terminal or command prompt on your operating system.
  • Navigate directories using cd, list files with ls (or dir on Windows), and run Python scripts from the command line.
  • Install Python packages using pip install.
  • Create and activate a Python virtual environment (we provide instructions in Chapter 1, but prior exposure is helpful).

Hardware and Software

You will need:

  • A computer running Windows 10 or later, macOS 10.15 or later, or a modern Linux distribution.
  • Python 3.9 or later installed and accessible from the command line. We recommend Python 3.11 or 3.12 for the best compatibility with current library versions.
  • A text editor or IDE of your choice. We do not prescribe a specific tool — VS Code, PyCharm, Sublime Text, Vim, and others all work well.
  • An internet connection for installing packages, accessing public prediction market APIs (in certain exercises), and downloading datasets.
  • At least 8 GB of RAM and 5 GB of free disk space. Some of the larger data analysis exercises in Parts III and IV benefit from 16 GB of RAM, but they can be completed with less by working with smaller data subsets.

Optional but Helpful

The following skills and knowledge are not required, but having them will make certain sections of the book more immediately accessible:

  • pandas and NumPy exposure: Parts III and IV make heavy use of these libraries. If you have used them before, you will move through the data-oriented chapters more quickly. If not, we introduce the necessary functionality as we go, but you may want to keep the official documentation open as a reference.
  • Basic finance concepts: An understanding of terms like bid, ask, spread, portfolio, and risk will help in Parts II and IV. We define all terms when we first use them, but prior familiarity reduces cognitive load.
  • Introductory machine learning: Chapters 16--18 and 35--36 use supervised and unsupervised learning techniques. If you have trained a classifier or regression model before, these chapters will feel natural. If not, we provide sufficient background to follow along.
  • Web development basics: Part V (Platform Design and Engineering) involves building web-based systems. Familiarity with HTTP, REST APIs, JSON, HTML, and basic JavaScript will be helpful. We introduce these technologies as needed, but prior experience accelerates comprehension.
  • Blockchain and smart contract awareness: Several chapters in Parts V and VI discuss blockchain-based prediction markets. You do not need to know Solidity or any specific blockchain framework, but a general understanding of what blockchains and smart contracts are will provide useful context.

Self-Assessment Checklist

Before you begin, use this checklist to gauge your readiness. If you can confidently check most items in the "Required" section, you are well-prepared. Items you cannot check represent areas where you may want to do brief supplementary reading — we suggest specific resources in Chapter 1.

Required Skills

  • [ ] I can write a Python function that takes arguments and returns a value.
  • [ ] I can create a Python class with an __init__ method and at least one other method.
  • [ ] I can use a for loop to iterate over a list and a dictionary.
  • [ ] I can use list comprehensions to transform or filter data.
  • [ ] I can install a Python package using pip and import it in a script.
  • [ ] I understand what a probability distribution is and can give an example.
  • [ ] I can calculate the mean and standard deviation of a small dataset by hand or with code.
  • [ ] I can explain conditional probability and apply Bayes' theorem to a simple problem.
  • [ ] I can open a terminal, navigate to a directory, and run a Python script.
  • [ ] I have Python 3.9 or later installed on my computer.

Optional Skills

  • [ ] I have used pandas DataFrames to load, filter, and manipulate tabular data.
  • [ ] I have used NumPy arrays for numerical computation.
  • [ ] I can explain what a bid-ask spread is in a financial market.
  • [ ] I have trained a machine learning model (e.g., logistic regression, random forest) using scikit-learn or a similar library.
  • [ ] I have built or worked with a REST API.
  • [ ] I have a general understanding of how blockchain transactions work.

If you checked all of the required items and several of the optional ones, you are in excellent shape to begin. If you are missing one or two required skills, consider spending a few hours with an introductory Python or statistics tutorial before starting Chapter 1 — the investment will pay dividends throughout the rest of the book.

Turn the page to begin Part I. Chapter 1 will orient you to the world of prediction markets and set up everything you need to follow along with the code.