insideout Get Pro

09 · Plotting to think

Pro

Python for Market Data, lesson 9

Plotting to think

The few charts that catch most data problems.

You can build a backtest from a table of prices.

Part 1. Find what's wrong

A year of daily prices for one simulated stock, with four problems hidden in it, planted the way they turn up in real files. Pick a chart and tap where something's wrong.

Four problems in one fileLive

None of the four made pandas complain. Every number was a valid price and every date a real date. You found them because a picture shows shapes a column of numbers hides: a cliff, a spike, a flat stretch, a gap.

Stock split

When a company splits its shares, say 4 for 1, every share becomes four and the price per share drops to a quarter. Nothing of value changed. Data vendors provide split-adjusted prices that scale the history to match; research uses those, or the returns show a crash that never happened.

Your turn

A stock's return is +900% one day and −90% the next, and the price ends up back where it was. Most likely:

Real jumps rarely reverse exactly the next day. Times 10, then divided by 10, is the mark of a misplaced decimal point. A split would leave the price low and keep it there.

Part 2. Checks you can print

Keep going with Pro

You've done the first part. Pro opens the rest of this lesson, and every other one.

Still to come
  1. Checks you can print
  2. The charts, in code
  3. The same thing, for real

Python for Market Data overviewSpotted a mistake? Tell us.