Describe the problem:
It seems as though for margin loans on Kucoin the actual gain/loss is not being calculated correctly. I’ve provided an example below to describe the exact issue:
- There is an initial margin loan for 15,000 BAT.
- That BAT is immediately traded for 11,656.58… USDT
(For some reason, this is calculated as a loss here? There should only be the .1% trading fee and a .1% taker fee on this trade. The trade happens at the exact same second that the BAT is borrowed) - The sold BAT is purchased back for $11,107.93 ($548.65 less than was initially sold for)
- BAT is repaid back (plus interest on the loan) worth $10,750.75
(I would expect this to be a profit of $11,656.58 - $10750.75 - fees… I also have no idea where $12,397.38 cost basis is coming from, and not sure that’s calculating correctly??)
Anyway, this is pretty unexplainable and seems like it’s the reason for about an $80,000 P&L difference for me.
Which exchange/wallet is this regarding?
Kucoin
How did you import data into this wallet?
API Sync
What have you tried to fix this so far?
I’m not sure I can fix this… it seems like a code issue after hours of looking into these transactions. But would be happy to be told there’s something I can do to fix it! Unfortunately this is thousands of trades, and not an easy manual fix.

