Skip to content

Commit 3e1cc72

Browse files
Merge pull request #69 from WHug0/master
Add return_calculated_values parameter
2 parents 958fba2 + 38b5a7c commit 3e1cc72

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/mplfinance/plotting.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ def _valid_plot_kwargs():
127127

128128
'returnfig' : { 'Default' : False,
129129
'Validator' : lambda value: isinstance(value,bool) },
130+
131+
'return_calculated_values': {'Default': None,
132+
'Validator': lambda value: isinstance(value, dict) and len(value) == 0},
130133

131134
}
132135

@@ -299,6 +302,17 @@ def plot( data, **kwargs ):
299302
else:
300303
ax1.plot(xdates, mavprices)
301304

305+
if config['return_calculated_values'] is not None:
306+
retdict = config['return_calculated_values']
307+
if ptype == 'renko':
308+
retdict['renko_bricks'] = brick_values
309+
retdict['renko_dates'] = mdates.num2date(new_dates)
310+
if config['volume']:
311+
retdict['renko_volumes'] = volumes
312+
if mavgs is not None:
313+
for i in range(0, len(mavgs)):
314+
retdict['mav' + str(mavgs[i])] = mavprices
315+
302316
avg_dist_between_points = (xdates[-1] - xdates[0]) / float(len(xdates))
303317
minx = xdates[0] - avg_dist_between_points
304318
maxx = xdates[-1] + avg_dist_between_points

0 commit comments

Comments
 (0)