View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
rnrss[_14_] rnrss[_14_] is offline
external usenet poster
 
Posts: 1
Default repost: Need Help With Steaming Data Macro


Hello thanks again for your response...

Here is a pic of what it looks like:
http://i22.photobucket.com/albums/b3...LatchIssue.jpg

Here is the complete program:

Dim genId As Integer

' I tried Dims here
' Dim myhi As String
' Dim mylo As String
' Dim mybid As String
' Dim myask As String

Sub requestMarketData()

' contract description vars
Dim symbol As String
Dim secType As String
Dim expiry As String
Dim strike As String
Dim right As String
Dim multiplier As String
Dim exchange As String
Dim curency As String

' get contract description
symbol = UCase(ActiveCell.offset(0, 0).Value)
secType = UCase(ActiveCell.offset(0, 1).Value)
expiry = ActiveCell.offset(0, 2).Value
strike = ActiveCell.offset(0, 3).Value
right = UCase(Left(ActiveCell.offset(0, 4).Value, 1))
multiplier = UCase(ActiveCell.offset(0, 5).Value)
exchange = UCase(ActiveCell.offset(0, 6).Value)
primaryExchange = UCase(ActiveCell.offset(0, 7).Value)
curency = UCase(ActiveCell.offset(0, 8).Value)

' must have symbol, secType, and exchange
If symbol = "" Or secType = "" Or exchange = "" Or curency = "
Then
Beep
MsgBox ("You must enter at least symbol, security type
exchange, and currency.")
Exit Sub
End If

' build server
Dim server As String
server = Range("d5").Value
If server = "" Then
MsgBox ("You must enver a valid user name.")
Exit Sub
End If
server = "=" & Range("d5").Value & "|"

' build topic
Dim topic As String
topic = "tik!"

' build id
Dim id As String
id = "id" & genId & "?"
genId = genId + 1

' build req
Dim req As String
Dim reqType As String

reqType = "req"

req = symbol & "_" & secType & "_"
' build req
If ((secType = "OPT" Or secType = "FUT" Or secType = "FOP") An
expiry = "") Then
reqType = "req2"
Else
If secType = "OPT" Or secType = "FUT" Or secType = "FOP" Then
req = req & expiry & "_"
End If
If secType = "OPT" Or secType = "FOP" Then
req = req & strike & "_" & right & "_"
If multiplier < "" Then
req = req & multiplier & "_"
End If
End If
End If

req = req & exchange & "_" & curency

If secType = "BAG" Then
req = req & "_" & Cells(ActiveCell.row, 10)
End If

If primaryExchange < "" Then
req = req & "_" & primaryExchange
End If

' Replace space with string "singleSpace" since dde won't work o
empty space
req = Replace(req, " ", "singleSpace")

' I tried Dims here
Dim myhi As String
Dim mylo As String
Dim mybid As String
Dim myask As String

myask = server & topic & id & "ask"
mybid = server & topic & id & "bid"

If server & topic & id & "bid" < mylo Then
mylo = server & topic & id & "bid"
End If
If server & topic & id & "ask" myhi Then
myhi = server & topic & id & "ask"
End If


' Place req in spreadsheet
Const reqOffset = 10
ActiveCell.offset(0, reqOffset).Formula = server & topic & id
reqType & "?" & req
ActiveCell.offset(0, reqOffset + 1).Formula = server & topic & id
"bidSize"
ActiveCell.offset(0, reqOffset + 2).Formula = server & topic & id
"bid"
ActiveCell.offset(0, reqOffset + 3).Formula = server & topic & id
"ask"
ActiveCell.offset(0, reqOffset + 4).Formula = server & topic & id
"askSize"
ActiveCell.offset(0, reqOffset + 5).Formula = server & topic & id
"last"
ActiveCell.offset(0, reqOffset + 6).Formula = server & topic & id
"lastSize"
ActiveCell.offset(0, reqOffset + 7).Formula = server & topic & id
"volume"
ActiveCell.offset(0, reqOffset + 8).Formula = server & topic & id
"close"
' I added the next 4 lines'''''''''''''''''''''''''''''''''
ActiveCell.offset(0, reqOffset + 11).Value = myhi
ActiveCell.offset(0, reqOffset + 12).Value = mylo

'''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''
ActiveCell.offset(1, 0).Activate
End Sub

In the spreadsheet bid has this statement in it: =edemo|tik!id15?bid
In the spreadsheet ask has this statement in it: =edemo|tik!id15?ask

In the spreadsheet my ask has this statement in it:
=edemo|tik!id15?ask
In the spreadsheet my bid for some reason has no statement in it

That is the problem it just transfers the the statements to the cel
without any operations on them...

If you need the streaming data I would need to email the whole thing
and you woudl need java installed

Hope this puts a better lite on it?

regards,
rnr


--
rnrss
------------------------------------------------------------------------
rnrss's Profile: http://www.excelforum.com/member.php...o&userid=27823
View this thread: http://www.excelforum.com/showthread...hreadid=475688