Skip to content
Edition NigeriaGlobal
Country

You are in the Nigeria edition. Type your country to switch.

Set up your profile

Financial Data Lab · Lesson 5 of 8

Lab 5: cleaning corporate actions in code

This lab adjusts a raw price series for a share split and a dividend in Python, using an adjustment factor applied to every earlier price, then checks the result: no false jump on the split date and a total return that matches a hand calculation. It also handles a ticker change by mapping old and new symbols to one identifier.

Advanced10 min read5 steps

This lesson is complete in writing. A video for it is on its way.

What you will learn

  • By the end you can build adjustment factors for a share split, a bonus issue and a cash dividend.
  • You can apply the factors in pandas to produce an adjusted close while keeping the raw prices unchanged.
  • You can check the result: no false jump on the split date and returns that match a hand calculation.
  • You can link a share's history through a ticker change using a permanent security identifier.

Key terms in this lesson

Adjustment factor
The number every earlier price is multiplied or divided by to remove the jump caused by a corporate action.
Corporate action
An event decided by a company that affects its shares, such as a dividend, bonus, rights issue or split.
Security identifier
A permanent code for a security that does not change when its ticker or name does, used to link price histories correctly through ticker changes.

Step 1 of 5

A crash that never happened

Opening this step…

Step 2 of 5

Building the adjustment factors

This step opens when you finish the one above.

Step 3 of 5

Applying the factors in pandas

This step opens when you finish the one above.

Step 4 of 5

Checking the adjusted series

This step opens when you finish the one above.

Step 5 of 5

Ticker changes and permanent identifiers

This step opens when you finish the one above.

Key takeaways

The key takeaways open when you finish every step.

Lesson quiz

6 questions. You need 85% to pass.

The quiz opens when you finish every step.

Read first

Stockertim Learn is education. It explains how investing works and never recommends buying or selling anything.

Up next

Financial data & analyticsLab 6: a sentiment classifier on…Read nowLab 6: a sentiment classifier on sample headlinesFinancial data & analytics · Advanced · 15 minFinancial data & analyticsLab 7: watching a model overfitRead nowLab 7: watching a model overfitFinancial data & analytics · Advanced · 15 minFinancial data & analyticsLab 8: writing the model card an…Read nowLab 8: writing the model card and a reproducible notebookFinancial data & analytics · Advanced · 15 minFinancial data & analyticsBuilding a three-statement modelRead nowBuilding a three-statement modelFinancial data & analytics · Advanced · 15 minAI at workAudience research with AIRead nowAudience research with AIAI at work · Intermediate · 15 minAI at workMeasuring AI-driven marketingRead nowMeasuring AI-driven marketingAI at work · Intermediate · 15 minFinancial data & analyticsCleaning data for splits, divide…Read nowCleaning data for splits, dividends and ticker changesFinancial data & analytics · Intermediate · 15 minStock marketstock splitRead nowWhat is a stock split?Stock market · Intermediate · 5 minFinancial data & analyticsSurvivorship, missing data, time…Read nowSurvivorship, missing data, time zones, calendars and currenciesFinancial data & analytics · Intermediate · 15 minFinancial data & analyticsLab 2: computing returns in codeRead nowLab 2: computing returns in codeFinancial data & analytics · Advanced · 15 minFinancial data & analyticsLab 1: reading CSV files in Pyth…Read nowLab 1: reading CSV files in Python and SQLFinancial data & analytics · Advanced · 15 minFinancial data & analyticsLab 3: plotting prices and returnsRead nowLab 3: plotting prices and returnsFinancial data & analytics · Advanced · 15 min
English