# A way to identify anomalous trends amongst several trends?

I'm working on a personal project, where I'd like to identify anomalous trends. Here's the scenario:

Imagine a company can sell 3 types of say, candies: X, Y, and Z. For some reason, these prices can fluctuate - meaning not all X candies are sold for \$2, some are sold for 4, some for 6. This repeats for all candies they sell.

Now, imagine there are 9 other companies competing in the same candy market. They all sell the same X, Y, and Z candies.

I happen to have the sales data for those 10 companies, where I have transactional information for each candy sale on a company basis, which includes:

• Date of the candy sale
• Amount paid for the candy
• Type of candy that was bought

How would I be able to identify anomalous sales trends, for any of those companies? What method would allow me to say that company Sweetums's sales trends are very different from the other 9 based on the cumulative sales? That is the main question I'd like some insight on, as I believe figuring out the same method for each candy type would be trivial.

I've done some digging, and while there are great packages out there (anomalize, AnomalyDetection), they all deal with anomaly detection of specific time points, and not trends.

I'm open to any approaches, be it more convenient statistical based ones to Keras and TensorFlow implementations of LSTMs, in either R or Python (though I'd probably prefer R).