Might be a good idea to mention that your post is not advice, and that the rules differ depending on who wants taxes from you. Also if it could be considered a business activity, which makes it a lot more complicated.
Regarding your question, there are several apis for historical price data. I think last time I needed to do that myself I used yahoo. There are paid services for crypto tax summaries by now which hopefully can work with the csv my script provides, I would love feedback on that if anyone wants to try out one of them),
If your transaction count isn't too high or not spread over too many chains and you prefer to do it yourself, the price apis usually provide daily steps and you choose if you use the start or end of the day, or the weighted average that site provides consistently throughout the year.
You then keep track of any price change between receiving and trading an asset, which can either be done by keeping track of which you bought when and apply fifo or lifo or the average price consistently again. There might be local rules that require you to use a certain method.
RE: Crypto Tax in the UK