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
[BUG] ProfitLossCriterion: Javadoc says "excludes trading costs" but code uses trading cost #1130
Comments
Good catch, do you want to create a PR to resolve this issue? Thanks.
…On Wed, Feb 14, 2024 at 3:38 PM Cashmeiser ***@***.***> wrote:
*I have checked existing issues and wiki*
- I could not find similar issues
<https://github.com/ta4j/ta4j/issues?utf8=%E2%9C%93&q=>
- I could not find a solution in the wiki
<https://ta4j.github.io/ta4j-wiki/> or faq section
<https://ta4j.github.io/ta4j-wiki/FAQ.html>
*Describe the bug*
Javadoc
<https://github.com/ta4j/ta4j/blob/master/ta4j-core/src/main/java/org/ta4j/core/criteria/pnl/ProfitLossCriterion.java#L33>
in ProfitLossCriterion says "Net Profit and loss criterion (absolute PnL, *excludes
trading costs*)."
The code uses: position.getProfit();
and that code is
<https://github.com/ta4j/ta4j/blob/master/ta4j-core/src/main/java/org/ta4j/core/Position.java#L236>
:
/**
* Calculates the net profit of the position if it is closed. The net profit
* **includes any trading costs.**
*
* @return the profit or loss of the position
*/
public Num getProfit() {
if (isOpened()) {
return zero();
} else {
return getGrossProfit(exit.getPricePerAsset()).minus(**getPositionCost()**);
}
}
So, what is expected from ProfitLossCriterion? With Costs as code, or
exclude cost as javadoc says?
*Expected behavior*
Consistency between Javadoc and Implementation
—
Reply to this email directly, view it on GitHub
<#1130>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABQJ6FOIP5NA2OTYQTO3VPLYTUOERAVCNFSM6AAAAABDJBDRPWVHI2DSMVQWIX3LMV43ASLTON2WKOZSGEZTKMJWGQ2DMNI>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Yes, I have a fix (like other criteria) with a constructor with But to do this, I need Permission to push a repo. Can you give it to me? |
Typically contributing to open source projects is done via pull requests. Please see the contribution guide here: https://ta4j.github.io/ta4j-wiki/How-to-contribute As for the implementation, to be consistent with the rest of the |
I get permission denied when I try to push my feature-branch:
About the implementation, I took the boolean param from the other existing PnL: https://github.com/ta4j/ta4j/blob/master/ta4j-core/src/main/java/org/ta4j/core/criteria/pnl/ProfitCriterion.java#L42 |
Maybe its on my side then. I had cloned the repo, created a feature-branch but couldn't push.
|
I have checked existing issues and wiki
Describe the bug
Javadoc in ProfitLossCriterion says "Net Profit and loss criterion (absolute PnL, excludes trading costs)."
The code uses:
position.getProfit();
and that code is:
So, what is expected from ProfitLossCriterion? With Costs as code, or exclude cost as javadoc says?
Expected behavior
Consistency between Javadoc and Implementation
The text was updated successfully, but these errors were encountered: