to Mastintin : yahoo financial

to Mastintin : yahoo financial

Postby Silvio.Falconi » Thu Dec 11, 2014 8:37 am

Dear Manuel,
as Meteo we can load financial data from Yahoo ?

I found only
http://download.finance.yahoo.com/d/quo ... d1t1ohgdrx

http://stackoverflow.com/questions/5246 ... 5#11421395
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6851
Joined: Thu Oct 18, 2012 7:17 pm

Re: to Mastintin : yahoo financial

Postby mastintin » Thu Dec 11, 2014 11:43 am

Silvio :
http://finance.yahoo.com/d/quotes.csv?e ... X,GBPUSD=X
devuelve un cvs que es facil de tratar con Harbour ...
y este nos devuelve un json ( como en weather)
[url]
https://query.yahooapis.com/v1/public/y ... 2BHP.AX%22)&format=json&diagnostics=true&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=[/url]

....................edito ...................................
de este ultimo enlace me he descargado el json que devuelve y analizandolo un poco me encuentor un monton de datos. No soy experto en finanzas pero creo que tenemos todos los datos del valor ....
Code: Select all  Expand view


"quote":{
                            "symbol":"BHP.AX",
                            "Ask":null,
                            "AverageDailyVolume":"7812270",
                            "Bid":null,
                            "AskRealtime":"29.050",
                            "BidRealtime":"28.980",
                            "BookValue":"14.873",
                            "Change_PercentChange":"-0.390 - -1.33%",
                            "Change":"-0.390",
                            "Commission":null,
                            "Currency":"AUD",
                            "ChangeRealtime":"-0.390",
                            "AfterHoursChangeRealtime":"N/A - N/A",
                            "DividendShare":"1.3092",
                            "LastTradeDate":"12/11/2014",
                            "TradeDate":null,
                            "EarningsShare":"2.591",
                            "ErrorIndicationreturnedforsymbolchangedinvalid":null,
                            "EPSEstimateCurrentYear":"2.140",
                            "EPSEstimateNextYear":"2.310",
                            "EPSEstimateNextQuarter":"0.000",
                            "DaysLow":"28.400",
                            "DaysHigh":"29.185",
                            "YearLow":"28.400",
                            "YearHigh":"39.790",
                            "HoldingsGainPercent":"- - -",
                            "AnnualizedGain":null,
                            "HoldingsGain":null,
                            "HoldingsGainPercentRealtime":"N/A - N/A",
                            "HoldingsGainRealtime":null,
                            "MoreInfo":"cnprIed",
                            "OrderBookRealtime":null,
                            "MarketCapitalization":"154.3B",
                            "MarketCapRealtime":null,
                            "EBITDA":"29.777B",
                            "ChangeFromYearLow":"+0.600",
                            "PercentChangeFromYearLow":"+2.11%",
                            "LastTradeRealtimeWithTime":"N/A - <b>29.000</b>",
                            "ChangePercentRealtime":"N/A - -1.33%",
                            "ChangeFromYearHigh":"-10.790",
                            "PercebtChangeFromYearHigh":"-27.12%",
                            "LastTradeWithTime":"12:10am - <b>29.000</b>",
                            "LastTradePriceOnly":"29.000",
                            "HighLimit":null,
                            "LowLimit":null,
                            "DaysRange":"28.400 - 29.185",
                            "DaysRangeRealtime":"N/A - N/A",
                            "FiftydayMovingAverage":"32.4389",
                            "TwoHundreddayMovingAverage":"35.4219",
                            "ChangeFromTwoHundreddayMovingAverage":"-6.4219",
                            "PercentChangeFromTwoHundreddayMovingAverage":"-18.13%",
                            "ChangeFromFiftydayMovingAverage":"-3.4389",
                            "PercentChangeFromFiftydayMovingAverage":"-10.60%",
                            "Name":"BHP BLT FPO",
                            "Notes":null,
                            "Open":"28.500",
                            "PreviousClose":"29.390",
                            "PricePaid":null,
                            "ChangeinPercent":"-1.33%",
                            "PriceSales":"2.33",
                            "PriceBook":"1.98",
                            "ExDividendDate":"Sep  3",
                            "PERatio":"11.34",
                            "DividendPayDate":null,
                            "PERatioRealtime":null,
                            "PEGRatio":"4.04",
                            "PriceEPSEstimateCurrentYear":"13.73",
                            "PriceEPSEstimateNextYear":"12.72",
                            "Symbol":"BHP.AX",
                            "SharesOwned":null,
                            "ShortRatio":null,
                            "LastTradeTime":"12:10am"
                            ,"TickerTrend":"&nbsp;======&nbsp;"
                            ,"OneyrTargetPrice":"34.270",
                            "Volume":"9122100",
                            "HoldingsValue":null,
                            "HoldingsValueRealtime":null,
                            "YearRange":"28.400 - 39.790",
                            "DaysValueChange":"- - -1.33%",
                            "DaysValueChangeRealtime":"N/A - N/A",
                            "StockExchange":"ASX",
                            "DividendYield":"4.45",
                            "PercentChange":"-1.33%"}}}}
 
User avatar
mastintin
 
Posts: 1516
Joined: Thu May 27, 2010 2:06 pm

Re: to Mastintin : yahoo financial

Postby Silvio.Falconi » Sat Dec 13, 2014 5:06 pm

can you make a small sample ?
usted puede hacer un pequeño ejemplo?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6851
Joined: Thu Oct 18, 2012 7:17 pm

Re: to Mastintin : yahoo financial

Postby George » Sat Dec 13, 2014 9:40 pm

Manuel,
Este post que iniciaste es bien interesante.
Nos da ideas para aplicaciones desarrolladas con Fivewin accesando data diponible en la red.

Saludos,

George
George
 
Posts: 724
Joined: Tue Oct 18, 2005 6:49 pm

Re: to Mastintin : yahoo financial

Postby mastintin » Sun Dec 14, 2014 12:07 pm

Yahoo no da en este tema mucha documentación y si quieres algo profesional tienes que pagar( lógico por otra parte )
Así todo se pueden sacar muchos datos , yo aquí solo pongo 4 o 5 , pero en la misma llamada existen muchos mas , los datos que devuelve no se si son en Dólares o Euros ( yo creo que Dólares ) , pero como ejemplo vale .
Code: Select all  Expand view


// Our first DialogBox sample

#include "FiveWin.ch"
#include "ttitle.ch"

function Main()
  local obmp ,cBmp
  local oDlg, oIco ,cValor:= "BHP.AX"+space(20)  // "GOOGL"+space(20) // "AAPL"+space(20)
   local ofont
   

   DEFINE Font ofont NAME "Verdana" SIZE 0,14
   DEFINE ICON oIco FILE "..\icons\fivewin.ico"

   DEFINE DIALOG oDlg TITLE "Ciudad a buscar" ;
      ICON oIco SIZE 350, 240

 //  @ 30,10  IMAGE oBmp FILE cBmp OF oDlg size 142,35 pixel NOBORDER
     
           
   
     @ 60, 10 SAY "Introduce el Valor a buscar :" size 100, 12 ;
                        FONT oFont pixel OF oDlg
     
     @ 70, 10 GET cValor size 120, 12 FONT oFont pixel OF oDlg

     @ 105, 85 BUTTON "&Buscar" SIZE 40, 12 OF oDlg pixel ;
              FONT oFont ;
              ACTION llamada(cValor)

     @ 105,130 BUTTON "&Salir" SIZE 40, 12 pixel OF oDlg;
               FONT oFont ;
               ACTION oDlg:End()

   ACTIVATE DIALOG oDlg CENTERED ;
    ON INIT  DlgBarTitle( oDlg, "  Servicio Finaciero","c:\fwh\bitmaps\alphaBmp\weather.bmp" ,44 )  ;
    ON PAINT DlgStatusBar(oDlg, 68,, .t. )
   
   oFont:End()
   
return nil

//------------------------------------------------------------------------------
//------------------------------------------------------------------------------


Function llamada(cValor)
local oHttp
local cResp
local cDir
local Formato :=  "json"    


cDir := "https://query.yahooapis.com/v1/public/yql?q=select * from yahoo.finance.quotes where symbol in ( '"+ cValor+ "')"

cDir := cDir + "&format="+ Formato +"&region=ES"+"&lang=es-es"+"&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback="

//cDir := cDir + "&format="+ Formato +"&diagnostics=true&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback="

//cDir := "https://query.yahooapis.com/v1/public/yql?q=select * from weather.forecast where woeid in (select woeid from geo.places(1)"
//cDir:= cDir + " where text= '"+ cValor +"' ) and u='"+cUnits+"'&format=" + Formato
 
 Try
      oHttp := CreateObject("winhttp.winhttprequest.5.1")
      oHttp:Open("GET", cDir, .f. )
      oHttp:Send()
      cResp := oHttp:ResponseText()
         oHttp:WaitForResponse()  
      // memowrit("finance.txt",cResp )
      leejson( cResp, cValor )
     
   Catch
      MsgStop( "Error" )
      Return cResp
   End Try


Return nil

//------------------------------------------------------------------------------

function Leejson(cResp,cValor )
local hvar
local hvar1,hvar2
local cTexto:=""
local oDlg, cBmp
local nValor
local oBmp
local ofont1,ofont2
Local oBrwForecast

local aForecast:= {}
local i
local cImage,cMin,cMax,cData,cDay
local ahTexto,hDias,cPrev
local cUrl
local nRow:=185
local nCol:= 5
local cTitle := "Resultados para el Valor: " + cValor
hb_jsondecode( cResp, @hvar )


