ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] VBA¦Û°Ê§ì¨úfinance.yahoo

³o­Ó¸ê®Æ¦³¿ìªk¥ÎVBA¦Û°Ê§ì¶Ü¡H

:) ¦U¦ì¡A §Ú·Q¨C¤Ñ¥ÎVBA¦Û°Ê§ì¨ú¤U­±³sµ²ªººô¯¸

https://www.hangseng.com/en-hk/e-services/e-mpf/fund-price-performance/price/

¨C¤Ñ¦Û°Ê§ó·sªº°òª÷»ù®æ¸ê®Æ¡C
¤ñ¦p¡A
Name of Constituent Fund        Bid Price (HKD)        Offer Price (HKD)
Age 65 Plus Fund                        11.57                                   11.57
·Q§ì¨ú 11.57 ³o­Ó»ù®æ¡A  ½Ð°Ý¥Î¤°»ò¤èªk©O¡H

¸Õ¤Fquery table ©M ¸ÑªRHTML³£¤£¦¨¥\§r¡C ¦hÁ«üÂI°g¬z¡I:handshake

TOP

¦^´_ 1# DanielWONG

¸Õ¸Õ¬Ý~
  1. Sub test()

  2. Cells.Clear

  3. Dim myXML As Object
  4. Set myXML = CreateObject("Winhttp.WinhttpRequest.5.1")

  5. With myXML
  6.     .Open "POST", "https://rbwm-api.hsbc.com.hk/pws-hk-hase-mpfunitprice-papi-prod-proxy/v1/mpf/getSuperTrustPlus", False
  7.     .setRequestHeader "content-type", "application/json;charset=UTF-8"
  8.     body = "{""locale"":""en""}"
  9.     .send body
  10.    
  11.     myText1 = .responseText
  12.     myText2 = Split(myText1, """trustPlusList"":[{""")(1)
  13.     j = 1
  14.     myStrArr = Array("FUND_NAME", "UNIT_PRICE_DATE", "FUND_CURRENCY", "ASK_PRICE", "BID_PRICE")
  15.     For Each myStr In myStrArr
  16.         myText3 = Split(myText2, myStr)
  17.         For i = 1 To UBound(myText3)
  18.             Cells(i + 1, j) = Replace(Replace(Split(myText3(i), ",")(0), ":", ""), Chr(34), "")
  19.         Next
  20.         j = j + 1
  21.     Next
  22.     Range("A1").Resize(1, UBound(myStrArr) + 1).Value = myStrArr
  23.     'Debug.Print .responseText
  24. End With
  25. Set myXML = Nothing
  26. End Sub
½Æ»s¥N½X
Excel VBAºô­¶¸ê®Æ¦¬¶°±Ð¾Ç:
http://forum.twbts.com/thread-20848-1-1.html

TOP

¦^´_ 1# DanielWONG

°õ¦æµ²ªGÀ³¸Ó¦p¤U¹Ï


§Ú¬Ý¥LÁÙ¦³ÆZ¦h¸ê®Æ¥i¥H¥Îªº

