# How is the price of an ASA token determined?

I realize this is a broad question.

For context, I am attempting to write a function that converts an asset transfer transaction amount to its equivalent worth in microalgo. The act of building this function helped reveal the question… “How is an ASA price determined to begin with?”.

For instance, when I am ready to perform a swap using a decentralized exchange, how are they determining the price of the two assets?

For those interested in my progress:

``````def axfer_amount_in_algo(algod_client, txn):
if txn['tx-type'] != 'axfer':
return
asset_id = txn['asset-transfer-transaction']['asset-id']
amount = txn['asset-transfer-transaction']['amount']
asset_params = algod_client.asset_info(asset_id)['params']
algo_params = {
'name': 'Algo',
'unit-name': 'ALGO',
'decimals': 6,
}
# TODO: Build poller that gets the price of both `asset` and `algo`
# TODO: Calculate asset amount converted to micro algo
``````

The total value of the two assets is always the same, so if the pool contains 100 of ASSET A and 200 of ASSET B, it means that 1 ASSET A is worth 2 ASSET B, if ASSET B is worth \$1, then ASSET A is worth \$2.

1 Like

I understand this, however I’m still trying to understand how the price of an ASA is calculated.

Perhaps the swap example isn’t a great analogy.

Let’s say I want to know the price of 1 FOO. What controls the price of 1 FOO?

Is it a calculation that can be performed by analyzing all transactions performed with the FOO token? How does the price of FOO fluctuate?

Thank you!

I believe you won’t find the answer to that question on chain.
The price of a commodety determined by how much people are willing to pay for it. The “willing” part might not have happened yet, and therefore there might be no evidence of that.

Price oracles usually use a combination of sources, combined with calculated percision. The percision is determined by the varience in the asset price across sources and time.

2 Likes

Thank you for this explanation

The percision is determined by the varience in the asset price across sources and time

Where can I find these sources? I see this as a great learning opportunity to create my own ASA price oracle.

Are there any existing ASA price oracles that I can use for reference?

My answer above wasn’t ASA specific.
The source could be ASA specific :
Tinyman, algodex and for wrapped bitcoin/eth, it could be the price from coinmarketcap, kucoin, coinbase and binance.

You mention price, but in what currency do you need the price? USD? If you have an ALGO / YLDY pool on Tinyman you can’t get the price of YLDY in dollars, you can just get the price in ALGO.

Please note that Tinyman or Exchange prices are always completely independent, the reason they are fairly comparable is only because there are people doing arbitrage.

So you can certainly retrieve in chain the numbers contained in the pool ALGO / USDC and obtain the price of ALGO in USDC, then with the same method you can obtain the price in ALGO of YLDY, and than doing the math you can derive the USDC price for YLDY

Hey there! Did you figure out a solution to this? I’m trying to do this right now as well as a fun exercise. Any pointers would be welcome!

If you are using Tinyman, they have the price data on-chain. The price is determined by the market and set by the AMM created by the Tinyman team.

I would refer to this forum post on how to get the on-chain price of ASAs: Is it possible to read the price of an asset on Tinyman from a stateful smart contract? Kind of like a on-chain oracle?

@Ben gave an excellent answer on this subject.

i think the answer you are looking for is the fact that price of asa is valuation of token in the future… the tokens which have high business possibilities will be evaluated higher, and tokens with smaller business opportunities will be evaluated lower. also you have to consider the dispenser of the tokens… who gets the token, what is required work to get the token and so on…

Disclaimer… i will try to explain on two of my projects.

Also note that to calculate exact price in the tinyman pool, you just divide one asa and other asa and you get the price (not considering now the decimals difference)… eg Here you can see now 370 USDC, and 70000 Vote coins, so the price is 0,00528 \$Vote/USDc…

So regarding the project valuation… I will explain it on two projects - Vote Coin, and DREM. In short, the Vote Coin is the voting system built on algorand which allows delegation of voting power, and efficient management of DAOs, and DREM is Decentralized real estate marketplace which allows onchain algodex trading of real estates as NFTs.

DREM has won the SB Hackathon in Switzerland and we received \$100k in AWS credits. Vote Coin has won Encode hackathon, and is part of Encode algorand accelerator program.

Regarding business potential, Vote Coin is open source solution where everybody can vote simply by submitting transactions to the network, and application calculates the results after the voting is finished. This has quite small business potential, because the only way how to capitalize it is through providing auditing services to rich entities who wants to have 100% accurancy of the voting. See the price development here. Vote Coin (Vote) – TinyChart

On the other side, the DREM has huge business potential because it combines the real world assets with the rental payouts in crypto. When this project goes worldwide, it will stabilize the price of crypto because it combines the house market with crypto market. Creating real decentralized market for estates may help even central banks because they need to have real time information about real estate market. It is win win for all parties… the investors because they can enter/exit any time, the people, and for global community in knowing the real best investment opportunities around the world. DREM dao token is not yet for sale because i am looking for VC capital first.

The point is, you cannot just compare asa prices… because you should really focus on the project perspective, you should talk to community, read whitepaper, see the roadmap, and so on…