<% '--- Forces us to declare all your variables. option explicit '-------------------------------------------------------- ' YOU NEED TO CUSTOMIZE THIS '-------------------------------------------------------- Dim devToken ' The token you received devToken = "6T2nL7NAdMF6cBTR" ' Your Dev Token '-------------------------------------------------------- '--- Get the symbol and encode the URL Dim symbol symbol = Server.URLEncode(request("symbol")) '--- Get the record size dim recNumb recNumb = Server.URLEncode(request("recNumb")) '--- Dim all Count for each side Dim bcount, scount, x, side '-------------------------------------------------------- ' Dim the returned values as arrays '-------------------------------------------------------- Dim BOpenShares(50), BOrderPrice(50) Dim SOpenShares(50), SOrderPrice(50) Dim BOpenOrders, SOpenOrders, asof '-------------------------------------------------------- ' GRAB ISLAND WS XML '-------------------------------------------------------- Function getBook(symbol) Dim xmlDoc, nodeName, XMLURL '--- Create the DOM object Set xmlDoc = CreateObject("Msxml2.DOMDocument") xmlDoc.async = False '--- This will validate the XML. '--- If you're having problems, set this to False xmlDoc.validateOnParse=True '--- Now we can create the URL to call XMLURL = "http://xml.island.com/ws/xml/book.xml?token=" & devToken &_ "&symbol=" & symbol &_ "&recNumb=" & recNumb dim xmlhttp Set xmlhttp = Server.CreateObject("Microsoft.XMLHTTP") xmlhttp.Open "GET",XMLURL,False xmlhttp.send '--- OK, Load the URL xmlDoc.loadXML(xmlhttp.responsetext) 'response.write xmlhttp.responsetext '--- If Errors found - spit them out. if xmlDoc.parseError.errorcode <> 0 Then response.write "Error Code : " & xmlDoc.parseError.errorcode & "
" response.write "Error Reason : " & xmlDoc.parseError.reason & "
" response.write "Error Line : " & xmlDoc.parseError.line & "
" '--- Otherwise begin walking the nodes else tree_walk(xmlDoc) end if End Function '-------------------------------------------------------- ' Recursive Node Walk function '-------------------------------------------------------- Function tree_walk(node) dim child For Each child In node.childNodes '--- This means we want this node: if child.nodeType = 1 then '--- Search for things that we want. Select Case child.nodeName Case "asof" '--- Found as of date and time asof = child.text Case "open" '--- Let's figure out the current side for orders if child.getAttribute("side") = "B" then side = "B" else side = "S" Case "openOrders" '--- Found # for total Open Orders for current side if side = "B" then BOpenOrders = child.text else SOpenOrders = child.text Case "order" '--- Found an Order, let's increment order count for current side if side = "B" then bcount = bcount+1 else scount = scount+1 Case "openShares" '--- Found Open Shares Data if side = "B" then BOpenShares(bcount) = child.text else SOpenShares(scount) = child.text Case "orderPrice" '--- Found Order Price Data if side = "B" then BOrderPrice(bcount) = child.text else SOrderPrice(scount) = child.text End Select '--- More nodes? Keep on walkin' If (child.hasChildNodes) then tree_walk(child) end if next End Function '--- This calls the actual Function and populates our Arrays. getBook(symbol) %> Online trading, Free real time stock quotes and level 2
<%if request("post")="true" then%> <%end if%>
Inet doesn't provide us java real time level II anymore
but this static form is still real time, just refresh the page.
BUY ORDERS SELL ORDERS
<% for x = 1 to bcount %> <% next %>
shares price
<%=BOpenShares(x)%>  <%=BOrderPrice(x)%> 
(<%=BOpenOrders-bcount%> more)
<% for x = 1 to scount %> <% next %>
shares price
<%=SOpenShares(x)%>  <%=SOrderPrice(x)%> 
(<%=SOpenOrders-scount%> more)
<%=asof%>