Wolfram Language

Processamento de séries temporais

Conversão de moeda histórica

Os preços de fechamento da empresa alemã Siemens negociados na Bolsa de Frankfurt na Alemanha são dados em euros. Para converter para dólares norte americanos é necessário as taxas de conversão de moedas históricas para esse período.

mostre o input completo da Wolfram Language
In[1]:=
Click for copyable input
siemens = TimeSeries@ WolframAlpha[ "Siemens stocks in 2015", \ {{"DateRangeSpecified:Close:FinancialData", 1}, "ComputableData"}];
In[2]:=
Click for copyable input
siemens = TemporalData[TimeSeries, {{ StructuredArray[QuantityArray, {253}, StructuredArray`StructuredData[QuantityArray, CompressedData[" 1:eJxdVW1IU2EUfkUscEVJ9gWyLH+IEhYMHJGrGxKrCMm23W2ybBWtfgStP1Em uBFaQTFDiAyiaxIWwcA/Yl8wpaKPUULIiixmEBUrKOiWgUa393ku+bYfezjn Pee85zznnPeu3Ht45/4iIcSM4C8e1Kz/fD+wsvOO/hejsSEd8muJ2uQlnEdW SBQ1kSDsjlK/RqLRe0Niovwt460PSdnTIjHffF2iEGNELQy/WxIzTlPqDe8I 48eCtKM8xHyFtIum3klZcy0KAV/g3vQp2hnA5osSMybQiM8w7+fUf2QcF+IO typoVQDM9aCewmCIfKGutu9KfZWdJxR7K88QeQmhzvf0u4/zWBfqz54lH6+I x1ugr2iBnU65gec19Ksgbg+jP9Pgo/Qn488J0592q8Oz40Rj9QoavWeIW2kX IU5Q/wn3CEPR/7O7G5qdn+aqov4z+TtPHsZtfhlvRxh92Q1++qMKJgp94Dey gHXVs84c+lfqZby1PP+B+cn1c36WsE9TkIedjNfBuUsqfbN4UFBzNdIO+Vem g8zrG+fdgbqy09iD0c2cozq777w3jTn0HuF8j8G+MMn5PGfni7omaznXS1nP PvrvgZ+nljxUc85+0z7HOA8x584Syhew3+kPOvPREa9Ph3+TDvsHAdRRoqMP CbwHrmIl/4SnjXIS92QnuHcvmW8x34En3LsU8+ii/zbyNa7zPrs/5KUIfamJ kM806x1Q5juTncf5z7Jv66hv514+5fs1TZ7fMM9HSl+sOMzzCn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TkMJWcNG9yciQ5aa+kIDc5 OT0hJy2cnBxJTlpEMZxoctJykZOWQk7afEN2Y64rw0knJ4c45KTN5WY3sha7 kdUMp4TYtPPOX7mJzXmOiM2RzXAqic35hsSmVROb1ovYtDNQXLmJTZtvTPsd 5KR1LqThS0jCeSRJQl8z+ASkk4S+giT0lSShn7nmyhb4dRGScJpBErpsktDF SMJnBoJflyQJXYoknIedJJwfScK5N4rjnn+XJJzrShL6q82QQRK65mY42iSh P8MoFs87j+P2Z7DDvs+8hX23k4T+vPRcnCShP48o9523DfuakoR+pssrN0k4 LyZJ6A84sO98f9qfytL+9IzdeLqCfc8Ye6WRhP58mIudJHQPktA9neGcifhK IQlHkoQzx5GE/kxn2HemLdqfbWk/kiT0M3pfef4L9J9MJQmHuCThSJJwXiOS cPwlw8kiCWfYJAm9Fkk4kiT0Om/5WxpJ6OUkoVeQhCNJwpkYiuH0Igm9hSQc SpCE3qejbxlEn3cSffNIEH0xx9mUmzNhLHux7jehBFio "], 1, { "Continuous", 1}, {"Discrete", 1}, 1, { ValueDimensions -> 1, DateFunction -> Automatic, ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}}}, True, 314.1];
In[3]:=
Click for copyable input
siemens["FirstValue"]
Out[3]=

Obtenha as taxas de conversão do de moeda histórica EUR/USD para este período.

mostre o input completo da Wolfram Language
In[4]:=
Click for copyable input
rates = TimeSeries[ First[WolframAlpha[ "euro to dollar in 2015", {{"Result", 1}, "ComputableData"}]]];
In[5]:=
Click for copyable input
rates = TemporalData[TimeSeries, {{ StructuredArray[QuantityArray, {343}, StructuredArray`StructuredData[QuantityArray, CompressedData[" 1:eJxFVnl4VNUVP48l4ESWYhAiOCztVxNpiTggFJ1yPqodICUh7LxzJ0AapoBR ISFIw9JPYNhSmCofbYcgGid8CsWpFMQpAtphl2ERKFM2IQhfiiObMIBF3+l5 70XeP3O/N/e9e8/9nd9yu5W8MnySBgBj5Kc/c65rQDHeM/hKERTjLYMLA4Yf Txg8/XWtGN8z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aW6DSrVzahUt0ml+hXd i06lqvNRqYpUqupQqf7ZZIhFpboaErD7HFSqT6NS/fr2xUml+lxUqvoxleoz qFSfSaVq31CpilTqkSKxq7MT+9X+i0alygNUqkt1xK79S+zLqVRXGyV29S9i Vx8hdr2xxH6nj+9RZYhdm4PY9ZCIXXSI3ReV6srELksQuyeVqkil+h2CXiwq 1b2pVEmSSj2Pk9hjUqkei0pVpFI9nEr1CCrV7yz24qZSJWcq1aOpVEUq1T9P CNGoVJczif2MGCh1NilLBZWqSKV6JpWqkYFK9SwqVQ+BSvU9qFTfRqWeTUXs aovEfifTF51KFWUqVc6gUl0tlth3UamKVKprgiD2GlSql1GpfgfkFxeVqomJ SlWkUr2CSvVKKlU7lErV3VGpmjaoVO9Bpfqd0xGpVO9JpWqOo1JdLIi9g0rV R1Sq96ZSFalU76JS/R4X/otq5VRqDKNSNU5SqTEWlfpRFUs5lRoa6yZLJZUa Y1OpcU8tLzaVqjGWSlWkUsOMStVrQ6VqCKBSw5xKPSecxVJJpcY9PL24qdSw olI1XFOp+pNKVbuiUmNOKlUXQaUqUqnqsFRq3DPci0mlxtxUapxfB7i26dA4 52Gs1XBNzucEiMs4Ry+UOqcLrg1KM848zbWb0oxVlGac0Q2lznSCtWcsSEZa MnzRktrMtGSc1s9Sm1qM01a4tqjFOC8S1p4djMu4h+MXneKLs5j/OSg++Yfi i9gUX9xz9otGtSlSbTqHUW1xzk/4Xp14SENfSxq5Ka+4B/oXm/LSy0w9SZLU kyL1pMGFetL9UU+xiwLSYZECihoUkCIFFGUUkLBSMWrlVEzcHyEQqRiNrVRM 9KBEoo0SUe+iRBQpkehFiehNoCZ03qUmJHJqQhMENaFITaSePW4/7w8nLzpF oJP0RwT/AAtnKg8= "], 1, {"Continuous", 1}, {"Discrete", 1}, 1, { ValueDimensions -> 1, DateFunction -> Automatic, ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}}}, True, 314.1];

Faça o gráfico das taxas históricas comparadas com a taxa atual.

In[6]:=
Click for copyable input
current = FinancialData["EUR/USD"]
Out[6]=
mostre o input completo da Wolfram Language
In[7]:=
Click for copyable input
DateListPlot[{rates, {{rates["FirstDate"], current}, {rates["LastDate"], current}}}, FrameLabel -> Automatic, PlotTheme -> "Detailed", TargetUnits -> "$"]
Out[7]=

Verifique as unidades das taxas de conversão.

In[8]:=
Click for copyable input
rates["FirstValue"]
Out[8]=

Estas taxas de conversão estão em centavos, então converta para dólares norte americanos, em seguida, divida o preço das ações por Euro.

In[9]:=
Click for copyable input
ratesUSD = UnitConvert[rates, "$"]*Quantity[1/"Euros"]
Out[9]=
In[10]:=
Click for copyable input
ratesUSD["FirstValue"]
Out[10]=

Multiplicar as séries temporais dos preços das ações pelos tempos das taxas de câmbio.

In[11]:=
Click for copyable input
prices1 = ratesUSD*siemens;

Use UnitConvert para converter os preços das ações usando a taxa atual do dólar versus euro.

In[12]:=
Click for copyable input
prices2 = UnitConvert[siemens, "$"];
mostre o input completo da Wolfram Language
In[13]:=
Click for copyable input
DateListPlot[{prices1, prices2}, PlotLegends -> {"stock price with historical rate conversion", "stock price with current rate conversion"}, PlotTheme -> "Detailed", FrameLabel -> Automatic]
Out[13]=

Exemplos Relacionados

de en es fr ja ko ru zh