Static HTML templates and API key access improvements in Exchange extension
Multitude of improvements in the latest near-stable version of the Exchange Extension. Overview of current project status and some info for programmatic JSON API access.
Version 0.7.0-beta
of the Exchange extension brings a large number of additions and improvements. Most of these are due to user feedback, so a big thank you to everyone who submitted feedback on the forum!
Static templates
The UI shortcodes, when rendered with their default template, are all dynamic, and powered with JavaScript. This is great in most cases. However, a number of users expressed the need to display a different market on each page for SEO and other purposes. This is now achieved with the new, static templates for these shortcodes. Static shortcodes are still lacking some features (like clickable amounts), but require a market attribute. This lets you create a separate page for each market.
For example, in your BTC_LTC market page, you might want to use the following shortcodes:
[wallets_exchange_market template="horizontal-static" market="BTC_LTC"]
[wallets_exchange_bids template="static" market="BTC_LTC"]
[wallets_exchange_asks template="static" market="BTC_LTC"]
[wallets_exchange_limit_buy template="static" market="BTC_LTC"]
[wallets_exchange_limit_sell template="static" market="BTC_LTC"]
[wallets_exchange_market_history template="static" market="BTC_LTC"]
[wallets_exchange_user_history template="static" market="BTC_LTC"]
[wallets_exchange_user_orders template="static" market="BTC_LTC"]
The chart also now has a static template, for example you can do this:
[wallets_exchange_chart template="static" market="BTC_LTC" timeframe="1d"]
When using these new static templates it is necessary to specify a market.
Understand that there are pros and cons between using the static or the default (dynamic) templates. For example, with static shortcodes, the UIs will not refresh unless you refresh the page, and the amounts displayed in tables are not clickable.
Please see the accompanying documentation for details on how to use the shortcodes.
API key access
With the need for programmatic access to the JSON API increasing lately, the system has been improved. Recently, API key authentication was introduced in the parent plugin, Bitcoin and Altcoin Wallets. The mechanism has now been unified in version 0.7.0-beta
of the Exchange extension:
- Users now have one API key for accessing both the wallets functionality and the trading functionality of the Exchange.
- Users no longer need to specify a
__wallets_user_id
argument or a__wallets_exchange_user_id
argument. - The
[wallets_exchange_api_key]
shortcode has been deprecated. Use[wallets_api_key]
instead.
These changes require that you upgrade to the latest version 4.2.1
of Bitcoin and Altcoin Wallets.
Other improvements and project status
This version is still marked beta, but should be stable. Many of the bugs have been ironed out, mostly thanks to user feedback (thank you, you know who you are!). I know that many users are already using the exchange in live websites. We are now close to a stable version 1.0.0
, which I will feel comfortable to recommend for production usage. The full changelog for 0.7.0-beta
is:
- Add: All shortcodes now have a static template. This allows the creation of SEO friendly pages, as the data is rendered as HTML on the server side. An additional market attribute is required. See the docs for details.
- Add: The table headers “Amount”, “Total”, and “Sum” now also include the corresponding coin symbol where applicable.
- Improve: The market orderbook (bids/asks) and the market history can now be displayed without needing to log in.
- Change: The
[wallets_exchange_market]
shortcode no longer uses radio buttons to allow market selection in its default view template. Instead the user can click on any part of a market row to select the current market. - Fix: When switching between markets, the default buy exchange rate for a market without bids, and the default sell exchange rate for a market without sells is set to zero to avoid user errors (previously would remain at previous value).
- Fix: The maximum suggested buy or sell amount is always rounded downwards to the 8th decimal, thus the amount cannot be rejected any more due to the available balance amount being rounded upwards.
- Add: New market info shortcode template displays market info horizontally in a table:
[wallets_exchange_market template="horizontal-dropdown"]
. Its static counterpart is[wallets_exchange_market template="horizontal-static"]
- Change: In all frontend HTML tables, the last column fills the remaining table width.
- Change: There is no longer a separate JSON API key for the Exchange, the one from the parent plugin is used.
- Fix: When unable to render a shortcode, there is no longer an
ob_end_clean()
warning. - Change: Data in numeric columns is now right-aligned. This helps visually, as the decimal points now align vertically.
- Change: When accessing the JSON API for trading using a key, the user ID no longer needs to be specified.
Comments:1