(¦ý§Ú¤£ª¾¹D¨º¨Ç¸ê®Æªº¥Î³~¡A©Ò¥H´N¨S¥[¤FXD)
¦pªG»Ý­nªº¸Ü¥i¦Û¦æ¥[¦bmyStrArr¸Ì
Excel VBAºô­¶¸ê®Æ¦¬¶°±Ð¾Ç:
http://forum.twbts.com/thread-20848-1-1.html

TOP

¦^´_ 3# iamaraymond


    ¦hÁ¤j¯«¡A §Ú¥ý®ø¤Æ¤@¤U±zªº¤èªk¡I

TOP

¦^´_ 3# iamaraymond

½Ð°Ý
https://djinfo.cathaysec.com.tw/z/ze/zef/zef.djhtm
©M   
http://justdata.yuanta.com.tw/z/ze/zeb/zeb.djhtm
³oºØ¤U¸ü«á¦³³¡¤ÀÁôÂäU¸ü¤£§¹¥þ
¸Ó«ç»ò¤U¸ü
ÁÂÁÂ

TOP

¦^´_ 3# iamaraymond


   
·Pı .ResponseText ¤º®e¦n¦h°Ú¡I
¨ä¹ê§Ú¤£»Ý­n¿ï¾Ü¤é´Á¡A¥u»Ý­n§ì·í«e¤é´Á Chinese Equity Fund¡A Global Bond Fund©MHang Seng Index Tracking Fund ¤TºØ°òª÷ªº·í«e»ù®æ¡C¬O§_¥i¯à§ì¤Ö¤@¨ÇªF¦èÅý.ResponseText¤º®e¤Ö¨Ç©O¡H

TOP

[µo°Ý] VBA¦Û°Ê§ì¨úfinance.yahoo

¦U¦ì¡A¦p¥ÎVBA XML.HTTP¦Û°Ê§ì¨ú¤U­±³sµ²ªººô¯¸

https://hk.finance.yahoo.com/quote/0388.HK?p=0388.HK

¨C¤Ñ¦Û°Ê§ó·sªº¦¨¥æ¶q¸ê®Æ¡C§Ú¤£·|´M§ä¹ïÀ³ªºURL¡A ­þ¦ì¤¸¥i¥HÀ°¦£´£¨Ñ¶}©l³¡¤À¨ìResponseTextªº¥N½X¶Ü¡H ·P¿E¡I

¦^´_ 1# DanielWONG


    Sub ­»´ä¥æ©ö©Ò_test()
Dim Stock1 As String
Dim oXmlhttp As Object, oHtmldoc As Object, surl As String, E As Object, R As Integer, C As Integer
  Set oXmlhttp = CreateObject("msxml2.xmlhttp")
   Set oHtmldoc = CreateObject("htmlfile")
     surl = "https://hk.finance.yahoo.com/quote/0388.HK"
        With oXmlhttp
        .Open "Get", surl, False
        .send
        oHtmldoc.Write .responseText
    End With
    ActiveSheet.Cells.Clear
     With oHtmldoc
        Set E = .all.tags("table")(1)
        For R = 0 To E.Rows.Length - 1
            For C = 0 To E.Rows(R).Cells.Length - 1
                ActiveSheet.Cells(R + 1, C + 1) = E.Rows(R).Cells(C).innerText
            Next
        Next
    End With
    End Sub

TOP

¦^´_ 6# DanielWONG

¦pªG¤£»Ý­n¤é´Áªº¸Ü¡A¥u­n§ï¤@¤UmyStrArr´N¦n
myStrArr = Array("FUND_NAME", "FUND_CURRENCY", "ASK_PRICE", "BID_PRICE")

¦Ü©ó¥u¨ú¨º¤TÀÉ°òª÷ªº¸ê®Æ
§Úı±o¤ñ¸û¦³¼u©Êªº§@ªk¬O¦b®ÇÃ䪽±µ¥Îvlookup¨ç¼Æ
«O«ù¸ê®Æªº§¹¾ã©Ê
¥H§K¤é«á­Y·Q­n¨ú¨ä¥L°òª÷ªº¸ê®Æ¤S­n§ï¤@¦¸µ{¦¡
Excel VBAºô­¶¸ê®Æ¦¬¶°±Ð¾Ç:
http://forum.twbts.com/thread-20848-1-1.html

TOP

¦^´_ 5# f3202

¤£¦n·N«ä¤£¬O«Ü¤F¸Ñ§Aªº·N«ä
¥i¥H¦h»¡©ú¤@¤U¶Ü?
Excel VBAºô­¶¸ê®Æ¦¬¶°±Ð¾Ç:
http://forum.twbts.com/thread-20848-1-1.html

TOP

        ÀR«ä¦Û¦b : ¡i®É¶¡¦¨´N¤@¤Á¡j®É¶¡¥i¥H³y´N¤H®æ¡A¥i¥H¦¨´N¨Æ·~¡A¤]¥i¥HÀx¿n¥\¼w¡C
ªð¦^¦Cªí ¤W¤@¥DÃD