Difference between revisions of "Template:Currency convert"
Jump to navigation
Jump to search
(Using https://exchangeratesapi.io/ instead of Yahoo API) |
|||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
− | <includeonly>{{#get_web_data: url=https:// | + | <includeonly>{{#get_web_data: url=https://api.exchangeratesapi.io/latest?base={{{1}}}&symbols={{{2}}} |
|format=JSON | |format=JSON | ||
− | |data= | + | |data=rates=rates |
|cache seconds=43200 | |cache seconds=43200 | ||
− | }} | + | }}{{#expr:{{{3|1}}}*{{#external_value:rates}} round 2}}{{#clear_external_data:}}<nowiki /></includeonly><noinclude> |
− | {{#expr:{{{3|1}}}*{{#external_value: | + | This template uses https://exchangeratesapi.io/ to convert currencies. |
− | {{#clear_external_data:}}</includeonly><noinclude> | ||
− | This template uses | ||
== Examples == | == Examples == | ||
Line 12: | Line 10: | ||
<code><nowiki>{{Currency convert|CZK|PLN|32}}</nowiki></code> → {{Currency convert|CZK|PLN|32}} | <code><nowiki>{{Currency convert|CZK|PLN|32}}</nowiki></code> → {{Currency convert|CZK|PLN|32}} | ||
− | Convert 1 Romanian leu to Hungarian forint<br /> | + | Convert 1 Romanian leu to Hungarian forint:<br /> |
<code><nowiki>{{Currency convert|RON|HUF}}</nowiki></code> → {{Currency convert|RON|HUF}} | <code><nowiki>{{Currency convert|RON|HUF}}</nowiki></code> → {{Currency convert|RON|HUF}} | ||
+ | |||
+ | For conversions to euros or US dollars you can also use [[Template:To EUR]] and [[Template:To USD]]:<br /> | ||
+ | <code><nowiki>{{To EUR|PLN|10}}</nowiki></code> → {{To EUR|PLN|10}} | ||
+ | |||
+ | [[Category:Templates]] | ||
+ | </noinclude> |
Latest revision as of 16:58, 30 October 2019
This template uses https://exchangeratesapi.io/ to convert currencies.
Examples
Convert 32 Czech korunas to Polish zloty:
{{Currency convert|CZK|PLN|32}}
→ Expression error: Unexpected < operator.
Convert 1 Romanian leu to Hungarian forint:
{{Currency convert|RON|HUF}}
→ Expression error: Unexpected < operator.
For conversions to euros or US dollars you can also use Template:To EUR and Template:To USD:
{{To EUR|PLN|10}}
→ Expression error: Unexpected < operator.