AppleScript名:Bitcoin Exchange Rates APIを呼び出す |
— Created 2017-12-11 by Takaaki Naganoya — 2017 Piyomaru Software use AppleScript version "2.5" use scripting additions use framework "Foundation" property |NSURL| : a reference to current application’s |NSURL| property NSData : a reference to current application’s NSData property NSJSONSerialization : a reference to current application’s NSJSONSerialization set aInfo to getBitcoinExchangeRating() of me as list of string or string –> {CNY:{15m:85561.31, sell:85497.93, symbol:"¥", last:85561.31, buy:85624.69}, PLN:{15m:45977.18, sell:45943.12, symbol:"zł", last:45977.18, buy:46011.23}, THB:{15m:426039.93, sell:425724.34, symbol:"฿", last:426039.93, buy:426355.52}, AUD:{15m:16863.96, sell:16851.47, symbol:"$", last:16863.96, buy:16876.45}, CLP:{15m:8071171.16, sell:8065192.44, symbol:"$", last:8071171.16, buy:8077149.89}, SEK:{15m:108311.42, sell:108231.19, symbol:"kr", last:108311.42, buy:108391.65}, BRL:{15m:43429.07, sell:43396.9, symbol:"R$", last:43429.07, buy:43461.24}, DKK:{15m:81673.5, sell:81613.0, symbol:"kr", last:81673.5, buy:81734.0}, GBP:{15m:9741.63, sell:9734.41, symbol:"£", last:9741.63, buy:9748.84}, RUB:{15m:759210.64, sell:758648.26, symbol:"RUB", last:759210.64, buy:759773.03}, CHF:{15m:12874.51, sell:12864.97, symbol:"CHF", last:12874.51, buy:12884.04}, ISK:{15m:1379204.64, sell:1378183.0, symbol:"kr", last:1379204.64, buy:1380226.29}, SGD:{15m:17490.64, sell:17477.68, symbol:"$", last:17490.64, buy:17503.6}, EUR:{15m:11399.17, sell:11385.02, symbol:"€", last:11399.17, buy:11413.33}, NZD:{15m:18527.65, sell:18513.92, symbol:"$", last:18527.65, buy:18541.37}, USD:{15m:13013.82, sell:13004.18, symbol:"$", last:13013.82, buy:13023.46}, TWD:{15m:389815.96, sell:389527.21, symbol:"NT$", last:389815.96, buy:390104.72}, KRW:{15m:14025514.37, sell:14015124.95, symbol:"₩", last:14025514.37, buy:14035903.78}, JPY:{15m:1474075.39, sell:1472983.47, symbol:"¥", last:1474075.39, buy:1475167.31}, INR:{15m:833116.13, sell:832498.99, symbol:"₹", last:833116.13, buy:833733.26}, HKD:{15m:101728.97, sell:101653.61, symbol:"$", last:101728.97, buy:101804.32}, CAD:{15m:16568.51, sell:16556.23, symbol:"$", last:16568.51, buy:16580.78}} set aVal to (aInfo’s valueForKeyPath:"JPY") as list of string or string –> {15m:1483814.35, sell:1483366.93, symbol:"¥", last:1483814.35, buy:1484261.76} on getBitcoinExchangeRating() try with timeout of 10 seconds set link to "https://blockchain.info/ticker" –Exchange Rates API set theURL to |NSURL|’s URLWithString:link set jsonData to NSData’s dataWithContentsOfURL:theURL set aJsonDict to (NSJSONSerialization’s JSONObjectWithData:jsonData options:0 |error|:(missing value)) return aJsonDict end timeout on error return missing value end try end getBitcoinExchangeRating |
More from my site
(Visited 30 times, 1 visits today)