hvar1:= hvar["query"]["results"]["quote"]

 define font ofont1 name "Arial" size 0,16 bold

 DEFINE Font ofont2 NAME "Verdana" SIZE 0,13
 
 
 DEFINE DIALOG oDlg TITLE "Resultados" SIZE 500, 570 pixel color CLR_BLACK,CLR_WHITE

 
     @ 10 ,80 SAY alltrim( cTitle ) OF oDlg SIZE 180, 20 ;
                        pixel Font ofont1 color CLR_BLACK,CLR_WHITE
     
     @ 25, 70 SAY "Fecha : "+ alltrim(hvar["query"]["created"])  SIZE 180, 20 OF oDlg ;
                    pixel  color CLR_BLACK,CLR_WHITE FONT ofont2
     
     
     @ 50, 50 say alltrim("Valor :" )  OF oDlg ;
               pixel color CLR_BLACK,CLR_WHITE FONT ofont2
               
     @ 50, 130 say alltrim( hVar1["symbol"] )  OF oDlg ;
              pixel color CLR_BLACK,CLR_WHITE FONT ofont2        
     
             
     @ 60, 50 say "Volumen Medio " OF oDlg ;
             pixel  color CLR_BLACK,CLR_WHITE FONT ofont2
     @ 60, 130 say  hVar1["AverageDailyVolume"]  OF oDlg ;
             pixel  color CLR_BLACK,CLR_WHITE FONT ofont2        
           
                 
     @ 70, 50 say "Demanda "  OF oDlg ;
                     pixel  color CLR_BLACK,CLR_WHITE FONT ofont2
     
     @ 70, 130 say  hVar1["AskRealtime"]  OF oDlg ;
                     pixel  color CLR_BLACK,CLR_WHITE FONT ofont2
   
     @ 80, 50 say "Oferta "  OF oDlg ;
                     pixel  color CLR_BLACK,CLR_WHITE FONT ofont2
     
     @ 80, 130 say  hVar1["BidRealtime"]  OF oDlg ;
                     pixel  color CLR_BLACK,CLR_WHITE FONT ofont2      
   
   
     
   
   
  //   @ 85, 95 say "Atmosfera " OF oDlg ;
   //                     pixel  color CLR_BLACK,CLR_WHITE FONT ofont1
                     
     @ 100, 50 say "Ultimo Cambio " OF oDlg ;
                    pixel  color CLR_BLACK,CLR_WHITE FONT ofont2
     @ 100, 130 say  hVar1["Change_PercentChange"]  OF oDlg ;
                    pixel  color CLR_BLACK,CLR_WHITE FONT ofont2
                                       
       
                   
     @ 110, 50 say "Maximo Anual " OF oDlg ;
                        pixel   color CLR_BLACK,CLR_WHITE FONT ofont2
                       
     @ 110, 130 say hVar1["YearHigh"] OF oDlg ;
                        pixel   color CLR_BLACK,CLR_WHITE FONT ofont2
                               
 
     @ 120, 50 say "Minimo Anual: "  OF oDlg ;
                        pixel color CLR_BLACK,CLR_WHITE FONT ofont2
     @ 120, 130 say  hVar1["YearLow"] OF oDlg ;
                        pixel color CLR_BLACK,CLR_WHITE FONT ofont2
   
 

     
         
    @ 270, 100 BUTTON "&Ok" SIZE 40, 12  OF oDlg pixel ;
      ACTION odlg:end() FONT oFont2
   
 ACTIVATE DIALOG oDlg CENTERED on paint  DlgStatusBar(oDlg, 68,, .t. )
 
  ofont1:end()
  ofont2:end()  

 return nil

//------------------------------------------------------------------------------
//------------------------------------------------------------------------------

Function DlgStatusBar(oDlg, nHeight, nCorrec , lColor )
Local nDlgHeight := oDlg:nHeight
Local aColor     := { { 0.40, nRGB( 200, 200, 200 ), nRGB( 184, 184, 184 ) },;
                    { 0.60, nRGB( 184, 184, 184 ), nRGB( 150, 150, 150 ) } }

DEFAULT nHeight  := 72
DEFAULT nCorrec  := 0
DEFAULT lColor   := .F.

nDlgHeight:= nDlgHeight+ncorrec
IF lColor
   GradienTfill(oDlg:hDC,nDlgHeight-( nHeight-2 ),0,nDlgHeight-20,oDlg:nWidth, aColor ,.t.)
   WndBoxIn( oDlg:hDc,nDlgHeight-( nHeight-1 ),0,nDlgHeight-( nHeight ),oDlg:nWidth )
ELSE
   WndBoxIn( oDlg:hDc,nDlgHeight -( nHeight-1 ),4,nDlgHeight-( nHeight ),oDlg:nWidth - 10 )
endif

Return Nil

//------------------------------------------------------------------------------

FUNCTION DlgBarTitle( oWnd, cTitle, cBmp ,nHeight )
   LOCAL oFont
   LOCAL oTitle
   LOCAL nColText := 180
   LOCAL nRowImg  := 0
   

   DEFAULT cTitle  := ""
   DEFAULT nHeight := 48

   IF nHeight < 48
      nColText := 60
      nRowImg  := 12
      DEFINE FONT oFont NAME "Arial" size 10, 30
   ELSE
      DEFINE FONT oFont NAME "Arial" size 12, 30
   endif

    @ -1, -1  TITLE oTitle size oWnd:nWidth+1, nHeight+1 of oWnd SHADOWSIZE 0
   
   @  nRowImg,  10  TITLEIMG  OF oTitle BITMAP cBmp  SIZE 48, 48 REFLEX ;
          TRANSPARENT
   
    @  nRowImg-2 ,  nColText TITLETEXT OF oTitle TEXT cTitle COLOR CLR_BLACK FONT oFont

    oTitle:aGrdBack := { { 1, RGB( 255, 255, 255 ), RGB( 229, 233, 238 )  } }
    oTitle:nShadowIntensity = 0
    oTitle:nShadow = 0
    oTitle:nClrLine1 := nrgb(0,0,0)
    oTitle:nClrLine2 := RGB( 229, 233, 238 )
    oWnd:oTop:= oTitle
   
     

RETURN oTitle


 
User avatar
mastintin
 
Posts: 1516
Joined: Thu May 27, 2010 2:06 pm

Re: to Mastintin : yahoo financial

Postby Silvio.Falconi » Mon Dec 15, 2014 12:47 pm

Manuel,
First I make some modify (add the proxy setup as meteo)

Code: Select all  Expand view


// Our first DialogBox sample

#include "FiveWin.ch"
#include "ttitle.ch"
#include "constant.ch"

#define HTTPREQUEST_PROXYSETTING_DEFAULT   0
#define HTTPREQUEST_PROXYSETTING_PRECONFIG 0
#define HTTPREQUEST_PROXYSETTING_DIRECT    1
#define HTTPREQUEST_PROXYSETTING_PROXY     2


#define HTTPREQUEST_SETCREDENTIALS_FOR_SERVER  0
#define HTTPREQUEST_SETCREDENTIALS_FOR_PROXY   1

function Main()
  local obmp ,cBmp
  local oDlg, oIco ,cValor:= "BHP.AX"+space(20)  // "GOOGL"+space(20) // "AAPL"+space(20)
   local ofont


  local lProxy
  Local cIniFile  := cFilePath(GetModuleFileName( GetInstance() ) ) + "finanza.ini"


   DEFINE Font ofont NAME "Verdana" SIZE 0,14
   DEFINE ICON oIco FILE "c:\work\fwh\icons\fivewin.ico"


    lProxy:=Request_Proxy()


     If lProxy
        cSection :="Config"
        cIniFile  := cFilePath(GetModuleFileName( GetInstance() ) ) + "finanza.ini"
        PROXY_SCHOOL  := GetIni(cIniFile, cSection, "Proxy")
        NPORT     := val(GetIni(cIniFile, cSection, "Port"))
        USERNAME := GetIni(cIniFile, cSection, "Username")
        PASSWORD := GetIni(cIniFile, cSection, "Password")
     Endif






   DEFINE DIALOG oDlg TITLE "Ciudad a buscar" ;
      ICON oIco SIZE 350, 240

 //  @ 30,10  IMAGE oBmp FILE cBmp OF oDlg size 142,35 pixel NOBORDER



     @ 60, 10 SAY "Introduce el Valor a buscar :" size 100, 12 ;
                        FONT oFont pixel OF oDlg

     @ 70, 10 GET cValor size 120, 12 FONT oFont pixel OF oDlg

     @ 105, 85 BUTTON "&Buscar" SIZE 40, 12 OF oDlg pixel ;
              FONT oFont ;
              ACTION llamada(cValor,lProxy)

     @ 105,130 BUTTON "&Salir" SIZE 40, 12 pixel OF oDlg;
               FONT oFont ;
               ACTION oDlg:End()

   ACTIVATE DIALOG oDlg CENTERED ;
    ON INIT  DlgBarTitle( oDlg, "  Servicio Finaciero","c:\fwh\bitmaps\alphaBmp\weather.bmp" ,44 )  ;
    ON PAINT DlgStatusBar(oDlg, 68,, .t. )

   oFont:End()

return nil

//------------------------------------------------------------------------------

 //--------------------------------------------------------------------------//


Function Request_Proxy()
Local   lReturn

   IF MsgyesNo("Devo usare il proxy ?")
      lReturn :=.t.
       Valid_Proxy()
   else
      lReturn :=.f.
   endif
   return lReturn

//------------------------------------------------------------------------------//


