資源簡介
python 實現的股票行情,有圖形化,接收數據
代碼片段和文件信息
import?pandas.io.data?as?web
import?datetime?as?dt
import?pandas?as?pd
import?numpy?as?np
import?matplotlib.pyplot?as?plt
import?matplotlib.widgets?as?wd
def?plot_data(stkname?fig?topplt?botplt?sidplt):
????#Get?data?from?yahoo
????#Calculate?olling?mean?mean?and?current?value?of?stock
????#Also?calculate?length?of?data
????startdate?=?dt.date(2007?1?1)
????stkdata?=?web.DataReader(stkname?‘yahoo‘?startdate)
????stklen?=?len(stkdata.index)
????enddate?=?dt.datetime.date(stkdata.index[stklen-1])
????stkrolmean?=?pd.ewma(stkdata[‘Close‘]?60)
????stkmean?=?stkdata[‘Close‘].mean(1).round(2)
????stkcur?=?stkdata[‘Close‘][stklen-1]
????stkmax?=?stkdata[‘Close‘].max(1)
????stkmin?=?stkdata[‘Close‘].min(1)
????#Decoration?for?annotation?of?latest?trading?value
????props?=?dict(boxstyl
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2015-08-06?21:31??StockPy-master\
?????文件??????????29??2013-07-25?21:34??StockPy-master\.gitignore
?????目錄???????????0??2015-08-06?21:31??StockPy-master\Images\
?????文件??????122792??2013-07-25?21:34??StockPy-master\Images\StockPy_GOOG.png
?????文件??????177569??2013-07-25?21:34??StockPy-master\Images\StockPy_HMM.png
?????文件??????118637??2013-07-25?21:34??StockPy-master\Images\StockPy_MSFT.png
?????文件???????18040??2013-07-25?21:34??StockPy-master\LICENSE
?????文件?????????373??2013-07-25?21:34??StockPy-master\README.md
?????文件????????3376??2013-07-25?21:34??StockPy-master\StockPy.py
?????目錄???????????0??2015-08-06?21:31??StockPy-master\Test\
?????文件??????????87??2013-07-25?21:34??StockPy-master\Test\Readme.md
?????文件????????4878??2013-07-25?21:34??StockPy-master\Test\StockPy_HMM.py
評論
共有 條評論