from pandas_datareader import data as web from mpl_finance import candlestick_ohlc from matplotlib import pyplot as plt from matplotlib import style import matplotlib.dates as mdates import yfinance as yf import datetime as dt import pandas as pd import numpy as np import time style.use('dark_background') yf.pdr_override() ma1 = 5 ma2 = 20 print('Stock Number:') stock_no = input() csv_file = '/users/jht/Desktop/python/stockData/'+stock_no+'.csv' start = dt.datetime(2020, 1, 1) end = dt.datetime.now() df = web.get_data_yahoo(stock_no + '.TW', start, end) df.to_csv(csv_file) time.sleep(2) data = pd.read_csv(csv_file, parse_dates=True, index_col='Date') data.head() close = data["Close"] avg = sum(close)/len(close) top = plt.subplot2grid((21, 9), (0, 0), rowspan=9, colspan=9)#整個畫面共有(21row,9col),其位於(0row,0col),此占各9row&col bottom = plt.subplot2grid((21, 9), (12, 0), rowspan=3, colspan=9, sharex=top) bottom1 = plt.subplot2gr...