Python如何獲取股票數(shù)據(jù)——詳細(xì)介紹
Python作為一款專業(yè)的編程語(yǔ)言,其應(yīng)用領(lǐng)域十分廣泛,其中之一就是股票數(shù)據(jù)的獲取。本文將詳細(xì)介紹Python如何獲取股票數(shù)據(jù)的方法,幫助大家快速獲取所需的股票信息。文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-672998.html
一、使用pandas-datareader獲取股票數(shù)據(jù)
pandas-datareader是一款很受歡迎的Python庫(kù),可以用來(lái)從多個(gè)數(shù)據(jù)源獲取金融數(shù)據(jù)。使用這個(gè)庫(kù)可以輕松獲取美股、歐洲股票市場(chǎng)和加拿大股票市場(chǎng)的歷史數(shù)據(jù)。文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-672998.html
import pandas_datareader as pdr
import datetime
start=datetime.datetime(2020,1,1)
end=datetime.datetime(2020,12,31)
df=pdr.get_data_yahoo('AAPL',start=start,end=end) #獲取蘋(píng)果公司2020年的股票數(shù)據(jù)
到了這里,關(guān)于chatgpt賦能python:Python如何獲取股票數(shù)據(jù)——詳細(xì)介紹的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!