【问题标题】:Pandas: 52 week high from yahoo or google finance熊猫:来自雅虎或谷歌金融的 52 周高点
【发布时间】:2015-04-20 07:19:46
【问题描述】:

有谁知道你是否可以从雅虎或谷歌金融获得熊猫 52 周的最高记录?谢谢。

【问题讨论】:

    标签: python pandas yahoo finance


    【解决方案1】:

    有可能,请查看pandas documentation。这是一个例子:

    import pandas.io.data as web
    import datetime
    
    symbol = 'aapl'
    
    end = datetime.datetime.now()
    start = end - datetime.timedelta(weeks=52)
    
    df = web.DataReader(symbol, 'yahoo', start, end)
    
    highest_high = df['High'].max()
    

    【讨论】:

    • 谢谢。是否有可能不提取所有 52 周的数据?即他们是否将 52 周的最高值存储在特定领域。谢谢。
    【解决方案2】:

    也可以使用 yfinance(来自 yahoo)

    pip install finance 
    
    import yfinance as yf
    
    stock = "JNJ"
    
    dataframe = yf.download(stock, period="1y", auto_adjust=True, prepost=True, threads=True)
    
    max = dataframe['High'].max()
    

    【讨论】:

    • pip install yfinance
    猜你喜欢
    • 2010-11-21
    • 1970-01-01
    • 2011-09-08
    • 1970-01-01
    • 2017-10-01
    • 1970-01-01
    • 1970-01-01
    • 2018-09-24
    • 1970-01-01
    相关资源
    最近更新 更多