Skip to content

Commit

Permalink
added conf option to deal with renamed tokens, see 'gbp_stablecoin_list'
Browse files Browse the repository at this point in the history
  • Loading branch information
aleqx committed Feb 21, 2021
1 parent 78f4423 commit 460818c
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 6 deletions.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ I'm adding functionality to [BittyTax](https://github.com/BittyTax/BittyTax) tha
Usage is at one own's risk.

Additions/changes:
- more/fixed parsers (Celsius, Crypto.com, etc - see commits)
- more/fixed parsers (Celsius, Crypto.com, Kucoin, etc - see commits)
- more options (config and/or command-line):
- specify tax year start date (applies to businesses)
- specify BnB duration (applies to businsses)
Expand All @@ -23,6 +23,7 @@ Additions/changes:
- hide detailed transaction rows (useful when debugging)
- allow negative amounts for buy (can deal with refunds/reverted transactions)
- address TGBP price issues
- deal with renamed tokens (conf option)
- subtotals per asset in reports (helps debugging)
- ability to specify multiple files or wildcards for the main and conv tools (e.g. `bittytax *.xlsx screwed/*.csv`)
- remove string storage in Excel (15 decimals is enough for me and is a pain to fix in Excel; Excel truncates anyway)
Expand All @@ -41,7 +42,13 @@ bed_and_breakfast_days: 30
ignore_wallet_names: False

# list of GBP stablecoins (addresses exchange rate issues)
gbp_stablecoins: ['TGBP']
gbp_stablecoin_list: ['TGBP']

# renamed assets $old: $new
renamed_asset_list: {
"XZC": "FIRO",
"LOKI": "OXEN",
}
```

Command-line additions:
Expand Down
4 changes: 3 additions & 1 deletion bittytax/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class Config(object):
FIAT_LIST = ['GBP', 'EUR', 'USD']
CRYPTO_LIST = ['BTC', 'ETH', 'XRP', 'LTC', 'BCH', 'USDT']
GBP_STABLECOIN_LIST = ['TGBP']
RENAMED_ASSET_LIST = {'LOKI': 'OXEN', 'XZC': 'FIRO'}

FORMAT_CSV = 'CSV'
FORMAT_EXCEL = 'EXCEL'
Expand Down Expand Up @@ -59,7 +60,8 @@ class Config(object):
'tax_year_start_month': TAX_YEAR_START_MONTH,
'bed_and_breakfast_days': BED_AND_BREAKFAST_DAYS,
'ignore_wallet_names': False,
'gbp_stablecoins': GBP_STABLECOIN_LIST,
'gbp_stablecoin_list': GBP_STABLECOIN_LIST,
'renamed_asset_list': RENAMED_ASSET_LIST,
'coinbase_zero_fees_are_gifts': False,
}

Expand Down
9 changes: 9 additions & 0 deletions bittytax/config/bittytax.conf
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,12 @@ bed_and_breakfast_days: 30

# ignore wallet names (consider a single global wallet)
ignore_wallet_names: False

# GBP stable coins
gbp_stablecoin_list: ['TGBP']

# renamed assets $old: $new
renamed_asset_list: {
"XZC": "FIRO",
"LOKI": "OXEN",
}
12 changes: 9 additions & 3 deletions bittytax/import_records.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,16 +197,22 @@ def parse(self):
raise UnexpectedTransactionTypeError(0, self.HEADER[0], t_type)

if buy_asset:
if buy_asset in config.gbp_stablecoins and not buy_value: # TGBP workaround
if buy_asset in config.gbp_stablecoin_list and not buy_value: # TGBP workaround
buy_value = buy_quantity
if buy_asset in config.renamed_asset_list:
buy_asset = config.renamed_asset_list[buy_asset]
buy = Buy(t_type, buy_quantity, buy_asset, buy_value)
if sell_asset:
if sell_asset in config.gbp_stablecoins and not sell_value: # TGBP workaround
if sell_asset in config.gbp_stablecoin_list and not sell_value: # TGBP workaround
sell_value = sell_quantity
if sell_asset in config.renamed_asset_list:
sell_asset = config.renamed_asset_list[sell_asset]
sell = Sell(t_type, sell_quantity, sell_asset, sell_value)
if fee_asset:
if fee_asset in config.gbp_stablecoins and not fee_value: # TGBP workaround
if fee_asset in config.gbp_stablecoin_list and not fee_value: # TGBP workaround
fee_value = fee_quantity
if fee_asset in config.renamed_asset_list:
fee_asset = config.renamed_asset_list[fee_asset]
# Fees are added as a separate spend transaction
fee = Sell(TransactionRecord.TYPE_SPEND, fee_quantity, fee_asset, fee_value)

Expand Down

0 comments on commit 460818c

Please sign in to comment.