On July 9, Lin-Manuel Miranda, the founding father of “Hamilton,” took his final bow in the title role of his hit Broadway musical. Other original cast members, like Leslie Odom Jr., who played Aaron Burr, also left the show after that performance and Daveed Diggs took his final bow within days. But the change in the cast was notable for more than matters of casting: It could well have been the high-water mark for demand for “Hamilton” tickets — and for profits reaped by ticket scalpers who make up part of what is known as the secondary market in ticket sales.

For most of May, the median price of a ticket on the secondary market was around $850. Between the Tonys and the July 9 performances, it pushed toward $1,600. Before Mr. Miranda’s announcement of his departure, ticket holders were offering a seat for the July 9 performance at an average of $2,700. With the news of his exit, the average asking price quickly climbed to $10,900 a seat.

Mind you, the average face value of a “Hamilton” ticket was $189.

The good news for fans of the show: With the cast departures, the resale price has dropped significantly and leveled off at around $700 a seat.

It’s difficult to get definitive sales information because scalping operates in the shadows. So to figure out just how much scalpers were making from “Hamilton” tickets, we created a database by collecting publicly available information on ticket prices on secondary market listings. We watched the ticket price history for each performance, for days and weeks and in some cases even for months.