Margin trade long ETH

Edited to simplify the question around just ETH…

I used the Maker oasis leverage to long ETH and then later withdrew.
Koinly creates:
Entry into margin trade: Withdrawal of X ETH with a gain/loss
Exit from margin trade: Deposit of Y ETH with cost 0

The actual gain is Y ETH - X ETH

The entry Withdrawal transaction probably shouldn’t have any gain/loss recorded but not sure if there is a manual workaround to avoid this?

What I tried: Edit the exit Deposit to set the Type to Realized Profit and set the Worth the gain (the value of Y ETH - X ETH). This records the gain and also uses that gain as the cost basis of the exited tokens. But I think the cost basis needs to be the gain plus the original value of the tokens from the entry transaction. So I am floundering.

What is the correct way to handle margin trades?

Thanks

Can I use a pool for this as follows:

For the margin opening trade, use Sent to Pool (so no gains are realised)
For the margin closing trade have the following:

  1. Received from Pool trade, to reverse the opening trade exactly, with no gains again
  2. Add a manual trade Realized P&L for the gain in tokens, all gain

Seems to work! If this is correct, I suggest it is written up in a help page?

Yeah Sent to Pool is a good solution. You can also create a custom Wallet and do transfers to that wallet.

Thanks @Jiecut , I guess a pool is much the same as a manual wallet, would be interesting to hear whether there are actually any differences at all. Would this same method be good for liquidity in / out I wonder? I will post on another thread.

Yeah pools and manual wallets are quite similar. I guess it depends how many things are in your pool. If you have a lot transactions with a service, you might want to seperate it so that it’s easier to do the internal accounting. And so that it doesn’t make your pool too messy.