Python and The Baltimore Stockbroker

In this post we are going to use Python to explore the story of the Baltimore Stockbroker.

If you were in the fortunate position to have some money to invest and you received a series of letters through your door from a stock broker in Baltimore claiming to have a secret formula for making successful predictions about stock prices, you would be sceptical, right?

What if he backed up his claim by sending you 10 letters in the following weeks, each one successfully predicting whether certain stocks would rise or fall? After 10 successful predictions in a row, you might start to think this Baltimore Stockbroker guy was onto something…

Would you be right?

The Baltimore Stockbroker has become something of a classic tale for reasoning about probability. It illustrates some interesting concepts. One of these is the matter of other people’s perspectives.

From the perspective of a potential client who has received 10 successful predictions in a row, it certainly seems that the stock broker is doing better than mere chance, or even moderate competence would suggest. The result seems truly impressive.

Other people’s perspectives are different though. Imagine the stock broker initially sent 5000 letters (or more likely in the modern era, emails). A typical result would be that 2477 people received correct predictions after the first round. These 2477 are mildly impressed. The other 2523 people are not impressed at all, and probably either unsubscribe, or put all future correspondence in the bin…

Below is a short Python program to illustrate the Baltimore Stockbroker effect.

Python Listing for to Simulate the Baltimore Stockbroker Effect

# The Baltimore Stockbroker
import random

# At the start we can assume all leads are "convinced" since they have had no false predictions
convinced_leads = 1000  # Leads who have seen 100% correct predictions
num_campaigns = 2

for i in range(num_campaigns):
    results = random.choices([True, False], k=convinced_leads)  # k is the number of trials (with replacement).
    convinced_leads = results.count(True)
    print(f"{convinced_leads} people have received only correct predictions")

Sample output:

2477 people have received only correct predictions
1222 people have received only correct predictions
621 people have received only correct predictions
342 people have received only correct predictions
170 people have received only correct predictions
79 people have received only correct predictions
35 people have received only correct predictions
14 people have received only correct predictions
6 people have received only correct predictions
2 people have received only correct predictions

With 5000 initial leads and 10 rounds, in this instance there were just 2 people who received only correct predictions. However, these 2 are likely to be very impressed and could well be willing to pay a lot of money for future predictions. An unscrupulous stockbroker could even implement a sliding scale for different numbers of correct predictions. He or she might only need to repeat the whole process occasionally to make a comfortable living.

An interesting question from a mathematical point of view is how many “convinced leads” we can expect after a given number of rounds with an initial starting number. Since we are using a very simple model of 50/50 odds for a correct prediction, in this case we would expect the number of convinced leads to decrease in a logarithmic fashion (base 2). This is certainly something worth exploring if you are mathematically inclined.

The moral of the story: improbable things happen often.

Human beings are notoriously bad at statistical and probabilistic reasoning. It appears to be a systemic flaw built into our biology, so much so that even expert academics have been shown to consistently fail to give correct answers to certain non-intuitive problems. So another moral of the story could be:

Question your certainty when dealing with statistical and probabilistic understanding.

This whole business if discussed in detail in this excellent book by Daniel Kahneman. As an Amazon Associate I earn from qualifying purchases.


This article has explored the Baltimore Stockbroker effect using Python programming. I hope it has been interesting and helpful.

Sharing is caring!

Leave a Reply

Your email address will not be published. Required fields are marked *