Skip to content

Commit f6c8c20

Browse files
add some kwarg descriptions
1 parent 1d6931a commit f6c8c20

File tree

2 files changed

+39
-17
lines changed

2 files changed

+39
-17
lines changed

src/mplfinance/_utils.py

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -387,11 +387,12 @@ def _valid_renko_kwargs():
387387
'''
388388
vkwargs = {
389389
'brick_size' : { 'Default' : 'atr',
390-
'Description' : '',
390+
'Description' : 'size of each brick on y-axis (typically price).'+
391+
' specify a number, or specify "atr" for average true range.',
391392
'Validator' : lambda value: isinstance(value,(float,int))
392393
or value == 'atr' },
393394
'atr_length' : { 'Default' : 14,
394-
'Description' : '',
395+
'Description' : 'number of periods for atr calculation (if brick size is "atr")',
395396
'Validator' : lambda value: isinstance(value,int)
396397
or value == 'total' },
397398
}
@@ -416,16 +417,18 @@ def _valid_pnf_kwargs():
416417
'''
417418
vkwargs = {
418419
'box_size' : { 'Default' : 'atr',
419-
'Description' : '',
420+
'Description' : 'size of each box on y-axis (typically price).'+
421+
' specify a number, or specify "atr" for average true range.',
420422
'Validator' : lambda value: isinstance(value,(float,int))
421423
or value == 'atr' },
422424
'atr_length' : { 'Default' : 14,
423-
'Description' : '',
425+
'Description' : 'number of periods for atr calculation (if box size is "atr")',
424426
'Validator' : lambda value: isinstance(value,int)
425427
or value == 'total' },
426428

427429
'reversal' : { 'Default' : 1,
428-
'Description' : '',
430+
'Description' : 'number of boxes, in opposite direction, needed to reverse'+
431+
' a trend (i.e. to start a new column).',
429432
'Validator' : lambda value: isinstance(value,int) },
430433
}
431434

@@ -451,52 +454,71 @@ def _valid_lines_kwargs():
451454
valid_linestyles = ['-','solid','--','dashed','-.','dashdot',':','dotted',None,' ','']
452455
vkwargs = {
453456
'hlines' : { 'Default' : None,
454-
'Description' : '',
457+
'Description' : 'Draw one or more HORIZONTAL LINES across entire plot, by'+
458+
' specifying a price, or sequence of prices. May also be a dict'+
459+
' with key `hlines` specifying a price or sequence of prices, plus'+
460+
' one or more of the following keys: `colors`, `linestyle`,'+
461+
' `linewidths`, `alpha`.',
455462
'Validator' : _bypass_kwarg_validation },
456463

457464
'vlines' : { 'Default' : None,
458-
'Description' : '',
465+
'Description' : 'Draw one or more VERTICAL LINES across entire plot, by'+
466+
' specifying a date[time], or sequence of date[time]. May also'+
467+
' be a dict with key `vlines` specifying a date[time] or sequence'+
468+
' of date[time], plus one or more of the following keys:'+
469+
' `colors`, `linestyle`, `linewidths`, `alpha`.',
459470
'Validator' : _bypass_kwarg_validation },
460471

461472
'alines' : { 'Default' : None,
462-
'Description' : '',
473+
'Description' : 'Draw one or more ARBITRARY LINES anywhere on the plot, by'+
474+
' specifying a sequence of two or more date/price pairs, or by'+
475+
' specifying a sequence of sequences of two or more date/price pairs.'+
476+
' May also be a dict with key `alines` (as date/price pairs described above),'+
477+
' plus one or more of the following keys:'+
478+
' `colors`, `linestyle`, `linewidths`, `alpha`.',
463479
'Validator' : _bypass_kwarg_validation },
464480

465481
'tlines' : { 'Default' : None,
466-
'Description' : '',
482+
'Description' : 'Draw one or more TREND LINES by specifying one or more pairs of date[times]'+
483+
' between which each trend line should be drawn. May also be a dict with key'+
484+
' `tlines` as just described, plus one or more of the following keys:'+
485+
' `colors`, `linestyle`, `linewidths`, `alpha`, `tline_use`,`tline_method`.',
467486
'Validator' : _bypass_kwarg_validation },
468487

469488
'colors' : { 'Default' : None,
470-
'Description' : '',
489+
'Description' : 'Color of [hvat]lines (or sequence of colors, if each line to be a different color)',
471490
'Validator' : lambda value: value is None
472491
or mcolors.is_color_like(value)
473492
or (isinstance(value,(list,tuple))
474493
and all([mcolors.is_color_like(v) for v in value]) ) },
475494

476495
'linestyle' : { 'Default' : '-',
477-
'Description' : '',
496+
'Description' : 'line style of [hvat]lines (or sequence of line styles, if each line to have a different linestyle)',
478497
'Validator' : lambda value: value is None or value in valid_linestyles or
479498
all([v in valid_linestyles for v in value]) },
480499

481500
'linewidths': { 'Default' : None,
482-
'Description' : '',
501+
'Description' : 'line width of [hvat]lines (or sequence of line widths, if each line to have a different width)',
483502
'Validator' : lambda value: value is None
484503
or isinstance(value,(float,int))
485504
or all([isinstance(v,(float,int)) for v in value]) },
486505

487506
'alpha' : { 'Default' : 1.0,
488-
'Description' : '',
507+
'Description' : 'Opacity of [hvat]lines. float from 0.0 to 1.0 '+
508+
' (1.0 means fully opaque; 0.0 means transparent.',
489509
'Validator' : lambda value: isinstance(value,(float,int)) },
490510

491511

492512
'tline_use' : { 'Default' : 'close',
493-
'Description' : '',
513+
'Description' : 'value to use for TREND LINE ("open","high","low","close") or sequence of'+
514+
' any combination of "open", "high", "low", "close" to use a average of the'+
515+
' specified values to determine the trend line.',
494516
'Validator' : lambda value: isinstance(value,str)
495517
or (isinstance(value,(list,tuple))
496518
and all([isinstance(v,str) for v in value]) ) },
497519

498520
'tline_method': { 'Default' : 'point-to-point',
499-
'Description' : '',
521+
'Description' : 'method for TREND LINE determination: "point-to-point" or "least-squares"',
500522
'Validator' : lambda value: value in ['point-to-point','least-squares'] }
501523
}
502524

src/mplfinance/plotting.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,11 @@ def _valid_plot_kwargs():
121121
'Validator' : _mav_validator },
122122

123123
'renko_params' : { 'Default' : dict(),
124-
'Description' : '',
124+
'Description' : 'dict of renko parameters; call `mpf.kwarg_help("renko_params")`',
125125
'Validator' : lambda value: isinstance(value,dict) },
126126

127127
'pnf_params' : { 'Default' : dict(),
128-
'Description' : '',
128+
'Description' : 'dict of point-and-figure parameters; call `mpf.kwarg_help("pnf_params")`',
129129
'Validator' : lambda value: isinstance(value,dict) },
130130

131131
'study' : { 'Default' : None,

0 commit comments

Comments
 (0)