Jump to content

RealTime Stock Quoter -- Update


dcop
 Share

Recommended Posts

Didnt Take the first time

#include <GUIConstants.au3>
If WinExists ( "DLM Real Time Stock Quoter") Then
    MsgBox(0, "", "I'm Already Running")
    Exit
EndIf
If FileExists(@WindowsDir&"\dlm.ini") then 
    main()
Else
    licGUI()
EndIf

func main()
; == GUI generated with Koda ==
Opt("GUIOnEventMode", 1) ; Change to OnEvent mode
$Form1 = GUICreate("DLM Real Time Stock Quoter", 550, 183, 336, 147)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
GUISetBkColor(0xC0DCC0)
;;;;;;;;;;;;;;;;;;;;;;;
GUICtrlCreateLabel("", 90, 16, 90, 17)
GUICtrlSetBkColor(-1, 0xFF00FF)
GUICtrlCreateLabel("", 180, 16, 140, 17)
GUICtrlSetBkColor(-1, 0xFF00FF)
GUICtrlCreateLabel("", 320, 16, 110, 17)
GUICtrlSetBkColor(-1, 0xFF00FF)
GUICtrlCreateLabel("", 430, 16, 100, 17)
GUICtrlSetBkColor(-1, 0xFF00FF)
;;;;;;;;;;;;;;;;;;;;;;;
GUICtrlCreateLabel("", 90, 56, 90, 17)
GUICtrlSetBkColor(-1, 0xFF00FF)
GUICtrlCreateLabel("", 180, 56, 140, 17)
GUICtrlSetBkColor(-1, 0xFF00FF)
GUICtrlCreateLabel("", 320, 56, 110, 17)
GUICtrlSetBkColor(-1, 0xFF00FF)
GUICtrlCreateLabel("", 430, 56, 100, 17)
GUICtrlSetBkColor(-1, 0xFF00FF)
;;;;;;;;;;;;;;;;;;;;;;;
GUICtrlCreateLabel("", 90, 96, 90, 17)
GUICtrlSetBkColor(-1, 0xFF00FF)
GUICtrlCreateLabel("", 180, 96, 140, 17)
GUICtrlSetBkColor(-1, 0xFF00FF)
GUICtrlCreateLabel("", 320, 96, 110, 17)
GUICtrlSetBkColor(-1, 0xFF00FF)
GUICtrlCreateLabel("", 430, 96, 100, 17)
GUICtrlSetBkColor(-1, 0xFF00FF)
;;;;;;;;;;;;;;;;;;;;;;;
GUICtrlCreateLabel("Refresh Rate: 1000 = 1 Second", 215, 140, 300, 17)
GUICtrlSetBkColor(-1, 0xC0DCC0)
$stk1 = IniRead ( @WindowsDir&"\dlm.ini", "DLM", "s1", "problem" )
$stk2 = IniRead ( @WindowsDir&"\dlm.ini", "DLM", "s2", "problem" )
$stk3 = IniRead ( @WindowsDir&"\dlm.ini", "DLM", "s3", "problem" )
$Input1 = GUICtrlCreateInput($stk1, 8, 16, 57, 17, $ES_UPPERCASE, $WS_EX_CLIENTEDGE)
$Input2 = GUICtrlCreateInput($stk2, 8, 56, 57, 17, $ES_UPPERCASE, $WS_EX_CLIENTEDGE)
$Input3 = GUICtrlCreateInput($stk3, 8, 96, 57, 17, $ES_UPPERCASE, $WS_EX_CLIENTEDGE)
$Input4 = GUICtrlCreateInput("3000", 160, 136, 49, 21, $ES_UPPERCASE, $WS_EX_CLIENTEDGE)
GUICtrlCreateButton("dummy button", 10, 120, 90, 20)
GUICtrlSetState(-1, $GUI_FOCUS)
GUICtrlSetState(-1, $GUI_HIDE)
GUISetState(@SW_SHOW)
While 1
$first = GUICtrlRead(16)
$f = StringIsAlpha($first)
$second = GUICtrlRead(17)
$s = StringIsAlpha($second)
$third = GUICtrlRead(18)
$t = StringIsAlpha($third)
$refresh = GUICtrlRead(19)
$r = StringIsDigit($refresh)
if $r = 0 Then MsgBox(0, "Need Input", "Please Enter A Valid Refresh Rate") 
if $r = 0 Then Sleep(5000)
If $f <> 0 Then first()
If $f <> 0 Then Sleep($refresh)
If $s <> 0 Then second()
If $s <> 0 Then Sleep($refresh)
If $t <> 0 Then third()
If $t <> 0 Then Sleep($refresh)
WEnd
Exit
EndFunc

