Suppose that I have $P$ amount of money in a bank that accrues fixed interest rate $\bar{r}$ continuously. This interest rate charged on this bank account is simple, instead of compound interest rate.
Now, I can transfer the interest accrued after time $t$, $\bar{r}Pt$, to another bank account that collects compound interest rate with the same interest rate $\bar{r}$. However, I can only transfer the interest earned from the first bank account, instead of transferring the whole $P$. Every time I transfer the interest from the first bank account to second bank account, I incur a fixed cost $\phi$. I can transfer the accrued interest from the first bank to the second bank at any time $t$, and for as many times as I want to.
Q: What is the optimal strategy function $f$ that takes in $(P,\bar{r}, \phi, T)$ and tells me when I should transfer the interest accrued from the first bank to the second bank to maximize my income at time $T$, starting from time $t = 0$? Is there even a closed form solution to this problem?
This is motivated by a real-world example I witnessed, and wanted to know how I can tackle this question. It seems that I need to wait for an ample amount of time for the interest collected to be high enough that I would profit from moving to the second bank despite the fixed cost $\phi$. If I wait too long, then I may miss out on the opportunity that interest collected could have earned more compound interest.
EDIT: Note that there is a finite amount of time, since a comment suggested that there is no solution given infinite amount of time.