How to calculate "money spent" on a futures position?

I’m building an accounting system and need to get historical details of each position. The only thing I’m missing is the initial margin or the money used to the open position. Trade list doesn’t give leverage information nor the actual USDT spent.

So are there any ways to get leverage history or the actual USDT used when opening the position?

Workaround would be frequently fetching v2 positionRisk, but I would like to get historical data.