1. Trang chủ
  2. » Công Nghệ Thông Tin

implementing models of financial derivatives

694 603 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 694
Dung lượng 4,55 MB

Nội dung

www.it-ebooks.info This page intentionally left blank www.it-ebooks.info Implementing Models of Financial Derivatives www.it-ebooks.info For other titles in the Wiley Finance series please see www.wiley.com www.it-ebooks.info Implementing Models of Financial Derivatives Object Oriented Applications with VBA Nick Webber A John Wiley and Sons, Ltd., Publication www.it-ebooks.info This edition first published 2011 © 2011, John Wiley & Sons, Ltd Registered office John Wiley & Sons Ltd, The Atrium, Southern Gate, Chichester, West Sussex, PO19 8SQ, United Kingdom For details of our global editorial offices, for customer services and for information about how to apply for permission to reuse the copyright material in this book please see our website at www.wiley.com. The right of the author to be identified as the author of this work has been asserted in accordance with the Copyright, Designs and Patents Act 1988. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording or otherwise, except as permitted by the UK Copyright, Designs and Patents Act 1988, without the prior permission of the publisher. Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic books. Designations used by companies to distinguish their products are often claimed as trademarks. All brand names and product names used in this book are trade names, service marks, trademarks or registered trademarks of their respective owners. The publisher is not associated with any product or vendor mentioned in this book. This publication is designed to provide accurate and authoritative information in regard to the subject matter covered. It is sold on the understanding that the publisher is not engaged in rendering professional services. If professional advice or other expert assistance is required, the services of a competent professional should be sought. Library of Congress Cataloging-in-Publication Data Webber, Nick. Implementing models of financial derivatives : object oriented applications with VBA / Nick Webber. p. cm. Includes bibliographical references and index. ISBN 978-0-470-71220-7 1. Derivative securities – Mathematical models. 2. Microsoft Visual Basic for applications. I. Title. HG6024.A3W43 2010 332.64  570285543 – dc22 2010022097 A catalogue record for this book is available from the British Library. ISBN: 978-0-470-71220-7 (hardback), ISBN: 978-0-470-66251-9 (ebk), ISBN: 978-0-470-66173-4 (ebk), ISBN: 978-0-470-66184-0 (ebk) Typeset in 10/12pt Times by Laserwords Private Limited, Chennai, India Printed in Great Britain by Antony Rowe Ltd, Chippenham, Wiltshire www.it-ebooks.info To clients of this book, may you enjoy it as much as I enjoyed writing it. www.it-ebooks.info This page intentionally left blank www.it-ebooks.info Contents Preface xv PART I A PROCEDURAL MONTE CARLO METHOD IN VBA 1 1 The Monte Carlo Method 3 1.1 The Monte Carlo valuation method 3 1.2 Issues with Monte Carlo 8 1.3 Computational issues 12 1.4 Summary 16 1.5 Exercises 16 2 Levels of Programming Sophistication 19 2.1 What makes a good application? 19 2.2 A high-level design 19 2.3 Progressing towards the ideal 21 2.4 Summary 22 2.5 Exercises 22 3 Procedural Programming: Level 1 25 3.1 Designing a Monte Carlo valuation application 25 3.2 Deficiencies of the level 1 code 35 3.3 Summary 36 3.4 Exercises 36 4 Validation and Error Handling: Level 2 39 4.1 Validation and error handling 40 4.2 Encapsulating functionality 45 4.3 The level 2 main() 48 4.4 Summary 50 4.5 Exercises 51 www.it-ebooks.info viii Contents PART II OBJECTS AND POLYMORPHISM 53 5 Introducing Objects: Level 3 55 5.1 Objects in VBA 55 5.2 An example: The StopWatch object 63 5.3 Further helpful VBA features 65 5.4 Objects in the Monte Carlo application 67 5.5 Summary 78 5.6 Exercises 78 6 Polymorphism and Interfaces: Level 4 81 6.1 Polymorphism 81 6.2 Interfaces in VBA 84 6.3 Implementing a polymorphic stopwatch 86 6.4 Polymorphism and the Monte Carlo application 88 6.5 Assessment of the polymorphic design 100 6.6 Summary 102 6.7 Exercises 102 7 A Slice-Based Monte Carlo 107 7.1 The revised Monte Carlo application object 107 7.2 The option object 109 7.3 The evolver object 113 7.4 Summary 116 7.5 Exercises 116 8 An Embryonic Factory: Level 5 119 8.1 Events 119 8.2 The Level 5 Monte Carlo application 122 8.3 The Factory object 127 8.4 Output 130 8.5 Summary 133 8.6 Exercises 133 PART III USING FILES WITH VBA 135 9 Input and Output to File in VBA 137 9.1 File handling in VBA 137 9.2 The TextStream and FileSystemObject objects 138 9.3 Intrinsic VB language functions 143 9.4 Example: Reading and writing to sequential and random files 145 9.5 Summary 151 9.6 Exercises 151 10 Valuing a Book of Options 153 10.1 Outline of the application 153 10.2 Timings 174 www.it-ebooks.info [...]... the needs of market participants and, insofar as there is a wide variety of needs, so there is a wide variety of models There are HJM and market models, the SABR and Heston models, factor models and string models, diffusion models and L´ vy process models, bridge distributions e and time changes; some areas from time to time settle upon a market standard model but these change through time Models are... Carlo Method 9 10 Implementing Models of Financial Derivatives such as bond prices, need to be computed In the case of a Gaussian affine model there are explicit formulae for their prices; in other factor models there are not and numerical methods must be used At some stage a set of SDEs has to be simulated If the SDEs cannot be solved as functions of their drivers then some kind of discretization method... = 1, , M, and taking the average of the vj www.it-ebooks.info (1.15) 6 Implementing Models of Financial Derivatives This is essentially integrating using (1.12a) (1.12b) and (1.12c) can also be used Using (1.12c) is called an inverse transform method Operationalizing this requires a number of approximations to be made Fix a number of time steps N , and a set of discretization times T = {ti }i=0,... www.it-ebooks.info 8 Implementing Models of Financial Derivatives 1.2 ISSUES WITH MONTE CARLO In practice Monte Carlo is used to value and hedge a book of options with a model usually specified, like equation (1.2), as a set of SDEs We briefly discuss the abstract structure of a Monte Carlo application, some practical considerations and some modelling aspects 1.2.1 The structure of a Monte Carlo valuation... the development of models in the fixed income and FX markets A derivative product specifies in its contract the relationship between its payoff and the values of observables in the market Quite often the contractual details, although absolutely necessary to get right, are finicky For instance, the computation of an average, or of a closing price, or indeed of a day count can be complex Models usually abstractify... number of state variables This does not apply to Monte Carlo; it is a powerful practical motivation for the adoption of Monte Carlo as a valuation mechanism when realism, accuracy, or plain necessity, require more than one or two state variables to be present in a model 3 For instance, at the time of writing the inverse of the beta distribution function www.it-ebooks.info 12 Implementing Models of Financial. .. option being valued, then it is bad Perhaps, not surprisingly, element-wise evolution www.it-ebooks.info 16 Implementing Models of Financial Derivatives is inappropriate for more complex applications because of the overhead of shifting around individual numbers It is more efficient to pass around a set of values as a slice or path There is nothing necessarily wrong with path-wise evolution Conceptually this... Preface xvii A full set of appendices adds substantive material, including a discussion of lattice and PDE methods, a brief review of important root-finding methods, with implementations, and a primer on OOP In parallel with the exposition accompanying the development of the Monte Carlo application are a series of exercises The reader is invited to develop a set of applications, several of which are presented... in Parts VI and VII 1.2.3 Modelling This section briefly mentions some aspects of the modelling component that affect the Monte Carlo method It is not in the scope of this book to investigate a range of models in detail although some models are reviewed en passant at various points Number of state variables A big advantage of Monte Carlo is that it is almost as easy to simulate many state variables as... Realism, in the sense of the ability to fit market data, is crucial, but comes at a cost Often the cost is so great that practicality requires only an acceptable fit, for loose definitions of ‘acceptable’ Realism often implies complexity and complexity implies reduced tractability Heston, as a stochastic volatility extension of GBM, fits better to the implied volatility surface than plain GBM, often making it, . blank www.it-ebooks.info Implementing Models of Financial Derivatives www.it-ebooks.info For other titles in the Wiley Finance series please see www.wiley.com www.it-ebooks.info Implementing Models of Financial Derivatives Object. engaged in rendering professional services. If professional advice or other expert assistance is required, the services of a competent professional should be sought. Library of Congress Cataloging-in-Publication. should be sought. Library of Congress Cataloging-in-Publication Data Webber, Nick. Implementing models of financial derivatives : object oriented applications with VBA / Nick Webber. p. cm. Includes

Ngày đăng: 24/04/2014, 15:21

TỪ KHÓA LIÊN QUAN