classWMA_DEMA:def__init__:#self.dailys_of_stocks#self.wma_demaself.charts
#获取股票的日线行情defdailys_of_stocks:stocks=["30099SZ","00241SZ","60176SH","000100.SZ","30005SZ","60123SH"]file_names=[]foriinstocks:df=pro.dailydf.index=pd.to_datetimedf.drop#tushare给的数据是从最近排到最远的,#而我们的股票都是从最远开始排到后面的,#所以我们要让它按日期重新排序df.sort_indexfile_name="daily_%s.csv"%ifile_names.appenddf.to_csvreturnfile_names
defcharts:file_names=self.wma_dema#k线整体设置my_color=mpf.make_marketcolorsmy_style=mpf.make_mpf_styleforiinfile_names:#index_col="trade_date"。df=pd.read_csvdf_new=pd.DataFrame)add_plot=[mpf.make_addplot,mpf.make_addplot,mpf.make_addplot,mpf.make_addplot]mpf.plot,figscale=3,volume=True,title=i[6:12],)
ts.set_tokenpro=ts.pro_api
文章为作者独立观点,不代表股票交易接口观点