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

How to get asset's decimal number? #25

Closed
majestique opened this issue Jan 21, 2022 · 2 comments
Closed

How to get asset's decimal number? #25

majestique opened this issue Jan 21, 2022 · 2 comments

Comments

@majestique
Copy link

I'd like to enter 1 for the asset in (ALGO), and it should automatically figure out how many decimals it has and convert it to 1,000,000

Couldn't seem to find an example of this.. also would it be okay to use 1000000 instead of 1_000_000 like in the example below?

quote = pool.fetch_fixed_input_swap_quote(ALGO(1_000_000), slippage=0.01)

@ctubio
Copy link

ctubio commented Jan 24, 2022

amount = 1
ALGO(amount * 10 ** ALGO.decimals)

🐨 works with any asset, and yea, python have underscores in numeric literals that are just (optional) visual separators

@gokselcoban
Copy link
Contributor

Thank you for the question and answer. The issue looks like resolved.

I will close this issue, feel free to reopen it.

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

3 participants