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

¤w¥i§ì¨úK½u¸ê®Æ,¦ý¤í¯Ê¶q¦³¤H¥i¥H¨ó§U¤@¤U? JSON

¤w¥i§ì¨úK½u¸ê®Æ,¦ý¤í¯Ê¶q¦³¤H¥i¥H¨ó§U¤@¤U? JSON

¦U¦ì¤j¤j¦n
¤p§Ì¦³¤@­ÓÀÉ®×
¤w¸g¥i¥H§ì¾ú¥v¸ê®Æ
¦ý³o­ÓJSONªºÀ³¥Î
§Ú¤£¤ÓÀ´
¤£ª¾¹D¦³¦n¤ßªº¤j¤j¥i¥H¨ó§U¤@¤U¶Ü?
¥u»Ý­n¥Î­ì¥»ªººô§}
¦]¬°¥L½L¤¤¤~·|¦³¸ê®Æ¶i¥h

¦³»Ý­nªº¤j¤j­Ì¤]¥i¥H¦Û¦æ¨ú¥Î¦¹ÀÉ®×

¸ê®Æ½d¨Ò.zip (80.95 KB)

¤ék§Þ³N¤ÀªR½u¹Ï
¥k¤W¨¤¦³¤@¦U ¤ék§¹¾ã½u¹Ï
§A¥Î¨º­Ó url ¸Ì­±ªº json ·|¦³ Volume

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2016-8-24 09:06 ½s¿è

