The Margin Whisperer
Automated margin monitoring across 30,000+ pricing combinations. Caught over $1M in leakage.
Nobody was watching the margins
At Shipbob, we were shipping thousands of packages a day across US fulfillment centers. Every shipment had a margin attached to it: what we charged the customer minus what we paid the carrier. Multiply that by dozens of carriers, hundreds of zones, and thousands of weight brackets, and you get roughly 30,000 pricing combinations.
The catch? Nobody was watching all of them. A carrier raised rates, a contract wasn’t updated, a pricing rule misfired. By the time anyone noticed, the damage was done.
Starting ugly
I didn’t start with a grand architecture. I started with a spreadsheet and a question: which shipments are losing us money right now?
The first version was a Python script that pulled transaction data from our SQL warehouse, compared actual margins against expected margins, and flagged anything that looked off. It ran on my laptop. It broke every other day.
But it worked. The first week, it surfaced a carrier rate change that had been silently eating into margins for two months. That single catch was worth more than my annual salary.
What I built
Once I had proof it mattered, I rebuilt it properly:
- A Python + SQL pipeline that ingested daily shipment data and computed margins at the transaction level
- A risk scoring engine that flagged high-risk combinations based on margin deviation, volume, and trend direction
- Alerting for the pricing team so they could act before losses compounded
- Dashboards giving leadership visibility into margin health across regions
The system scaled from one region to all US fulfillment centers. Other teams started asking for their own versions.
The numbers
- >$1M in savings identified through flagged margin leakage
- Pricing team could respond to issues in hours instead of weeks
- Scaled cross-region without needing a rewrite
- Awarded 4-Star Performer for leadership in pricing and analytics
Honestly, the hardest part
Getting people to trust the numbers. The pricing team had been doing things a certain way for years, and here’s this analyst telling them their margins were wrong. I spent as much time on data storytelling and stakeholder buy-in as I did on the Python scripts. Turns out the best automation is useless if nobody believes the output.