Skip to content

Commit

Permalink
ADD support for new Kraken operation types
Browse files Browse the repository at this point in the history
  • Loading branch information
Griffsano committed Jan 2, 2025
1 parent 6b6c5b4 commit ee16bd5
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions src/book.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,8 +605,8 @@ def _read_kraken_ledgers(self, file_path: Path) -> None:

platform = "kraken"
operation_mapping = {
"spend": "Sell", # Sell ordered via 'Buy Crypto' button
"receive": "Buy", # Buy ordered via 'Buy Crypto' button
"spend": "Sell", # Sell ordered via 'Buy Crypto' or 'Dust Sweeping'
"receive": "Buy", # Buy ordered via 'Buy Crypto' or 'Dust Sweeping'
"reward": "StakingInterest",
"staking": "StakingInterest",
"deposit": "Deposit",
Expand Down Expand Up @@ -742,6 +742,34 @@ def _read_kraken_ledgers(self, file_path: Path) -> None:
elif subtype in ["spottostaking", "spotfromstaking"]:
# duplicate entries for staking actions
continue
elif subtype in ["spottofutures", "spotfromfutures"]:
# transfer between spot and futures
continue
else:
log.error(
f"{file_path} row {row}: Order subtype '{subtype}' is "
"currently not supported. Please create an Issue or PR."
)
raise RuntimeError
elif _type == "earn":
if subtype == "reward":
operation = "StakingInterest"
elif subtype == "migration":
# Migration of "x.S" legacy staking balance to new staking
# infrastructure in "earn / bonded" wallet
continue
elif subtype == "allocation":
if change > 0:
operation = "Staking"
else:
# duplicate entries for staking actions
continue
elif subtype == "deallocation":
if change > 0:
operation = "StakingEnd"
else:
# duplicate entries for staking actions
continue
else:
log.error(
f"{file_path} row {row}: Order subtype '{subtype}' is "
Expand Down

0 comments on commit ee16bd5

Please # to comment.