Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Calculation precision #9

@pavleprica

Description

@pavleprica

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions