def fooCandlestick(ax, quotes, width=0.5, colorup='#FFA500', colordown='#222', alpha=1.0):
OFFSET = width/2.0
lines = []
boxes = []
for q in quotes:
timestamp, op, hi, lo, close = q[:5]
box_h = max(op, close)
box_l = min(op, close)
height = box_h - box_l
if close>=op:
color = '#3fd624'
else:
color = '#e83e2c'
vline_lo = Line2D( xdata=(timestamp, timestamp), ydata=(lo, box_l), color = 'k', linewidth=0.5, antialiased=True, zorder=10 )
vline_hi = Line2D( xdata=(timestamp, timestamp), ydata=(box_h, hi), color = 'k', linewidth=0.5, antialiased=True, zorder=10 )
rect = Rectangle( xy = (timestamp-OFFSET, box_l), width = width, height = height, facecolor = color, edgecolor = color, zorder=10)
rect.set_alpha(alpha)
lines.append(vline_lo)
lines.append(vline_hi)
boxes.append(rect)
ax.add_line(vline_lo)
ax.add_line(vline_hi)
ax.add_patch(rect)
ax.autoscale_view()
return lines, boxes
# Enable a Grid
google-trends.py 文件源码
python
阅读 22
收藏 0
点赞 0
评论 0
评论列表
文章目录