Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Token migration/rebranding/redenomination #320

Open
tstanbur opened this issue Nov 2, 2023 · 10 comments
Open

Token migration/rebranding/redenomination #320

tstanbur opened this issue Nov 2, 2023 · 10 comments
Assignees
Labels
enhancement New feature or request

Comments

@tstanbur
Copy link

tstanbur commented Nov 2, 2023

I have several occurrences of token migration/rebranding/redenomination in my Binance account history.

Here are a some screenshots showing examples of this - my original Binance Statement data and the results after it is parsed by the conv tool.

  • ANY became MULTI with a 1:1 token distribution
  • GXS became REI with a 1:10 token distribution

As you can see, they are both shown as "Distribution" with positive (new token issued) or negative "change" (old token removed).

Bitty Tax parses the positve as "Airdrop" and the negative as "Spend" but there isn't actually a disposal taking place.

It would be good if this situation was catered for.

image

image

image

image

@tstanbur
Copy link
Author

tstanbur commented Nov 2, 2023

I posted a question about this on the Discord server too,

https://discordapp.com/channels/581493570112847872/581493570112847876/1169587813130444810

copy and pasting messages here to expand on the above.

One thing you could do is write a script to simply rename the tokens in all of the pre-swap transactions to be the same as the new name, and then remove the transactions for spending the old tokens and receiving the new ones. If the denomination has changed then you'd also need to do change the values though.

That would be preferable to having a disposal for the swap

Tom78: thanks for the suggestion, I suppose that is an option.

_However I also had NU and KEEP which both were merged into "T" and the distribution makes things a little more complex!

so in this case, I'd have to

find all NU trades, change the token name to "T" and multiply the quantity by 3.26
find all KEEP trades, change the token name to "T" and multiply the quantity by 4.78
Remove the distribution (airdrop/spend) records

image

@nanonano nanonano self-assigned this Nov 2, 2023
@nanonano nanonano added the enhancement New feature or request label Nov 2, 2023
@njwedwards
Copy link

+1

nanonano added a commit that referenced this issue Apr 4, 2024
The Swap transaction type allows you to rebrand/redenominate a token.

The cost basis is transfered from the sell asset to the buy asset, this is NOT a taxable event. See #320.
@nanonano
Copy link
Member

nanonano commented Apr 4, 2024

I've just added a feature branch for the new Swap transaction type. See https://github.com/BittyTax/BittyTax/tree/features/swap.

Type Buy Quantity Buy Asset Buy Value in GBP Sell Quantity Sell Asset Sell Value in GBP Fee Quantity Fee Asset Fee Value in GBP Wallet Timestamp Note
Swap M M M M O O O O M O

This new transaction type allows you to rebrand/redenominate a token.

The cost basis is transfered from the sell asset to the buy asset, this is NOT a taxable event.

Please give it a test.

I've also updated the Binance parser, to use Swap for a "Token Swap - Redenomination/Rebranding" operation in the Statements export.

@njwedwards
Copy link

Thanks for this. From my initial brief testing. For a stock split or reverse split this seems to work well. The only issue is when the swap and subsequent trade happens on the same day, the calculation is then wrong. However in real life this will almost never happen as the split will happen before or after the trading day. For crypto tokens not sure.

Example, gain marked as 90 when it is actually 0

Trade	200	DIG		200	GBP						2023-09-30 14:10:11	
Trade	100	GBP		100	DIG						2023-09-30 15:10:11	
Swap	10	DIG		100	DIG						2023-09-30 16:10:11	Reverse split
Trade	100	GBP		10	DIG						2023-09-30 17:10:11	

@nanonano
Copy link
Member

nanonano commented Apr 7, 2024

Hi @njwedwards, thanks for this, I forgot about how the same day pooling/matching would impact the swap. It's also going to be a problem for B&B matched trades too, as these are matched before the section104 pooling, which is where the cost basis is transferred for the swap.

I think I'll have to go back to the drawing board, I'm not even sure it's possible to find a solution, be interested to know your thoughts?

