ceroma
589011f956
Feature/improve performance of portfolio snapshot computation
After doing some perf analysis on the portfolio snapshot computation, this line turned out to be the biggest offender on my machine (Raspberry Pi 4).
My current DB consists of 5189 activities and 478 different symbols. The majority (about 400) of the symbols represent single `INTEREST` data points.
This line runs for each `SymbolProfile`, and deep-cloning is very expensive. Specially if most of the time (in my case) it ends up filtering out just one element out of the entire clone. On my machine, this line averaged 280ms per invocation, amounting to over 2 minutes during a snapshot computation.
After this diff, this line averaged 1.5ms per symbol, with a peak of 56ms for my symbol with the highest number of activities (1500). The total time spent filtering and deep-cloning is now less than a second (~750ms).
Per my understanding of the code, this change should preserve the same behavior as before, but I'm not too familiar with TypeScript so please feel free to be very pedantic in the review.
Test Plan:
Check that result of portfolio snapshot computation is the same before and after this diff:
1. Flush portfolio snapshot cache:
```
$ docker exec -it ghostfolio-redis-1 redis-cli --pass $REDIS_PASSWORD del "portfolio-snapshot-f9e4c63e-4b8e-46fc-b6ed-75ca0205f12b"
```
2. Open Accounts to trigger snapshot calculation
3. Dump portfolio snapshot to a file:
```
$ docker exec -it ghostfolio-redis-1 redis-cli --pass $REDIS_PASSWORD --no-auth-warning get "portfolio-snapshot-f9e4c63e-4b8e-46fc-b6ed-75ca0205f12b" | python -c "import json, sys; json.dump(json.loads(json.loads(json.load(sys.stdin))), sys.stdout, indent=2, sort_keys=True)" > snapshot-before.json
```
4. Apply this patch
5. Repeat steps 1-3
6. Compare results, check everything matches except for expiration time:
```
$ diff snapshot-before.json snapshot-after.json
2c2
< "expiration": 1727423725104,
---
> "expiration": 1727424454187,
```
1 year ago
Thomas Kaul
bb445ddf2e
Feature/improve experimental chart in account detail dialog ( #3813 )
* Improve chart in account detail dialog
* Update changelog
1 year ago
Thomas Kaul
4a97e2bb54
Feature/align holdings and regions of public page with allocations page ( #3815 )
* Align holdings and regions of public page with allocations page
* Update changelog
1 year ago
Thomas Kaul
f59e8c8798
Feature/add feature graphic for hacktoberfest 2024 blog post ( #3800 )
* Add feature graphic
1 year ago
Thomas Kaul
be09acdb24
Feature/expose concurrency of data gathering processor as environment variable ( #3799 )
* Expose concurrency of data gathering processor
* PROCESSOR_CONCURRENCY_GATHER_ASSET_PROFILE
* PROCESSOR_CONCURRENCY_GATHER_HISTORICAL_MARKET_DATA
* Update changelog
1 year ago
Thomas Kaul
6f227e677c
Feature/refactor environment variable access in create user of user service ( #3797 )
* Refactor environment variable access
1 year ago
Thomas Kaul
e918970feb
Feature/expose concurrency of portfolio snapshot calculation as environment variable ( #3796 )
* Expose PROCESSOR_CONCURRENCY_PORTFOLIO_SNAPSHOT
* Update changelog
1 year ago
Thomas Kaul
583c14128b
Feature/extend public api with portfolio performance metrics endpoint ( #3762 )
* Extend Public API with portfolio performance metrics endpoint
* Update changelog
1 year ago
Thomas Kaul
7761e4d712
Feature/add hacktoberfest 2024 blog post ( #3790 )
* Add blog post: Hacktoberfest 2024
* Update changelog
1 year ago
Thomas Kaul
cb472c0884
Feature/improve ghostfolio po polsku ( #3782 )
* Improve Ghostfolio po polsku
1 year ago
Thomas Kaul
4865aa1665
Feature/add fallback in get quotes of eod historical data service ( #3776 )
* Add fallback to previousClose in getQuotes()
* Update changelog
1 year ago
Nikolai
38ac3d387b
Feature/extend market data endpoint by lastMarketPrice ( #3752 )
* Extend market data endpoint by lastMarketPrice
* Integrate last market price in admin market data
* Update changelog
---------
Co-authored-by: Thomas Kaul <4159106+dtslvr@users.noreply.github.com>
1 year ago
Thomas Kaul
3de192c65e
Feature/expose thresholds in rule settings ( #3770 )
1 year ago
Thomas Kaul
9fb80e5067
Feature/remove accounts from holding endpoint ( #3765 )
* Clean up accounts
1 year ago
Shaunak Das
323cfbfcaa
Feature/introduce filters in account endpoint ( #3764 )
* Introduce filters in acount endpoint
* Integrate endpoint in holding detail dialog
* Update changelog
---------
Co-authored-by: Thomas Kaul <4159106+dtslvr@users.noreply.github.com>
1 year ago
Thomas Kaul
403ee2741d
Feature/set up portfolio snapshot queue ( #3725 )
* Set up portfolio snapshot queue
* Update changelog
1 year ago
Shaunak Das
383a02519a
Feature/extend filters of order endpoint ( #3743 )
* Extend filters of order endpoint
* Update changelog
---------
Co-authored-by: Thomas Kaul <4159106+dtslvr@users.noreply.github.com>
1 year ago
Thomas Kaul
6db881b08f
Feature/optimize admin control panel endpoint using promise.all ( #3741 )
* Optimize by using Promise.all()
* Update changelog
1 year ago
Thomas Kaul
557a0bf808
Feature/optimize info endpoint using promise.all ( #3742 )
* Optimize by using Promise.all()
* Update changelog
1 year ago
Thomas Kaul
9cd4321bd0
Feature/extract users from admin control panel endpoint to dedicated endpoint ( #3740 )
* Introduce GET api/v1/admin/user endpoint
* Update changelog
1 year ago
Thomas Kaul
8c322b4e81
Bugfix/fix historical market data gathering in yahoo finance service ( #3737 )
* Switch from historical() to chart()
* Update changelog
1 year ago
Thomas Kaul
df5e2f5f0e
Feature/extract common CACHE_TTL as constants ( #3722 )
Extract CACHE_TTL
* CACHE_TTL_NO_CACHE
* CACHE_TTL_INFINITE
1 year ago
Thomas Kaul
fb44933c9c
Feature/improve error logs in scraper configuration test ( #3730 )
* Improve error logs
* Update changelog
1 year ago
Shaunak Das
7ea9061852
Feature/execute scraper configuration instantly ( #3723 )
* Execute scraper configuration instantly
* Update changelog
---------
Co-authored-by: Thomas Kaul <4159106+dtslvr@users.noreply.github.com>
1 year ago
Thomas Kaul
c48e4ec4c6
Feature/improve usage of portfolio calculator in holding endpoint ( #3727 )
* Improve usage of portfolio calculator
1 year ago
Thomas Kaul
adcddae44e
Encode redis password ( #3720 )
1 year ago
Thomas Kaul
71a568264d
Feature/improve portfolio snapshot caching ( #3717 )
* Improve portfolio snapshot caching
* Update changelog
1 year ago
Thomas Kaul
c6f804f68c
Feature/Improve redis cache part 2 ( #3716 )
* Set ttl to 0
1 year ago
Thomas Kaul
0fc83486dc
Feature/improve redis cache ( #3714 )
* Improve redis cache
* Update changelog
1 year ago
Thomas Kaul
b794c4dcc8
Feature/add todo for emergency fund positions value calculation ( #3684 )
* Add todo
1 year ago
Thomas Kaul
c4a28c6bff
Feature/set up a performance logging service ( #3703 )
* Setup performance logging service
* Update changelog
1 year ago
Thomas Kaul
bc51f106e9
Feature/expose log levels as env variable ( #3704 )
* Expose log levels as env variable
* Update documentation
* Update changelog
1 year ago
Thomas Kaul
d08e8b4fd8
Feature/expose max chart items as env variable ( #3701 )
* Expose MAX_CHART_ITEMS as env variable
* Update changelog
1 year ago
Thomas Kaul
e23019a115
Feature/improve liabilities in portfolio calculator ( #3696 )
Improve liabilities
1 year ago
Thomas Kaul
a8e0bb5a21
Bugfix/fix division by zero in performance calculation ( #3695 )
* Fix division by zero
* Update changelog
1 year ago
gizmodus
f360a12823
Feature/rework portfolio calculator ( #3393 )
* Rework portfolio calculation
* Update changelog
---------
Co-authored-by: Thomas Kaul <4159106+dtslvr@users.noreply.github.com>
1 year ago
Bastien Jeannelle
2b212078b8
Feature/add support to deactivate x-ray rules ( #3537 )
* Add support to deactivate X-ray rules
* Update changelog
1 year ago
Anatoly Popov
12c722afe1
Bugfix/Use currency conversion for fees and values ( #3672 )
* Use currency conversion for fees and values
* Update changelog
1 year ago
Thomas Kaul
c34959896c
Feature/improve color assignment with annualized performance in treemap chart ( #3657 )
* Improve color assignment
* Update changelog
1 year ago
Thomas Kaul
2bbad8f4b0
Feature/add logging to benchmark service ( #3654 )
* Add logging
1 year ago
Thomas Kaul
dc1948016f
Feature/clone or edit activity from holding detail dialog ( #3644 )
* Clone or edit activity from holding detail dialog
* Update changelog
1 year ago
Thomas Kaul
b2ed0b2c80
Feature/improve caching of benchmarks in markets overview ( #3640 )
* Improve caching
* Update changelog
1 year ago
Thomas Kaul
42fe653e1e
Bugfix/fix cache flush endpoint response ( #3641 )
* Fix cache flush endpoint response
* Update changelog
1 year ago
Thomas Kaul
41f5801b5e
Feature/refactor unique asset type to asset profile identifier ( #3636 )
* Refactoring
1 year ago
Thomas Kaul
8f6203d296
Feature/manage tags of holdings ( #3630 )
* Manage tags of holdings
* Update changelog
1 year ago
Thomas Kaul
02db0db733
Feature/persist view mode of holdings tab on home page ( #3624 )
* Persist view mode of holdings in user settings
* Update changelog
1 year ago
Thomas Kaul
fcc2ab1a48
Feature/change color assignment by annualized performance in treemap chart ( #3617 )
* Change color assignment to annualized performance
* Update changelog
2 years ago
Thomas Kaul
97db144e01
Feature/skip derived currencies in get quotes of data provider service ( #3610 )
* Skip derived currencies
* Update changelog
2 years ago
Thomas Kaul
cec55127c8
Bugix/fix dividend import from data provider for holdings without account ( #3606 )
* Fix dividend import for holdings without account
* Update changelog
2 years ago
Thomas Kaul
dd15bba359
Bugfix/fix public page for non existent access ( #3604 )
* Handle non-existent access
* Update changelog
2 years ago