Company share prices (where to parse them from?)

For everything that's not in any way related to PureBasic. General chat etc...
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Company share prices (where to parse them from?)

Post by Kale »

Hi, I'm thinking of writing a program to display a selected few company's share prices but i was wondering if there was a place online where they appear in xml or simple ascii format updated at regular intervals so programmers could write software to take into account the current share prices by parsing these simple files? Does anyone know of such a resource? I'm particulaly interested in UK share prices. :) i know alot of websites list current UK share prices and i guess i could parse these sites BUT this relies to much on the site to not change format. Any ideas?
--Kale

Image
TerryHough
Enthusiast
Enthusiast
Posts: 781
Joined: Fri Apr 25, 2003 6:51 pm
Location: NC, USA
Contact:

Post by TerryHough »

I don't know if they handle UK prices, but take a look at the services offered by this site.

http://www.inetats.com/

I use a "minibrowser" created from the PB example to access their information about selected US stocks and the "book" of open orders

Code: Select all

; ------------------------------------------------------------
;
;   PureBasic - MiniBrowser v1.1  07/25/2002 TWH
;     based on software provided by PureBasic examples
;
; ------------------------------------------------------------
;
; This program requires the Microsoft freely distribuable 
; ATL.dll shared library.
;
; ------------------------------------------------------------
Procedure FullScreenWindow(WinSizeX,WinSizeY)
   WinPos.RECT : GetWindowRect_(WindowID(),WinPos)
   SetWindowPos_(WindowID(),0,WinPos\left,WinPos\top,WinSizeX,WinSizeY,0)
EndProcedure 

Procedure ResizeWebWindow()
  ResizeGadget(10, -1, -1, WindowWidth(), WindowHeight()-52)
  ResizeGadget(4, -1, -1, WindowWidth()-185, -1)
  ResizeGadget(5, WindowWidth()-25, -1, -1, -1)
  ResizeGadget(6, -1, -1, WindowWidth(), -1)
EndProcedure

Procedure SizeCallback(WindowID, Message, wParam, lParam)

  ReturnValue = #PB_ProcessPureBasicEvents
  
  If Message = #WM_SIZE 
    UpdateStatusBar(0)
    ResizeWebWindow()
    ReturnValue = 1
  EndIf
  
  ProcedureReturn  ReturnValue
EndProcedure

If OpenWindow(0, 0, 0, 500, 300, #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget, "MiniBrowser v1.0")
  FullScreenWindow(GetSystemMetrics_(#SM_CXSCREEN), GetSystemMetrics_(#SM_CYSCREEN)) 

  CreateStatusBar(0, WindowID())
    StatusBarText(0, 0, "Island Book MiniBrowser", 0)
      
  CreateGadgetList(WindowID())
    ButtonGadget(1,   0, 0, 50, 25, "Back")
    ButtonGadget(2,  50, 0, 50, 25, "Next")
    ButtonGadget(3, 100, 0, 50, 25, "Stop")
    GadgetToolTip(1, "Back up to the previous page") 
    GadgetToolTip(2, "Go to the next page in a previous sequence") 
    GadgetToolTip(3, "Stop trying to download the current page") 
  
    ComboBoxGadget(4, 155, 5, 0, 120, #PB_ComboBox_Editable)
    AddGadgetItem(4, -1, "http://data.island.com/ds/tools/bookviewer/htmlbook.jsp?STOCK=trac")
    Selected = SetGadgetState(4, 0) 
     
    ButtonGadget(5, 0, 0, 25, 25, "Go")
    
    Frame3DGadget(6, 0, 30, 0, 2, "", 2) ; Nice little separator
  
    If WebGadget(10, 0, 31, 0, 0, GetGadgetText(4)) = 0 : MessageRequester("Error", "ATL.dll Not found", 0) : End : EndIf
  
  AddKeyboardShortcut(0, #PB_Shortcut_Return, 0)
  
  ResizeWebWindow()
  
  SetWindowCallback(@SizeCallback())
  
  Repeat
    Event = WaitWindowEvent()
    
    Select Event
      Case #PB_Event_Gadget
      
        Select EventGadgetID()
          Case 1
            SetGadgetState(10, #PB_Web_Back)
          
          Case 2
            SetGadgetState(10, #PB_Web_Forward)
          
          Case 3
            SetGadgetState(10, #PB_Web_Stop)
  
          Case 5
            V$=Space(255):GetWindowText_(GadgetID(4),V$,255)
            i = CountGadgetItems(4)
            a = 0
            Flag = 0
            Repeat
              temp = SetGadgetState(4, a) 
              If Trim(V$) = Trim(GetGadgetText(4))
                a = i + 1
                Flag = 1
              Else
                a = a + 1
              EndIf
            Until a = i + 1
            If Flag = 0
              AddGadgetItem(4, -1, V$)
              SetGadgetState(4, CountGadgetItems(4) - 1) 
            EndIf  
            StatusBarText(0, 0, V$, 0)
            SetGadgetText(10, V$)
            
        EndSelect      
      
      Case #PB_Event_Menu ; We only have one shortcut
        V$=Space(255):GetWindowText_(GadgetID(4),V$,255); Work around ComboBoxGadget buf
        i = CountGadgetItems(4)
        a = 0
        Flag = 0
          Repeat
            temp = SetGadgetState(4, a) 
            If Trim(V$) = Trim(GetGadgetText(4))
              a = i + 1
              Flag = 1
            Else
              a = a + 1
            EndIf
          Until a = i + 1
          If Flag = 0
            AddGadgetItem(4, -1, V$)
            SetGadgetState(4, CountGadgetItems(4) - 1) 
          EndIf  
        StatusBarText(0, 0, V$, 0)
        SetGadgetText(10, V$)
    EndSelect
      
  Until Event = #PB_Event_CloseWindow

EndIf
Hope it helps.

Terry
Post Reply