Disclaimer: I am not sure this is appropriate kind of question here, but I would really appreciate any help. I tried at money.stackexchange.com first.
Let's assume we have an investment fund with holders, who may transfer funds from this fund between each other. We can track how much funds each holder has on his account at any moment. There is some reward we need to distribute among all the participants according to their stake during the given payment period. Because the stake can change during the payment period (while holders transfer funds to each other), the reward needs to be calculated this way:
$$R_h=\sum^k_{n=1} R_p \frac {t^{(n)}\cdot s^{(n)}_h}{t_p\cdot s_t},$$
where
$R_h$ - holder reward in the given period
$n=1..k$ - amount of account states in the given billing period (amount of incoming and outcoming transactions to this account + 1; if there were no transactions, there is only 1 state of the account in the current billing period and the formula simplifies)
$R_p$ - total reward in the given period (amount of funds that has to be distributed among all holders)
$t^{(n)}$ - length of current time interval - interval between the transactions for the given account (whole billing period is split into such intervals. 1 transaction adds 1 interval; if there are no transactions, there is only 1 interval)
$s^{(n)}_h$ - user account stake in the current moment (between the transactions; when holder transfers funds to someone, this parameter decreases; when holder receives funds from someone, this parameter increases)
$t_p$ - time length of the current billing period
$s_t$ - stake total (total amount of funds issued by the fund, sum of all the user stakes)
I assume this (or similar) formula can be used to calculate user's interests for the banking accounts when a number of funds in the account is constantly changing.
But I do not know if it is really so and what's the proper name for this formula. This may be similar to the chronological weighted mean, but I doubt the 'chronological weighted mean' term is correct. I would appreciate helping me to figure this out.