@@ -221,9 +221,9 @@ def parse_yahoo_historical(fh, adjusted=True, asobject=False,
221
221
holding 1-D ndarrays. The behavior of a numpy recarray is
222
222
very similar to the Bunch.
223
223
224
- stock_dt : `np.dtype `
225
- The data type to be used for the returned array. This is a
226
- temporary argument to easy the transition from ochl -> ohlc
224
+ ochl : `bool `
225
+ Temporary argument to select between ochl and ohlc ordering.
226
+ Defaults to True to preserve original functionality.
227
227
228
228
"""
229
229
if ochl :
@@ -516,6 +516,8 @@ def plot_day_summary(ax, quotes, ticksize=3,
516
516
the color of the lines where close >= open
517
517
colordown : color
518
518
the color of the lines where close < open
519
+ ochl: bool
520
+ temporary argument to select between ochl and ohlc ordering
519
521
520
522
Returns
521
523
-------
@@ -563,11 +565,49 @@ def plot_day_summary(ax, quotes, ticksize=3,
563
565
return lines
564
566
565
567
566
- def candlestick (ax , quotes , width = 0.2 , colorup = 'k' , colordown = 'r' ,
568
+ def candlestick_ochl (ax , quotes , width = 0.2 , colorup = 'k' , colordown = 'r' ,
567
569
alpha = 1.0 ):
568
570
569
571
"""
572
+ Plot the time, open, close, high, low as a vertical line ranging
573
+ from low to high. Use a rectangular bar to represent the
574
+ open-close span. If close >= open, use colorup to color the bar,
575
+ otherwise use colordown
576
+
577
+ Parameters
578
+ ----------
579
+ ax : `Axes`
580
+ an Axes instance to plot to
581
+ quotes : sequence of (time, open, high, low, close, ...) sequences
582
+ As long as the first 5 elements are these values,
583
+ the record can be as long as you want (eg it may store volume).
584
+
585
+ time must be in float days format - see date2num
586
+
587
+ width : float
588
+ fraction of a day for the rectangle width
589
+ colorup : color
590
+ the color of the rectangle where close >= open
591
+ colordown : color
592
+ the color of the rectangle where close < open
593
+ alpha : float
594
+ the rectangle alpha level
595
+
596
+ Returns
597
+ -------
598
+ ret : tuple
599
+ returns (lines, patches) where lines is a list of lines
600
+ added and patches is a list of the rectangle patches added
601
+
602
+ """
603
+ candlestick (ax , quotes , width = width , colorup = colorup , colordown = colordown ,
604
+ alpha = alpha , ochl = True )
605
+
570
606
607
+ def candlestick_ohlc (ax , quotes , width = 0.2 , colorup = 'k' , colordown = 'r' ,
608
+ alpha = 1.0 ):
609
+
610
+ """
571
611
Plot the time, open, high, low, close as a vertical line ranging
572
612
from low to high. Use a rectangular bar to represent the
573
613
open-close span. If close >= open, use colorup to color the bar,
@@ -598,14 +638,64 @@ def candlestick(ax, quotes, width=0.2, colorup='k', colordown='r',
598
638
returns (lines, patches) where lines is a list of lines
599
639
added and patches is a list of the rectangle patches added
600
640
641
+ """
642
+ candlestick (ax , quotes , width = width , colorup = colorup , colordown = colordown ,
643
+ alpha = alpha , ochl = False )
644
+
645
+
646
+ def candlestick (ax , quotes , width = 0.2 , colorup = 'k' , colordown = 'r' ,
647
+ alpha = 1.0 , ochl = True ):
648
+
649
+ """
650
+
651
+ This function has been deprecated in 1.4 in favor of
652
+ `candlestick_ochl`, which maintains the original argument
653
+ order, or `candlestick_ohlc`, which uses the
654
+ open-high-low-close order. This function will be removed in 1.5
655
+
656
+ Plot the time, open, high, low, close as a vertical line ranging
657
+ from low to high. Use a rectangular bar to represent the
658
+ open-close span. If close >= open, use colorup to color the bar,
659
+ otherwise use colordown
660
+
661
+ Parameters
662
+ ----------
663
+ ax : `Axes`
664
+ an Axes instance to plot to
665
+ quotes : sequence of (time, open, high, low, close, ...) sequences
666
+ As long as the first 5 elements are these values,
667
+ the record can be as long as you want (eg it may store volume).
668
+
669
+ time must be in float days format - see date2num
670
+
671
+ width : float
672
+ fraction of a day for the rectangle width
673
+ colorup : color
674
+ the color of the rectangle where close >= open
675
+ colordown : color
676
+ the color of the rectangle where close < open
677
+ alpha : float
678
+ the rectangle alpha level
679
+ ochl: bool
680
+ temporary argument to select between ochl and ohlc ordering
681
+
682
+ Returns
683
+ -------
684
+ ret : tuple
685
+ returns (lines, patches) where lines is a list of lines
686
+ added and patches is a list of the rectangle patches added
687
+
601
688
"""
602
689
603
690
OFFSET = width / 2.0
604
691
605
692
lines = []
606
693
patches = []
607
694
for q in quotes :
608
- t , open , high , low , close = q [:5 ]
695
+ if ochl :
696
+ t , open , close , high , low = q [:5 ]
697
+ else :
698
+ t , open , high , low , close = q [:5 ]
609
699
610
700
if close >= open :
611
701
color = colorup
0 commit comments