Function Valid_Proxy()
       Local oDlgProxy,oFont
       Local cIniFile  := cFilePath(GetModuleFileName( GetInstance() ) ) + "finanza.ini"
       Local nBottom   := 14
       Local nRight    := 55
       Local nWidth :=  Max( nRight * DLG_CHARPIX_W, 180 )
       Local nHeight := nBottom * DLG_CHARPIX_H
       Local oBtnHelp,oBtnOK,oBtnCan


       Local cUSERNAME :=  pad(GetPvProfString("Config","Username"       ,"mioUsername"    ,cIniFile ) , 40 ," " )
       Local cPASSWORD :=  pad(GetPvProfString("Config","Password"       ,"miapassword"    ,cIniFile ) , 40 ," " )
       Local cPROXY    :=  pad(GetPvProfString("Config","Proxy"       ,"miaproxy"    ,cIniFile ) , 45 ," " )
       Local nPORT     :=  pad(GetPvProfString("Config","Port"   ,"8080"    ,cIniFile ) , 4 ," " )


       Local aGet[4]

       DEFINE FONT oFont NAME "MS Sans Serif" SIZE 0, 8

     DEFINE DIALOG oDlgProxy TITLE "Inserimento Proxy" ;
      FROM 100, 100 TO 230,600  pixel


     @ 12, 10 SAY "Proxy:" OF oDlgProxy SIZE 60, 8 PIXEL FONT oFont
     @ 10, 45 GET aGet[1] VAR cPROXY OF oDlgProxy SIZE 50, 12 PIXEL FONT oFont

     @ 26, 10 SAY "Porta:" OF oDlgProxy SIZE 80, 8 PIXEL FONT oFont
     @ 24, 45 GET aGet[2] var nPORT   OF oDlgProxy SIZE 44, 12 PIXEL  FONT oFont

     @ 12, 120 SAY "Codice utente:" OF oDlgProxy SIZE 80, 8 PIXEL FONT oFont
     @ 10, 175 GET aGet[3] var cUSERNAME OF oDlgProxy SIZE 44, 12 PIXEL  FONT oFont

     @ 26, 120 SAY "Password:" OF oDlgProxy SIZE 80, 8 PIXEL FONT oFont
     @ 24, 175 GET aGet[4] var cPASSWORD OF oDlgProxy SIZE 44, 12 PIXEL  FONT oFont



   @ 46, 4 BUTTON oBtnHelp PROMPT "&Aiuto" OF oDlgProxy SIZE 42, 12 PIXEL FONT oFont  ACTION Helpindex()
   @ 46, 160 BUTTON oBtnOK PROMPT I18n("Conferma") OF oDlgProxy SIZE 42, 12 PIXEL FONT oFont DEFAULT ACTION (oDlgProxy:End(IDOK ))
   @ 46, 204 BUTTON oBtnCan PROMPT i18n("Annulla") OF oDlgProxy SIZE 42, 12 PIXEL FONT oFont CANCEL ACTION (oDlgProxy:End(IDCANCEL))
     ACTIVATE DIALOG oDlgProxy CENTERED


     if oDlgProxy:nresult == IDOK

     SetIni( cInifile, "Config", "Proxy", cPROXY )
     SetIni( cInifile, "Config", "Username", cUSERNAME )
     SetIni( cInifile, "Config", "Password", cPASSWORD )
     SetIni( cInifile, "Config", "Port", nPORT )

  endif

  return nil


//------------------------------------------------------------------------------


Function llamada(cValor,lProxy)
local oHttp
local cResp
local cDir
local Formato :=  "json"


cDir := "https://query.yahooapis.com/v1/public/yql?q=select * from yahoo.finance.quotes where symbol in ( '"+ cValor+ "')"

cDir := cDir + "&format="+ Formato +"&region=ES"+"&lang=it-IT"+"&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback="

//cDir := cDir + "&format="+ Formato +"&diagnostics=true&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback="

//cDir := "https://query.yahooapis.com/v1/public/yql?q=select * from weather.forecast where woeid in (select woeid from geo.places(1)"
//cDir:= cDir + " where text= '"+ cValor +"' ) and u='"+cUnits+"'&format=" + Formato





     If lProxy
        cSection :="Config"
        cIniFile  := cFilePath(GetModuleFileName( GetInstance() ) ) + "finanza.ini"
        PROXY_SCHOOL    := GetIni(cIniFile, cSection, "Proxy")
        NPORT     := val(GetIni(cIniFile, cSection, "Port"))
        USERNAME := GetIni(cIniFile, cSection, "Username")
        PASSWORD := GetIni(cIniFile, cSection, "Password")
       Endif














  Try
      oHttp := CreateObject( "winhttp.winhttprequest.5.1" )

      if lProxy
         oHttp:SetProxy( HTTPREQUEST_PROXYSETTING_PROXY, PROXY_SCHOOL+":"+alltrim(str(NPORT)))

      endif


      oHttp:Open("GET", cDir, .f. )

       if lProxy
         oHttp:SetCredentials(USERNAME,PASSWORD,HTTPREQUEST_SETCREDENTIALS_FOR_PROXY)
      endif

      oHttp:Send()
       *cResp := oHttp:ResponseBody()

      cResp := oHttp:ResponseText()

      // memowrit("finance.txt",cResp )
      leejson( cResp, cValor ,lProxy)


  Catch
      MsgStop( "Error" )
      Return cResp
   End Try


Return cResp

//------------------------------------------------------------------------------

function Leejson(cResp,cValor ,lProxy)
local hvar
local hvar1,hvar2
local cTexto:=""
local oDlg, cBmp
local nValor
local oBmp
local ofont1,ofont2
Local oBrwForecast

local aForecast:= {}
local i
local cImage,cMin,cMax,cData,cDay
local ahTexto,hDias,cPrev
local cUrl
local nRow:=185
local nCol:= 5
local cTitle := "Resultados para el Valor: " + cValor
hb_jsondecode( cResp, @hvar )


hvar1:= hvar["query"]["results"]["quote"]

 define font ofont1 name "Arial" size 0,16 bold

 DEFINE Font ofont2 NAME "Verdana" SIZE 0,13


 DEFINE DIALOG oDlg TITLE "Resultados" SIZE 500, 570 pixel color CLR_BLACK,CLR_WHITE


     @ 10 ,80 SAY alltrim( cTitle ) OF oDlg SIZE 180, 20 ;
                        pixel Font ofont1 color CLR_BLACK,CLR_WHITE

     @ 25, 70 SAY "Fecha : "+ alltrim(hvar["query"]["created"])  SIZE 180, 20 OF oDlg ;
                    pixel  color CLR_BLACK,CLR_WHITE FONT ofont2


     @ 50, 50 say alltrim("Valor :" )  OF oDlg ;
               pixel color CLR_BLACK,CLR_WHITE FONT ofont2

     @ 50, 130 say alltrim( hVar1["symbol"] )  OF oDlg ;
              pixel color CLR_BLACK,CLR_WHITE FONT ofont2


     @ 60, 50 say "Volumen Medio " OF oDlg ;
             pixel  color CLR_BLACK,CLR_WHITE FONT ofont2
     @ 60, 130 say  hVar1["AverageDailyVolume"]  OF oDlg ;
             pixel  color CLR_BLACK,CLR_WHITE FONT ofont2


     @ 70, 50 say "Demanda "  OF oDlg ;
                     pixel  color CLR_BLACK,CLR_WHITE FONT ofont2

     @ 70, 130 say  hVar1["AskRealtime"]  OF oDlg ;
                     pixel  color CLR_BLACK,CLR_WHITE FONT ofont2

     @ 80, 50 say "Oferta "  OF oDlg ;
                     pixel  color CLR_BLACK,CLR_WHITE FONT ofont2

     @ 80, 130 say  hVar1["BidRealtime"]  OF oDlg ;
                     pixel  color CLR_BLACK,CLR_WHITE FONT ofont2





  //   @ 85, 95 say "Atmosfera " OF oDlg ;
   //                     pixel  color CLR_BLACK,CLR_WHITE FONT ofont1

     @ 100, 50 say "Ultimo Cambio " OF oDlg ;
                    pixel  color CLR_BLACK,CLR_WHITE FONT ofont2
     @ 100, 130 say  hVar1["Change_PercentChange"]  OF oDlg ;
                    pixel  color CLR_BLACK,CLR_WHITE FONT ofont2



     @ 110, 50 say "Maximo Anual " OF oDlg ;
                        pixel   color CLR_BLACK,CLR_WHITE FONT ofont2

     @ 110, 130 say hVar1["YearHigh"] OF oDlg ;
                        pixel   color CLR_BLACK,CLR_WHITE FONT ofont2


     @ 120, 50 say "Minimo Anual: "  OF oDlg ;
                        pixel color CLR_BLACK,CLR_WHITE FONT ofont2
     @ 120, 130 say  hVar1["YearLow"] OF oDlg ;
                        pixel color CLR_BLACK,CLR_WHITE FONT ofont2





    @ 270, 100 BUTTON "&Ok" SIZE 40, 12  OF oDlg pixel ;
      ACTION odlg:end() FONT oFont2

 ACTIVATE DIALOG oDlg CENTERED on paint  DlgStatusBar(oDlg, 68,, .t. )

  ofont1:end()
  ofont2:end()

 return nil

//------------------------------------------------------------------------------
//------------------------------------------------------------------------------

Function DlgStatusBar(oDlg, nHeight, nCorrec , lColor )
Local nDlgHeight := oDlg:nHeight
Local aColor     := { { 0.40, nRGB( 200, 200, 200 ), nRGB( 184, 184, 184 ) },;
                    { 0.60, nRGB( 184, 184, 184 ), nRGB( 150, 150, 150 ) } }

DEFAULT nHeight  := 72
DEFAULT nCorrec  := 0
DEFAULT lColor   := .F.

nDlgHeight:= nDlgHeight+ncorrec
IF lColor
   GradienTfill(oDlg:hDC,nDlgHeight-( nHeight-2 ),0,nDlgHeight-20,oDlg:nWidth, aColor ,.t.)
   WndBoxIn( oDlg:hDc,nDlgHeight-( nHeight-1 ),0,nDlgHeight-( nHeight ),oDlg:nWidth )
ELSE
   WndBoxIn( oDlg:hDc,nDlgHeight -( nHeight-1 ),4,nDlgHeight-( nHeight ),oDlg:nWidth - 10 )
endif

Return Nil

//------------------------------------------------------------------------------

