__init__.py 文件源码

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

项目:marconibot 作者: s4w3d0ff 项目源码 文件源码
def plotVolume(p, df, plotwidth=800, upcolor='green',
               downcolor='red', colname='volume'):
    candleWidth = (df.iloc[2]['date'].timestamp() -
                   df.iloc[1]['date'].timestamp()) * plotwidth
    # create new y axis for volume
    p.extra_y_ranges = {colname: Range1d(start=min(df[colname].values),
                                         end=max(df[colname].values))}
    p.add_layout(LinearAxis(y_range_name=colname), 'right')
    # Plot green candles
    inc = df.close > df.open
    p.vbar(x=df.date[inc],
           width=candleWidth,
           top=df[colname][inc],
           bottom=0,
           alpha=0.1,
           fill_color=upcolor,
           line_color=upcolor,
           y_range_name=colname)

    # Plot red candles
    dec = df.open > df.close
    p.vbar(x=df.date[dec],
           width=candleWidth,
           top=df[colname][dec],
           bottom=0,
           alpha=0.1,
           fill_color=downcolor,
           line_color=downcolor,
           y_range_name=colname)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号