__init__.py 文件源码

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

项目:marconibot 作者: s4w3d0ff 项目源码 文件源码
def plotCCI(p, df, plotwidth=800, upcolor='orange', downcolor='yellow'):
    # create y axis for rsi
    p.extra_y_ranges = {"cci": Range1d(start=min(df['cci'].values),
                                       end=max(df['cci'].values))}
    p.add_layout(LinearAxis(y_range_name="cci"), 'right')
    candleWidth = (df.iloc[2]['date'].timestamp() -
                   df.iloc[1]['date'].timestamp()) * plotwidth
    # plot green bars
    inc = df.cci >= 0
    p.vbar(x=df.date[inc],
           width=candleWidth,
           top=df.cci[inc],
           bottom=0,
           fill_color=upcolor,
           line_color=upcolor,
           alpha=0.5,
           y_range_name="cci",
           legend='cci')
    # Plot red bars
    dec = df.cci < 0
    p.vbar(x=df.date[dec],
           width=candleWidth,
           top=0,
           bottom=df.cci[dec],
           fill_color=downcolor,
           line_color=downcolor,
           alpha=0.5,
           y_range_name="cci",
           legend='cci')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号