@verb #1409:"_get_quote" this none this rxdo #8084
@program #1409:"_get_quote" this none this
caller == this || raise(E_PERM)
{symbol} = args
data = $gopher:get_now("quote.yahoo.com", 80, "GET /q?s=" + symbol)
try
for x in (data)
if (m = match(x, "
%([0-9.]*%) *%([0-9supb/<>]+%) | "))
amount = x[m[3][1][1]..m[3][1][2]]
frac = x[m[3][2][1]..m[3][2][2]]
" #8084:tell(toliteral(amount));"
" #8084:tell(toliteral(frac));"
if (match(frac, "^[0-9]+$"))
amount = amount + frac
endif
amount = tofloat(amount)
if (mfrac = match(frac, "%([0-9]+%)/%([0-9]+%)"))
amount = amount + tofloat(frac[mfrac[3][1][1]..mfrac[3][1][2]]) / tofloat(frac[mfrac[3][2][1]..mfrac[3][2][2]])
endif
return amount
endif
endfor
except (E_TYPE)
endtry
raise(E_INVARG, "Unable to find symbol.")
"Last modified by Lao-Tzu (#8084) on Tue Apr 9 08:26:28 2002 MDT."
.