← All lessons

Lesson 5 of 17Understand markets1 min read

Why does timing matter?

Separate noticing a price from acting on it.

The idea

A program does not receive information and act at exactly the same moment.

There is time between a market update, your program reading it, a decision, and an order reaching a venue. That delay is often called latency.

A small example

Imagine this sequence:

  1. A seller offers one unit at 101.
  2. Your program receives that update.
  3. Another buyer takes the unit.
  4. Your program tries to buy.

The offer at 101 may no longer be available. A test that automatically gives the program that old price would be making an assumption.

Try it

Draw four boxes: update → receive → decide → act.

Mark where the program first knows the price. Then mark where a fill could happen.

Check your answer

The program first knows the price when it receives the update. A fill comes later, if the order can execute.

For our first project, we will keep these steps separate and make the paper-fill assumptions visible. Next, you will build the simple measurement the program uses.