Luigi Ballabio - Implementing QuantLib (2020).pdf
- 文档编号:30839383
- 上传时间:2024-01-30
- 格式:PDF
- 页数:326
- 大小:6.37MB
Luigi Ballabio - Implementing QuantLib (2020).pdf
《Luigi Ballabio - Implementing QuantLib (2020).pdf》由会员分享,可在线阅读,更多相关《Luigi Ballabio - Implementing QuantLib (2020).pdf(326页珍藏版)》请在冰豆网上搜索。
ImplementingQuantLibLuigiBallabioThisbookisforsaleathttp:
/versionwaspublishedon2020-09-07ThisisaLeanpubbook.LeanpubempowersauthorsandpublisherswiththeLeanPublishingprocess.LeanPublishingistheactofpublishinganin-progressebookusinglightweighttoolsandmanyiterationstogetreaderfeedback,pivotuntilyouhavetherightbookandbuildtractiononceyoudo.2014-2020LuigiBallabioTweetThisBook!
PleasehelpLuigiBallabiobyspreadingthewordaboutthisbookonTwitter!
Thesuggestedhashtagforthisbookis#quantlib.FindoutwhatotherpeoplearesayingaboutthebookbyclickingonthislinktosearchforthishashtagonTwitter:
#quantlibAlsoByLuigiBallabioQuantLibPythonCookbook构建QuantLibImplementingQuantLib和訳Contents1.Introduction.12.Financialinstrumentsandpricingengines.42.1TheInstrumentclass.42.1.1Interfaceandrequirements.42.1.2Implementation.52.1.3Example:
interest-rateswap.92.1.4Furtherdevelopments.132.2Pricingengines.132.2.1Example:
plain-vanillaoption.203.Termstructures.263.1TheTermStructureclass.263.1.1Interfaceandrequirements.263.1.2Implementation.273.2Interest-ratetermstructures.313.2.1Interfaceandimplementation.313.2.2Discount,forward-rate,andzero-ratecurves.333.2.3Example:
bootstrappinganinterpolatedcurve.373.2.4Example:
addingz-spreadtoaninterest-ratecurve.473.3Othertermstructures.493.3.1Default-probabilitytermstructures.493.3.2Inflationtermstructures.523.3.3Volatilitytermstructures.543.3.4Equityvolatilitystructures.553.3.5Interest-ratevolatilitystructures.584.Cashflowsandcoupons.634.1TheCashFlowclass.634.2Interest-ratecoupons.644.2.1Fixed-ratecoupons.664.2.2Floating-ratecoupons.684.2.3Example:
LIBORcoupons.734.2.4Example:
capped/flooredcoupons.78CONTENTS4.2.5Generatingcash-flowsequences.844.2.6Othercouponsandfurtherdevelopments.874.3Cash-flowanalysis.884.3.1Example:
fixed-ratebonds.915.Parameterizedmodelsandcalibration.985.1TheCalibrationHelperclass.985.1.1Example:
theHestonmodel.1035.2Parameters.1055.3TheCalibratedModelclass.1085.3.1Example:
theHestonmodel,continued.1146.TheMonteCarloframework.1176.1Pathgeneration.1176.1.1Random-numbergeneration.1176.1.2Stochasticprocesses.1216.1.3Randompathgenerators.1326.2Pricingonapath.1386.3Puttingitalltogether.1396.3.1MonteCarlotraits.1396.3.2TheMonteCarlomodel.1426.3.3MonteCarlosimulations.1456.3.4Example:
basketoption.1497.Thetreeframework.1557.1TheLatticeandDiscretizedAssetclasses.1557.1.1Example:
discretizedbonds.1617.1.2Example:
discretizedoption.1657.2Treesandtree-basedlattices.1687.2.1TheTreeclasstemplate.1687.2.2Binomialandtrinomialtrees.1727.2.3TheTreeLatticeclasstemplate.1827.3Tree-basedengines.1897.3.1Example:
callablefixed-ratebonds.1898.Thefinite-differenceframework.1958.1Theoldframework.1958.1.1Differentialoperators.1958.1.2Evolutionschemes.1988.1.3Boundaryconditions.2018.1.4Stepconditions.2058.1.5TheFiniteDifferenceModelclass.2078.1.6Example:
Americanoption.2128.1.7Time-dependentoperators.220CONTENTS8.2Thenewframework.2248.2.1Meshers.2268.2.2Operators.2298.2.3Examples:
Black-Scholesoperators.2388.2.4Initial,boundary,andstepconditions.2428.2.5Schemesandsolvers.2479.Conclusion.254A.Oddsandends.255Basictypes.255Datecalculations.256Datesandperiods.256Calendars.257Day-countconventions.259Schedules.260Finance-relatedclasses.261Marketquotes.262Interestrates.264Indexes.266Exercisesandpayoffs.272Math-relatedclasses.275Interpolations.275One-dimensionalsolvers.279Optimizers.281Statistics.285Linearalgebra.288Globalsettings.291Utilities.294Smartpointersandhandles.295Errorreporting.298Disposableobjects.300Designpatterns.303TheObserverpattern.303TheSingletonpattern.306TheVisitorpattern.307B.Codeconventions.310QuantLiblicense.312Bibliography.316CONTENTSiTheauthorhasusedgoodfaitheffortinpreparationofthisbook,butmakesnoexpressedorimpliedwarrantyofanykindanddisclaimswithoutlimitationallresponsibilityforerrorsoromissions.Noliabilityisassumedforincidentalorconsequentialdamagesinconnectionwithorarisingoutoftheuseoftheinformationorprogramscontainedherein.Useoftheinformationandinstructionsinthisbookisatyourownrisk.ThecoverimageisinthepublicdomainandavailablefromtheNewYorkPublicLibrary.ThecoverfontisOpenSansCondensed,releasedbySteveMattesonundertheApacheLicenseversion2.0.1.IntroductionWiththeenthusiasmofyouth,theQuantLibwebsiteusedtostatethatQuantLibaimedatbecoming“thestandardfree/open-sourcefinanciallibrary.”Byinterpretingsuchstatementabitloosely,onemightsaythatithassomewhatsucceededalbeitbyemployingtheratherdevioustrickofbeingthefirst,andthusforsometimetheonlyopen-sourcefinanciallibrary.Standardornot,theprojectisthriving;atthetimeofthiswriting,eachnewreleaseisdownloadedafewthousandtimes,thereisasteadystreamofcontributionsfromusers,andthelibraryseemstobeusedintherealworldasfarasIcanguessthroughtheusualshroudofsecrecyusedinthefinancialworld.Allinall,asaprojectadministrator,Icandeclaremyselfahappycamper.Butallthemoreforthat,thelackofproperdocumentationshows.Althoughadetailedclassreferenceisavailable(thatwasaneasytask,sinceitcanbegeneratedautomatically)itdoesntletoneseetheforestforthetrees;sothatanewusermightgettheimpressionthattheQuantLibdeveloperssharetheviewsoftheBellmanfromLewisCarrollsHuntingoftheSnark:
“WhatuseareMercatorsNorthPolesandEquators,Tropics,ZonesandMeridianLines?
”SotheBellmanwouldcry:
andthecrewwouldreply,“Theyaremerelyconventionalsigns!
”Thepurposeofthisbookistofillapartoftheexistingvoid.ItisareportonthedesignandimplementationofQuantLib,alikeinspiritbut,hopefully,withlessfrighteningresultstotheHowIdiditbookprominentlyfeaturedinMelBrooksYoungFrankenstein.IfyouareorwanttobeaQuantLibuser,youwillfindhereusefulinformationonthedesignofthelibrarythatmightnotbereadilyapparentwhenreadingthecode.Ifyoureworkinginquantitativefinance,evenifnotusingQuantLib,youcanstillreaditasafieldreportonthedesignofafinanciallibrary.Youwillfindthatitcoversissuesthatyoumightalsoface,aswellassomepossiblesolutionsandtheirrationale.Basedonyourconstraints,itispossibleevenlikelythatyouwillchooseothersolutions;butyoumightprofitfromthisdiscussionjustthesame.Inmydescriptions,Illalsopointoutshortcomingsinthecurrentimplementation;nottodisparagethelibrary(Imprettymuchinvolvedinit,afterall)butformoreusefulpurposes.Ontheonehand,describingtheexistingpitfallswillhelpdevelopersavoidthem;ontheotherhand,itmightshowhowtoimprovethelibrary.Indeed,italreadyhappenedthatreviewingthecodeforthisbookcausedmetogobackandmodifyitforthebetter.Afewgentleusershappenedtorefertoourlibraryas“theQuantLib.”AsmuchasIliketheexpression,modestyandhabithavesofarpreventedmefromusingit.Inthiscase,ofcourse,itwouldbe“Howwedidit.”1Introduction2Forreasonsofbothspaceandtime,Iwontbeabletocovereveryaspectofthelibrary.Inthefirsthalfofthebook,Illdescribeafewofthemostimportantclasses,suchasthosemodelingfinancialinstrumentsandtermstructures;thiswillgiveyouaviewofthelargerarchitectureofthelibrary.Inthesecondhalf,Illdescribeafewspecializedframeworks,suchasthoseusedforcreatingMonteCarloorfinite-differencesmodels.Someofthosearemorepolishedthanothers;Ihopethattheircurrentshortcomingswillbeasinterestingastheirstrongpoints.Thebookisprimarilyaimedatuserswantingtoextendthelibrarywiththeirowninstrumentsormodels;ifyoudesiretodoso,thedescriptionoftheavailableclasshierarchiesandframeworkswillprovideyouwithinformationaboutthehooksyouneedtointegrateyourcodewithQuantLibandtakeadvantageofitsfacilities.Ifyourenotthiskindofuser,dontclosethebookyet;youcanfindusefulinformationtoo.However,youmightwanttolookattheQuantLibPythonCookbookinstead.ItcanbeusefultoC+users,too.*Andnow,asistradition,afewnotesonthestyleandrequirementsofthisbook.KnowledgeofbothC+andquantitativefinanceisassumed.Ivenopretenseofbeingabletoteachyoueitherone,andthisbookisthickenoughalready.Here,IjustdescribetheimplementationanddesignofQuantLib;Illleaveittootherandbetterauthorstodescribetheproblemdomainononehand,andthelanguagesyntaxandtricksontheother.Asyoualreadynoticed,Illwriteinthefirstpersonsingular.True,itmightlookratherself-centeredasamatteroffact,Ihopeyoustillhaventputdownthebookinannoyancebutwewouldfeelratherpompousifweweretousethefirstpersonplural.Theauthorofthisbookfeelsthesameaboutusingthethirdperson.Afterabitofthinking,Ioptedforalessformalbutmorecomfortablestyle(which,asyounoted,alsoincludesaliberaluseofcontractions).Forthesamereason,Illbeaddressingyouinsteadoftheproverbialacutereader.Theuseofthesingularwillalsohelptoavoidconfusion;whenIusetheplural,IdescribeworkdonebytheQuantLibdevelopersasagroup.Iwilldescribetheevolutionofadesignwhenitisinterestingonitsown,orrelevantforthefinalresult.Forthesakeofclarity,inmostcasesIllskipovertheblindalleysandwrongturnstaken;puttogetherdesigndecisionswhichweremadeatdifferenttimes;andonlyshowthefinaldesign,sometimessimplified.Thiswillstillleavemewithplentytosay:
inthewordsoftheAlabamaShakes,“why”isanawfullotofquestion.IwillpointouttheuseofdesignpatternsinthecodeIdescribe.Mindyou,Imnotadvocatingcrammingyourcodewiththem;theyshouldbeappliedwhentheyreuseful,notfortheirownsake.However,QuantLibisnowtheresultofseveralyearsofcodingandrefactoring,bothbasedonuserfeedbac
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- Luigi Ballabio Implementing QuantLib 2020 2020