您可以尝试使用雅虎的
V8 API
,如下所示;
Sub GetBTC()
Dim URL As String, startDate As Long, endDate As Long, strResponse As String, valBTC As Variant
startDate = DateDiff("s", "1/1/1970", Date)
endDate = startDate
URL = "https://query1.finance.yahoo.com/v8/finance/chart/BTC-USD?symbol=BTC-USD&period1=" & startDate & "&period2=" & endDate & "&useYfid=true&interval=1d&includePrePost=true&events=div%7Csplit%7Cearn&lang=en-US®ion=US&crumb=Mvg42d3eDTb&corsDomain=finance.yahoo.com"
With CreateObject("MSXML2.ServerXMLHTTP")
.Open "GET", URL, False
.send
strResponse = .responseText
End With
valBTC = Split(Split(strResponse, """regularMarketPrice"":")(1), ",")(0)
MsgBox valBTC
End Sub