FUNCTION DlgBarTitle( oWnd, cTitle, cBmp ,nHeight )
   LOCAL oFont
   LOCAL oTitle
   LOCAL nColText := 180
   LOCAL nRowImg  := 0


   DEFAULT cTitle  := ""
   DEFAULT nHeight := 48

   IF nHeight < 48
      nColText := 60
      nRowImg  := 12
      DEFINE FONT oFont NAME "Arial" size 10, 30
   ELSE
      DEFINE FONT oFont NAME "Arial" size 12, 30
   endif

    @ -1, -1  TITLE oTitle size oWnd:nWidth+1, nHeight+1 of oWnd SHADOWSIZE 0

   @  nRowImg,  10  TITLEIMG  OF oTitle BITMAP cBmp  SIZE 48, 48 REFLEX ;
          TRANSPARENT

    @  nRowImg-2 ,  nColText TITLETEXT OF oTitle TEXT cTitle COLOR CLR_BLACK FONT oFont

    oTitle:aGrdBack := { { 1, RGB( 255, 255, 255 ), RGB( 229, 233, 238 )  } }
    oTitle:nShadowIntensity = 0
    oTitle:nShadow = 0
    oTitle:nClrLine1 := nrgb(0,0,0)
    oTitle:nClrLine2 := RGB( 229, 233, 238 )
    oWnd:oTop:= oTitle



RETURN oTitle




 FUNCTION SetIni( cIni, cSection, cEntry, xVar )

   LOCAL oIni

   DEFAULT cIni := oApp:cIniFile

   INI oIni FILE cIni
      SET SECTION cSection ;
         ENTRY cEntry      ;
         TO xVar           ;
         OF oIni
   ENDINI

RETURN nil

/*_____________________________________________________________________________*/

FUNCTION GetIni( cIni, cSection, cEntry, xDefault )

   LOCAL oIni
   LOCAL xVar := xDefault

   DEFAULT cIni := oApp:cIniFile

   INI oIni FILE cIni
      GET xVar            ;
         SECTION cSection ;
         ENTRY cEntry     ;
         DEFAULT xDefault ;
         OF oIni
   ENDINI

RETURN xVa
 



then I found only this

https://code.google.com/p/yahoo-finance ... loads/list it could be usefull to us ?

I not found documentation for yahoo finance but on doaload list there is a source of manager and on finace folder there is a source also for download charts
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6851
Joined: Thu Oct 18, 2012 7:17 pm

Re: to Mastintin : yahoo financial

Postby mastintin » Mon Dec 15, 2014 3:38 pm

Silvio, para poner un grafico ....

Code: Select all  Expand view


local cRegion:= "ES"
local cLang := "es-ES"
local aTipo :={ {"Line", "Bar", "Candle"},{ "l", "b", "c" } }
local aSize := { {"Large","Middle","Small"},{"l", "m", "s" } }

    cTexto:="http://chart.finance.yahoo.com/z?s=" + alltrim(cValor)+"&q="+aTipo[2,3] +"&region="+cRegion+"&lang="+ cLang
    cTexto:= cTexto+"&z=" + aSize[2,3]
               
             
     @ 140,1  IMAGE oBmp FILE cBmp SIZE 248,144 OF oDlg ADJUST  pixel NOBORDER
         
      cargaBmp(cTexto,oBmp)


 
User avatar
mastintin
 
Posts: 1516
Joined: Thu May 27, 2010 2:06 pm

Re: to Mastintin : yahoo financial

Postby Silvio.Falconi » Mon Dec 15, 2014 8:07 pm

Gulp...
where I found this information ?

Listen ....

Citas, a menos que se indique lo contrario, son diferidos. Divisa en USD

but I found also
BHP Billiton Limited (BHP.AX) -ASX Codice: 000BHP/ISIN: AU000000BHP4 divisa en AUD

Perhaps there is a value tell us type of Values od each symbol

I saw there is the possibilty to List all symbols as Browse ( in Italy I see 610 symbols)

please see this : https://es.finance.yahoo.com/q/cp;_ylt= ... s=ITLMS.MI



for the image for the logo I founded this

http://eur.i1.yimg.com/eur.yimg.com/i/it/fi/fi6.gif for Italy
http://eur.i1.yimg.com/eur.yimg.com/i/es/fi/fi6.gif for Espana

do you have other values to insert ?
as this image

Image
Last edited by Silvio.Falconi on Mon Dec 15, 2014 8:50 pm, edited 2 times in total.
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6851
Joined: Thu Oct 18, 2012 7:17 pm

Re: to Mastintin : yahoo financial

Postby Silvio.Falconi » Mon Dec 15, 2014 8:38 pm

New Version

This release is complete of Finance and Meteo Yahoo ( with or without Proxy)

Image


I add a main dialog to call finance and Meteo services yahoo


Make a folder Yahoo and insert this sources
the include on includes folder



YaHoo.prg

Code: Select all  Expand view


#include "FiveWin.ch"
#include "constant.ch"



Function  Yahoo()
Local oDlgYahoo,oFont
       Local nBottom   := 14
       Local nRight    := 55
       Local nWidth :=  Max( nRight * DLG_CHARPIX_W, 180 )
       Local nHeight := nBottom * DLG_CHARPIX_H
       Local oBtnOption[2]
       local cUrl_Finance :=  "http://eur.i1.yimg.com/eur.yimg.com/i/it/fi/fi6.gif"
       local cUrl_Meteo := "http://l.yimg.com/a/i/brand/purplelogo//uh/us/news-wea.gif"

       Local oBmpMeteo,cBmpMeteo
       Local oBmpFinance,cBmpFinance

       lProxy:=Request_Proxy()

      If lProxy
        cSection :="Config"
        cIniFile  := cFilePath(GetModuleFileName( GetInstance() ) ) + PROXY_MEM
        PROXY_SCHOOL  := GetIni(cIniFile, cSection, "Proxy")
        NPORT     := val(GetIni(cIniFile, cSection, "Port"))
        USERNAME := GetIni(cIniFile, cSection, "Username")
        PASSWORD := GetIni(cIniFile, cSection, "Password")
     Endif


  DEFINE FONT oFont NAME "MS Sans Serif" SIZE 0, 8

     DEFINE DIALOG oDlgYahoo TITLE "Yahoo" ;
    FROM 100, 100 TO 230,600  pixel

     @ 0,10  IMAGE oBmpMeteo FILE cBmpMeteo OF oDlgYahoo size 142,35 pixel NOBORDER    ON CLICK     Meteo()
     @ 40,10  IMAGE oBmpFinance FILE cBmpFinance OF oDlgYahoo size 142,35 pixel NOBORDER  ON CLICK  Finance()


     oBmpMeteo:lTransparent := .t.
     oBmpFinance:lTransparent := .t.



     cargaBmp(cUrl_Meteo,oBmpMeteo,lProxy)

     cargaBmp(cUrl_Finance,oBmpFinance,lProxy)



ACTIVATE DIALOG oDlgYahoo CENTERED

return nil
 





Proxy.prg
Code: Select all  Expand view

#include "FiveWin.ch"
#include "ttitle.ch"
#include "constant.ch"



#include ".\INCLUDE\yahoo.ch"



// to connect  to Internet    without or With Proxy


Function Request_Proxy()
Local   lReturn

   IF MsgyesNo("Devo usare il proxy ?")
      lReturn :=.t.
       Valid_Proxy()
   else
      lReturn :=.f.
   endif
return lReturn

//------------------------------------------------------------------------------//


Function Valid_Proxy()
       Local oDlgProxy,oFont
       Local cIniFile  := cFilePath(GetModuleFileName( GetInstance() ) ) + PROXY_MEM
       Local nBottom   := 14
       Local nRight    := 55
       Local nWidth :=  Max( nRight * DLG_CHARPIX_W, 180 )
       Local nHeight := nBottom * DLG_CHARPIX_H
       Local oBtnHelp,oBtnOK,oBtnCan


       Local cUSERNAME :=  pad(GetPvProfString("Config","Username"       ,"mioUsername"    ,cIniFile ) , 40 ," " )
       Local cPASSWORD :=  pad(GetPvProfString("Config","Password"       ,"miapassword"    ,cIniFile ) , 40 ," " )
       Local cPROXY    :=  pad(GetPvProfString("Config","Proxy"       ,"miaproxy"    ,cIniFile ) , 45 ," " )
       Local nPORT     :=  pad(GetPvProfString("Config","Port"   ,"8080"    ,cIniFile ) , 4 ," " )


       Local aGet[4]

       DEFINE FONT oFont NAME "MS Sans Serif" SIZE 0, 8

     DEFINE DIALOG oDlgProxy TITLE "Validate Proxy" ;
      FROM 100, 100 TO 230,600  pixel


     @ 12, 10 SAY "Proxy:" OF oDlgProxy SIZE 60, 8 PIXEL FONT oFont
     @ 10, 45 GET aGet[1] VAR cPROXY OF oDlgProxy SIZE 50, 12 PIXEL FONT oFont

     @ 26, 10 SAY "Port:" OF oDlgProxy SIZE 80, 8 PIXEL FONT oFont
     @ 24, 45 GET aGet[2] var nPORT   OF oDlgProxy SIZE 44, 12 PIXEL  FONT oFont

     @ 12, 120 SAY "Username:" OF oDlgProxy SIZE 80, 8 PIXEL FONT oFont
     @ 10, 175 GET aGet[3] var cUSERNAME OF oDlgProxy SIZE 44, 12 PIXEL  FONT oFont

     @ 26, 120 SAY "Password:" OF oDlgProxy SIZE 80, 8 PIXEL FONT oFont
     @ 24, 175 GET aGet[4] var cPASSWORD OF oDlgProxy SIZE 44, 12 PIXEL  FONT oFont



   @ 46, 4 BUTTON oBtnHelp PROMPT "&Help" OF oDlgProxy SIZE 42, 12 PIXEL FONT oFont  ACTION Helpindex()
   @ 46, 160 BUTTON oBtnOK PROMPT I18n("Confirm") OF oDlgProxy SIZE 42, 12 PIXEL FONT oFont DEFAULT ACTION (oDlgProxy:End(IDOK ))
   @ 46, 204 BUTTON oBtnCan PROMPT i18n("Exit") OF oDlgProxy SIZE 42, 12 PIXEL FONT oFont CANCEL ACTION (oDlgProxy:End(IDCANCEL))
     ACTIVATE DIALOG oDlgProxy CENTERED


     if oDlgProxy:nresult == IDOK

     SetIni( cInifile, "Config", "Proxy", cPROXY )
     SetIni( cInifile, "Config", "Username", cUSERNAME )
     SetIni( cInifile, "Config", "Password", cPASSWORD )
     SetIni( cInifile, "Config", "Port", nPORT )

  endif

  return nil
 




