Getting asset price from Waves DEX

Hi,

I do need to get the price of several assets (including WAVES, Bitcoin… and my own token) from Waves DEX to disclose them on my web site.

Is some API function for such application there?

Thank you in advance and I look forward to hear from you soon.

Kindest Regards.

After some hours of study about JavaScript… I finally wrote this code to get and publish my token price on any

with identifier “MyTokenPrice”.

Happy to solve this matter and sharing it with Waves Developers:

<div id="MyTokenPrice">
</div>
<script>
   var MyTokenPrice = document.querySelector('#MyTokenPrice')
    function GetPrice() {
        fetch('https://marketdata.wavesplatform.com/api/trades/EizwzJUFzUxPRXi5yr94XSqAcpzHC2vFWuWFwoFpp1EU/WAVES/1')
        .then(res => res.json())
        .then(data => {
            MyTokenPrice.innerHTML = `
            <p>Price: ${data['0'].price}</p>
            `
        })
    } 
window.onload=GetPrice();	
</script>
3 Likes

I have to note, that marketdata API is deprecated and it’s better to use https://api.wavesplatform.com/v0/docs/

On Waves Wallet’s Portfolio I do see a US$ value of my token which is not the same I get from the API.

Is there some API to get the US$ value of a token like provided on Waves Wallet’s Portfolio?

I finally wrote this code to get and publish my

its possible also in a different way here with certain chart design, its a long code you have to scroll down

this is for https coding windows.

.highcharts-credits { visibility: hidden !important; }
<div ng-controller="ChartsController">
	<div ng-repeat="unit in units">
		<h3 style="margin-bottom: 0px; padding-bottom: 0px;">
			<span class="name">{{unit.name}}</span> <span class="price">{{unit.price | number: 2}}</span>
		</h3>
		<div id="{{unit.id}}" style="height: 100px; margin-left: {{unit.marginLeft}}px"></div>
	</div>
</div>

from my website:https://www.cryptoproductivity.org/real-time-market-data

Nice chart design. I was looking for something similar.

However I don’t understand how to create it! :blush:

This post was flagged by the community and is temporarily hidden.

No worries, I’ll try to find something similar by myself :slightly_smiling_face: :+1:

nevertheless i have problems with low volume charts, i dont get a default timeframe setting for the marketdata like the pairing ZEC/EUR does, so i am here for the waves developers,

https://marketdata.wavesplatform.com/api/candles/ZEC/EUR/60/24

you wont get a default 0 volume market data like this ZEC/EUR pairing here for your custom asset

1 Like

changed that and it works now very well although i wonder weather i could also make the entire chart like a button so when someone click it he gets directed to the waves dex exchange pairings, currently i can only do that with the token logos above the chart