{ "HIGHLIGHTSTROKECOLORS": [ [ "external", "#000000" ] ], "ARGPLUGINS": [ [ "currencyrate", "var block = logo.blocks.blockList[blk];var conns = block.connections;var from = logo.parseArg(logo, turtle, conns[1]);var to = logo.parseArg(logo, turtle, conns[2]);var apiURL = 'https://currency-exchange.p.mashape.com/exchange?from=' + from + '&q=1.0&to=' + to;if (block.cacheFor === apiURL && block.cache !== undefined) { var response = block.cache;} else { try { var request = new XMLHttpRequest(); request.open('GET', apiURL, false); request.setRequestHeader('X-Mashape-Authorization', financeMashapeKey); request.send(null); var response = request.responseText; block.cacheFor = apiURL; block.cache = response; } catch (e) { logo.errorMsg('Could not connect to Currency API', blk); }}block.value = parseFloat(response);" ], [ "stockprice", "var block = logo.blocks.blockList[blk];var conns = block.connections;var stock = logo.parseArg(logo, turtle, conns[1]);var apiURL = 'https://cors-anywhere.herokuapp.com/dev.markitondemand.com/Api/v2/Quote/json?symbol=' + stock;if (block.cacheFor === apiURL && block.cache !== undefined) { var response = block.cache;} else { try { var request = new XMLHttpRequest(); request.open('GET', apiURL, false); request.send(null); var response = request.responseText; block.cacheFor = apiURL; block.cache = response; } catch (e) { logo.errorMsg('Could not connect to Markit On Demand API', blk); }}j = JSON.parse(response);if (j.Status !== 'SUCCESS') { if (j.Message.indexOf('No symbol matches') !== -1) { logo.errorMsg('No stock symbol %s found. Try another, eg. GOOG, AAPL'.replace('%s', stock), blk); } else { logo.errorMsg(j.Message, blk); }} else { block.value = j.LastPrice;}" ] ], "GLOBALS": "financeMashapeKey = '3Rfxc7fwp2mshJxgtDxKSueYna8Ap1qZfAcjsn2hjpuWPuBCrI';", "PALETTEHIGHLIGHTCOLORS": [ [ "external", "#9DC4FF" ] ], "PALETTEPLUGINS": [ [ "external", "" ] ], "BLOCKPLUGINS": [ [ "currencyrate", "var currencyRate = new ProtoBlock('currencyrate');currencyRate.palette = palettes.dict['external'];blocks.protoBlockDict['currencyrate'] = currencyRate;currencyRate.extraWidth = 20;currencyRate.staticLabels.push(_('currency'), _('from'), _('to'));currencyRate.adjustWidthToLabel();currencyRate.twoArgMathBlock();currencyRate.dockTypes[1] = 'anyin';currencyRate.dockTypes[2] = 'anyin';currencyRate.defaults.push('AUD', 'USD');" ], [ "stockprice", "var stockprice = new ProtoBlock('stockprice');stockprice.palette = palettes.dict['external'];blocks.protoBlockDict['stockprice'] = stockprice;stockprice.staticLabels.push(_('stock price'));stockprice.adjustWidthToLabel();stockprice.oneArgMathBlock();stockprice.dockTypes[1] = 'anyin';stockprice.defaults.push('GOOG');" ] ], "PALETTEFILLCOLORS": [ [ "external", "#59f" ] ], "PALETTESTROKECOLORS": [ [ "external", "#3771c8" ] ] }