本文与 Linux 无关;这是关于使用JMP下载货币换算数据。
Linux 计算器上的货币按钮最近引起了我的注意。
Calculator showing the currency conversion buttonsCalculator showing the currency conversion buttonsCalculator showing the currency conversion buttonsCalculator showing the currency conversion buttons显示货币转换按钮的计算器
他们如何获得最新的换算系数? 谷歌带我去这里,这让我这里,这带我去此欧洲央行页面包含费率以及 PDF、CSV 和 XML 下载链接。 单击 XML 链接,您的浏览器可能会打开如下所示的内容:
screenshot of FireFox showing an XML file of exchange ratesscreenshot of FireFox showing an XML file of exchange ratesscreenshot of FireFox showing an XML file of exchange ratesscreenshot of FireFox showing an XML file of exchange rates显示汇率 XML 文件的 FireFox 屏幕截图
快速浏览一下就会发现这些汇率均基于欧元,因为欧元没有出现,并且表中没有 1.0000 因子。 参考页面也是这么说的:
based on the eurobased on the eurobased on the eurobased on the euro基于欧元
让我们将 XML 加载到数据表中。 JMP 15 的 XML 向导可以帮助构建 JSL 来执行此操作。 首先,将 XML 从浏览器保存到您的计算机,然后使用“文件”->“打开”,选择 XML 扩展名,选择您的文件,然后在向导中打开它。
Choose the XML extension to see the downloaded fileChoose the XML extension to see the downloaded fileChoose the XML extension to see the downloaded fileChoose the XML extension to see the downloaded file选择 XML 扩展名以查看下载的文件
XML 向导打开,是时候决定哪些列和行是有趣的。 打开统计列以查看重复数据位于哪些键下,并关闭名称列以使显示更适合屏幕:
opening the XML file with the wizardopening the XML file with the wizardopening the XML file with the wizardopening the XML file with the wizard使用向导打开 XML 文件
您也可以使用 Tall Guess 来获得相同的结果。 高个猜测注意到 32 个重复条目并选择该键来生成行,然后选择所有(两个)子键来生成列。 它使用采样器数据来确定子键是否应生成数字数据或字符数据。
现在,通过关闭统计列并重新打开名称列来重命名列。 还修改一些其他内容,将“货币”的建模类型设置为“名义”。 时间、姓名、主题都在图片后面描述了...
Changing column names, adding some meta dataChanging column names, adding some meta dataChanging column names, adding some meta dataChanging column names, adding some meta data更改列名称,添加一些元数据
还有其他三列元数据:时间、名称、主题。 时间似乎是最有用的;让我们保留每一行的时间。 姓名和主题只能保留为表变量;确定后他们会出现:
The source script and the two table variables are part of the imported tableThe source script and the two table variables are part of the imported tableThe source script and the two table variables are part of the imported tableThe source script and the two table variables are part of the imported table源脚本和两个表变量是导入表的一部分
单击要提醒的表变量,该表来自何处。
要在下周使用下周的当前数据重现此导入,请获取源脚本并在 URL 中进行编辑:
Open(
//"E:\eurofxref-daily.xml",
"https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml",
XML Settings( Stack( 0 ),
Row( "/gesmes:Envelope/Cube/Cube/Cube" ),
Col("/gesmes:Envelope/gesmes:subject",
Column Name( "gesmes:subject" ), Fill( "Use Forever" ),
Type( "Table Variable" ), Format( {"Best"} ), Modeling Type( "Continuous" ) ),
Col("/gesmes:Envelope/gesmes:Sender/gesmes:name",
Column Name( "gesmes:name" ), Fill( "Use Forever" ),
Type( "Table Variable" ), Format( {"Best"} ), Modeling Type( "Continuous" ) ),
Col("/gesmes:Envelope/Cube/Cube/@time",
Column Name( "time" ), Fill( "Use Forever" ),
Type( "Numeric" ), Format( {"yyyy-mm-dd", 10} ), Modeling Type( "Continuous" ) ),
Col("/gesmes:Envelope/Cube/Cube/Cube/@currency",
Column Name( "currency" ), Fill( "Use Once" ),
Type( "Character" ), Format( {"Best"} ), Modeling Type( "Nominal" ) ),
Col("/gesmes:Envelope/Cube/Cube/Cube/@rate",
Column Name( "rate" ), Fill( "Use Once" ),
Type( "Numeric" ), Format( {"Best"} ), Modeling Type( "Continuous" ) )
),
XML Wizard( 0 )
);