Skip to content

Conversation

@frodoe7
Copy link

@frodoe7 frodoe7 commented Jan 23, 2025

The backtesting have a bug when I send the prices like 0.988, 1.024
for example ADA/USDT, it round automatically to "1"

The issue happens in broker.ts

        if (!((limitPrice || stopPrice || adjustedPrice) > (tpPrice || Number.NEGATIVE_INFINITY) && (limitPrice || stopPrice || adjustedPrice) < (slPrice || Number.POSITIVE_INFINITY))) {
            console.log(tpPrice, ' <> ', slPrice);

slPrice & tpPrice are around 0.988 or 1.024
however after this if condition, it logs 1 <> 1

@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (be42fbb) to head (010ff3c).
Report is 6 commits behind head on master.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff            @@
##            master        #8   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           15        15           
  Lines          666       677   +11     
  Branches       127       145   +18     
=========================================
+ Hits           666       677   +11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@chunkai1312
Copy link
Contributor

@frodoe7 Thank you for reporting this. I checked the code you mentioned, and based on my tests, I couldn't reproduce the automatic rounding issue. Could you provide more test cases or specific scenarios where the issue occurs? This will help me investigate and fix the issue more accurately.

@frodoe7
Copy link
Author

frodoe7 commented Feb 5, 2025

I'll close the PR, because there's no reproduce example

@frodoe7 frodoe7 closed this Feb 5, 2025
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.

3 participants