FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour to Mastintin : yahoo financial
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
to Mastintin : yahoo financial
Posted: Thu Dec 11, 2014 08: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 March-April 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
Posts: 1516
Joined: Thu May 27, 2010 02:06 PM
Re: to Mastintin : yahoo financial
Posted: 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)
https://query.yahooapis.com/v1/public/y ... 2BHP.AX%22)&format=json&diagnostics=true&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=" rel="noopener">
https://query.yahooapis.com/v1/public/y ... 2BHP.AX%22)&format=json&diagnostics=true&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=

....................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 (fw): Select all Collapse
"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%"}}}}
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: to Mastintin : yahoo financial
Posted: Sat Dec 13, 2014 05: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 March-April 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
Posts: 729
Joined: Tue Oct 18, 2005 06:49 PM
Re: to Mastintin : yahoo financial
Posted: Sat Dec 13, 2014 09: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

Posts: 1516
Joined: Thu May 27, 2010 02:06 PM
Re: to Mastintin : yahoo financial
Posted: 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 (fw): Select all Collapse
// 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
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: to Mastintin : yahoo financial
Posted: Mon Dec 15, 2014 12:47 PM
Manuel,
First I make some modify (add the proxy setup as meteo)

Code (fw): Select all Collapse
 

// 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 March-April 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
Posts: 1516
Joined: Thu May 27, 2010 02:06 PM
Re: to Mastintin : yahoo financial
Posted: Mon Dec 15, 2014 03:38 PM
Silvio, para poner un grafico ....

Code (fw): Select all Collapse
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)
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: to Mastintin : yahoo financial
Posted: Mon Dec 15, 2014 08: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

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 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
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: to Mastintin : yahoo financial
Posted: Mon Dec 15, 2014 08:38 PM
New Version

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




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 (fw): Select all Collapse
#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 (fw): Select all Collapse
#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 (fw): Select all Collapse
#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 (fw): Select all Collapse
#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 (fw): Select all Collapse
 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 (fw): Select all Collapse
// 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 March-April 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
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: to Mastintin : yahoo financial
Posted: Mon Dec 15, 2014 09:27 PM
Modifies













Yahoo.prg

Code (fw): Select all Collapse
#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 (fw): Select all Collapse
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 March-April 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
Posts: 1516
Joined: Thu May 27, 2010 02:06 PM
Re: to Mastintin : yahoo financial
Posted: Tue Dec 16, 2014 08: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 (fw): Select all Collapse
聽 聽// 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%"
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: to Mastintin : yahoo financial
Posted: Tue Dec 16, 2014 09: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 March-April 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
Posts: 1516
Joined: Thu May 27, 2010 02:06 PM
Re: to Mastintin : yahoo financial
Posted: 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

Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: to Mastintin : yahoo financial
Posted: Sat Dec 20, 2014 09: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 March-April 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

Continue the discussion