Code Monkey home page Code Monkey logo

Comments (6)

stevendavis avatar stevendavis commented on May 30, 2024 1

Thanks for the detailed explanation. Tested again with manual intra CSV for the receiving side and the spot price was fetched from Coinbase Pro. Closing the issue.

from dali-rp2.

eprbell avatar eprbell commented on May 30, 2024

For intra-transactions the fee is implicitly defined as crypto_sent - crypto_received: when you add the missing half of the transaction it will get populated. The spot price should have been populated: are you sure you passed the -s option? If you did can you instrument the code around https://github.com/eprbell/dali-rp2/blob/main/src/dali/transaction_resolver.py#L202? Add a few LOGGER.debug calls to see what is happening. If -s has been passed it should get inside _update_spot_price_from_web() and it should read the price from Coinbase Pro.

from dali-rp2.

stevendavis avatar stevendavis commented on May 30, 2024

Dali is indeed calling _update_spot_price_from_web, but the transaction spot_price is None, and it returns right away. Not sure how to fix this without breaking something else. What do you recommend?

from dali-rp2.

eprbell avatar eprbell commented on May 30, 2024

Can you add more LOGGER.debug calls inside _update_spot_price_from_web() to see what path it is taking? Also: does this happen for only one transaction or for all of them?

from dali-rp2.

stevendavis avatar stevendavis commented on May 30, 2024

In my limited testing, _update_spot_price_from_web() always exits without doing anything, but for different reasons depending on the transaction.

For "match" transactions (BUY), the spot price is a numeric value upon entry to _update_spot_price_from_web(), so it exits without needing to fetch the price from the web.

For "transfer" / "withdraw" transactions. The function is exiting in this snippet:

    if transaction.spot_price is None:  # type: ignore
        return transaction

from dali-rp2.

eprbell avatar eprbell commented on May 30, 2024

Thanks for running the code with instrumentation: that gave me enough context to understand what is happening. This is not a bug, but intended behavior. In intra-transaction the only field that has an effect on taxes (or more precisely on the in-out coin flow) is crypto_fee, which is crypto_sent - crypto_received, as explained above. Since this is an unresolved transaction (there is only one half of it), either crypto_sent or crypto_received are missing and therefore crypto_fee cannot be computed: so the spot_price is also not computed, because it would be useless (it only affects the "taxable" part of the transaction, which is crypto_fee). If you were to complete the transaction by providing the missing half, then the transaction resolver would notice that both crypto_sent and crypto_received are present and therefore it would compute crypto_fee and resolve spot_price. Can you try that and let me know if it works?

from dali-rp2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.