ut_fun.prg
Code: Select all  Expand view
#include "FiveWin.ch"
#include "ttitle.ch"

 FUNCTION SetIni( cIni, cSection, cEntry, xVar )

   LOCAL oIni

   DEFAULT cIni := oApp:cIniFile

   INI oIni FILE cIni
      SET SECTION cSection ;
         ENTRY cEntry      ;
         TO xVar           ;
         OF oIni
   ENDINI

RETURN nil

/*_____________________________________________________________________________*/

FUNCTION GetIni( cIni, cSection, cEntry, xDefault )

   LOCAL oIni
   LOCAL xVar := xDefault

   DEFAULT cIni := oApp:cIniFile

   INI oIni FILE cIni
      GET xVar            ;
         SECTION cSection ;
         ENTRY cEntry     ;
         DEFAULT xDefault ;
         OF oIni
   ENDINI

   RETURN xVa





Function loadBmp(cUrl,lProxy)
local oHttp
local cResp := nil



cProxyNo  := "*.yimg.com"



     If lProxy
        cSection :="Config"
        cIniFile  := cFilePath(GetModuleFileName( GetInstance() ) ) + "Meteo.ini"
        PROXY_SCHOOL    := GetIni(cIniFile, cSection, "Proxy")
        NPORT     := val(GetIni(cIniFile, cSection, "Port"))
        USERNAME := GetIni(cIniFile, cSection, "Username")
        PASSWORD := GetIni(cIniFile, cSection, "Password")
       Endif


     // ?PROXY_SCHOOL ,NPORT ,USERNAME ,PASSWORD

   Try
      oHttp := CreateObject( "winhttp.winhttprequest.5.1" )

      if lProxy
         oHttp:SetProxy( HTTPREQUEST_PROXYSETTING_PROXY, PROXY_SCHOOL+":"+alltrim(str(NPORT)))
      endif

      oHttp:Open("GET", cUrl, .f. )

       if lProxy
         oHttp:SetCredentials(USERNAME,PASSWORD,HTTPREQUEST_SETCREDENTIALS_FOR_PROXY)
      endif

      oHttp:Send()


      cResp := oHttp:ResponseBody()

      oHttp:WaitForResponse()


   Catch
      MsgStop( "Errore" )
      Return cResp
   End Try

   Return cResp









 Function cargaBmp(cUrl,oImage,lProxy)
local cResp := loadBmp(cUrl,lProxy)
local nZeroZeroClr
 if !Empty( cResp )
     // oImage:LoadFromString( cResp )
    oImage:LoadFromMemory( cResp )
    oImage:HasAlpha()
    oImage:Refresh()
 endif
Return nil




Function DlgStatusBar(oDlg, nHeight, nCorrec , lColor )
Local nDlgHeight := oDlg:nHeight
Local aColor     := { { 0.40, nRGB( 200, 200, 200 ), nRGB( 184, 184, 184 ) },;
                    { 0.60, nRGB( 184, 184, 184 ), nRGB( 150, 150, 150 ) } }

DEFAULT nHeight  := 72
DEFAULT nCorrec  := 0
DEFAULT lColor   := .F.

nDlgHeight:= nDlgHeight+ncorrec
IF lColor
   GradienTfill(oDlg:hDC,nDlgHeight-( nHeight-2 ),0,nDlgHeight-20,oDlg:nWidth, aColor ,.t.)
   WndBoxIn( oDlg:hDc,nDlgHeight-( nHeight-1 ),0,nDlgHeight-( nHeight ),oDlg:nWidth )
ELSE
   WndBoxIn( oDlg:hDc,nDlgHeight -( nHeight-1 ),4,nDlgHeight-( nHeight ),oDlg:nWidth - 10 )
endif

Return Nil

//------------------------------------------------------------------------------

FUNCTION DlgBarTitle( oWnd, cTitle, cBmp ,nHeight )
   LOCAL oFont
   LOCAL oTitle
   LOCAL nColText := 180
   LOCAL nRowImg  := 0


   DEFAULT cTitle  := ""
   DEFAULT nHeight := 48

   IF nHeight < 48
      nColText := 60
      nRowImg  := 12
      DEFINE FONT oFont NAME "Arial" size 10, 30
   ELSE
      DEFINE FONT oFont NAME "Arial" size 12, 30
   endif

    @ -1, -1  TITLE oTitle size oWnd:nWidth+1, nHeight+1 of oWnd SHADOWSIZE 0

   @  nRowImg,  10  TITLEIMG  OF oTitle BITMAP cBmp  SIZE 48, 48 REFLEX ;
          TRANSPARENT

    @  nRowImg-2 ,  nColText TITLETEXT OF oTitle TEXT cTitle COLOR CLR_BLACK FONT oFont

    oTitle:aGrdBack := { { 1, RGB( 255, 255, 255 ), RGB( 229, 233, 238 )  } }
    oTitle:nShadowIntensity = 0
    oTitle:nShadow = 0
    oTitle:nClrLine1 := nrgb(0,0,0)
    oTitle:nClrLine2 := RGB( 229, 233, 238 )
    oWnd:oTop:= oTitle



RETURN oTitle





 





Yahoo.ch

Code: Select all  Expand view
#define HTTPREQUEST_PROXYSETTING_DEFAULT   0
#define HTTPREQUEST_PROXYSETTING_PRECONFIG 0
#define HTTPREQUEST_PROXYSETTING_DIRECT    1
#define HTTPREQUEST_PROXYSETTING_PROXY     2


#define HTTPREQUEST_SETCREDENTIALS_FOR_SERVER  0
#define HTTPREQUEST_SETCREDENTIALS_FOR_PROXY   1


#define PROXY_MEM "proxy.ini"

 




Meteo.prg
Code: Select all  Expand view
Our first DialogBox sample

#include "FiveWin.ch"
#include "constant.ch"

#include ".\include\yahoo.ch"





Function  Meteo()
  local obmp ,cBmp
  local oDlg, oIco ,cCity:= "Marbella"+space(20)
  local cUrl := "http://l.yimg.com/a/i/brand/purplelogo//uh/us/news-wea.gif"
  local ofont
  local lProxy
  Local cIniFile  := cFilePath(GetModuleFileName( GetInstance() ) ) + PROXY_MEM


   DEFINE Font ofont NAME "Verdana" SIZE 0,14
   DEFINE ICON oIco FILE ".\Bitmaps\fivetech.ico"


    lProxy:=Request_Proxy()


     If lProxy
        cSection :="Config"
        cIniFile  := cFilePath(GetModuleFileName( GetInstance() ) ) + PROXY_MEM
        PROXY_SCHOOL  := GetIni(cIniFile, cSection, "Proxy")
        NPORT     := val(GetIni(cIniFile, cSection, "Port"))
        USERNAME := GetIni(cIniFile, cSection, "Username")
        PASSWORD := GetIni(cIniFile, cSection, "Password")
     Endif

    // ?PROXY_SCHOOL



   DEFINE DIALOG oDlg TITLE "Città da cercare" ;
      ICON oIco SIZE 350, 240

   @ 30,10  IMAGE oBmp FILE cBmp OF oDlg size 142,35 pixel NOBORDER

     obmp:lTransparent := .t.
     cargaBmp(cUrl,oBmp,lProxy)

   //  oBmp:display()


     @ 60, 10 SAY "Introdurre la citta da trovare :" size 100, 12 ;
                        FONT oFont pixel OF oDlg

     @ 70, 10 GET cCity size 120, 12 FONT oFont pixel OF oDlg

     @ 105, 85 BUTTON "&Cerca" SIZE 40, 12 OF oDlg pixel ;
              FONT oFont ;
              ACTION llamada_meteo(cCity,lProxy)

     @ 105,130 BUTTON "&Uscita" SIZE 40, 12 pixel OF oDlg;
               FONT oFont ;
               ACTION oDlg:End()

   ACTIVATE DIALOG oDlg CENTERED ;
    ON INIT (DlgBarTitle( oDlg, "  Servizio Metereologico",".\Bitmaps\weather.bmp" ,44 ))  ;
    ON PAINT DlgStatusBar(oDlg, 68,, .t. )

   return nil





Function llamada_Meteo(cCity,lProxy)
local oHttp
local cResp
local cDir
local Formato :=  "json"  // "xml"
local cUnits:= "c"

