{"id":566,"date":"2014-09-05T00:10:05","date_gmt":"2014-09-05T06:10:05","guid":{"rendered":"http:\/\/rrbits.com\/epb\/?p=566"},"modified":"2014-09-06T05:07:01","modified_gmt":"2014-09-06T11:07:01","slug":"a-script-a-day-convcurrency-day-0405","status":"publish","type":"post","link":"https:\/\/rrbits.com\/epb\/2014\/09\/05\/a-script-a-day-convcurrency-day-0405\/","title":{"rendered":"A Script A Day &#8211; ConvCurrency &#8211; Day 04\/05"},"content":{"rendered":"<p>Day 4 out of 5 of my &#8220;A Script A Day&#8221; challenge. Day 4: ConvCurrency, a simple currency converter using WebServiceX.net&#8217;s currency conversion web API.<\/p>\n<p><!--more--><\/p>\n<p>Example usage:<\/p>\n<pre>.\/sd1.sh convcurrency JPY USD 240098\r\n240098.000 JPY -> 2280.931 USD<\/pre>\n<p>This one is pretty straightforward.  It accepts a currency pair and does the conversion you ask of it.  Without an amount argument, it&#8217;ll default to 1 of the source currency.  It&#8217;ll print 3 decimal places regardless of the currency, and of course the rates aren&#8217;t guaranteed to be exactly what the API returns. Especially when you start considering fees and the like which this doesn&#8217;t account for at all. It should give a pretty good ballpark number though. <a href=\"https:\/\/bitbucket.org\/epb9000\/script-a-day\/\">Link to the script-a-day repo.<\/a><\/p>\n<a href=\"https:\/\/rrbits.com\/epb\/files\/2014\/09\/convcurrency.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-567\" src=\"https:\/\/rrbits.com\/epb\/files\/2014\/09\/convcurrency.png\" alt=\"convcurrency\" width=\"631\" height=\"464\" srcset=\"https:\/\/rrbits.com\/epb\/files\/2014\/09\/convcurrency.png 631w, https:\/\/rrbits.com\/epb\/files\/2014\/09\/convcurrency-300x220.png 300w, https:\/\/rrbits.com\/epb\/files\/2014\/09\/convcurrency-200x147.png 200w\" sizes=\"auto, (max-width: 631px) 100vw, 631px\" \/><\/a>\n","protected":false},"excerpt":{"rendered":"<p>Day 4 out of 5 of my &#8220;A Script A Day&#8221; challenge. Day 4: ConvCurrency, a simple currency converter using WebServiceX.net&#8217;s currency conversion web API.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[42,3999],"tags":[4256,4260,4257],"class_list":["post-566","post","type-post","status-publish","format-standard","hentry","category-linux","category-programming","tag-bash","tag-currencies","tag-script-a-day"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/rrbits.com\/epb\/wp-json\/wp\/v2\/posts\/566","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rrbits.com\/epb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rrbits.com\/epb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rrbits.com\/epb\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rrbits.com\/epb\/wp-json\/wp\/v2\/comments?post=566"}],"version-history":[{"count":2,"href":"https:\/\/rrbits.com\/epb\/wp-json\/wp\/v2\/posts\/566\/revisions"}],"predecessor-version":[{"id":580,"href":"https:\/\/rrbits.com\/epb\/wp-json\/wp\/v2\/posts\/566\/revisions\/580"}],"wp:attachment":[{"href":"https:\/\/rrbits.com\/epb\/wp-json\/wp\/v2\/media?parent=566"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rrbits.com\/epb\/wp-json\/wp\/v2\/categories?post=566"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rrbits.com\/epb\/wp-json\/wp\/v2\/tags?post=566"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}