At any given time, the exchange rate would be x/y. There is a trading fee applicable to every trade, which does increase the constant k, and is shared amongst all LPs based on their shares of the pool.
When adding liquidity to the pool
LPs are required to add both Token A and Token B in a ratio equal to the current rate, meaning adding liquidity would have no impact on the exchange rate.
LP tokens are minted to the Liquidity Provider’s balance after adding liquidity. LP shares, as the pro-rata contribution, may change as the total liquidity in the pool changes.
LPs can realize the gain/loss when redeeming the underlying tokens (and essentially burning their LP shares).
Assume the pool opens with 2,200 Token A and 1,100 Token B, these LPs added liquidity, and for simplicity sake, there are no trades happening in between these liquidity addition transactions.
LP 1 adds 50 Token A and 25 Token B, as the current exchange rate is 2
LP tokens = 50*1 + 25 *2 = 100
LP Shares, as the pro-rata liquidity an LP contributed, keep changing as new liquidity is added.
LP 1’s LP Shares = 100/4500 = 2.22%
Trading fees are added to the liquidity pool and shared amongst all LPs. The trading fees do increase the constant product and affect the actual number of tokens received. For demonstration purposes, the four trades are relatively large trades that would impact exchange rate and trading fees in a visible way.