cDir := "https://query.yahooapis.com/v1/public/yql?q=select * from weather.forecast where woeid in (select woeid from geo.places(1)"
cDir:= cDir + " where text= '"+ cCity +"' ) and u='"+cUnits+"'&format=" + Formato





     If lProxy
        cSection :="Config"
        cIniFile  := cFilePath(GetModuleFileName( GetInstance() ) ) + PROXY_MEM
        PROXY_SCHOOL    := GetIni(cIniFile, cSection, "Proxy")
        NPORT     := val(GetIni(cIniFile, cSection, "Port"))
        USERNAME := GetIni(cIniFile, cSection, "Username")
        PASSWORD := GetIni(cIniFile, cSection, "Password")
       Endif


      //?PROXY_SCHOOL ,NPORT ,USERNAME ,PASSWORD


  Try
      oHttp := CreateObject( "winhttp.winhttprequest.5.1" )

      if lProxy
         oHttp:SetProxy( HTTPREQUEST_PROXYSETTING_PROXY, PROXY_SCHOOL+":"+alltrim(str(NPORT)))

      endif


      oHttp:Open("GET", cDir, .f. )

       if lProxy
         oHttp:SetCredentials(USERNAME,PASSWORD,HTTPREQUEST_SETCREDENTIALS_FOR_PROXY)
      endif

      oHttp:Send()
       *cResp := oHttp:ResponseBody()

      cResp := oHttp:ResponseText()

      oHttp:WaitForResponse()

        leejson_Meteo( cResp,lProxy )

  Catch
      MsgStop( "Errore" )
      Return cResp
   End Try

   Return cResp



  /*

 Try
      oHttp := CreateObject("winhttp.winhttprequest.5.1")
      oHttp:Open("GET", cDir, .f. )
      oHttp:Send()
      cResp := oHttp:ResponseText()
         oHttp:WaitForResponse()
     // memowrit("eltiempo.txt",cResp )
     // msginfo("grabado")
     // winexec( "notepad.exe eltiempo.txt" )

     leejson_Meteo( cResp )
   Catch
      MsgStop( "Error" )
      Return cResp
   End Try
     */


Return nil

//------------------------------------------------------------------------------

function Leejson_Meteo(cResp ,lProxy)
local hvar
local hvar1,hvar2
local cTexto:=""
local oDlg, cBmp
local nValor
local oBmp
local ofont1,ofont2
Local oBrwForecast


local i
local cImage,cMin,cMax,cData,cDay
local ahTexto,hDias,cPrev
local cUrl
local  oBmp2,cBmp2

hb_jsondecode( cResp, @hvar )

hvar1:= hvar["query"]["results"]["channel"]

 define font ofont1 name "Arial" size 0,16 bold

 DEFINE Font ofont2 NAME "Verdana" SIZE 0,13

 DEFINE DIALOG oDlg TITLE "Risultati" SIZE 600, 600 pixel color CLR_BLACK,CLR_WHITE


    @ 10 ,80 SAY alltrim(hvar1["title"] ) OF oDlg SIZE 100, 10 ;
                        pixel Font ofont1 color CLR_BLACK,CLR_WHITE

     @ 25, 70 SAY "Data : "+ alltrim(hvar["query"]["created"])  SIZE 100, 10 OF oDlg ;
                    pixel  color CLR_BLACK,CLR_WHITE FONT ofont2

     hvar2:= hvar1["wind"]

     @ 40, 100 say alltrim("Vento") SIZE 50, 20  OF oDlg  ;
                        pixel COLOR CLR_BLACK,CLR_WHITE FONT ofont1
     @ 50, 50 say alltrim("Sensazione Termica :" )  OF oDlg ;
               pixel color CLR_BLACK,CLR_WHITE FONT ofont2
     @ 50, 130 say alltrim( hVar2["chill"]+chr(186)+" "+ hvar1["units"]["temperature"] )  OF oDlg ;
              pixel color CLR_BLACK,CLR_WHITE FONT ofont2


     @ 60, 50 say "Direzione " OF oDlg ;
             pixel  color CLR_BLACK,CLR_WHITE FONT ofont2
     @ 60, 130 say  hVar2["direction"]  OF oDlg ;
             pixel  color CLR_BLACK,CLR_WHITE FONT ofont2

     @ 70, 50 say "Velocità "  OF oDlg ;
                     pixel  color CLR_BLACK,CLR_WHITE FONT ofont2

     @ 70, 130 say  hVar2["speed"]+" "+ hvar1["units"]["speed"]  OF oDlg ;
                     pixel  color CLR_BLACK,CLR_WHITE FONT ofont2


        hvar2:= hvar1["atmosphere"]


     @ 85, 95 say "Atmosfera " OF oDlg ;
                      pixel  color CLR_BLACK,CLR_WHITE FONT ofont1

     @ 100, 50 say "Umidità " OF oDlg ;
                    pixel  color CLR_BLACK,CLR_WHITE FONT ofont2
     @ 100, 130 say  hVar2["humidity"] + " %" OF oDlg ;
                    pixel  color CLR_BLACK,CLR_WHITE FONT ofont2


     @ 110, 50 say "Pressione Barometrica " OF oDlg ;
                        pixel   color CLR_BLACK,CLR_WHITE FONT ofont2

     @ 110, 130 say hVar2["pressure"] + " "+ hvar1["units"]["pressure"] OF oDlg ;
                        pixel   color CLR_BLACK,CLR_WHITE FONT ofont2


     nValor:= hVar2["rising"]

     if  nValor == "0"
         cTexto := "Costante"
     elseif nValor == "1"
         cTexto := "In aumento"
     elseif nValor == "2"
         cTexto := "In diminuizione"
     endif

     @ 120, 50 say "Tendenza Barometrica: "  OF oDlg ;
                        pixel color CLR_BLACK,CLR_WHITE FONT ofont2
     @ 120, 130 say cTexto OF oDlg ;
                        pixel color CLR_BLACK,CLR_WHITE FONT ofont2


      hvar2:= hvar1["astronomy"]



     @ 160, 30 say "Alba " + hVar2["sunrise"] OF oDlg ;
                         pixel color CLR_BLACK,CLR_WHITE FONT ofont2

     @ 160, 160 say "Tramonto " + hVar2["sunset"] OF oDlg ;
                         pixel color CLR_BLACK,CLR_WHITE FONT ofont2



      hvar2:= hvar1["item"]





aHTexto:=hVar2["forecast"]
nRow:=185
nCol:= 5
@ nRow,nCol say "Data" OF oDlg  pixel color CLR_BLACK,CLR_WHITE FONT ofont2
nRow+= 8
@ nRow,nCol say "Giorno" OF oDlg  pixel color CLR_BLACK,CLR_WHITE FONT ofont2
nRow+= 8
@ nRow,nCol say "Massima" OF oDlg  pixel color CLR_BLACK,CLR_WHITE FONT ofont2
nRow+= 8
@ nRow,nCol say "Minimima" OF oDlg  pixel color CLR_BLACK,CLR_WHITE FONT ofont2
nRow+= 8
@ nRow,nCol say "Previsione" OF oDlg  pixel color CLR_BLACK,CLR_WHITE FONT ofont2

nCol+=45
nRow:=185

for i=1 to len(aHTexto)
hDias:=aHTexto[i]
cData:= hDias["date"]
cDay:= hDias["day"]
cMax:= hDias["high"]
cMin:= hDias["low"]
cPrev:= hDias["text"]
cUrl:= "http://l.yimg.com/a/i/us/we/52/"+hDias["code"]+".gif"
@ nRow,nCol say cData OF oDlg  pixel color CLR_BLACK,CLR_WHITE FONT ofont2
nRow+= 8
@ nRow,nCol+15 say cDay OF oDlg  pixel color CLR_BLACK,CLR_WHITE FONT ofont2
nRow+= 8
@ nRow,nCol+15 say cMax OF oDlg  pixel color CLR_BLACK,CLR_WHITE FONT ofont2
nRow+= 8
@ nRow,nCol+15 say cMin  OF oDlg  pixel color CLR_BLACK,CLR_WHITE FONT ofont2
nRow+= 8
@ nRow,nCol say cPrev OF oDlg  pixel color CLR_BLACK,CLR_WHITE FONT ofont2
nRow+= 10
@ nRow,nCol  IMAGE oBmp FILE cBmp OF oDlg size 32,32 pixel NOBORDER
cargaBmp(cUrl,oBmp,lProxy)
nCol+=50
nRow:=185
next

@ 170, 2 GROUP oGroup TO 260,288 LABEL "Previsione settimanale" OF oDlg  pixel TRANSPARENT



     cUrl := "http://l.yimg.com/a/i/brand/purplelogo//uh/us/news-wea.gif"

       @ 10,189  IMAGE oBmp2 FILE cBmp2 OF oDlg size 142,55 pixel NOBORDER

     obmp2:lTransparent := .t.
     cargaBmp(cUrl,oBmp2,lProxy)


      cTexto:=hVar2["condition"]["code"]

      cTexto:="http://l.yimg.com/a/i/us/we/52/"+cTexto+".gif"

     @ 10,12  IMAGE oBmp FILE cBmp OF oDlg size 32,32 pixel NOBORDER


      cargaBmp(cTexto,oBmp,lProxy)


    @ 285, 100 BUTTON "&Ok" SIZE 40, 12  OF oDlg pixel ;
      ACTION odlg:end() FONT oFont2

 ACTIVATE DIALOG oDlg CENTERED on paint  DlgStatusBar(oDlg, 68,, .t. )

  ofont1:end()
  ofont2:end()

 return nil







 




Finance.prg
Code: Select all  Expand view
// Our first DialogBox sample

#include "FiveWin.ch"
#include "ttitle.ch"
#include "constant.ch"

#include ".\yahoo.ch"





