I'm new to kafka and have been going over the basic example of how positions from trades are aggregated. However I am unable to get my head around how this would work when a position already exists. As an example, if I execute an initial trade on MSFT then my position will either be created but what if I already have a position? How would this older position be loaded?
The answer to me appears to be that either we first load base positions into a table and then replay trades on top of this or alternatively load all trades into kafka and let the aggregation handle this. However this seems a bit of an overkill if I ever want to calculate an additional metric for a position, say an average price. Is there a better approach that I am missing? Thanks, Gaurav