split transaction records
split: TR Trade 200 DIG <- 200 GBP '' 2023-09-30T14:10:11 UTC [TID:1]
split:   BUY Trade 200 DIG (=£200.00 GBP) '' 2023-09-30T15:10:11 BST [TID:1.1]
split:   SELL Trade 200 GBP (=£200.00 GBP) '' 2023-09-30T15:10:11 BST [TID:1.2]
split: TR Trade 100 GBP <- 100 DIG '' 2023-09-30T15:10:11 UTC [TID:2]
split:   BUY Trade 100 GBP (=£100.00 GBP) '' 2023-09-30T16:10:11 BST [TID:2.1]
split:   SELL Trade 100 DIG (=£100.00 GBP) '' 2023-09-30T16:10:11 BST [TID:2.2]
split: TR Swap 10 DIG <- 100 DIG '' 2023-09-30T16:10:11 UTC 'Reverse split' [TID:3]
split:   SELL* Swap 100 DIG '' 2023-09-30T17:10:11 BST 'Reverse split' [TID:3.1]
split:   BUY* Swap 10 DIG '' 2023-09-30T17:10:11 BST 'Reverse split' [TID:3.2]
split: TR Trade 100 GBP <- 10 DIG '' 2023-09-30T17:10:11 UTC [TID:4]
split:   BUY Trade 100 GBP (=£100.00 GBP) '' 2023-09-30T18:10:11 BST [TID:4.1]
split:   SELL Trade 10 DIG (=£100.00 GBP) '' 2023-09-30T18:10:11 BST [TID:4.2]
split: total transactions=8
pool same day transactions
pool: SELL Trade 110 DIG (=£200.00 GBP) '' 2023-09-30T18:10:11 BST [TID:2.2] (2)
pool:   (SELL Trade 100 DIG (=£100.00 GBP) '' 2023-09-30T16:10:11 BST [TID:2.2])
pool:   (SELL Trade 10 DIG (=£100.00 GBP) '' 2023-09-30T18:10:11 BST [TID:4.2])
pool: total transactions=7
match same day transactions
match: BUY Trade 200 DIG (=£200.00 GBP) '' 2023-09-30T15:10:11 BST [TID:1.1]
match: SELL Trade 110 DIG (=£200.00 GBP) '' 2023-09-30T18:10:11 BST [TID:2.2] (2)
match:   split: BUY Trade 110 DIG (=£110.00 GBP) '' 2023-09-30T15:10:11 BST [TID:1.3]
match:   split: BUY Trade 90 DIG (=£90.00 GBP) '' 2023-09-30T15:10:11 BST [TID:1.4]
match:   Disposal(same day) gain=£90.00 (proceeds=£200.00 - cost=£110.00 - fees=£0.00)
match: total transactions=8
match bed & breakfast transactions
match: total transactions=8
process section 104
section104: //SELL Trade 200 GBP (=£200.00 GBP) '' 2023-09-30T15:10:11 BST [TID:1.2] <- fiat
section104: //BUY Trade 110 DIG (=£110.00 GBP) '' 2023-09-30T15:10:11 BST [TID:1.3] <- matched
section104: BUY Trade 90 DIG (=£90.00 GBP) '' 2023-09-30T15:10:11 BST [TID:1.4]
section104:   DIG=90 (+90) cost=£90.00 GBP (+£90.00 GBP) fees=£0.00 GBP (+£0.00 GBP)
section104: //BUY Trade 100 GBP (=£100.00 GBP) '' 2023-09-30T16:10:11 BST [TID:2.1] <- fiat
section104: SELL* Swap 100 DIG '' 2023-09-30T17:10:11 BST 'Reverse split' [TID:3.1]
section104:   DIG=-10 (-100) cost=£-10.00 GBP (-£100.00 GBP) fees=£0.00 GBP (-£0.00 GBP)
section104: BUY* Swap 10 DIG '' 2023-09-30T17:10:11 BST 'Reverse split' [TID:3.2]
section104:   DIG=0 (+10) cost=£90.00 GBP (+£100.00 GBP) fees=£0.00 GBP (+£0.00 GBP)
section104: //BUY Trade 100 GBP (=£100.00 GBP) '' 2023-09-30T18:10:11 BST [TID:4.1] <- fiat
section104: //SELL Trade 110 DIG (=£200.00 GBP) '' 2023-09-30T18:10:11 BST [TID:2.2] (2) <- matched

@njwedwards
Copy link

I see what you mean. I am not sure how you get around this. The B&B matching is likely to come up quite a lot and cause problems. I can't see a way without in effect doing in code what you would have to do manually currently, which is to update past transactions with the new ratio.

@nanonano
Copy link
Member

nanonano commented Apr 7, 2024

I wonder how sites like Koinly and CryptoTaxCalculator do it? Or maybe it doesn't work for UK.