Function Finance()
  local obmp ,cBmp
  local oDlg, oIco ,cValor:= "BHP.AX"+space(20)  // "GOOGL"+space(20) // "AAPL"+space(20)
   local ofont
   local cUrl :="http://eur.i1.yimg.com/eur.yimg.com/i/it/fi/fi6.gif"

  local lProxy
  Local cIniFile  := cFilePath(GetModuleFileName( GetInstance() ) ) + PROXY_MEM


   DEFINE Font ofont NAME "Verdana" SIZE 0,14
   DEFINE ICON oIco FILE "c:\work\fwh\icons\fivewin.ico"


    lProxy:=Request_Proxy()


     If lProxy
        cSection :="Config"
        cIniFile  := cFilePath(GetModuleFileName( GetInstance() ) ) + PROXY_MEM
        PROXY_SCHOOL  := GetIni(cIniFile, cSection, "Proxy")
        NPORT     := val(GetIni(cIniFile, cSection, "Port"))
        USERNAME := GetIni(cIniFile, cSection, "Username")
        PASSWORD := GetIni(cIniFile, cSection, "Password")
     Endif






   DEFINE DIALOG oDlg TITLE "Quote da ricercare" ;
      ICON oIco SIZE 350, 240

  @ 30,10  IMAGE oBmp FILE cBmp OF oDlg size 142,35 pixel NOBORDER

     obmp:lTransparent := .t.
     cargaBmp(cUrl,oBmp,lProxy)



     @ 60, 10 SAY "Introduce el Valor a buscar :" size 100, 12 ;
                        FONT oFont pixel OF oDlg

     @ 70, 10 GET cValor size 120, 12 FONT oFont pixel OF oDlg

     @ 105, 85 BUTTON "&Buscar" SIZE 40, 12 OF oDlg pixel ;
              FONT oFont ;
              ACTION llamada_Finance(cValor,lProxy)

     @ 105,130 BUTTON "&Salir" SIZE 40, 12 pixel OF oDlg;
               FONT oFont ;
               ACTION oDlg:End()

   ACTIVATE DIALOG oDlg CENTERED ;
    ON INIT  DlgBarTitle( oDlg, "  Servicio Finaciero","c:\fwh\bitmaps\alphaBmp\weather.bmp" ,44 )  ;
    ON PAINT DlgStatusBar(oDlg, 68,, .t. )

   oFont:End()

return nil




static Function llamada_Finance(cValor,lProxy)
local oHttp
local cResp
local cDir
local Formato :=  "json"


cDir := "https://query.yahooapis.com/v1/public/yql?q=select * from yahoo.finance.quotes where symbol in ( '"+ cValor+ "')"

cDir := cDir + "&format="+ Formato +"&region=ES"+"&lang=it-IT"+"&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback="

//cDir := cDir + "&format="+ Formato +"&diagnostics=true&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback="

//cDir := "https://query.yahooapis.com/v1/public/yql?q=select * from weather.forecast where woeid in (select woeid from geo.places(1)"
//cDir:= cDir + " where text= '"+ cValor +"' ) and u='"+cUnits+"'&format=" + Formato





     If lProxy
        cSection :="Config"
        cIniFile  := cFilePath(GetModuleFileName( GetInstance() ) ) + PROXY_MEM
        PROXY_SCHOOL    := GetIni(cIniFile, cSection, "Proxy")
        NPORT     := val(GetIni(cIniFile, cSection, "Port"))
        USERNAME := GetIni(cIniFile, cSection, "Username")
        PASSWORD := GetIni(cIniFile, cSection, "Password")
       Endif








  Try
      oHttp := CreateObject( "winhttp.winhttprequest.5.1" )

      if lProxy
         oHttp:SetProxy( HTTPREQUEST_PROXYSETTING_PROXY, PROXY_SCHOOL+":"+alltrim(str(NPORT)))

      endif


      oHttp:Open("GET", cDir, .f. )

       if lProxy
         oHttp:SetCredentials(USERNAME,PASSWORD,HTTPREQUEST_SETCREDENTIALS_FOR_PROXY)
      endif

      oHttp:Send()
       *cResp := oHttp:ResponseBody()

      cResp := oHttp:ResponseText()

      // memowrit("finance.txt",cResp )
      leejson_Finance( cResp, cValor ,lProxy)


  Catch
      MsgStop( "Error" )
      Return cResp
   End Try


Return cResp

//------------------------------------------------------------------------------

Function Leejson_Finance(cResp,cValor ,lProxy)
local hvar
local hvar1,hvar2
local cTexto:=""
local oDlg, cBmp
local nValor
local oBmp
local ofont1,ofont2
Local oBrwForecast

local aForecast:= {}
local i
local cImage,cMin,cMax,cData,cDay
local ahTexto,hDias,cPrev
local cUrl
local nRow:=185
local nCol:= 5
local cTitle := "Resultados para el Valor: " + cValor


local cRegion:= "IT"
local cLang := "it-IT"
local aTipo :={ {"Line", "Bar", "Candle"},{ "l", "b", "c" } }
local aSize := { {"Large","Middle","Small"},{"l", "m", "s" } }







hb_jsondecode( cResp, @hvar )


hvar1:= hvar["query"]["results"]["quote"]

 define font ofont1 name "Arial" size 0,16 bold

 DEFINE Font ofont2 NAME "Verdana" SIZE 0,13


 DEFINE DIALOG oDlg TITLE "Resultados" SIZE 500, 570 pixel color CLR_BLACK,CLR_WHITE


     @ 10 ,80 SAY alltrim( cTitle ) OF oDlg SIZE 180, 20 ;
                        pixel Font ofont1 color CLR_BLACK,CLR_WHITE

     @ 25, 70 SAY "Fecha : "+ alltrim(hvar["query"]["created"])  SIZE 180, 20 OF oDlg ;
                    pixel  color CLR_BLACK,CLR_WHITE FONT ofont2


     @ 50, 50 say alltrim("Valor :" )  OF oDlg ;
               pixel color CLR_BLACK,CLR_WHITE FONT ofont2

     @ 50, 130 say alltrim( hVar1["symbol"] )  OF oDlg ;
              pixel color CLR_BLACK,CLR_WHITE FONT ofont2


     @ 60, 50 say "Volumen Medio " OF oDlg ;
             pixel  color CLR_BLACK,CLR_WHITE FONT ofont2
     @ 60, 130 say  hVar1["AverageDailyVolume"]  OF oDlg ;
             pixel  color CLR_BLACK,CLR_WHITE FONT ofont2


     @ 70, 50 say "Demanda "  OF oDlg ;
                     pixel  color CLR_BLACK,CLR_WHITE FONT ofont2

     @ 70, 130 say  hVar1["AskRealtime"]  OF oDlg ;
                     pixel  color CLR_BLACK,CLR_WHITE FONT ofont2

     @ 80, 50 say "Oferta "  OF oDlg ;
                     pixel  color CLR_BLACK,CLR_WHITE FONT ofont2

     @ 80, 130 say  hVar1["BidRealtime"]  OF oDlg ;
                     pixel  color CLR_BLACK,CLR_WHITE FONT ofont2





  //   @ 85, 95 say "Atmosfera " OF oDlg ;
   //                     pixel  color CLR_BLACK,CLR_WHITE FONT ofont1

     @ 100, 50 say "Ultimo Cambio " OF oDlg ;
                    pixel  color CLR_BLACK,CLR_WHITE FONT ofont2
     @ 100, 130 say  hVar1["Change_PercentChange"]  OF oDlg ;
                    pixel  color CLR_BLACK,CLR_WHITE FONT ofont2



     @ 110, 50 say "Maximo Anual " OF oDlg ;
                        pixel   color CLR_BLACK,CLR_WHITE FONT ofont2

     @ 110, 130 say hVar1["YearHigh"] OF oDlg ;
                        pixel   color CLR_BLACK,CLR_WHITE FONT ofont2


     @ 120, 50 say "Minimo Anual: "  OF oDlg ;
                        pixel color CLR_BLACK,CLR_WHITE FONT ofont2
     @ 120, 130 say  hVar1["YearLow"] OF oDlg ;
                        pixel color CLR_BLACK,CLR_WHITE FONT ofont2






     cTexto:="http://chart.finance.yahoo.com/z?s=" + alltrim(cValor)+"&q="+aTipo[2,3] +"&region="+cRegion+"&lang="+ cLang
    cTexto:= cTexto+"&z=" + aSize[2,3]



      @ 140,1  IMAGE oBmp FILE cBmp SIZE 248,124 OF oDlg ADJUST  pixel NOBORDER


       cargaBmp(cTexto,oBmp,lProxy)






    @ 270, 100 BUTTON "&Ok" SIZE 40, 12  OF oDlg pixel ;
      ACTION odlg:end() FONT oFont2

 ACTIVATE DIALOG oDlg CENTERED on paint  DlgStatusBar(oDlg, 68,, .t. )

  ofont1:end()
  ofont2:end()

 return nil

//------------------------------------------------------------------------------
//------------------------------------------------------------------------------


 
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6851
Joined: Thu Oct 18, 2012 7:17 pm

Re: to Mastintin : yahoo financial

Postby Silvio.Falconi » Mon Dec 15, 2014 9:27 pm

Modifies



Image









Yahoo.prg

Code: Select all  Expand view
#include "FiveWin.ch"
#include "constant.ch"
#include ".\include\yahoo.ch"


Function  Yahoo()
Local oDlgYahoo,oFont
       Local nBottom   := 14
       Local nRight    := 55
       Local nWidth :=  Max( nRight * DLG_CHARPIX_W, 180 )
       Local nHeight := nBottom * DLG_CHARPIX_H
       Local oBtnOption[2]
       local cUrl_Finance :=  "http://eur.i1.yimg.com/eur.yimg.com/i/it/fi/fi6.gif"
       local cUrl_Meteo := "http://l.yimg.com/a/i/brand/purplelogo//uh/us/news-wea.gif"

       Local oBmpMeteo,cBmpMeteo
       Local oBmpFinance,cBmpFinance

        local cIniFile  := cFilePath(GetModuleFileName( GetInstance() ) ) + PROXY_MEM
        local lProxy   := IIF(GetIni( cIniFile, "Config", "ProxyYes","1" ) == "1" , .T. , .F. )




      If lProxy
        cSection :="Config"
        cIniFile  := cFilePath(GetModuleFileName( GetInstance() ) ) + PROXY_MEM
        PROXY_SCHOOL  := GetIni(cIniFile, cSection, "Proxy")
        NPORT     := val(GetIni(cIniFile, cSection, "Port"))
        USERNAME := GetIni(cIniFile, cSection, "Username")
        PASSWORD := GetIni(cIniFile, cSection, "Password")
     Endif


  DEFINE FONT oFont NAME "MS Sans Serif" SIZE 0, 8

     DEFINE DIALOG oDlgYahoo TITLE TITLE_MANAGER ;
    FROM 100, 100 TO 430,600  pixel

     @ 30,10  IMAGE oBmpMeteo FILE cBmpMeteo OF oDlgYahoo size 142,35 pixel NOBORDER    ON CLICK     Meteo()
     @ 80,10  IMAGE oBmpFinance FILE cBmpFinance OF oDlgYahoo size 142,35 pixel NOBORDER  ON CLICK  Finance()


     oBmpMeteo:lTransparent := .t.
     oBmpFinance:lTransparent := .t.



     cargaBmp(cUrl_Meteo,oBmpMeteo,lProxy)

     cargaBmp(cUrl_Finance,oBmpFinance,lProxy)



     ACTIVATE DIALOG oDlgYahoo CENTERED ;
     ON INIT BuildMenu(oDlgYahoo)

