Chapter 30. Portfolio Valuation
Valuing a single derivative is a useful first milestone, but real-world applications
rarely stop there. Traders, risk managers, and portfolio managers care about
collections of positions: the value of the whole book, the contribution of each trade,
and the sensitivities of the aggregated exposure. This chapter extends dxlib with a
compact portfolio layer that lets you value and analyze multiple derivatives
consistently.
This chapter adds a small portfolio container to dxlib. You implement a Position
class that combines a quantity with a pricer and a Portfolio class that aggregates
values and simple bump-and-revalue deltas. You also add two diagnostic figures that
visualize value and delta contributions across the positions of an example equity-index
options book. The examples assume numpy, Matplotlib, pandas for tabular output,
and the valuation layer from Chapter 29.
Why Portfolios Need Structure
If you value instruments one by one in ad-hoc scripts, the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access