plot_exposure

Defined in fynance.plot

plot_exposure(W, ax=None, **kw)[source]

Plot the book’s gross and net exposure over time.

W is the weight/position book, shape (T,) (promoted to (T, 1)) or (T, N). Gross exposure (gross_exposure, \(\sum_i |w_i|\)) reads as total book leverage; net exposure (net_exposure, \(\sum_i w_i\)) reads as the long/short bias — plotting both together shows at a glance whether a high-leverage book is directionally hedged or one-sided. Returns the matplotlib Axes.

Parameters:
Warray_like

Weights held at each step, shape (T,) or (T, N).

axmatplotlib.axes.Axes, optional

Axes to draw on; a new figure is created when omitted.

**kw

index (array_like, optional) overrides the x-axis (defaults to range(T)); any other keyword is forwarded to both ax.plot calls (e.g. lw, alpha).

Returns:
matplotlib.axes.Axes