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

[µo°Ý] ÃÒ¥æ©Ò§Y®É¸ê°Tªº§ì¨ú

[µo°Ý] ÃÒ¥æ©Ò§Y®É¸ê°Tªº§ì¨ú

·Q§ì¨úªººô­¶¡G ¡]¥Î IE ¤~¯à¥¿±`¡A§_«h¤W­±ªº³sµ²·|¤£§¹¥þ ¡^
http://mis.twse.com.tw/stock/group.jsp?ind=TIDX&ex=tse&currPage=0&type=fixed

¥Î¤F2­Ó¤èªk³£¤£¦æ¡G
1. IQY ¤U¸üªí®æ, ¥þ³¡³£¬O  "-"
2. ¥Î VBA  code ¦p¤U¡G
===========================
Sub sbManualRefresh()
    'Dim HttpReq As New MSXML2.XMLHTTP30
    Dim HttpReq As Object
    Set HttpReq = CreateObject("MSXML2.XMLHTTP.3.0")
    HttpReq.Open "GET", "http://mis.twse.com.tw/stock/group.jsp?ind=TIDX&ex=tse&type=fixed", False
    HttpReq.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    HttpReq.send
   
    If HttpReq.readyState = 4 Then
        Call fetchTesData(HttpReq.responseText)
        G_NEXTTIME = Now() + TimeValue("00:00:00" & G_INTERVAL)
        'MsgBox "complete"
    End If
End Sub
=====================================
HttpReq.responseText ¸Ì­±¡AÀ³¸Ó¬O¼Æ¦rªº¦ì¸m¤@¼Ë³£¬O  "-"
¡]¦pªþ¹Ï¡^.

½Ð±Ð¤j®a¡A³o­Óºô­¶¦p¦ó³z¹LEXCEL¡@§ì¨ú.....
·PÁÂ!! ·PÁÂ!!!


¦^´_ 1# hipper68


±q jsp ¸Ì­±§ä¨ì¥t¤@­Óºô§},  Code ¦p¤U:

   Sub sbManualRefresh()
    'Dim HttpReq As New MSXML2.XMLHTTP30
    Dim myUrl As String
    Dim HttpReq As Object
    Dim rt As Integer

    Set HttpReq = CreateObject("MSXML2.XMLHTTP.3.0")
    'Set HttpReq = CreateObject("Microsoft.XMLHTTP")
   
    myUrl = "http://mis.twse.com.tw/stock/api/getStatis.jsp?ex=tse&delay=0&_=" & Str(Int(Format(Now, "General Number") * 10000000))
    'myUrl = "http://mis.twse.com.tw/stock/api/getStatis.jsp?ex=tse&delay=0&_=" & Str(1505227799001#)
    MsgBox myUrl
    HttpReq.Open "GET", myUrl, False
    HttpReq.send
   
    If HttpReq.readyState = 4 Then
        Call fetchTesData(HttpReq.responseText)
        G_NEXTTIME = Now() + TimeValue("00:00:00" & G_INTERVAL)
        'MsgBox "complete"
    End If
End Sub

­n¦b­ì¨Óªº«á­±¥[¤W " &_[®É¶¡¼ÐÅÒ]"  
¥[¤F¤§«á, ¨Ï¥Î python ´N¥i¥H§ì¨ì¥¿½Tªº­È...
¦ý¬O¤W­±ªº code ´N§ì¤£¨ì....
½Ð°Ý¦U¦ì¤j¤j...¦³¸Ñªk¶Ü??
·PÁÂ!!! ·PÁÂ!!!

Python ªº code ¤j­P¦p¤U (¨Ï¥Îrequests ®M¥ó) :
STOCKINFO_URL = 'http://mis.twse.com.tw/stock/api/getStatis.jsp?ex=tse&delay=0&_={time}'
page = requests.get( STOCKINFO_URL.format(time=int(time.time()) * 1000))
open('tse_test_0912.csv','wb').write( page.content)

VBA.png (28.35 KB)

¤U¸üµ²ªG

VBA.png

TOP

        ÀR«ä¦Û¦b : µêªÅ¦³ºÉ¡D§ÚÄ@µL½a¡AµoÄ@®e©ö¦æÄ@Ãø¡C
ªð¦^¦Cªí ¤W¤@¥DÃD