main.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:CTPAPI 作者: doubleelforbes 项目源码 文件源码
def drawgraph(markethistory):
    global graphdrawn
    # Set up a graph and data sets
    timeplots = []
    priceplots = []
    # Set up the graph
    figgraph = Figure(figsize=(10, 10), dpi=60)
    # 2D Graph : 1 column, 1 Row, 1 Plot
    axes = figgraph.add_subplot(111)
    for key in markethistory:
        figgraph.suptitle(markethistory[key].Label)
        price = markethistory[key].Price
        timestamp = markethistory[key].Timestamp
        dtplot = datetime.datetime.fromtimestamp(timestamp)
        timeplots.insert(len(timeplots), dtplot)
        priceplots.insert(len(priceplots), price)
    # Enforce 8 decimal places
    axes.yaxis.set_major_formatter(FormatStrFormatter('%.8f'))
    # Plot the graph
    axes.plot(timeplots, priceplots)
    # Canvas placed in main frame, controlled by figgraph
    window.canvas = FigureCanvasTkAgg(figgraph, master=window.mainframe)
    window.canvas.get_tk_widget().place(relx=0.26, rely=0.01, relheight=0.46, relwidth=0.74)
    window.canvas.draw()
    graphdrawn = True


# Sell order list select event.
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号