Aha! just found this... https://help.cryptotaxcalculator.io/en/articles/6188320-swap-category

Important Notes:
Currently, users on HMRC and ACB cannot use swaps due to complexities with specific tax rulings.

Might have to raise this with HMRC as they state here: https://www.gov.uk/hmrc-internal-manuals/cryptoassets-manual/crypto22110

An example of this can be seen with the Ethereum blockchain. Currently ether are on the Ethereum ‘mainnet’ (short for main network, the main public Ethereum blockchain). Holders of ether can choose to transfer their tokens from the mainnet to a different blockchain called the ‘Beacon Chain’. The Beacon Chain blockchain is where Ethereum’s ‘Proof of Stake’ will be implemented (for more information on Proof of Stake see CRYPTO10300. It will be impossible to transfer ether from the Beacon Chain to the mainnet, making transfers a one-way process only.

HMRC’s view is that TCGA92/S43 applies to this type of transaction. The allowable costs in respect of the first cryptoasset are attributed in full to the second cryptoasset. A gain or loss will accrue as normal on a subsequent disposal of the second cryptoasset.

This is not possible due to the same day/bnb rules.

@nanonano nanonano pinned this issue Apr 7, 2024
@njwedwards
Copy link

Had a bit of a thought, don't know if this is workable.

Create a new step before or after import.
Check for Type 'Reclassify'
If it exists, then take the Buy and Sell Assets and Quantity
Search for previous entries before the date entry (and after any potential other Reclassify for the Sell Asset in question)
Update previous entries with the new asset name if needed, so for example sell is DIG and buy is NEWDIG
Update previous entries with the new ratio if needed, so for example sell is 10 and buy is 1 (divided each old entry by 10)
Run through the other steps and ignore or remove the 'Reclassify' type

Of course this could all just be done manually (as I have been doing) or with a separate script, but here it just means that the current master data does not need to be changed and everything in the master file is as it was at the time (apart from new Reclassify entries) and can be audited easily. In the master Excel spreadsheet, one could even have a separate sheet, that is for just this.

Here are some examples of shares ratio/name changes from recent years:

TATE 6:7
TSCO 15:19
GSK 8:10
TUI 1:10
RSDA to SHEL

@nanonano
Copy link
Member

nanonano commented Apr 9, 2024

I think the solution you describe is similar to how the CGTCalculator handles it, see Example5.

Screenshot 2024-04-09 at 10 29 09

Although they have the limitation that you can only use it once per stock/asset.

This is probably the best option, allowing the user to rename an asset, and to redenominate an asset in its entirely.

@njwedwards
Copy link

Was not aware they had that but makes sense as I don't see any other way they could do it.

Anyway as an example, TSLA which has had 2 recent splits (and added rename as example):

Type	Buy Quantity	Buy Asset	Buy Value in GBP	Sell Quantity	Sell Asset	Sell Value in GBP	Fee Quantity	Fee Asset	Fee Value in GBP	Wallet	Timestamp	Note
Trade	10	TSLA		100	USD						2018-10-13 14:10:11	
Reclassify	5	TSLA2		1	TSLA						2020-08-31 00:00:00	1 to 5 share split and rename
Trade	10	TSLA2		100	USD						2020-10-15 14:10:11	
Reclassify	3	TSLA2		1	TSLA2						2022-08-25 00:00:00	1 to 3 share split

Don't see an issue here with the refactoring or renaming, when going over old entries each time there is a new Reclassify.

Of course there is still the issue of modifying or splitting the cost basis of a holding, as in the following example, so perhaps the Swap functionality will still be suitable here and in other instances:

Type    Buy Quantity    Buy Asset   Buy Value in GBP    Sell Quantity   Sell Asset  Sell Value in GBP   Fee Quantity    Fee Asset   Fee Value in GBP    Wallet  Timestamp   Note
Trade   50. GSK     50  GBP                     2023-09-29 14:10:11 
Trade   50. GSK     50  GBP                     2023-09-29 14:11:11
Swap    100.    GSK.2       81.84   GSK                     2023-10-15 14:12:11
Swap    100 HAL     18.16   GSK                     2023-10-15 14:13:11
Swap    100 GSK     100 GSK.2                       2023-10-15 14:16:11

I don't know if the above Swaps could be done with a ratio instead of the actual amount. Anyway, I am getting out of my depth. Will leave it with you to have a good think about and decide the best way forward. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants