-
Notifications
You must be signed in to change notification settings - Fork 31
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
Bitpanda changed fileformat #165
Open
wullxz
wants to merge
3
commits into
provinzio:main
Choose a base branch
from
wullxz:bitpanda_changed_fileformat
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… small cfg fix * cfg fix: The de_DE locale doesn't work on my system. I've changed it to try different locales in order ("de_DE", "de_DE.utf-8") * general: Created AirdropGift (non-taxed) and AirdropIncome (taxed) as subclasses of Airdrop. AirdropGifts are always non-taxed and AirdropIncome are always taxed, no matter the setting `ALL_AIRDROPS_ARE_GIFTS` in the config. These subclasses can be used if it is save to say that a record is to be taxed or not. * bitpanda general: Current csv exports have an additional field that tripped up the parsing. Added the field `_tax_fiat` to the header definition. TODO: check if the contained information is relevant. * bitpanda airdrop types: Implemented AirdropGift for BEST and ETHW drops (see below). * bitpanda stocks: Ignore records where the asset type starts with "Stock" (for now) * bitpanda BEST transfer: BEST is bitpandas own coin and is rewarded for activity and holding a portfolio. These are classified as AirdropGift (non-taxable). * bitpanda ETHW transfer: ETHW is the old ETH chain. If a user held ETH with bitpanda when the fork to PoS happened, they received ETHW some time in September 2022. Classify that as AirdropGift according to the first reasoning described [here](https://www.winheller.com/bankrecht-finanzrecht/bitcointrading/bitcoinundsteuer/besteuerung-hardforks-ledger-splits.html) * bitpanda staking: Implemented handling of staking for `transfer(stake)` and `transfer(unstake)` operation types.
Background info: Bitpanda Pro, which is used to obtain historical prices for (crypto-)assets is now ONE TRADING and a separate company to which Bitpanda only holds a minority stake. After that split, BEST can't be used anymore on ONE TRADING and historical BEST price data isn't available anymore. Also, ETHW, which stands for the Proof of Work branch of the ETH chain, isn't available on ONE TRADING. This means, that we need to use the prices we have from the csv file as best as we can. For normal transactions, that's possible by using the "Asset market price" column of the export but for fee withdrawals from the BEST wallet, no price was actually associated with the withdrawal transaction. For now, I'm using an asset price of 0 because I don't know how to fix this otherwise. For the normal transactions, a new property has been added to the Operation class (`exported_price`) to be able to carry the asset price for normal transactions into the processing classes like PriceData and use it there if a proper price can't be obtained (see `get_cost` method in `PriceData` in price_data.py). Source: https://support.bitpanda.com/hc/en-us/articles/9374684386332-Why-is-Bitpanda-Pro-evolving-to-become-One-Trading * general: Added new data field `exported_price` to `Operation` class * bitpanda general: For ETHW and BEST, the `exported_price` will be used because the ONE TRADING API doesn't return anything. * bitpanda general fix: The `change` calculation used a change from an earlier data record for some operation types, because the `change` variable was not touched (for Airdrops of any kind and Staking operations of any kind). The missing operations are now added in `_read_bitpanda` in book.py and an Exception has been added for anything else not included in my change.
* bitpanda general: Bitpanda Pro, whose API we use to fetch prices for bitpanda transactions, is now One Trading. As a result, their API is available under a different address and with a slightly different response. This commit contains the fixes for both, the address and the parsing/usage of the result. * bitpanda general: Since One Trading doesn't offer the same coins as Bitpanda anymore, some coin/fiat pairs aren't available there (like BEST/EUR, ETHW/EUR, LTC/EUR and others). To differentiate between a "market" not being available and other errors, we raise a ValueError in case the "market" is not available. I chose ValueError because catching LookupError also catches errors with indices in lists, which should be thrown. * bitpanda general: The ValueError is caught in price_data.py in the `get_cost` method. In the last commit, I added a new field `exported_price` to the `Operation` data class, which is used in the exception handling to use the price from the csv export (it's better than nothing). For BEST, there is sadly no price available if the BEST transaction is a Withdrawal (Fee). For now, we assume a value of 0 in that case (I don't know how to fix this otherwise). * bitpanda LUNC airdrop: I added special handling for the LUNC airdrop that happened in May 2022 because of a blockchain crash and subsequent fork. Sadly, the price can't be retrieved using the API and the airdrop didn't have a price associated. CoinTaxman should throw an exception because it can't fetch a price and it should also say which line the airdrop is in. I used that to edit my csv export and input a ridiculously small price since the price was really low anyway. * bitpanda staking rewards: Sometime before 2022/6/14, bitpanda used "transfer" for staking rewards. Incoming crypto "transfers" before that date, that aren't BEST, are therefore classified as (staking-)reward.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR deals with some developments for Bitpanda, which are roughly:
The detailed changes from 3 commits:
ALL_AIRDROPS_ARE_GIFTS
in the config. These subclasses can be used if it is save to say that a record is to be taxed or not._tax_fiat
to the header definition. TODO: check if the contained information is relevant.transfer(stake)
andtransfer(unstake)
operation types.exported_price
toOperation
classexported_price
will be used because the ONE TRADING API doesn't return anything.change
calculation used a change from an earlier data record for some operation types,because the
change
variable was not touched (for Airdrops of any kind and Staking operations of any kind).The missing operations are now added in
_read_bitpanda
in book.py and an Exception has been added for anything else notincluded in my change.
get_cost
method. In the last commit, I added a new fieldexported_price
to theOperation
data class, which is used in the exception handling to use the price from the csv export (it's better than nothing). For BEST, there is sadly no price available if the BEST transaction is a Withdrawal (Fee). For now, we assume a value of 0 in that case (I don't know how to fix this otherwise).Background of the Bitpanda Pro spin off into One Trading:
Bitpanda Pro, which is used to obtain historical prices for (crypto-)assets
is now ONE TRADING and a separate company to which Bitpanda only holds a minority stake.
After that split, BEST can't be used anymore on ONE TRADING and historical BEST price data isn't available anymore.
Also, ETHW, which stands for the Proof of Work branch of the ETH chain, isn't available on ONE TRADING.
This means, that we need to use the prices we have from the csv file as best as we can.
For normal transactions, that's possible by using the "Asset market price" column of the export but for fee withdrawals
from the BEST wallet, no price was actually associated with the withdrawal transaction.
For now, I'm using an asset price of 0 because I don't know how to fix this otherwise.
For the normal transactions, a new property has been added to the Operation class (
exported_price
) to be able tocarry the asset price for normal transactions into the processing classes like PriceData and use it there
if a proper price can't be obtained (see
get_cost
method inPriceData
in price_data.py).Source: https://support.bitpanda.com/hc/en-us/articles/9374684386332-Why-is-Bitpanda-Pro-evolving-to-become-One-Trading