¦^´_ 1# vavashop
­×§ïªþÀɤ¤ fnLoadFileAndParse ª½±µÅª¨ú¸ê®Æ
¥i¤£»Ý¦A¥Îª«¥óÃþ§O¼Ò²Õ¤¤ªºclsJSParse
  1. Sub fnLoadFileAndParse(ByVal StockNo As String, ByVal DataType As String)
  2.     Dim xmlHttp As Object
  3.     Dim Readstr As Variant, Ar As Variant, xAr(), i As Integer, T As Date
  4.     T = Time
  5.     Set xmlHttp = CreateObject("MSXML2.XMLHTTP.6.0")
  6.     If DataType = "Week" Then
  7.             xmlHttp.Open "GET", "http://www.wantgoo.com/Stock/%E5%80%8B%E8%82%A1%E7%B7%9A%E5%9C%96/%E6%8A%80%E8%A1%93%E7%B7%9A%E5%9C%96%E8%B3%87%E6%96%99?StockNo=" & StockNo & "&Kcounts=245&Type=%E5%91%A8K_K%E7%B7%9A%7C%E5%91%A8K_%E6%BC%B2%E8%B7%8C%E8%B3%87%E6%96%99%7C%E5%91%A8K_%E6%88%90%E4%BA%A4%E9%87%8F%7C%E5%91%A8K_KD%7C%E5%91%A8K_RSI%7C%E5%91%A8K_MACD%7C%E5%91%A8K_%E5%8A%A0%E6%AC%8A%E6%8C%87%E6%95%B8%7C%E5%91%A8K_DMI&isCleanCache=false", False
  8.     ElseIf DataType = "Day" Then
  9.             xmlHttp.Open "GET", "http://www.wantgoo.com/Stock/%E5%80%8B%E8%82%A1%E7%B7%9A%E5%9C%96/%E6%8A%80%E8%A1%93%E7%B7%9A%E5%9C%96%E8%B3%87%E6%96%99?StockNo=" & StockNo & "&Kcounts=245&Type=%E6%97%A5K_K%E7%B7%9A%7C%E6%97%A5K_%E6%BC%B2%E8%B7%8C%E8%B3%87%E6%96%99%7C%E6%97%A5K_%E6%88%90%E4%BA%A4%E9%87%8F%7C%E6%97%A5K_KD%7C%E6%97%A5K_RSI%7C%E6%97%A5K_MACD%7C%E6%97%A5K_%E5%91%A8%E8%BD%89%E7%8E%87%7C%E6%97%A5K_William%7C%E6%97%A5K_%E5%8A%A0%E6%AC%8A%E6%8C%87%E6%95%B8%7C%E6%97%A5K_DMI&isCleanCache=false", False
  10.     Else
  11.         Exit Sub
  12.     End If
  13.     xmlHttp.setRequestHeader "Content-Type", "text/html; charset=utf-8"
  14.     xmlHttp.send
  15.     Readstr = xmlHttp.responseText
  16.     '************* 'responseText  Àɮתº¥»¤å
  17.     'Mid ¨ç¼Æ           ±q¤@¦r¦ê¶Ç¦^¯S©w¼Æ¶q¦r¤¸©Òºc¦¨ªºVariant (String)
  18.     'InStr ¨ç¼Æ         ¶Ç¦^¦b¬Y¦r¦ê¤¤¤@¦r¦êªº³Ì¥ý¥X²{¦ì¸m¡A¦¹¦ì¸m¬° Variant (Long)¡C
  19.     'Split ¨ç¼Æ         ¶Ç¦^¤@­Ó³¯¦C¯Á¤Þ±q¹s¶}©lªº¤@ºû°}¦C¡A¥¦¥]§t«ü©w¼Æ¥Øªº¤l¦r¦ê¡C
  20.     'Replace ¨ç¼Æ   ¶Ç¦^¤@­Ó¦r¦ê¡A¸Ó¦r¦ê¤¤«ü©wªº¤l¦r¦ê¤w³Q¨ú¥N¦¨¥t¤@¤l¦r¦ê¡A¨Ã¥B¨ú¥Nµo¥Íªº¦¸¼Æ¤]¬O«ü©wªº¡C
  21.     '******************************************
  22.     '***Â^¨ú©Ò­nªº¤å¦r
  23.     If DataType = "Week" Then
  24.         Readstr = Mid(Readstr, InStr(Readstr, "W = [{x:") + Len("D = [{x:"))
  25.         Readstr = Split(Readstr, "}];var Close_W =")(0)
  26.     Else
  27.         Readstr = Mid(Readstr, InStr(Readstr, "D = [{x:") + Len("D = [{x:"))
  28.         Readstr = Split(Readstr, "}];var Close_D =")(0)
  29.     End If
  30.     '***½ð°£¤£­nªº¤å¦r
  31.     Readstr = Replace(Readstr, "open:", "")
  32.     Readstr = Replace(Readstr, "high:", "")
  33.     Readstr = Replace(Readstr, "low:", "")
  34.     Readstr = Replace(Readstr, "close:", "")
  35.     '*** ¥H  "},{x:"  ±N¤å¦r¤À³Î¬°°}¦C
  36.     Readstr = Split(Readstr, "},{x:")
  37.     ReDim xAr(UBound(Readstr))  '­«¸m¤@°}¦Cªººû¼Æ
  38.     For i = 0 To UBound(Readstr)
  39.         Ar = Split(Readstr(i), ",")
  40.         Ar(0) = DateAdd("s", Mid(Ar(0), 1, 10), CDbl(DateSerial(1970, 1, 1))) '*** ¦r¦êÂର¤é´Á
  41.         xAr(i) = Ar '***¾ã²z¦nªº¸ê®Æ©ñ¦b°}¦C
  42.     Next
  43.     With Sheet2
  44.         .UsedRange.Offset(1).ClearContents   '²M°£¤§«e°O¿ýªº¸ê®Æ
  45.         .Range("A2").Resize(UBound(xAr) + 1, UBound(Ar) + 1) = Application.Transpose(Application.Transpose(xAr)) '°}¦C¸ê®ÆªºÅª¨ú
  46.     End With
  47.     'MsgBox Application.Text(Time - T, ["S¬í"])  '´ú¸Õµ{¦¡¹B¦æªº³t«×
  48. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 3# GBKEE
µ{¦¡½Xºë²³\¦h¤F¡A¥Ø«eÁö¤w¥i§ì¨úK½u¸ê®Æ,
¦ý©|¤í¯Ê¶q¡A¤£ª¾¬O§_¥i¥H§ì¨ú¨ì?  
¦Ó±N¥¦¶¶«K¥[¤J¨ì F Ä椺¡H
¶¢µÛ¶¢µÛ«K¤Wºô¬Ý¤F¤@¤U¡AÁÂÁ±zÅo¡I

TOP

¦^´_ 3# GBKEE
¸Ì­±¦n¹³§ä¤£¨ì Volume
    '  Readstr : "{"code":"0","message":"","returnValues":{"value":"<script>var
    '  candlestickData_D = [{x:1440547200000,open:59.3,high:60.5,low:58.65,close:60.35},
    '  {x:1440633600000,open:60.6,high:6
    '  Readstr : "1440547200000,59.3,60.5,58.65,60.35},{x:1440633600000,60.6,60.65,60,60.15},
    '  {x:1440720000000,61,61.9,61,61.8},{x:1440979200000,61.3,62.35,61.2,62.3},
    '  {x:1441065600000,61.9,62.6,6
    '  ---------------------------------------------------------------------------------------
    '  Readstr :  : Variant/String(0 to 244)
    '  Readstr(0) : "1440547200000,59.3,60.5,58.65,60.35" : String
    '  Readstr(1) : "1440633600000,60.6,60.65,60,60.15" : String
    '  Readstr(2) : "1440720000000,61,61.9,61,61.8" : String
    '  Readstr(242) : "1471824000000,69,69.15,68.45,68.7" : String
    '  Readstr(243) : "1471910400000,68.9,69.6,68.9,69.4" : String
    '  Readstr(244) : "1471996800000,69.35,69.55,69.2,69.4" : String

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2016-8-24 11:52 ½s¿è

¦^´_ 4# c_c_lai
¶g½u Readstr = xmlHttp.responseText
¸Ì¦³"</script><script>var TAIEXcandlestickData_W = [" ¸Õ¬Ý¬Ý
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¬O«ü§â
Readstr = Split(Readstr, "}];var Close_W =")(0)
§ï¦¨
Readstr = Split(Readstr, "</script><script>var TAIEXcandlestickData_W = [" )(0)
¦n¹³¤£¦æ

TOP

        ÀR«ä¦Û¦b : ¨ü¤HÂI¤ô¤§®¦¡A¶··í´é¬u¥H³ø¡C
ªð¦^¦Cªí ¤W¤@¥DÃD