I reply to all queries on the forums and via email, once per day, Monday to Friday (not weekends).

If you are new here, please see some information on how to ask for support. Thank you!

Reply To: high low in the table

dashed-slug.net Forums Exchange extension support high low in the table Reply To: high low in the table

#9734
alexg
Keymaster

Hello,

Not directly. The market stats are available to the user via the [wallets_exchange_market] UI and are embedded into the table.

However, the “high” and “low” values are only relevant with respect to a particular time interval. If you need access to the price data for the current market, you can find it in the JavaScript object wp.wallets.viewModels.walletsExchange.marketHistory().

To get the prices sorted in an array, first do:

let prices = wp.wallets.viewModels.walletsExchange.marketHistory().map( function( p) { return parseFloat(p.rate); } ).sort();

Then, the lowest price within the loaded timerange is the first element in the array:

let low = prices[0];

And the highest price in the loaded timerange, is, conversely, the last element in the array:

let high = prices[ prices.length – 1 ];

Hope this helps. Please let me know if you have any more questions.

with regards,
Alex