Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions yahoo/finance/yahoo.finance.xchange.without.time.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="2.0" encoding="UTF-8" ?>
<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd">
<meta>
<author>l&l softelecom</author>
<description>need curent date and time - because in yahoo.finance.xchange there is dynamic time query </description>
<sampleQuery>select * from {table} where pair in ("EURUSD","GBPUSD")</sampleQuery>
</meta>
<bindings>
<select itemPath="rates.rate" produces="XML">
<inputs>
<key id="pair" type="xs:string" paramType="variable" required="true" />
</inputs>
<execute><![CDATA[
var pairs = [];
for each (var p in pair.toString().replace(/\s+/g,'').split(','))
pairs.push(p.toUpperCase() + '=X');
var q = "select * from csv where url='http://download.finance.yahoo.com/d/quotes.csv?s="+ pairs.join(',') +
"&f=snl1d1t1ab'" + " and columns='Symbol,Name,Rate,Date'",
results = y.query(q),
rates = <rates/>,
rows=results.results.row;
for each (var row in rows) {
for each (var item in row.*)
row[item.localName()]=item.text().toString().replace(/"/g, '');
var tag = row.Symbol.text().toString().substr(0,6);
delete row.Symbol;
rates.rate += <rate id={tag}>{row.*}</rate>;
}
response.object = rates;
]]></execute>
</select>
</bindings>
</table>