tinymanorg / tinyman-py-sdk

Tinyman Python SDK
MIT License
117 stars 60 forks source link

How to get asset's decimal number? #25

Closed majestique closed 2 years ago

majestique commented 2 years ago

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 commented 2 years ago
amount = 1
ALGO(amount * 10 ** ALGO.decimals)

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

gokselcoban commented 2 years ago

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

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