return nil



 Static Function BuildMenu(oDlgYahoo)

  // Menu

   IF IsWinxp()
             MENU oMenu 2007
      ELSEIF IsWinVista()
             MENU oMenu  2007
         ELSEIF IsWin8()
             MENU oMenu 2010
         ELSEIF IsWin7()
             MENU oMenu
   ENDIF

     MENUITEM "&Info"
    MENU
    MENUITEM "Configuration"    ACTION Request_Proxy()
    SEPARATOR
    MENUITEM "Authors"    ACTION Authors()
    SEPARATOR
     MENUITEM "&Exit"   ACTION oDlgYahoo:End()
     ENDMENU
     ENDMENU

     oDlgYahoo:SetMenu(oMenu)




   // ButtonBar

         IF IsWinxp()
             DEFINE BUTTONBAR oBar 3D SIZE 30,30 OF  oDlgYahoo 2007
         ELSEIF IsWinVista()
             DEFINE BUTTONBAR oBar 3D SIZE 30,30 OF  oDlgYahoo 2007
         ELSEIF IsWin8()
             DEFINE BUTTONBAR oBar 3D SIZE 30,30 OF  oDlgYahoo 2010
         ELSEIF IsWin7()
            DEFINE BUTTONBAR oBar 3D SIZE 30,30 OF  oDlgYahoo   2013
         ENDIF





   IF IsWinxp()
             SET MESSAGE OF oDlgYahoo TO TITLE_MANAGER CENTER NOINSET  2007
      ELSEIF IsWinVista()
              SET MESSAGE OF oDlgYahoo TO TITLE_MANAGER CENTER NOINSET 2007
         ELSEIF IsWin8()
              SET MESSAGE OF oDlgYahoo TO TITLE_MANAGER CENTER NOINSET 2010
         ELSEIF IsWin7()
             SET MESSAGE OF oDlgYahoo TO TITLE_MANAGER CENTER NOINSET  2010
   ENDIF








  return nil




Function Authors()
   msgabout("Services Yahoo", TITLE_MANAGER+CRLF+ "MastinTin Manuel ")
   return nil












 


on proxy.prg
modify the function Request_Proxy()

Code: Select all  Expand view
Function Request_Proxy()
Local   lReturn
 Local cIniFile  := cFilePath(GetModuleFileName( GetInstance() ) ) + PROXY_MEM
   IF MsgyesNo("Devo usare il proxy ?")
      lReturn :=.t.

      Valid_Proxy()

   else
      lReturn :=.f.
   endif


   SetIni( cInifile, "Config", "ProxyYes", IIF(lReturn,"1","0") )


return lReturn







On Meteo.prg and Finance.prg

insert these lines
local cIniFile := cFilePath(GetModuleFileName( GetInstance() ) ) + PROXY_MEM
local lProxy := IIF(GetIni( cIniFile, "Config", "ProxyYes","1" ) == "1" , .T. , .F. )

instead of this line
lProxy:=Request_Proxy()
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6851
Joined: Thu Oct 18, 2012 7:17 pm

Re: to Mastintin : yahoo financial

Postby mastintin » Tue Dec 16, 2014 8:16 am

Silvio, Gran Trabajo .
Dentro de los datos que se consiguen veo uno :
"Currency":"AUD"....
hVar1[ "Currency" ] nos da la moneda usada :)

Pongo aqui una listas de todos los datos que puedes conseguir ....
Code: Select all  Expand view


   // Todo cuelga de hVar1..... hVar1["symbol"],hVar1["Ask"],, hvar1["AverageDailyvolume"],...
 
     "symbol":"BHP.AX",
      "Ask":null,  
      "AverageDailyVolume":"7897170",
      "Bid":null,
      "AskRealtime":"27.450"
      ,"BidRealtime":"27.410",
      "BookValue":"14.873",
      "Change_PercentChange":"-0.910 - -3.21%",
      "Change":"-0.910",
      "Commission":null,
      "Currency":"AUD",
      "ChangeRealtime":"-0.910",
      "AfterHoursChangeRealtime":"N/A - N/A",
      "DividendShare":"1.3092",
      "LastTradeDate":"12/16/2014",
      "TradeDate":null,
      "EarningsShare":"2.591",
      "ErrorIndicationreturnedforsymbolchangedinvalid":null,
      "EPSEstimateCurrentYear":"2.110",
      "EPSEstimateNextYear":"2.310",
      "EPSEstimateNextQuarter":"0.000",
      "DaysLow":"27.290",
      "DaysHigh":"27.630",
      "YearLow":"27.720",
      "YearHigh":"39.790",
      "HoldingsGainPercent":"- - -",
      "AnnualizedGain":null,
      "HoldingsGain":null,
      "HoldingsGainPercentRealtime":"N/A - N/A",
      "HoldingsGainRealtime":null,
      "MoreInfo":"cnprIed",
      "OrderBookRealtime":null,
      "MarketCapitalization":"145.9B",
      "MarketCapRealtime":null,
      "EBITDA":"29.777B",
      "ChangeFromYearLow":"-0.300",
      "PercentChangeFromYearLow":"-1.08%",
      "LastTradeRealtimeWithTime":"N/A - <b>27.420</b>",
      "ChangePercentRealtime":"N/A - -3.21%",
      "ChangeFromYearHigh":"-12.370",
      "PercebtChangeFromYearHigh":"-31.09%",
      "LastTradeWithTime":"12:10am - <b>27.420</b>",
      "LastTradePriceOnly":"27.420",
      "HighLimit":null,
      "LowLimit":null,
      "DaysRange":"27.290 - 27.630",
      "DaysRangeRealtime":"N/A - N/A",
      "FiftydayMovingAverage":"32.0939",
      "TwoHundreddayMovingAverage":"35.271",
      "ChangeFromTwoHundreddayMovingAverage":"-7.851",
      "PercentChangeFromTwoHundreddayMovingAverage":"-22.26%",
      "ChangeFromFiftydayMovingAverage":"-4.6739",
      "PercentChangeFromFiftydayMovingAverage":"-14.56%"
      ,"Name":"BHP BLT FPO",
      "Notes":null,
      "Open":"27.530",
      "PreviousClose":"28.330",
      "PricePaid":null,
      "ChangeinPercent":"-3.21%",
      "PriceSales":"2.24",
      "PriceBook":"1.90",
      "ExDividendDate":"Sep  3",
      "PERatio":"10.93",
      "DividendPayDate":null,
      "PERatioRealtime":null,
      "PEGRatio":"3.93",
      "PriceEPSEstimateCurrentYear":"13.43",
      "PriceEPSEstimateNextYear":"12.26",
      "Symbol":"BHP.AX",
      "SharesOwned":null,
      "ShortRatio":null,
      "LastTradeTime":"12:10am",
      "TickerTrend":"&nbsp;======&nbsp;",
      "OneyrTargetPrice":"34.100",
      "Volume":"12587657",
      "HoldingsValue":null,
      "HoldingsValueRealtime":null,
      "YearRange":"27.720 - 39.790",
      "DaysValueChange":"- - -3.21%",
      "DaysValueChangeRealtime":"N/A - N/A",
      "StockExchange":"ASX",
      "DividendYield":"4.62",
      "PercentChange":"-3.21%"

 
User avatar
mastintin
 
Posts: 1516
Joined: Thu May 27, 2010 2:06 pm

Re: to Mastintin : yahoo financial

Postby Silvio.Falconi » Tue Dec 16, 2014 9:09 am

Thanks I 'll try to make a dialog as Yahoo
I wish ask you 3 questions

1) I saw there are two chart for each symbols
for a sample :
https://it.finance.yahoo.com/echarts?s= ... I;range=1d


2) When we can download all quotes for each NAtion ?
I saw there are a browse list quotes
Sample :
https://it.finance.yahoo.com/q/cp?s=FTSEMIB.MI or https://es.finance.yahoo.com/q/cp?s=FTSEMIB.MI
and the values are changed on line ...
Symbol Name Variation Volume


3) with this url sample for IBM https://es.finance.yahoo.com/q/h?s=IBM& ... 3:00+01:00
we can have all news for each symbol
If it return a array we can use a xbrowse to list all news the I can make a Rss reader
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6851
Joined: Thu Oct 18, 2012 7:17 pm

Re: to Mastintin : yahoo financial

Postby mastintin » Tue Dec 16, 2014 10:18 am

Silvio , more in Charts ....Technical Indicators ... creo que lo que me enseñas son 2 imagenes distintas con dos graficos distintos . uno enseña cotizacion con &q="l" y el otro enseña Volumen &p=v&q=b ...

use "&p=" in the url ....
Values for p=

Stochastic fs
Moving-Average-Convergence-Divergence m26-12-9
Money Flow Index f14
Rate of Change p12
Relative Strength Index r14
Slow Stochastic ss
Volume v
Volume with Moving Average vm
Williams Percent Range w14
Bollinger Bands b
Parabolic Stop And Reverse p
Splits s
User avatar
mastintin
 
Posts: 1516
Joined: Thu May 27, 2010 2:06 pm

Re: to Mastintin : yahoo financial

Postby Silvio.Falconi » Sat Dec 20, 2014 9:25 am

Manuel, Sorry for the delay
I not found youe mail , can you write a message at my mail please
silvio[dot]falconi[at]gmail[dot]com
thanks
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6851
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 28 guests