Texis Web Script source code for:
/texis/site/demos/dnewsquote.vs
Note: Click on links to view the documentation for HTML tags
which are special to the Vortex compiler.
<script language=vortex>
<export $id>
<export $tick url userok>
<uses demonav=demonav><!--simple look and feel module-->
<entryfunc=init>
<!-- What to do if the quoteserver is down ------------------------------------>
<timeout=10>
The Quote Server is temporarily unavailable.<br>
Please try again later.
</timeout>
<a name=init private>
<if '' eq $SERVER_ROOT><$SERVER_ROOT=/usr2/pub/httpd></if>
<sum "%s" $SERVER_ROOT "/texis"><db = $ret> <!-- set the database -->
<sum "%s" $SERVER_ROOT "/graphing/stockgraph"><$StockGraph = $ret>
</a>
<!--Macro for header and footer ---------------------------------------->
<a name=hdr>
<if $tick eq "">
<$tick=msft>
</if>
<demolook title="Texis Quotes and News Code Example">
</a>
<a name=ftr>
<h6 align=right>Copyright © 2007 <a href=/>Thunderstone</a> - EPI, Inc. </h6>
</demolook>
</a>
<!---------------------------------------------------------------------------->
<a name=red><span style="color: red"></a>
<a name=/red></span></a>
<!--Display the graph --------------------------------------------------------->
<!-- stockgraph expects
Title text
junk
Label(the date),High,Low,Close,Volume
--- msn format as of 2013-09-05 (double-byte encoded ascii)
Copyright © 2013 Morningstar.
Quotes supplied by Morningstar Inc.
Stock price data provided by Morningstar Inc. Quotes delayed 20 minutes.
Microsoft Corporation (MSFT)
Weekly
DATE,OPEN,HIGH,LOW,CLOSE,VOLUME
08/30/2013,33.34,33.48,33.09,33.4,42784642
08/23/2013,35.16,35.2,34,34.75,225493737
-->
<a name=gethistdata>
<local page>
<!--
<strfmt "http://investing.money.msn.com/investments/equity-options/?Symbol=%U" $tick>
<fetch $ret>
-->
<strfmt "http://investing.money.msn.com/investments/equity-historical-price/?PT=7&D4=1&DD=1&D5=0&DCS=2&MA0=0&MA1=0&CF=0&nocookie=1&SZ=0&symbol=%U&Download=1" $tick>
<fetch urls=$ret />
<$page=$ret>
<strfmt "%!v" $page><!-- ucs16 to ascii -->
<sandr "\x0d" "" $ret>
<sandr ".*[^\x0a]+\x0aWeekly=\space+>>DATE,OPEN,HIGH,LOW,CLOSE,VOLUME" "\2\x0a\5" $ret>
</a>
<a name=graphit PUBLIC>
<gethistdata>
<exec BIN $StockGraph>
<send $ret>
</exec>
$ret
</a>
<!--Display article full text-------------------------------------------------->
<a name=article PUBLIC>
<hdr>
<sql max=1 "select id,When Date,Headline,Category,Keywords,Body,Ticks from stories where id=$id">
<b><red>Date:</red></b> <fmt "%m/%d %H:%M EST" $Date><br>
<b><red>Category:</red></b> $Category <br>
<if $Keywords neq ""><b><red>Keywords:</red></b> $Keywords<br></if>
<if $Ticks neq ""><b><red>Ticks:</red></b> $Ticks<br></if>
<sandr "\n=\space+" "<p>\x0a\x0a" $Body> <!-- do paragraph markup -->
<sandr "!http://=>>www\.=" "http://www\." $ret> <!-- look for URL's -->
<sandr "http://" " <a href=http://" $ret>
<sandr "http:=[\alnum\-/\.]\P+." "><b>HERE</b></a> " $ret> <!-- Hyperlink -->
<h3 align=center>$Headline</h3>
<center><table boder=0><td><td><pre><send $ret></pre></td></tr></table></center>
</sql>
<ftr>
</a>
<!--Get the quote-------------------------------------------------------------->
<a name=symparse>
<timport "csv {
keepfirst
field Exchange varchar 1
field Last double 4
field High double 7
field Low double 8
field Cumvol long 9
field Change double 11
field Open double 12
field Yclose double 14
" $parsethis />
</a>
<a name=quote PUBLIC>
<!--
<exec nobr /usr/local/bin/gettick -h199.221.68.77 sym $tick></exec>
-->
<!-- wtf - get quotes from somewhere
<urlcp timeout 5>
<strfmt "%s/%U" "http://208.51.1.102:10000" $tick>
<fetch $ret>
<$parsethis=$ret>
<symparse>
-->
<table border=1>
<tr>
<td valign=top>
<!-- wtf - get quotes from somewhere?
<table>
<tr><td align=left>Last</td><td align=right><fmt "%F" $Last></td></tr>
<tr><td colspan=2><hr></td></tr>
<tr><td align=left>Change</td><td align=right><if $Change lt 0.0><red><fmt "%F" $Change></red><else><fmt "%F" $Change></if></td></tr>
<tr><td colspan=2><hr></td></tr>
<tr><td align=left>High</td><td align=right><fmt "%F" $High></td></tr>
<tr><td colspan=2><hr></td></tr>
<tr><td align=left>Low</td><td align=right><fmt "%F" $Low></td></tr>
<tr><td colspan=2><hr></td></tr>
<tr><td align=left>Volume</td><td align=right><fmt "%kd" $Cumvol></td></tr>
<tr><td colspan=2><hr></td></tr>
<tr><td align=left>Previous Close</td><td align=right><fmt "%F" $Yclose></td></tr>
<tr><td colspan=2><hr></td></tr>
<tr><td colspan=2 align=center><b>Quote delay >15 minutes</b></td></tr>
</table>
-->
</td>
<td valign=middle align=center><!-- width=450 height=300 -->
<img src=$url/graphit.gif></center>
</td>
</tr>
</table>
</a>
<!--Display a headline row----------------------------------------------------->
<a name=headline>
<small><tt><fmt "%m/%d %H:%M EST" $Date></tt></small> <a href="$url/article.html"><b>$Headline</b></a><br>
</a>
<!--Search the news database--------------------------------------------------->
<a name=newsquery>
<nobr>
<sql max=50
"select id,When Date,Headline,Category,Keywords
from stories
where Keywords like $tick
or Ticks like $tick
order by When desc"/>
<loop $id $Date $Headline $Category $Keywords>
<headline>
</loop>
<if $loop eq 0>
<h5>There are no articles containing: $tick</h5>
</if>
<if $loop lt 5>
<h5>Looking for more content about: $Company</h5>
<if $loop gt 0>
<sum ",'%s'" "" $id><substr $ret 4 -1>
<strfmt " and id not in (%s)" $ret>
<else>
<$ret="">
</if>
<sql max=25 "select id,When Date,Headline,Category,Keywords
from stories
where Category\Keywords\Headline\Body like3 $Company
" $ret "
order by When desc"/>
<loop $id $Date $Headline $Category $Keywords>
<headline>
</loop>
</if>
<if $loop eq 0>
<h5> No articles match "$Company" in the last 30 Days</h5>
</if>
</nobr>
</a>
<!--Look up the symbol--------------------------------------------------------->
<a name=symlu>
<$exchs = amex nyse otc>
<upper $tick>
<sql max=1 "select Symbol,Company,Exchange from tick where Symbol = $ret order by Company">
</sql>
<if $Symbol eq "">
<sql max=100 "select Symbol,Company,Exchange from tick where Company likep $tick order by Company"/>
</if>
<if $sqlresult.returnedmin eq 1>
<$tick=$Symbol>
<$dosearch=1>
<elseif $sqlresult.returnedmin gt 1>
<table>
<loop $Symbol $Company $Exchange>
<rex $exchs $Exchange />
<if $ret neq "">
<tr><td align=left>$Company</td><td><a href=$url?tick=$Symbol>$Symbol</a></td></tr>
<else>
<tr><td align=left>$Company</td><td>$Symbol</td><td><small> -- No Quotes or News available -- </small></td></tr>
</if>
</loop>
</table>
<else>
Sorry, the company you entered is unknown by this database
<exit>
</if>
</a>
<!--Spew the query form-------------------------------------------------------->
<a name=qform>
<form method=post action="$url/">
Enter a ticker symbol or company name: <input name=tick size=20 value="$tick"><input type=submit value="Search">
</form>
</a>
<!--The main entry point for this script--------------------------------------->
<a name=main>
<hdr>
<qform>
<symlu>
<if $dosearch eq 1>
<b>$Company ($tick) <fmt "%t" now></b><br>
<quote>
<newsquery>
<p style="font-size: 7pt"><sup>*</sup> Thunderstone - EPI, Inc. makes no guarantee about the accuracy of any stock prices presented in this code example.</p>
</if>
<ftr>
</a>
<!--That's all folks! --------------------------------------------------------->
</script>
The Source Viewer is also a Code Example.
Click Here to see its source.
Copyright © 1992-1999 Thunderstone Software