Func first()
$line = GUICtrlRead(16)
IniWrite ( @WindowsDir&"\dlm.ini", "DLM", "s1", $line )
$dir = "C:\Temp\"
$stk = $line 
$outpt = "quote.txt"
$outpt1 = "quote1.txt"
If FileExists($dir) Then    
Else
    DirCreate($dir)
EndIf
InetGet ( "http://finance.yahoo.com/q/ecn?s=" & $stk, $dir & $outpt, 1, 0)
$fil = FileRead($dir & $outpt, 100000)
$sear = StringInStr ( $fil, "last trade")
$par = StringMid ( $fil, $sear, 60)
$par1 = StringReplace ( $par, "<b>", "   ")
$par2 = StringReplace ( $par1, "</b>", "   ")
$par3 = StringMid($par2, 45, 11)
$par4 = StringStripWS ( $par3, 8 )
InetGet ( "http://finance.yahoo.com/q?s=" & $stk, $dir & $outpt1, 1, 0)
$fil = FileRead($dir & $outpt1, 100000)
$sear = StringInStr ( $fil, "Prev Close:")
$parprev = StringMid ( $fil, $sear, 50)
$parprev1 = StringTrimLeft ( $parprev, 43 )
$parprev2 = StringReplace ( $parprev1, "<", "")
$parprev3 = StringReplace ( $parprev2, ">", "")
$parprev4 = StringReplace ( $parprev3, "/", "")
$parprev5 = StringStripWS ( $parprev4, 8 )
FileDelete ( "C:\Temp\quote.txt" )
FileDelete ( "C:\Temp\quote1.txt" )
$diff = $par3 - $parprev4
$diff1 = Round ( $diff ,2 )
If StringInStr ( $diff1, "-") Then
    $diff2 = "("&$diff1& ")"
    $diff2 = StringReplace($diff2, "-", "")
ElseIf $diff1 = 0 Then
    $diff2 = $diff1
Else 
    $diff2 = "+"&$diff1
EndIf
GUICtrlSetData ( 3, $stk & ": "& $par4)
GUICtrlSetData ( 4, "Last Updated At  " & @HOUR & ":" & @MIN & ":" & @SEC)
GUICtrlSetData ( 5, "Prev. Close:  " & $parprev5)
GUICtrlSetData ( 6, "Change:   " & $diff2)
EndFunc

Func second()
$line = GUICtrlRead(17)
IniWrite ( @WindowsDir&"\dlm.ini", "DLM", "s2", $line )
$dir = "C:\Temp\"
$stk = $line 
$outpt = "quote.txt"
$outpt1 = "quote1.txt"
If FileExists($dir) Then    
Else
    DirCreate($dir)
EndIf
InetGet ( "http://finance.yahoo.com/q/ecn?s=" & $stk, $dir & $outpt, 1, 0)
$fil = FileRead($dir & $outpt, 100000)
$sear = StringInStr ( $fil, "last trade")
$par = StringMid ( $fil, $sear, 60)
$par1 = StringReplace ( $par, "<b>", "   ")
$par2 = StringReplace ( $par1, "</b>", "   ")
$par3 = StringMid($par2, 45, 11)
$par4 = StringStripWS ( $par3, 8 )
;
InetGet ( "http://finance.yahoo.com/q?s=" & $stk, $dir & $outpt1, 1, 0)
$fil = FileRead($dir & $outpt1, 100000)
$sear = StringInStr ( $fil, "Prev Close:")
$parprev = StringMid ( $fil, $sear, 50)
$parprev1 = StringTrimLeft ( $parprev, 43 )
$parprev2 = StringReplace ( $parprev1, "<", "")
$parprev3 = StringReplace ( $parprev2, ">", "")
$parprev4 = StringReplace ( $parprev3, "/", "")
FileDelete ( "C:\Temp\quote.txt" )
FileDelete ( "C:\Temp\quote1.txt" )
$diff = $par3 - $parprev4
$diff1 = Round ( $diff ,2 )
If StringInStr ( $diff1, "-") Then
    $diff2 = "("&$diff1& ")"
    $diff2 = StringReplace($diff2, "-", "")
