Skip to content

Commit 4896efa

Browse files
committed
Adding function to display kwarg table with descriptions
1 parent dc95949 commit 4896efa

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/mplfinance/_utils.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ def _check_input(opens, closes, highs, lows):
6363
if not same_missing:
6464
raise ValueError('O,H,L,C must have the same missing data!')
6565

66+
6667
def _check_and_convert_xlim_configuration(data, config):
6768
'''
6869
Check, if user entered `xlim` kwarg, if user entered dates
@@ -1391,6 +1392,31 @@ def _tline_lsq(dfslice,tline_use):
13911392
return _construct_aline_collections(alines, dtix)
13921393

13931394

1395+
def _display_formetted_kwargs_table(kwargs_dict: dict):
1396+
"""
1397+
Displays through stdout the provided kwargs dict along with each
1398+
one of the discriptions and default values.
1399+
1400+
Parameters
1401+
--------------
1402+
kwargs_dict : dict
1403+
Dictionary containing the kwargs in the format (kwarg, default, description)
1404+
"""
1405+
1406+
# TODO must be defined the best way to place it in the API
1407+
# (either inside the 'plot' method or some other auxiliary
1408+
# method)
1409+
1410+
# prints header of the table
1411+
print('=' * 120)
1412+
print("{:<30} {:<15} {}".format('kwarg', 'Default', 'Description'))
1413+
print('=' * 120)
1414+
1415+
for kwarg, info in kwargs_dict.items():
1416+
print(f'{kwarg:30} {str(info["Default"]):15} {info["Description"]}')
1417+
print('-' * 120)
1418+
1419+
13941420
from matplotlib.ticker import Formatter
13951421
class IntegerIndexDateTimeFormatter(Formatter):
13961422
"""

0 commit comments

Comments
 (0)