@@ -66,8 +66,12 @@ def _valid_plot_kwargs():
6666 '''
6767
6868 vkwargs = {
69- 'type' : { 'Default' : 'ohlc' ,
70- 'Validator' : lambda value : value in ['candle' ,'candlestick' ,'ohlc' ,'bars' ,'ohlc_bars' ,'line' , 'renko' , 'pnf' , 'p&f' , 'pointnfigure' ] },
69+ 'columns' : { 'Default' : ('Open' , 'High' , 'Low' , 'Close' , 'Volume' ),
70+ 'Validator' : lambda value : isinstance (value , (tuple , list ))
71+ and len (value ) == 5
72+ and all (isinstance (c , str ) for c in value ) },
73+ 'type' : { 'Default' : 'ohlc' ,
74+ 'Validator' : lambda value : value in ['candle' ,'candlestick' ,'ohlc' ,'bars' ,'ohlc_bars' ,'line' , 'renko' , 'pnf' , 'p&f' , 'pointnfigure' ] },
7175
7276 'style' : { 'Default' : 'default' ,
7377 'Validator' : lambda value : value in _styles .available_styles () or isinstance (value ,dict ) },
@@ -169,10 +173,10 @@ def plot( data, **kwargs ):
169173 Also provide ability to plot trading signals, and/or addtional user-defined data.
170174 """
171175
172- dates ,opens ,highs ,lows ,closes ,volumes = _check_and_prepare_data (data )
173-
174176 config = _process_kwargs (kwargs , _valid_plot_kwargs ())
175177
178+ dates ,opens ,highs ,lows ,closes ,volumes = _check_and_prepare_data (data , config )
179+
176180 if config ['type' ] in VALID_PMOVE_TYPES and config ['addplot' ] is not None :
177181 err = "`addplot` is not supported for `type='" + config ['type' ] + "'`"
178182 raise ValueError (err )
0 commit comments