ElseIf $diff1 = 0 Then
    $diff2 = $diff1
Else 
    $diff2 = "+"&$diff1
EndIf
GUICtrlSetData ( 7, $stk & ": "& $par4)
GUICtrlSetData ( 8, "Last Updated At  " & @HOUR & ":" & @MIN & ":" & @SEC)
GUICtrlSetData ( 9, "Prev. Close:  " & $parprev4)
GUICtrlSetData ( 10, "Change:   " & $diff2)
EndFunc

Func third()
$line = GUICtrlRead(18)
IniWrite ( @WindowsDir&"\dlm.ini", "DLM", "s3", $line )
$dir = "C:\Temp\"
$stk = $line 
$outpt = "quote.txt"
$outpt1 = "quote1.txt"
If FileExists($dir) Then    
Else
    DirCreate($dir)
EndIf
InetGet ( "http://finance.yahoo.com/q/ecn?s=" & $stk, $dir & $outpt, 1, 0)
$fil = FileRead($dir & $outpt, 100000)
$sear = StringInStr ( $fil, "last trade")
$par = StringMid ( $fil, $sear, 60)
$par1 = StringReplace ( $par, "<b>", "   ")
$par2 = StringReplace ( $par1, "</b>", "   ")
$par3 = StringMid($par2, 45, 11)
$par4 = StringStripWS ( $par3, 8 )
InetGet ( "http://finance.yahoo.com/q?s=" & $stk, $dir & $outpt1, 1, 0)
$fil = FileRead($dir & $outpt1, 100000)
$sear = StringInStr ( $fil, "Prev Close:")
$parprev = StringMid ( $fil, $sear, 50)
$parprev1 = StringTrimLeft ( $parprev, 43 )
$parprev2 = StringReplace ( $parprev1, "<", "")
$parprev3 = StringReplace ( $parprev2, ">", "")
$parprev4 = StringReplace ( $parprev3, "/", "")
FileDelete ( "C:\Temp\quote.txt" )
FileDelete ( "C:\Temp\quote1.txt" )
$diff = $par3 - $parprev4
$diff1 = Round ( $diff ,2 )
If StringInStr ( $diff1, "-") Then
    $diff2 = "("&$diff1& ")"
    $diff2 = StringReplace($diff2, "-", "")
ElseIf $diff1 = 0 Then
    $diff2 = $diff1
Else 
    $diff2 = "+"&$diff1
EndIf
GUICtrlSetData ( 11, $stk & ": "& $par4)
GUICtrlSetData ( 12, "Last Updated At  " & @HOUR & ":" & @MIN & ":" & @SEC)
GUICtrlSetData ( 13, "Prev. Close:  " & $parprev4)
GUICtrlSetData ( 14, "Change:   " & $diff2)
EndFunc

Func CLOSEClicked()
  Exit
EndFunc

