回覆列表
  • 1 # SuperBean

    沒有免費的軟體,寫爬蟲需要自己有python程式碼功底,作為一個程式設計師,有自己的傲嬌,炒股不喜歡用別人的軟體,喜歡自己分析總結。

    python環境就不在贅述了,在cmd下命令

    pip install yfinance

    安裝成功後,我們寫個簡單的py檔案執行

    import yfinance as fy

    import matplotlib.pyplot as plt

    import numpy as np

    fy.pdr_override()

    def get_data(tick,start_date="2000-01-01", end_date="2020-01-01"):

    data = fy.download(tick, start=start_date, end=end_date)

    return data

    tickers=["AAPL", "GOOG","AMZN","FB"]

    all_data = {}

    for ticker in tickers:

    all_data[ticker]=get_data(ticker)

    subjects = ["蘋果公司股價走勢","谷歌公司股價走勢",

    "亞馬遜公司股價走勢","FaceBook公司股價走勢"]

    #每個子圖的title

    plot_pos = [221,222,223,224] # 每個子圖的位置

    new_colors = ["#1f77b4","#ff7f0e", "#2ca02c", "#d62728",

    "#9467bd","#8c564b", "#e377c2",

    "#7f7f7f","#bcbd22","#17becf"]

    fig = plt.figure(figsize=(16,9))

    fig.suptitle("美股&指數走勢",fontsize=18)

    for pos in np.arange(len(plot_pos)):

    ax = fig.add_subplot(plot_pos[pos])

    y_data = all_data[tickers[pos]]["Adj Close"]

    b = ax.plot(y_data,color=new_colors[pos])

    ax.set_title(subjects[pos])

    ax = plt.gca()

    ax.spines["right"].set_color("none")

    ax.spines["top"].set_color("none")

    plt.show()

    成功跑起來了

    也不比市面上的亂七八糟的軟體差吧!

  • 中秋節和大豐收的關聯?
  • 室內設計效果表現軟體怎麼選擇?