def candlestick(ax, quotes, width=<NUM_LIT>, colorup='<STR_LIT:k>', colordown='<STR_LIT:r>',<EOL>alpha=<NUM_LIT:1.0>):
OFFSET = width/<NUM_LIT><EOL>lines = []<EOL>patches = []<EOL>for q in quotes:<EOL><INDENT>t, open, close, high, low = q[:<NUM_LIT:5>]<EOL>if close>=open :<EOL><INDENT>color = colorup<EOL>lower = open<EOL>height = close-open<EOL><DEDENT>else           :<EOL><INDENT>color = colordown<EOL>lower = close<EOL>height = open-close<EOL><DEDENT>vline = Line2D(<EOL>xdata=(t, t), ydata=(low, high),<EOL>color='<STR_LIT:k>',<EOL>linewidth=<NUM_LIT:0.5>,<EOL>antialiased=True,<EOL>)<EOL>rect = Rectangle(<EOL>xy    = (t-OFFSET, lower),<EOL>width = width,<EOL>height = height,<EOL>facecolor = color,<EOL>edgecolor = color,<EOL>)<EOL>rect.set_alpha(alpha)<EOL>lines.append(vline)<EOL>patches.append(rect)<EOL>ax.add_line(vline)<EOL>ax.add_patch(rect)<EOL><DEDENT>ax.autoscale_view()<EOL>return lines, patches<EOL>
quotes is a list of (time, open, close, high, low, ...)  tuples.
As long as the first 5 elements of the tuples are these values,
the tuple can be as long as you want (eg it may store volume).

time must be in float days format - see date2num

Plot the time, open, close, high, low as a vertical line ranging
from low to high.  Use a rectangular bar to represent the
open-close span.  If close >= open, use colorup to color the bar,
otherwise use colordown

ax          : an Axes instance to plot to
width       : fraction of a day for the rectangle width
colorup     : the color of the rectangle where close >= open
colordown   : the color of the rectangle where close <  open
alpha       : the rectangle alpha level

return value is lines, patches where lines is a list of lines
added and patches is a list of the rectangle patches added