func licGUI()
; == GUI generated with Koda ==
Opt("GUIOnEventMode", 1)
$Form1 = GUICreate("USER AGREEMENT", 556, 590, 524, 78)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
GUISetBkColor(0xC0C0C0)
$Edit = GUICtrlCreateEdit("", 24, 8, 505, 537, $WS_DISABLED, $WS_EX_CLIENTEDGE)
GUICtrlSetData($Edit, "End-User License Agreement (EULA)"&@CRLF&""&@CRLF&"User may install purchased copy of DLM Real Time Stock Quoter on any "&@CRLF&"Computer owned by the purchasing USER. "&@CRLF&""&@CRLF&"Stock Quotes are provided by free service and are not guaranteed to be "&@CRLF&"100% accurate at any given time and should never be used for decision "&@CRLF&"making on stock purchasing or selling. DLM Real Time Stock Quoter"&@CRLF&"author(s) are not responsible for the accuracy of the quotes or for any "&@CRLF&"decision the enduser makes in response to the quotes. In summary this "&@CRLF&"application is for informational purposes only, not intended for trading purposes or advice. The quotes retrieved are only intended to be received by the End-User and never distributed thereafter."&@CRLF&""&@CRLF&"NO WARRANTIES."&@CRLF&"The Author of this Software expressly disclaims any warranty for the "&@CRLF&"SOFTWARE PRODUCT. The SOFTWARE PRODUCT and any related "&@CRLF&"documentation is provided "&Chr(34)&"as is"&Chr(34)&" without warranty of any kind, either express or implied, including, without limitation, the implied warranties or merchantability, fitness for a particular purpose, or no infringement. The entire risk arising out of use or performance of the SOFTWARE PRODUCT remains with you."&@CRLF&""&@CRLF&"BUG FIXES."&@CRLF&"If End-User discovers any bugs that need attention please contact author at "&@CRLF&"dennismu@yahoo.com and put DLM Real Time Stock Quoter in the subject "&@CRLF&"line and state the bug that needs fixing. If bug reported renders patching author will supply patch to End-User. Author reserves all rights for the decision on the need for all patches."&@CRLF&""&@CRLF&"If you would like to be on the list for notification of new versions email "&@CRLF&"dennismu@yahoo.com and put DLM Real Time Stock Quoter in the subject "&@CRLF&"line.") 
GUICtrlSetFont(-1, 10, 1000, 0, "Arial")
GUICtrlSetBkColor(-1, 0xC0C0C0)
$Radio1 = GUICtrlCreateRadio("ARadio1", 8, 552, 17, 17)
GUICtrlSetOnEvent ( $Radio1, "agreed" )
GUICtrlCreateLabel("I Agree to the above USER AGREEMENT", 24, 552, 205, 17)
GUICtrlSetBkColor(-1, 0xC0C0C0)
$Radio2 = GUICtrlCreateRadio("ARadio2", 256, 552, 17, 17)
GUICtrlSetOnEvent ( $Radio2, "noagree" )
GUICtrlSetBkColor(-1, 0xC0C0C0)
GUICtrlCreateLabel("I do NOT Agree to the above USER AGREEMENT", 274, 552, 250, 17)
GUICtrlSetBkColor(-1, 0xC0C0C0)
GUICtrlCreateButton("Exit", 520, 552)
GUICtrlSetOnEvent(-1, "CLOSEClicked")
GUICtrlSetBkColor(-1, 0xC0C0C0)
GUISetState(@SW_SHOW)
While 1
Sleep(1000)
WEnd
Exit
EndFunc

Func agreed()
MsgBox(0,"", "You Agreed, Hit OK then Restart DLM Real Time Stock Quoter and Enjoy the Program, Thank You")
IniWrite(@WindowsDir&"\dlm.ini", "DLM", "Lic", "1")
IniWrite(@WindowsDir&"\dlm.ini", "DLM", "s1", "MSFT")
IniWrite(@WindowsDir&"\dlm.ini", "DLM", "s2", "GOOG")
IniWrite(@WindowsDir&"\dlm.ini", "DLM", "s3", "IBM")
  Exit
EndFunc

Func noagree()
MsgBox(0,"", "You didn't Agree")
  Exit
EndFunc
Link to comment
Share on other sites

  • 3 years later...

Anyone found a source that doesn't have the 15min delay?

No, my understanding is that all of the free quote services have delays of 15-20 minutes. If you want live quotes, you have to pay to get them.

Avian

A millihelen is the amount of beauty required to launch one ship.

Link to comment
Share on other sites

My ScotTrade account has a fairly nice Java based quoting system that is realtime, but I've looked at the Network Monitor captures and haven't been able to find the interaction messages. They must be encrypted or something.

No, my understanding is that all of the free quote services have delays of 15-20 minutes. If you want live quotes, you have to pay to get them.

Avian

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...