Please explain what is the Unrealized profit and how it effect our earnings in arbitrage bot. Do the Unrealized profit effect the funding rate profit?

**Answer**

“Unrealized Profit” in arbitrage bot comes from the difference between the opening price gap, and the current price gap. Let say you open the arbitrage bot with +0.5% gap. This means if the btc price at spot is 10000, you open the short position at 10 050 which is good for you (higher entry for short position is better)

10 000 vs 10 050 is a 0.5% price gap

Lets say now price comes up to 11000 with 0% price gap. it means the futures market is also 11000. Your spot position will profit 1000 , while your futures position will have -950. Overall you will gain unrealized profit 50 usdt for 1 size btc open at spot market. This 50 usdt is coming from (opening price gap – closing price gap) which is +0.5% – 0% = 0.5%

You can maximize this unrealized profit by opening the bot at the highest price gap you can reach, and closing when the price gap reaching negative gap. Becareful if you do the opposite (i.e. opening when price gap low and closing when the price gap higher than the opening) you will get the negative result, you can check it with the formula