Back in 2011, I was planning a one-month trip to the American Southwest. In the fall of 2012, I would land in Las Vegas and explore Utah, Arizona and California. What an exciting trip!
My goal was to camp most of the time, so two of my biggest expenses would be the flight and the car rental. I searched online for tips for finding the cheapest deals, but I ended up with mostly contradictory information.
Some blogs mentioned that airfare was cheaper on some weekdays (or during specific months), while others stated that prices were constantly fluctuating and that getting a good deal was just a matter of luck. I was more confused than ever, to say the least.
So this is when an interesting idea struck me - assuming that a price pattern did exist, could I discover it myself?
Web scraping to the rescue
Before going any further, I wanted to validate what I had read online. So I performed many manual tests using the leading travel search engines. It turns out that every piece of advice that I had read was dead wrong - the prices didn't seem to follow any of the predicted patterns. But I wondered, what if my handful of data points weren't enough to identify the so-called pattern? That was an interesting hypothesis!
Basically, what I wanted to know was when booking made the most sense, price-wise. And figuring out the when was equivalent to determining the number of days prior to the departure date before which I needed to book. Fortunately, I found a simple strategy to do that:
- Precompute every contiguous 4-week period of the year, starting from the beginning of each month (e.g. 03/04/2012-03/31/2012, 04/01/2012-04/28/2012, etc.).
- Every single day, retrieve the flight and car rental prices for each one of those 4-week periods, the departure date being the first one of each period (e.g. 03/04/2012, 04/01/2012, etc.). Also compute the number of days between the current date and the departure date.
- Accumulate this data over a sufficiently long period of time, by making sure that past periods are no longer taken into account. So on March 5th, it would no longer make sense to get any data about the period spanning from 03/04/2012 to 03/31/2012.
- Trace graphs showing the relationship between the flight and car rental prices and the number of days preceding the departure date.
- Connect to one of the leading travel search engines.
- Enter my departing airport (my city) and my arrival airport (Las Vegas).
- Enter the departure and return dates, based on the precomputed 4-week periods.
- Perform the flight (or car rental) search.
- Extract the cheapest price(s) from the results page3.
- Append whatever fields I needed to a CSV file (including the price, indeed).
- Redo the whole thing, until all date combinations were exhausted.
Finally, I let the thing run for about 1 year to ensure that I'd have enough data.
Some unexpected results
Once all the data had been collected, the real fun started. I opened the CSV file in Excel and I began tracing some graphs.
"Wow!", I told myself while looking excitedly at the preliminary results. There was indeed a very clear pattern in the data!
These graphs suggested that:
- Flight prices were consistently at their lowest of the year in the 80 days preceding the departure date. And approximately 10 days before the departure, prices considerably increased.
- Car rental prices were consistently at their lowest of the year in the 2 months preceding the departure date.
- There was no specific weekday that was preferable for booking a flight or renting a car.
- There was randomness in the data throughout the year - lows and highs seemed to generally happen unpredictably.
So assuming that these results were legit, I had just found an approach for getting the cheapest flights and car rentals for my specific destination. Quite an incredible finding, wasn't it?
But somehow, I grew sceptical - things looked a little bit too good to be true. After all, why was there such a clear pattern in the data4? I had no answer, but I knew that I had to put my findings to the test.
Booking my flight
Of course, I hadn't stopped my web scraper just yet - it was still running and accumulating data.
So in June 2012 (approximately 3 months before my planned departure in September 2012), I started monitoring flight prices that were being appended daily to my CSV file.
I knew that the cheapest possible flight to Las Vegas for a 1-month trip was 495$CAD (based on 1 year's worth of data). So all I had to do was wait until prices would get close to that.
Indeed, after only a few days, prices fell to 499$CAD. Fantastic! So I booked my flight immediately. Knowing exactly when to book definitely felt like magic.
Booking my car rental
Similarly to what I had done for my flight, I started monitoring car rental prices 2 months prior to my departure. Unsurprisingly, not long after, prices started to fall considerably, as my findings had predicted.
However, I had an additional challenge here - I didn't want to book with just about any company, because quality varies a lot and I didn't want to end up stuck somewhere in the southwestern desert. So I settled on which company I wanted to book with, accepting that I'd pay a little bit more to get the level of reliability that I wanted.
Believe it or not, but after a few trials and errors5, I was ultimately able to book a highly reliable car for 1 month for 851$CAD. How cool was that?
I continued monitoring prices afterwards and I was able to confirm that 851$ was indeed the cheapest possible price for that specific period of the year with that specific car rental company. Fantastic!
A startup, maybe?
My experiment had gone really good so far - when combined, I had saved hundreds of dollars on my flight and car rental.
This is when I wondered - could I make a startup out of it? There was definitely some potential, because pretty much everybody wanted to pay less for their trips. So I did a lot of research to discover what the market was like. It turns out that competition was ferocious and that profit margins were very thin in that industry.
Moreover, I realized that I was perhaps too late to the party - a researcher who had come up with a plane ticket prediction algorithm had just sold his idea to one of the leading travel search engines of the time. The novelty aspect of my idea suddenly disappeared, and I found the whole thing much less appealing - at least from a business perspective.
Finally, I wasn't really fond of creating a business out of web scraping - this was neither scalable nor sustainable. Instead, I'd have to make partnerships and pay for flight and car rental data.
So did I really want to pursue this startup idea? Not really.
But throughout the project, I found an even greater source of motivation - breaking the black box and finding the ultimate method for paying less. Honestly, the technical challenge was much more rewarding than saving a few hundred bucks.
Sure, I could have saved myself all this trouble by booking the damn trip like everybody else, with my fingers crossed and hoping to make a good deal. But where's the fun in doing that?
At the time, nobody expected - nor did I expect - that this project would actually become a stepping stone in my personal project journey.
Who could have known?
I say that web requests were performed roughly at the same hour because I included slight variations to make them appear authentic. ↩
For the car rental, I needed to extract the cheapest price for each car rental company. Quite obviously, I didn't know in advance which one I'd book my car rental with! ↩
Only the travel search engines themselves could really explain the existence of that pattern. I don't know if my results are replicable (I haven't tried), but I suspect that if I performed the same experiment today, I'd get similar results. ↩
One of the great things about car rentals is that you can generally cancel a reservation without any penalties. So whenever I found a slightly better price, I just canceled my reservation and made a new one with the same company. ↩
Besides, it was my first real personal project - one that I actually completed and that solved a real problem of mine. ↩
My one-month trip cost me approximately 2500$CAD. It was quite on the cheap side! ↩