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

Calculation precision #9

Open
pavleprica opened this issue Apr 29, 2021 · 0 comments
Open

Calculation precision #9

pavleprica opened this issue Apr 29, 2021 · 0 comments

Comments

@pavleprica
Copy link

pavleprica commented Apr 29, 2021

Hey team, I hope all of you are doing well in these times.

So I have a question, related to calculation precision. I am not that knowledgeable with Python, so I cannot propose a concrete solution.

The issue is that for calculation as a type float is being used as a type, which leads to unstable calculations because of decimals.
I think this can pose a really big issue and is a no-go for us to use this. When decimals are being calculated and everything depends on the floating-point, something else should be used. Because it really depends on which CPU is the machine using, and what is the state of that CPU.

In the Java world, the solution is BigDecimal or a custom implementation.

For an example

bot = Bot(
    account_id='account-id',
    access_token='access-token',
    granularity='D',
    instrument='EUR_USD',
    environment='practice'
)
print(bot._candles(count='6'))

print(bot.rsi(period=5))

Prints a different result every time.

Is there a plan to resolve this in the near future?

EDIT:
Also, this would apply to all calculations inside the app with float as a type

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

No branches or pull requests

1 participant