What is the Autotrader?

Autotrader is a car selling website that allows you to list the car you want to sell for a small fee to try and advertise it to a greater audience than the likes of gumtree or usedcarsni.

What does the graph represent?

The graph represents all the cars that are currently for sale with the filter: Acceleration 0-5s. This is also not limited to Northern Ireland, it is a UK wide search, and will also include Category C/D/S/N.

What's the purpose of the graph?

The purpose of the graph is to find out if there are any trends in car selling of luxury / sports cars. Due to the corona virus being at large and the world is having a financial meltdown, I want to track how many cars go up for sale. Due to cars being an ostentatious good, it's more likely that people will get rid of them during a crisis, therefore leaving a greater amount of cars up for sale.

Are there any downfalls with the graph?

Yes, there is a huge downfall - the graph does not take account of the number of cars that are being sold. Currently, the number represented on the graph is

C a r s F o r S a l e = C a r s L i s t e d F o r S a l e − C a r s B o u g h t CarsForSale = CarsListedForSale - CarsBought C a r s F o r S a l e = C a r s L i s t e d F o r S a l e − C a r s B o u g h t

So the only indicator that cars are being sold is if the number from one day to the next decreases. However, we cannot tell how many cars are being sold if the number of cars being put up for sale is greater than the number of cars being purchased.

Architecture

First, there is a bash script (script.sh), and this is called by a cronjob every night at 12:00am.

in the bash script, it hits a curl command of another php page on the server, this php page carries out the following:

// create curl resource $ch = curl_init(); // set url curl_setopt($ch, CURLOPT_URL, "https://www.autotrader.co.uk/search-form?search-target=usedcars& zero-to-60=TO_5&postcode=&isBuying=true"); //return the transfer as a string curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // $output contains the output string $output = curl_exec($ch); // close curl resource to free up system resources curl_close($ch); preg_match_all("/Search (.*?) cars/", $output, $matches); $cars = $matches[1][1]; $cars_numeric = str_replace( ',', '', $cars ); echo "{ cars_num : " . $cars_numeric . "," . "date : " . '"' . date("Y-m-d") . '"' . "}";

Giving a json output of the number of cars and the date that can be used in the front-end.

These will be put into a file on the server and then uploaded to mongo.