Skip to content

Show the wallets market performance - don't merge yet #3410

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

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kakulukia
Copy link

This PR is not quite done yet, but i rather wanted to ask for feedback before i continue.

If I have a savings plan rather than some BTC one time investment, the current percentage gain just makes no sense at all. Thats why I started the connected issue some months ago and now this PR is my attempt to fix it.

It's missing some stuff still. But as it already solves my main pain point and I'd like to get some feedback and as im quite unfamiliar with the code base. Is the way it's implemented heading into the right direction?

Here is what it does - it adds a little switch in the upper right corner:

image

The current default is showing the coin sum data as before, but now its possible to switch to the percent view.

image

Before continuing there are some questions: The account-summery call serves on hourly (week) and one daily time series to power all other Month, Year and All filters. As the month/year/all percentage gain will be different there are two options. Calculating it on the fly in the frontend and the (in my opinion cleaner) way of letting account-summery just return the currently shown version of the data when pressing one of the filter options.
Yes, that means more calls when switching the filters, but thats why im asking for some guidance.

Here is a quick roundup of what i have done so far to get it working:

  1. enhanced the creation of the timeseries to include the RatesProvider to calculate sumFiatAtTime for each transaction to be used as as base to
  2. Add SumFiatAtTime for each timeseries data point
  3. in chart.go: adding sumFiatAtTime and the calculated percentage gain to the data so its already possible for the frontend to calculate a new filter based value on the fly
  4. added the switch in the frontend to allow to change the view from coin sum to percent
  5. additionally i added a servewallet-reload option to the Makefile because its easier to work that way than reloading the backend manually - i would open a second PR for that if somebody is interested (optional)

Would there be a better UI option or place for the switch? I don't fully like that it's grey for one option and blue for the other. Any idea?

I have one additional question to the tests. I get this while running the backend tests via go test ./backend/...:

ok      github.com/BitBoxSwiss/bitbox-wallet-app/backend/bitsurance     (cached)
Logging into '/Users/andy/Library/Application Support/bitbox/log.txt' from 'debug'.
panic: test timed out after 10m0s
    running tests:
            TestServeShutdownServe (10m0s)

The readme is not specifically telling me how to run those tests, so it was just a guess. There is this ci makefile command which is also running into the same 10m timeout. Im not aware that i changed code that might be related to TestServeShutdownServe so im wondering what might be wrong?
Also a fresh checkout of the repo is also running into this problem.

I'm leaving all the checkboxes as a reminder of things to do before merging.

Before asking for reviews, here is a check list of the most common things you might need to consider:

  • updating the Changelog
  • writing unit tests
  • checking if your changes affect other coins or tokens in unintended ways
  • testing on multiple environments (Qt, Android, ...)
  • having an AI review your changes

Closes #3147

@kakulukia
Copy link
Author

Ah, and ignore the .gitignore changes. :)

@kakulukia kakulukia marked this pull request as draft June 13, 2025 08:06
@jadzeidan
Copy link
Contributor

@kakulukia thank you for the detailed summary. I will need a bit of time to look through it in detail and then give feedback.

For expectation management, external contributions aren't guaranteed to be merged as the review process can be quiet resource intensive and need to align with our internal priorities.

@kakulukia
Copy link
Author

Hi @jadzeidan, thanks for considering to merge it. If the likelihood turns out to be above 50% I can surely polish this a bit more and add some additional tests. I just need little guidance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: Show percentage gain excluding transactions
2 participants