Skip to content
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

fixed_cost value does not accumulate #283

Open
diogoftm opened this issue Dec 13, 2024 · 0 comments
Open

fixed_cost value does not accumulate #283

diogoftm opened this issue Dec 13, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@diogoftm
Copy link

For multiple entries under lots with the same symbol, only the first fixed_cost is being considered. This has two implications, first the value of fixed_cost does not accumulate for the same symbol and, second, if fixed_cost is only introduced in the second or later instance of a symbol in the lots, its value is completly ignored.

To Reproduce
Using this configuration that is basically the one in the README.md:

lots:
  - symbol: "ARKW"
    quantity: 20.0
    unit_cost: 100
  - symbol: "ARKW"
    quantity: 20.0
    unit_cost: 100
    fixed_cost: 7.00

The cost displayed is 4000 instead of the expected 4007.

Also, if using this configuration:

lots:
  - symbol: "ABNB"
    quantity: 35.0
    unit_cost: 100.00
    fixed_cost: 2.00
  - symbol: "ABNB"
    quantity: 70.0
    unit_cost: 50.00
    fixed_cost: 3.00

The cost that is displayed is 7002 instead of 7005.

Expected behavior
fixed_cost of all entries under lots should be considered and accumulate across multiple entries for the same symbol.

Environment:

  • ticker Version: v4.7.1

Possible solution

Change line 160 in asset.go from:

aggregatedLot.Cost += lot.Quantity * lot.UnitCost

to:

aggregatedLot.Cost += lot.Quantity*lot.UnitCost + lot.FixedCost
@diogoftm diogoftm added the bug Something isn't working label Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant