taLib_demo.py 文件源码

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

项目:base_function 作者: Rockyzsu 项目源码 文件源码
def math_operator_process(event):
    print(event.widget.get())
    math_operator = event.widget.get()

    upperband, middleband, lowerband = ta.BBANDS(close, timeperiod=5, nbdevup=2, nbdevdn=2, matype=0)
    fig, axes = plt.subplots(2, 1, sharex=True)
    ax1, ax2 = axes[0], axes[1]
    axes[0].plot(close, 'rd-', markersize=3)
    axes[0].plot(upperband, 'y-')
    axes[0].plot(middleband, 'b-')
    axes[0].plot(lowerband, 'y-')
    axes[0].set_title(math_operator, fontproperties="SimHei")


    if math_operator == '?????????':
        real = ta.MAX(close, timeperiod=30)
        axes[1].plot(real, 'r-')
    elif math_operator == '????????????':
        integer = ta.MAXINDEX(close, timeperiod=30)
        axes[1].plot(integer, 'r-')
    elif math_operator == '?????????':
        real = ta.MIN(close, timeperiod=30)
        axes[1].plot(real, 'r-')
    elif math_operator == '????????????':
        integer = ta.MININDEX(close, timeperiod=30)
        axes[1].plot(integer, 'r-')
    elif math_operator == '????????????':
        min, max = ta.MINMAX(close, timeperiod=30)
        axes[1].plot(min, 'r-')
        axes[1].plot(max, 'r-')
    elif math_operator == '???????????????':
        minidx, maxidx = ta.MINMAXINDEX(close, timeperiod=30)
        axes[1].plot(minidx, 'r-')
        axes[1].plot(maxidx, 'r-')
    elif math_operator == '??':
        real = ta.SUM(close, timeperiod=30)
        axes[1].plot(real, 'r-')

    plt.show()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号