The returns for your portfolio are always calculated using a time-weighted rate of return. This is to avoid distorting performance due to deposits or withdrawals.
You can learn more about the time-weighted rate of return from this article on Investopedia.
Essentially to calculate the return for your portfolio, we calculate the return for each sub-period and then multiply these returns.
Alice put in $1000 during the first month and gains 10%. She then decides to put in another $2000 and gains 5% during the second month. Her ending balance is $3255.
Bob also put in $1000 at the same time and gained 10%. He then decided to take the profit and withdrew $100. During the second month, he gained 5%. His ending balance is $1050.
Their end results are different yet the performance is the same. The returns should reflect that.
So to calculate time-weighted rate of return, we just multiply (1 + 0.1) * (1 + 0.05) - 1 = 0.155 or 15.5%