Skip to content

Invalid calculation Stocks Gain/Loss #4122

@Yurand

Description

@Yurand

MMEX version:

  • 1.5.11
  • 1.6.x

Operating System:

  • Windows
  • Mac OSX
  • Linux

Description of the bug

Gain/Loss show last trade loss instead of 0 (since no position is opened) or total Gain/Loss

Reproduction

Is the bug reproducible?

  • Always
  • Randomly
  • Happened only once

Reproduction steps:

  1. Create an investment account
  2. Add stock
  3. Enter the following trade history:

01-05-2022 +69 72.80
01-13-2022 -69 77.69
01-13-2022 76 70.77
01-13-2022 -76 71.90
01-13-2022 +76 70.77
01-13-2022 -76 66.97

Expected result:
Gain/Loss should be 0 since no position is opened or 134.49 - total trade

Actual result:
-288.80

It is the result of the two last operations:

01-13-2022 +76 70.77
01-13-2022 -76 66.97

Additional information

Database that shows the issue.
mmbtest.mmb.zip

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions