eprbell / dali-rp2

DaLI (Data Loader Interface) is a data loader and input generator for RP2 (https://pypi.org/project/rp2), the privacy-focused, free, open-source cryptocurrency tax calculator: DaLI removes the need to manually prepare RP2 input files. Just like RP2, DaLI is also free, open-source and it prioritizes user privacy.
https://pypi.org/project/dali-rp2/
Apache License 2.0
66 stars 42 forks source link

Implement Filtering of NFT asset in Binance.com REST API plugin #253

Open rapus95 opened 4 months ago

rapus95 commented 4 months ago

Not sure what to do and what the actual problem is. What is NFT(None) and what is EUR(Vertex:...)? And which one is missing? And why does it crash everything :/ Would it be possible to have it generate all nodes as necessary and then later on spit out IDs where I can say "the nodes with these IDs shall be the same node". (If my idea of how this works is right).

These are the logs:

2024-07-27 11:10:53,451/dali/INFO: Country: generic
2024-07-27 11:10:53,478/dali/INFO: Initialized input plugin 'dali.plugin.input.rest.binance_com'
2024-07-27 11:10:53,851/dali/INFO: Initialized pair converter plugin 'dali.plugin.pair_converter.ccxt'
2024-07-27 11:10:53,999/dali/INFO: Reading crypto data for plugin 'dali.plugin.input.rest.binance_com' from cache
2024-07-27 11:10:54,003/dali/INFO: Building manifest to optimize price calculation with the pair converters.
2024-07-27 11:10:54,014/dali/INFO: Resolving transactions
2024-07-27 11:11:42,494/dali/ERROR: Fatal exception occurred:
Traceback (most recent call last):
  File "C:\Python312\Lib\site-packages\dali\dali_main.py", line 193, in _dali_main_internal
    resolved_transactions: List[AbstractTransaction] = resolve_transactions(transactions, dali_configuration, args.read_spot_price_from_web)
                                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\site-packages\dali\transaction_resolver.py", line 286, in resolve_transactions
    transaction = _update_spot_price_from_web(transaction, global_configuration)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\site-packages\dali\transaction_resolver.py", line 138, in _update_spot_price_from_web
    conversion: RateAndPairConverter = _get_pair_conversion_rate(
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\site-packages\dali\transaction_resolver.py", line 110, in _get_pair_conversion_rate
    rate = cast(AbstractPairConverterPlugin, pair_converter).get_conversion_rate(timestamp, from_asset, to_asset, exchange)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\site-packages\dali\abstract_pair_converter_plugin.py", line 88, in get_conversion_rate
    historical_bar = self.get_historic_bar_from_native_source(timestamp, from_asset, to_asset, exchange)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\site-packages\dali\abstract_ccxt_pair_converter_plugin.py", line 406, in get_historic_bar_from_native_source
    raise RP2RuntimeError(
rp2.rp2_error.RP2RuntimeError: The asset NFT(None) or EUR(Vertex:
  name=EUR
  data=None
  neighbors=[AUD, CAD, CHF, GBP, JPY, NZD, USD]
  weights={}) is missing from Binance.com graph for 2021-07-23 05:14:51+00:00
2024-07-27 11:11:42,567/dali/INFO: Log file: ./log/rp2_2024_07_27_11_10_52_359886.log
2024-07-27 11:11:42,571/dali/INFO: Generated output directory: output
2024-07-27 11:11:42,573/dali/INFO: Done
macanudo527 commented 3 months ago

NFT is missing from the graph because I'm guessing it is not a crypto token or coin but an actual NFT?

The pricing graph is not designed to price NFTs, so that is why you are getting the error. I'm guessing the Binance plugin is somehow retrieving an NFT that you have. You'll have to get the Binance plugin to filter out the NFTs.

rapus95 commented 3 months ago

is there any way to go into a "dump error continue with next data point"-mode? I guess that would be helpful for most importer plugins. Is there any way to make the importer ignore the assumed-to-be-Coin "NFT"?

macanudo527 commented 3 months ago

Not at the moment no. I guess we never planned on an exchange mixing in NFTs for no apparent reason. It would be pretty simple to filter out though.