adfinx_analytics_fun..
adfinx_analytics_fun.. adfinx_analytics_fun..
AdfinX Analytics 1.0 Function Library User Guide
- Page 2 and 3: AdfinX Analytics 1.0 Function Libra
- Page 4 and 5: AdfinX Analytics 1.0 Function Libra
- Page 6 and 7: AdfinX Analytics 1.0 Function Libra
- Page 8 and 9: AdfinX Analytics 1.0 Function Libra
- Page 10 and 11: AdfinX Analytics 1.0 Function Libra
- Page 12 and 13: AdfinX Analytics 1.0 Function Libra
- Page 14 and 15: AdfinX Analytics 1.0 Function Libra
- Page 16 and 17: AdfinX Analytics 1.0 Function Libra
- Page 18 and 19: AdfinX Analytics 1.0 Function Libra
- Page 20 and 21: AdfinX Analytics 1.0 Function Libra
- Page 22 and 23: AdfinX Analytics 1.0 Function Libra
- Page 24 and 25: AdfinX Analytics 1.0 Function Libra
- Page 26 and 27: AdfinX Analytics 1.0 Function Libra
- Page 28 and 29: AdfinX Analytics 1.0 Function Libra
- Page 30 and 31: AdfinX Analytics 1.0 Function Libra
- Page 32 and 33: AdfinX Analytics 1.0 Function Libra
- Page 34 and 35: AdfinX Analytics 1.0 Function Libra
- Page 36 and 37: AdfinX Analytics 1.0 Function Libra
- Page 38 and 39: AdfinX Analytics 1.0 Function Libra
- Page 40 and 41: AdfinX Analytics 1.0 Function Libra
- Page 42 and 43: AdfinX Analytics 1.0 Function Libra
- Page 44 and 45: AdfinX Analytics 1.0 Function Libra
- Page 46 and 47: AdfinX Analytics 1.0 Function Libra
- Page 48 and 49: AdfinX Analytics 1.0 Function Libra
- Page 50 and 51: AdfinX Analytics 1.0 Function Libra
AdfinX Analytics 1.0 Function Library<br />
User Guide
AdfinX Analytics 1.0 Function Library – User Guide<br />
AdfinX Analytics 1.0 Function Library – User Guide<br />
Last Revised 03 April 03<br />
Copyright © 2003 Reuters. All rights reserved.<br />
Except as permitted by law, no part of this document may be reproduced or transmitted by any process or means without the<br />
prior consent of Reuters. Reuters, by publishing this document, does not guarantee that any information contained herein is and<br />
will remain accurate or that use of the information will ensure correct and faultless operation of the relevant service or<br />
equipment. Reuters, its agents, and employees shall not be held liable to or through any user for any loss or damage<br />
whatsoever resulting from reliance on the information contained herein.<br />
Reuters and the Reuters sphere logo are registered trademarks and trademarks of the Reuters group of companies around the<br />
world.<br />
ADFIN, KOBRA, and KONDOR are registered trademarks, and Reuters Analytic Data System (ADS), Reuters CashFlow (RCF),<br />
Reuters Data Contribution Servers (DCS), Reuters Data Transformation System (DTS), Reuters Dealing 2000-2, Reuters<br />
Dealing 3000, Reuters Enterprise Licensing System (ELS), Reuters Integrated Data Network (IDN), Reuters KreditNet, Reuters<br />
KVAR+, Reuters Market Data System (RMDS), Reuters Network Management System (NMS), Reuters News 2000, Reuters<br />
Optimizing Contribution Server (OCS), Reuters Risk@ccess, Reuters Trade@ccess, Reuters Trade Processing (RTP), Reuters<br />
Triarch are trademarks of the Reuters group of companies around the world.<br />
Adobe, Acrobat, FrameMaker, and PostScript are trademarks of Adobe Systems Inc. BEA WebLogic Server is a trademark of<br />
BEA Systems. Clearing21 is a registered trademark of CLEARNET S.A. Hewlett-Packard is a registered trademark of Hewlett-<br />
Packard Company. IBM is a registered trademark, and IBM AIX, RISC System/6000 (RS6000), and Power PC are trademarks<br />
of International Business Machines Corporation. Intel is a registered trademark of Intel Corp. Java, Solaris, Sun, and SunOS are<br />
trademarks or registered trademarks of Sun Microsystems Inc. in the U.S.A. and other countries. libwww: Copyright © 1994-<br />
2000 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et<br />
en Automatique, Keio University). All Rights Reserved. See W3C License http://www.w3.org/Consortium/Legal/ for more details.<br />
Copyright © 1995 CERN.Reuters ADS includes computer software created and made available by CERN. This acknowledgment<br />
shall be mentioned in full in any product which includes the CERN computer software included herein or parts thereof. Microsoft,<br />
MS-DOS, Visual Basic, Windows, Windows NT, Windows XP, and Windows 2000 are registered trademarks, and ActiveX,<br />
Microsoft Excel, Microsoft Internet Explorer, and Microsoft Word are products of Microsoft Corp. in the U.S.A. and other<br />
countries. MOTIF is a trademark of the Open Software Foundation in the U.S.A. and other countries. Netscape is a registered<br />
trademark of Netscape Communications Corporation in the U.S.A. and other countries. NuTCRACKER is a registered trademark<br />
of MKS. Olectra and Olectra Chart are trademarks of KL Group Inc. OPEN LOOK is a registered trademark of Novell Inc. Oracle<br />
is a trademark of Oracle Corporation. PASSOLO is a registered trademark of PASS Engineering GmbH in Germany.PowerTier<br />
is a trademark of Persistence Software Inc. in the U.S.A. and other countries. RiskMetrics is a trademark of J.P. Morgan.<br />
SYBASE is a registered trademark, SYBASE SQL is a trademark, SYBASE Adaptive Server, SYBASE Open Client, SYBASE<br />
Open Server, SYBASE Replication Server, and SYBASE RSSD, are products of SYBASE Inc. SPARC trademarks are<br />
trademarks or registered trademarks of SPARC International Inc. licensed exclusively to Sun Microsystems Inc. UNIX is a<br />
registered trademark in the U.S.A. and other countries, licensed exclusively through X/Open Company Limited. TIB and TIBCO<br />
are registered trademarks, and TIBCO Information Cache, TIBCO Hawk, and TIBCO Rendezvous are trademarks of TIBCO<br />
Software Inc. Visigenic and VisiBroker are trademarks of Visigenic Software Inc. X Window System is a trademark of<br />
Massachusetts Institute of Technology.<br />
Acknowledgement is made to all other brand or product names referred to in the text that are registered trademarks,<br />
trademarks, or trade names of their respective owners.<br />
Your comments are welcome<br />
Please provide feedback on the Reuters guides and on-line help by sending your comments by e-mail to: rfs-doc@reuters.com.<br />
Published by Reuters, 85 Fleet Street, London, EC4P 4AJ, UK.<br />
2
AdfinX Analytics 1.0 Function Library – User Guide<br />
TABLE OF CONTENTS<br />
1. ADFINX ADXMODULE CONTROL .............................................................................10<br />
1.1. ADXMODULE PROPERTIES..................................................................................................... 10<br />
1.1.1. ErrorCode................................................................................................................................ 10<br />
1.1.2. ErrorMode ............................................................................................................................... 10<br />
1.1.3. ErrorString............................................................................................................................... 10<br />
1.2. ADXMODULE METHODS.......................................................................................................... 11<br />
1.2.1. AdDepToFra............................................................................................................................ 11<br />
1.2.2. AdDepToFraBA....................................................................................................................... 12<br />
1.2.3. AdFormat................................................................................................................................. 12<br />
1.2.4. AdHistoryUpdate ..................................................................................................................... 13<br />
1.2.5. AdHistoryValue ....................................................................................................................... 13<br />
1.2.6. AdInterp................................................................................................................................... 13<br />
1.2.7. AdParse................................................................................................................................... 14<br />
1.2.8. AdRateConv............................................................................................................................ 14<br />
1.2.9. AdRound ................................................................................................................................. 15<br />
1.2.10. AdZcToFraBA...................................................................................................................... 15<br />
1.2.11. DfAddMonths....................................................................................................................... 16<br />
1.2.12. DfAddPeriod ........................................................................................................................ 16<br />
1.2.13. DfAddYears ......................................................................................................................... 17<br />
1.2.14. DfAddWD............................................................................................................................. 17<br />
1.2.15. DfAdjustToWD..................................................................................................................... 18<br />
1.2.16. DfCountDays ....................................................................................................................... 18<br />
1.2.17. DfCountNonWD................................................................................................................... 19<br />
1.2.18. DfCountWD.......................................................................................................................... 19<br />
1.2.19. DfCountYears ...................................................................................................................... 19<br />
1.2.20. DfFindDateD........................................................................................................................ 20<br />
1.2.21. DfFindDateM ....................................................................................................................... 20<br />
1.2.22. DfFormatDate ...................................................................................................................... 21<br />
1.2.23. DfIDNDate ........................................................................................................................... 21<br />
1.2.24. DfIsWD ................................................................................................................................ 21<br />
1.2.25. DfLastWD ............................................................................................................................ 22<br />
1.2.26. DfListHolidays...................................................................................................................... 22<br />
1.2.27. AdDefAttribute ..................................................................................................................... 22<br />
1.2.28. AdDefSet ............................................................................................................................. 23<br />
1.2.29. AdDefStructure .................................................................................................................... 23<br />
1.2.30. AdReadParam .....................................................................................................................23<br />
3
AdfinX Analytics 1.0 Function Library – User Guide<br />
1.2.31. AdStyleAttribute................................................................................................................... 24<br />
1.2.32. AdStyleDelete...................................................................................................................... 24<br />
1.2.33. AdStyleName....................................................................................................................... 24<br />
1.2.34. AdStyleSet........................................................................................................................... 25<br />
1.2.35. AdStyleStructure.................................................................................................................. 25<br />
1.2.36. AdWriteParam ..................................................................................................................... 26<br />
1.2.37. DisplayDefaults.................................................................................................................... 26<br />
1.2.38. DisplayStyles ....................................................................................................................... 26<br />
1.2.39. MaxDate .............................................................................................................................. 27<br />
1.2.40. MinDate ............................................................................................................................... 27<br />
1.2.41. NormalC............................................................................................................................... 27<br />
1.2.42. NormalS............................................................................................................................... 28<br />
1.2.43. SetReferenceDates ............................................................................................................. 28<br />
2. ADFINX ADXBONDMODULE CONTROL...................................................................29<br />
2.1. ADXBONDMODULE PROPERTIES .......................................................................................... 29<br />
2.1.1. ErrorCode................................................................................................................................ 29<br />
2.1.2. ErrorMode ............................................................................................................................... 29<br />
2.1.3. ErrorString............................................................................................................................... 29<br />
2.2. ADXBONDMODULE METHODS................................................................................................ 30<br />
2.2.1. Accrued ................................................................................................................................... 30<br />
2.2.2. AdBondDeriv ........................................................................................................................... 30<br />
2.2.3. AdBondPrice ........................................................................................................................... 31<br />
2.2.4. AdBondSpread........................................................................................................................ 32<br />
2.2.5. AdBondYield ........................................................................................................................... 33<br />
2.2.6. BdCalcCpn .............................................................................................................................. 34<br />
2.2.7. BdCashFlows .......................................................................................................................... 34<br />
2.2.8. BdConvFactor ......................................................................................................................... 35<br />
2.2.9. BdCpnCrv................................................................................................................................ 35<br />
2.2.10. BdCpnValue ........................................................................................................................ 36<br />
2.2.11. BdIrsStructure...................................................................................................................... 36<br />
2.2.12. BdPvbpCrv........................................................................................................................... 37<br />
2.2.13. BdRepo................................................................................................................................ 37<br />
2.2.14. BdSettle ............................................................................................................................... 38<br />
2.2.15. BdSettleLock ....................................................................................................................... 39<br />
2.2.16. CfAvgLife ............................................................................................................................. 39<br />
2.2.17. CfConv................................................................................................................................. 39<br />
2.2.18. CfDur ................................................................................................................................... 40<br />
2.2.19. CfPvbp................................................................................................................................. 40<br />
4
AdfinX Analytics 1.0 Function Library – User Guide<br />
2.2.20. CfPx ..................................................................................................................................... 41<br />
2.2.21. CfPxCrv ............................................................................................................................... 41<br />
2.2.22. CfRepo................................................................................................................................. 41<br />
2.2.23. CfVol .................................................................................................................................... 42<br />
2.2.24. CfYld .................................................................................................................................... 43<br />
2.2.25. CpnNext............................................................................................................................... 43<br />
2.2.26. CpnNumber ......................................................................................................................... 44<br />
2.2.27. CpnPrev............................................................................................................................... 44<br />
2.2.28. IlbCalcCpn ........................................................................................................................... 44<br />
2.2.29. IlbCashFlows ....................................................................................................................... 45<br />
2.2.30. IlbPx..................................................................................................................................... 46<br />
2.2.31. IlbYld.................................................................................................................................... 47<br />
3. ADFINX ADXCONVBONDMODULE CONTROL ........................................................48<br />
3.1. ADXCONVBONDMODULE PROPERTIES................................................................................ 48<br />
3.1.1. ErrorCode................................................................................................................................ 48<br />
3.1.2. ErrorMode ............................................................................................................................... 48<br />
3.1.3. ErrorString............................................................................................................................... 49<br />
3.2. ADXCONVBONDMODULE METHODS ..................................................................................... 49<br />
3.2.1. AdConvBdDeriv....................................................................................................................... 49<br />
3.2.2. AdConvCalcCpn...................................................................................................................... 50<br />
3.2.3. AdConvCashFlows.................................................................................................................. 50<br />
3.2.4. AdConvImpliedVol................................................................................................................... 51<br />
3.2.5. AdConvOpDeriv ...................................................................................................................... 51<br />
3.2.6. AdConvPrice ........................................................................................................................... 52<br />
3.2.7. AdConvRatios ......................................................................................................................... 53<br />
3.2.8. AdConvYield ........................................................................................................................... 53<br />
4. ADFINX ADXCREDITMODULE CONTROL ................................................................54<br />
4.1. ADXCREDITMODULE PROPERTIES ....................................................................................... 54<br />
4.1.1. ErrorCode................................................................................................................................ 54<br />
4.1.2. ErrorMode ............................................................................................................................... 54<br />
4.1.3. ErrorString............................................................................................................................... 54<br />
4.2. ADXCREDITMODULE METHODS............................................................................................. 55<br />
4.2.1. AdCdsNpv ............................................................................................................................... 55<br />
4.2.2. AdCdsSpread.......................................................................................................................... 56<br />
4.2.3. AdFxCdsNpv ........................................................................................................................... 57<br />
4.2.4. AdFxCdsSpread...................................................................................................................... 57<br />
4.2.5. AdCreditStructure.................................................................................................................... 58<br />
5
AdfinX Analytics 1.0 Function Library – User Guide<br />
4.2.6. AdCreditZcCurve..................................................................................................................... 59<br />
4.2.7. AdDefaultProba....................................................................................................................... 60<br />
4.2.8. AdJLTCreditStructure.............................................................................................................. 61<br />
5. ADFINX ADXEXOTICMODULE CONTROL ................................................................62<br />
5.1. ADXEXOTICMODULE PROPERTIES ....................................................................................... 62<br />
5.1.1. ErrorCode................................................................................................................................ 62<br />
5.1.2. ErrorMode ............................................................................................................................... 62<br />
5.1.3. ErrorString............................................................................................................................... 63<br />
5.2. ADXEXOTICMODULE METHODS............................................................................................. 63<br />
5.2.1. OpAsianDeriv .......................................................................................................................... 63<br />
5.2.2. OpAsianImpliedVol.................................................................................................................. 64<br />
5.2.3. OpAsianPremium .................................................................................................................... 65<br />
5.2.4. OpBarrierDeriv ........................................................................................................................ 66<br />
5.2.5. OpBarrierImpliedVol................................................................................................................ 67<br />
5.2.6. OpBarrierPremium .................................................................................................................. 67<br />
5.2.7. OpBasketDeriv ........................................................................................................................ 68<br />
5.2.8. OpBasketPremium .................................................................................................................. 69<br />
5.2.9. OpBinaryDeriv......................................................................................................................... 69<br />
5.2.10. OpBinaryImpliedVol............................................................................................................. 70<br />
5.2.11. OpBinaryPremium ............................................................................................................... 71<br />
5.2.12. OpChooserDeriv..................................................................................................................72<br />
5.2.13. OpChooserImpliedVol ......................................................................................................... 73<br />
5.2.14. OpChooserPremium............................................................................................................ 73<br />
5.2.15. OpCliquetDeriv .................................................................................................................... 74<br />
5.2.16. OpCliquetImpliedVol............................................................................................................ 75<br />
5.2.17. OpCliquetPremium .............................................................................................................. 76<br />
5.2.18. OpCompoundDeriv.............................................................................................................. 76<br />
5.2.19. OpCompoundImpliedVol ..................................................................................................... 77<br />
5.2.20. OpCompoundPremium........................................................................................................ 78<br />
5.2.21. OpDoubleBarrierDeriv ......................................................................................................... 79<br />
5.2.22. OpDoubleBarrierImpliedVol................................................................................................. 80<br />
5.2.23. OpDoubleBarrierPremium ................................................................................................... 80<br />
5.2.24. OpExLookbackDeriv............................................................................................................ 81<br />
5.2.25. OpExLookbackImpliedVol ................................................................................................... 82<br />
5.2.26. OpExLookbackPremium...................................................................................................... 83<br />
5.2.27. OpFxLinkedDeriv.................................................................................................................83<br />
5.2.28. OpFxLinkedImpliedVol ........................................................................................................ 85<br />
5.2.29. OpFxLinkedPremium........................................................................................................... 86<br />
6
AdfinX Analytics 1.0 Function Library – User Guide<br />
5.2.30. OpPowerDeriv ..................................................................................................................... 86<br />
5.2.31. OpPowerImpliedVol............................................................................................................. 87<br />
5.2.32. OpPowerPremium ............................................................................................................... 88<br />
5.2.33. OpRainbowDeriv ................................................................................................................. 89<br />
5.2.34. OpRainbowPremium ........................................................................................................... 90<br />
6. ADFINX ADXFOREXMODULE CONTROL .................................................................92<br />
6.1. ADXFOREXMODULE PROPERTIES ........................................................................................ 92<br />
6.1.1. ErrorCode................................................................................................................................ 92<br />
6.1.2. ErrorMode ............................................................................................................................... 92<br />
6.1.3. ErrorString............................................................................................................................... 92<br />
6.2. ADXFOREXMODULE METHODS.............................................................................................. 93<br />
6.2.1. FxCalcPeriod........................................................................................................................... 93<br />
6.2.2. FxCross................................................................................................................................... 94<br />
6.2.3. FxCrossA................................................................................................................................. 94<br />
6.2.4. FxCrossD ................................................................................................................................ 95<br />
6.2.5. FxDepToSwpD........................................................................................................................ 95<br />
6.2.6. FxDepToSwpP ........................................................................................................................ 96<br />
6.2.7. FxGenCalc .............................................................................................................................. 97<br />
6.2.8. FxGenParse ............................................................................................................................ 98<br />
6.2.9. FxSwpToDepD........................................................................................................................ 98<br />
6.2.10. FxSwpToDepP .................................................................................................................... 99<br />
6.2.11. FxSwpToOut...................................................................................................................... 100<br />
6.2.12. FxSwpToSwp .................................................................................................................... 101<br />
6.2.13. FxSwpToSwpD.................................................................................................................. 101<br />
6.2.14. FxSwpToSwpP .................................................................................................................. 102<br />
7. ADFINX ADXOPTIONMODULE CONTROL..............................................................103<br />
7.1. ADXOPTIONMODULE PROPERTIES..................................................................................... 103<br />
7.1.1. ErrorCode.............................................................................................................................. 103<br />
7.1.2. ErrorMode ............................................................................................................................. 103<br />
7.1.3. ErrorString............................................................................................................................. 103<br />
7.2. ADXOPTIONMODULE METHODS .......................................................................................... 104<br />
7.2.1. AdBarrierCapFloorCaplets.................................................................................................... 104<br />
7.2.2. AdBarrierCapFloorDeriv........................................................................................................ 105<br />
7.2.3. AdBarrierCapFloorImpliedVol ............................................................................................... 106<br />
7.2.4. AdBarrierCapFloorPremium.................................................................................................. 107<br />
7.2.5. AdBondOptionDeriv .............................................................................................................. 108<br />
7.2.6. AdBondOptionPremium ........................................................................................................ 109<br />
7
AdfinX Analytics 1.0 Function Library – User Guide<br />
7.2.7. AdCapFloorCaplets............................................................................................................... 109<br />
7.2.8. AdCapFloorDeriv................................................................................................................... 110<br />
7.2.9. AdCapFloorImpliedVol .......................................................................................................... 111<br />
7.2.10. AdCapFloorPremium ......................................................................................................... 112<br />
7.2.11. AdDigitalCapFloorCaplets ................................................................................................. 113<br />
7.2.12. AdDigitalCapFloorDeriv..................................................................................................... 114<br />
7.2.13. AdDigitalCapFloorImpliedVol............................................................................................. 115<br />
7.2.14. AdDigitalCapFloorPremium............................................................................................... 116<br />
7.2.15. AdSwaptionDeriv ............................................................................................................... 116<br />
7.2.16. AdSwaptionPremium ......................................................................................................... 117<br />
7.2.17. OpCalcDeriv ...................................................................................................................... 118<br />
7.2.18. OpHistVol........................................................................................................................... 119<br />
7.2.19. OpImpliedVol ..................................................................................................................... 120<br />
7.2.20. OpPremium........................................................................................................................ 120<br />
8. ADFINX ADXSWAPMODULE CONTROL.................................................................122<br />
8.1. ADXSWAPMODULE PROPERTIES ........................................................................................ 122<br />
8.1.1. ErrorCode.............................................................................................................................. 122<br />
8.1.2. ErrorMode ............................................................................................................................. 122<br />
8.1.3. ErrorString............................................................................................................................. 122<br />
8.2. ADXSWAPMODULE METHODS ............................................................................................. 123<br />
8.2.1. FrnCalcCpn ........................................................................................................................... 123<br />
8.2.2. FrnCashFlows ....................................................................................................................... 124<br />
8.2.3. FrnMargin.............................................................................................................................. 125<br />
8.2.4. FrnPx..................................................................................................................................... 125<br />
8.2.5. SwCsCashFlows ................................................................................................................... 126<br />
8.2.6. SwCsPx................................................................................................................................. 127<br />
8.2.7. SwCsSolve............................................................................................................................ 128<br />
8.2.8. SwIrsCashFlows ................................................................................................................... 129<br />
8.2.9. SwIrsCpnDates ..................................................................................................................... 130<br />
8.2.10. SwIrsPvbpCrv.................................................................................................................... 131<br />
8.2.11. SwIrsPx.............................................................................................................................. 132<br />
8.2.12. SwIrsSolve......................................................................................................................... 132<br />
8.2.13. SwSwpExtend ................................................................................................................... 133<br />
9. ADFINX ADXYIELDCURVEMODULE CONTROL ....................................................135<br />
9.1. ADXYIELDCURVEMODULE PROPERTIES............................................................................ 135<br />
9.1.1. ErrorCode.............................................................................................................................. 135<br />
9.1.2. ErrorMode ............................................................................................................................. 135<br />
8
AdfinX Analytics 1.0 Function Library – User Guide<br />
9.1.3. ErrorString............................................................................................................................. 136<br />
9.2. ADXYIELDCURVEMODULE METHODS................................................................................. 136<br />
9.2.1. AdCalibrate............................................................................................................................ 136<br />
9.2.2. AdFutCodes .......................................................................................................................... 138<br />
9.2.3. AdFutDates ........................................................................................................................... 138<br />
9.2.4. AdRate .................................................................................................................................. 138<br />
9.2.5. AdTermStructure................................................................................................................... 139<br />
10. GENERAL IDENTIFIERS...........................................................................................142<br />
10.1. ERRORMODE ...................................................................................................................... 142<br />
10.1.1. AdxErrorMode ................................................................................................................... 142<br />
11. BACKWARD COMPATIBILITY .................................................................................143<br />
11.1. COMPATIBILITY................................................................................................................... 143<br />
11.2. NAMING DIFFERENCES ..................................................................................................... 143<br />
11.3. HOW TO MIGRATE YOUR CODE ..................................................................................... 144<br />
12. TROUBLESHOOTING ...............................................................................................145<br />
9
AdfinX Analytics 1.0 Function Library – User Guide<br />
1. ADFINX ADXMODULE CONTROL<br />
1.1. ADXMODULE PROPERTIES<br />
1.1.1. ErrorCode<br />
ErrorCode() As Long<br />
The ErrorCode property of the AdxModule control retrieves the last error code generated by the<br />
object.<br />
Arguments<br />
This property takes no argument.<br />
Example<br />
Dim mo as AdxModule : Declares an object of v type AdxModule<br />
Set mo = New AdxModule : Creates an AdxModule object<br />
If mo.ErrorCode 0 Then : mo.ErrorCode contains the error<br />
MsgBox (mo.ErrorCode) : Displays the error code in a message box<br />
End If<br />
1.1.2. ErrorMode<br />
ErrorMode() As AdxErrorMode<br />
The ErrorMode property of the AdxModule component sets the error mode of the AdxModule.<br />
Three modes are defined:<br />
DIALOGBOX : In this mode a dialog box is displayed when an error occurs<br />
EXCEPTION : In this mode an exception is thrown when an error occurs<br />
NO_EXCEPTION : In this mode the user must call the property ErrorCode to know the<br />
error encountered<br />
Arguments<br />
This property takes no argument.<br />
Note<br />
By default the error mode is set to EXCEPTION.<br />
Example<br />
Dim mo as AdxModule : Declares an object of type AdxModule<br />
Set mo = New AdxModule : Creates an AdxModule object<br />
mo.ErrorMode = NO_EXCEPTION : mo.ErrorMode is set to NO_EXCEPTION<br />
1.1.3. ErrorString<br />
ErrorString() As String<br />
The ErrorString property of the AdxModule retrieves the last error code generated by the<br />
object with the associated error string.<br />
10
AdfinX Analytics 1.0 Function Library – User Guide<br />
Arguments<br />
This property takes no argument.<br />
Example<br />
Dim mo as AdxModule : Declares an object of type AdxModule<br />
Set mo = New AdxModule : Creates an AdxModule object<br />
mo.ErrorMode = EXCEPTION : mo.ErrorMode must be set to EXCEPTION to use the<br />
ErrorString<br />
On Error Go To Handle : Error handler executes code after Handle when an error<br />
occurs<br />
RES = mo.DfIsWD("EUR", "05-MAR-01", "LAY:V")<br />
: The calendar code is incorrect. The <strong>fun</strong>ction DfIsWD returns<br />
an error<br />
Exit Sub : Exits sub or <strong>fun</strong>ction before the handle or code will be<br />
executed<br />
Handle<br />
MsgBox(mo.ErrorString) : Displays the ErrorString in a message box<br />
mo.ErrorString contains the ErrorString (‘Error#f000 –<br />
Calendars:Calendar(s) not found.’)<br />
1.2. ADXMODULE METHODS<br />
1.2.1. AdDepToFra<br />
AdDepToFra(Date1 As Variant, Date2 As Variant, Date3 as Variant, RateMode As<br />
String, Rate1 As Double, Rate3 As Double) As Double<br />
Calculates a forward rate.<br />
The type of rate used for Rate1, Rate3 and the returned rate must be specified in the RateMode<br />
argument with the either the keyword RATES or all three keywords R1, R2 and R3.<br />
Arguments<br />
Date1 : First date<br />
Date2 : Second date<br />
Date3 : Third date<br />
RateMode : Extended argument defining the type of rates used<br />
Rate1 : Rate applicable for the period from Date1 to Date2<br />
Rate3 : Rate applicable for the period from Date1 to Date3<br />
Return Value<br />
The rate applicable for the period from Date2 to Date3.<br />
11
AdfinX Analytics 1.0 Function Library – User Guide<br />
1.2.2. AdDepToFraBA<br />
AdDepToFraBA(Date1 As Variant, Date2 As Variant, Date3 As Variant, RateMode As<br />
String, Rate1BA As Variant, Rate3BA As Variant) As Variant<br />
Calculates forward bid and ask rates.<br />
The type of rate used for Rate1BA, Rate3BA and the returned rates must be specified in the<br />
RateMode argument with either the keyword RATES or all three keywords R1, R2 and R3.<br />
Arguments<br />
Date1 : First date<br />
Date2 : Second date<br />
Date3 : Third date<br />
RateMode : Extended argument defining the type of rates used<br />
Rate1BA : Rates applicable for the period from Date1 to Date2 (array Bid/Ask)<br />
Rate3BA : Rates applicable for the period from Date1 to Date3 (array Bid/Ask)<br />
Return Value<br />
The return value depends on the value of RateMode. The default value is a vertical 2-element array<br />
containing:<br />
Rate2B : Bid side of the rate applicable for the period from Date2 to Date3<br />
Rate2A : Ask side of the rate applicable for the period from Date2 to Date3<br />
1.2.3. AdFormat<br />
AdFormat(Data As Variant, BidDecimals As Integer, AskDigits As Integer,<br />
FormatMode As String) As String<br />
Converts a decimal number to a fraction or displays a bid/ask array as a string using the bid/ask<br />
format.<br />
Arguments<br />
Data : Decimal number or array of bid and ask values to format<br />
BidDecimals :<br />
Number of decimals of the fractional component (for fraction formatting) or of<br />
the bid side (for bid/ask formatting)<br />
AskDigits : Number of last digits of the ask side (applicable for bid/ask formatting only)<br />
FormatMode : Extended argument customizing the return value<br />
Return Value<br />
The formatted string.<br />
Note<br />
To get a rate in the Ask/Bid format, switch the bid and ask array arguments and set the BACTRL<br />
keyword as desired in FormatMode.<br />
Examples<br />
AdFormat(7.5,0,0,"FD:32") equals the string "7 * 16".<br />
AdFormat(7.5,0,0,"FD:32 FSEP:^-^ FSHOW") equals the string "7 - 16/32".<br />
12
AdfinX Analytics 1.0 Function Library – User Guide<br />
AdFormat({1.235,1.264},3,2,"BASEP:-") equals the string "1.235-64".<br />
1.2.4. AdHistoryUpdate<br />
AdHistoryUpdate(IndexName As String, DateArray As Variant, ValueArray As<br />
Variant) As Double<br />
Adds new values to the index history database.<br />
Arguments<br />
IndexName : Index history style name<br />
DateArray : Array of dates<br />
ValueArray : Array of historical values<br />
Return Value<br />
1 if successful.<br />
1.2.5. AdHistoryValue<br />
AdHistoryValue(IndexName As String, StyleMode As String) As Variant<br />
Retrieves the latest historical value available in the database for an index history style.<br />
Arguments<br />
IndexName :<br />
StyleMode :<br />
Index history style name<br />
Extended argument customizing the return value<br />
Return Value<br />
The return value depends on the value of StyleMode. The default value is a 2-element array<br />
containing:<br />
LatestDate : Date corresponding to the latest historical value available<br />
LatestValue : Value of the index for that date<br />
1.2.6. AdInterp<br />
AdInterp(X As Variant, XArray As Variant, YArray As Variant, InterpMode As<br />
String) As Double<br />
Interpolates a point from a curve according to a linear or cubic spline method.<br />
To define the type of the interpolation, use the IM keyword in InterpMode.<br />
If the calculation date s not within the range of the date array DateArray, the <strong>fun</strong>ction may either<br />
extrapolate or return an error message depending on value of the OBC keyword.<br />
Arguments<br />
X : Calculation date (x j<br />
corresponding to the interpolated y j<br />
)<br />
13
AdfinX Analytics 1.0 Function Library – User Guide<br />
XArray : Array of dates (x i<br />
)<br />
YArray : Array of values (y i<br />
= f(x i<br />
))<br />
InterpMode : Extended argument defining the interpolation<br />
Return Value<br />
The value interpolated (y j<br />
).<br />
1.2.7. AdParse<br />
AdParse(DataString As String, ParseMode As String) As Variant<br />
Parses a data string formatted in fraction or bid/ask format.<br />
To define the type of parsing, use the PDF and PDT keywords in ParseMode.<br />
Arguments<br />
DataString : BidAsk string<br />
ParseMode : Extended argument defining the parsing mode<br />
Return Value<br />
The return value depends on the value of ParseMode. The default value is a 2-element array<br />
containing:<br />
Bid : Bid value<br />
Ask : Ask value<br />
1.2.8. AdRateConv<br />
AdRateConv(StartDate As Variant, EndDate As Variant, RateMode As String, Rate<br />
As Double) As Double<br />
Converts a rate from one type to another.<br />
The type of rate used for Rate and the returned rate must be specified in the RateMode argument<br />
with the keywords FROM and TO.<br />
Arguments<br />
StartDate : Start date of the period<br />
EndDate : End date of the period<br />
RateMode : Extended argument defining the type of the conversion<br />
Rate : Rate to be converted<br />
Return Value<br />
The converted rate.<br />
14
AdfinX Analytics 1.0 Function Library – User Guide<br />
1.2.9. AdRound<br />
AdRound(Value As Double, Tick As Double, RoundMode As String) As Double<br />
Rounds a number to the nearest tick.<br />
Arguments<br />
Value : Number to be rounded<br />
Tick : Rounding tick<br />
RoundMode : Extended argument defining the type of the rounding.<br />
Return Value<br />
The rounded number.<br />
Note<br />
By default the <strong>fun</strong>ction rounds the number to the nearest possible value, but it is also possible to round<br />
the number down or up using respectively the keyword DOWN or UP in RoundMode.<br />
1.2.10. AdZcToFraBA<br />
AdZcToFraBA(StirFutStructure As String, StartDate As Variant, Period As<br />
String, ZcArray As Variant, YcMode As String) As Variant<br />
Calculates a FRA bid and ask rates from a zero-coupon yield curve.<br />
To indicate the zero-coupon yield curve type (rates or discount factors), use the ZCTYPE keyword in<br />
YcMode.<br />
Arguments<br />
StirFutStructure : Extended argument defining the STIR futures contract<br />
StartDate : FRA starting date<br />
Period : FRA maturity date (expressed as a date or a code such as "1Y")<br />
ZcArray : Array of zero-coupon dates and rates or discount factors<br />
YcMode : Extended argument customizing the return value<br />
Return Value<br />
The return value depends on the value of YcMode. The default value is a vertical 3-element array<br />
containing:<br />
FraBid : FRA bid rate<br />
FraAsk : FRA ask rate<br />
NbDays : Number of days covered by the FRA<br />
Notes<br />
The StirFutStructure argument is included in this <strong>fun</strong>ction to define the calendar and the<br />
year basis used for FRA calculations.<br />
The BWB keyword in YcMode can be used to monitor the spread of the calculated FRA.<br />
"BWB:NO" calculates synthetic prices with a larger spread whereas "BWB:YES" retrieves market<br />
prices which is needed for instance for IMM FRAs.<br />
15
AdfinX Analytics 1.0 Function Library – User Guide<br />
The NFVP and PFVP keywords in YcMode can be used to customize how broken FRAs are<br />
calculated. The standard method consists in interpolating the FRA rate from the 2 bounding fixing<br />
rates but it is possible to apply the previous fixing for some days after the fixing date (PFVP) and/or<br />
the next fixing for some days before the fixing date (NFVP).<br />
1.2.11. DfAddMonths<br />
DfAddMonths(Calendars As String, CalcDate As Variant, NbMonths As Integer,<br />
DfMode As String) As Variant<br />
Adds a number of months to a date.<br />
Arguments<br />
Calendars : String of calendar codes (example: "FRA,UKG")<br />
CalcDate : Calculation date<br />
NbMonths : Number of months<br />
DfMode : Extended argument customizing the return value<br />
Return Value<br />
Returns the date computed by adding NbMonths to CalcDate.<br />
Note<br />
If the computed date falls on a non-working day, the date moving convention specified in DfMode<br />
with the keyword DMC (or the default value if not specified) applies. If CalcDate falls on the last<br />
working day of the month, the return date may also vary depending on the end-of-month convention<br />
defined as default or specified in DfMode with the keyword EMC.<br />
1.2.12. DfAddPeriod<br />
DfAddPeriod(Calendars As String, CalcDate As Variant, Period As String, DfMode<br />
As String) As Variant<br />
Adds a period (number of calendar days, working days, weeks, months or years) to a date.<br />
Arguments<br />
Calendars : String of calendar codes (example: "FRA,UKG")<br />
CalcDate : Calculation date<br />
Period : Period code {iD, iM, iW, iWD, iY, with i as integer}<br />
iD i calendar days<br />
iM i months<br />
iW i weeks<br />
iWD i working days (from -366 to 366)<br />
iY i years<br />
DfMode : Extended argument customizing the return value<br />
Return Value<br />
The return value depends on the value of DfMode. The default value is a vertical 2-cell array<br />
containing:<br />
ComputedDate : Date computed by adding Period to CalcDate.<br />
16
AdfinX Analytics 1.0 Function Library – User Guide<br />
If this date falls on a non-working day, the date moving convention<br />
specified in DfMode with the keyword DMC (or the default value if<br />
not specified) applies.<br />
If CalcDate falls on the last working day of the month, the computed<br />
date may also vary depending on the end-of-month convention defined<br />
as default or specified in DfMode with the keyword EMC.<br />
Adjustement : String indicated why CalcDate was adjusted if applicable.<br />
Notes<br />
It is possible to combine two period calculations within the same Period argument (e.g. iYjM<br />
for adding i years and j months to CalcDate).<br />
When Period stands for a given number of working days (iWD), DfAddPeriod is equivalent to<br />
DfAddWD.<br />
When Period stands for a given number of months (iM), DfAddPeriod is equivalent to<br />
DfAddMonths.<br />
When Period stands for a given number of years (iY), DfAddPeriod is equivalent to<br />
DfAddYears.<br />
1.2.13. DfAddYears<br />
DfAddYears(Calendars As String, CalcDate As Variant, NbYears As Integer, DfMode<br />
As String) As Variant<br />
Adds a number of years to a date.<br />
Arguments<br />
Calendars : String of calendar codes (example : "FRA,UKG")<br />
CalcDate : Calculation date<br />
NbYears : Number of years<br />
DfMode : Extended argument customizing the return value<br />
Return Value<br />
The date computed by adding NbYears to CalcDate.<br />
Note<br />
If the computed date falls on a non-working day, the date moving convention specified in DfMode<br />
with the keyword DMC (or the default value if not specified) applies. If CalcDate falls on the last<br />
working day of the month, the return date may also vary depending on the end-of-month convention<br />
defined as default or specified in DfMode with the keyword EMC.<br />
1.2.14. DfAddWD<br />
DfAddWD(Calendars As String, CalcDate As Variant, NbDays As Integer, DfMode As<br />
String) As Long<br />
Adds a number of working days to a date.<br />
Arguments<br />
Calendars : String of calendar codes (example : "FRA,UKG")<br />
CalcDate : Calculation date<br />
NbDays : Number of working days (from -366 to 366)<br />
17
AdfinX Analytics 1.0 Function Library – User Guide<br />
DfMode : Extended argument customizing the return value<br />
Return Value<br />
The NbDays-th working day following CalcDate is first calculated independently for all listed<br />
calendars. The greatest of the computed dates is returned if it is a working day for all calendars.<br />
Otherwise, the next working day common to all listed calendars is returned.<br />
Note<br />
When NbDays equals 0, DfAddWD is equivalent to DfAdjustToWD with the argument Direction<br />
= 1.<br />
1.2.15. DfAdjustToWD<br />
DfAdjustToWD(Calendars As String, CalcDate As Variant, AdjMode As Integer,<br />
DfMode as String) As Long<br />
Adjusts a holiday date to the previous or next working day.<br />
Arguments<br />
Calendars : String of calendar codes (example : "FRA,UKG")<br />
CalcDate : Calculation date<br />
AdjMode : Adjustment mode {0, 1, -1}<br />
0 for adjusting the date according to the date moving convention specified in DfMode<br />
with the keyword DMC<br />
1 for adjusting the date to the next day<br />
-1 for adjusting the date to the previous day<br />
DfMode : Extended argument customizing the return value<br />
Return Value<br />
The same date if it is a working day, otherwise the previous ("DMC:P") or the next ("DMC:F") working<br />
day common to all listed calendars.<br />
1.2.16. DfCountDays<br />
DfCountDays(StartDate As Variant, EndDate as Variant, DfMode As String) As<br />
Long<br />
Calculates the number of days between two dates according to the day count basis specified in<br />
DfMode with the keyword DCB.<br />
Arguments<br />
StartDate : Period start date<br />
EndDate : Period end date<br />
DfMode : Extended argument customizing the return value<br />
Return Value<br />
The number of days calculated according to the chosen basis.<br />
18
AdfinX Analytics 1.0 Function Library – User Guide<br />
Note<br />
This <strong>fun</strong>ction will return the same number of days as in a normal year (365,366) except for "DCB:00"<br />
and "DCB:E0".<br />
1.2.17. DfCountNonWD<br />
DfCountNonWD(Calendars As String, StartDate As Variant, EndDate As Variant,<br />
DfMode As String) As Long<br />
Calculates the number of non-working days between two dates.<br />
Arguments<br />
Calendars : String of calendar codes (example : "FRA,UKG")<br />
StartDate : Period start date<br />
EndDate : Period end date<br />
DfMode : # not currently used - leave blank #<br />
Return Value<br />
The number of non-working days in any of the listed calendars between StartDate and EndDate.<br />
Only the end date is counted if it is a non-working day. The start date is not taken into account.<br />
1.2.18. DfCountWD<br />
DfCountWD(Calendars As String, StartDate As Variant, EndDate As Variant,<br />
DfMode As String)As Long<br />
Calculates the number of working days between two dates.<br />
Arguments<br />
Calendars : String of calendar codes (example : "FRA,UKG")<br />
StartDate : Period start date<br />
EndDate : Period end date<br />
DfMode : # not currently used - leave blank #<br />
Return Value<br />
The number of working days common to all listed calendars between StartDate and EndDate.<br />
Only the end date is counted if it is a working day. The start date is not taken into account.<br />
1.2.19. DfCountYears<br />
DfCountYears(StartDate As Variant, EndDate As Variant, DfMode As String) As<br />
Double<br />
Calculates the number of years between two dates according to the day count basis specified in<br />
DfMode with the keyword DCB.<br />
Arguments<br />
StartDate : Period start date<br />
EndDate : Period end date<br />
DfMode : Extended argument customizing the return value<br />
19
AdfinX Analytics 1.0 Function Library – User Guide<br />
Return Value<br />
The number of years calculated according to the chosen basis.<br />
1.2.20. DfFindDateD<br />
DfFindDateD(Number As Integer, Day As String, Direction As String, RefDate As<br />
Variant) As Long<br />
Finds a date from a rule based on a reference date.<br />
Arguments<br />
Number : Integer representing the number of days or given day of the week<br />
Day : String representing the day {Day, Monday, Tuesday, Wednesday, Thursday,<br />
Friday, Saturday, Sunday}<br />
Direction : String representing the direction {Of, Before, After}<br />
RefDate : Reference date<br />
Return Value<br />
The calculated date.<br />
Note<br />
The string arguments (Day and Direction) are not case sensitive and can be limited to the first<br />
three characters when applicable.<br />
1.2.21. DfFindDateM<br />
DfFindDateM(Number As Integer, Day As String, Direction As String, Month As<br />
String, Year As Integer) As Long<br />
Finds a date from a rule based on a reference month.<br />
Arguments<br />
Number : Integer representing the number of days or given day of the week<br />
Day : String representing the day {Day, Monday, Tuesday, Wednesday, Thursday,<br />
Friday, Saturday, Sunday}<br />
Direction : String representing the direction {Of, Before, After}<br />
Month : String representing the month {January, February, March, April, May, June,<br />
July, August, September, October, November, December, Easter}<br />
Year : Year<br />
Return Value<br />
The calculated date.<br />
Note<br />
The string arguments (Day, Direction and RefMonth) are not case sensitive and can be limited to<br />
the first three characters when applicable.<br />
20
AdfinX Analytics 1.0 Function Library – User Guide<br />
1.2.22. DfFormatDate<br />
DfFormatDate(CalcDate As Variant) As String<br />
Converts a date specified as a serial number to the string format "DDMMMYY".<br />
Arguments<br />
CalcDate :<br />
Calculation date<br />
Return Value<br />
The corresponding string.<br />
Note<br />
This <strong>fun</strong>ction may be useful to convert dates that have to be included as strings in AdfinX extended<br />
arguments.<br />
1.2.23. DfIDNDate<br />
DfIDNDate(DateStr As String) As Long<br />
Converts a date specified in the string format "DD MMM YY" or "DD MMM YYYY" to a serial<br />
number, whatever the date settings of both the operating system and the client application are.<br />
Arguments<br />
DateStr : Date-formatted string ("DD MMM YY" or "DD MMM YYYY")<br />
Return Value<br />
The corresponding serial number.<br />
Note<br />
This <strong>fun</strong>ction may be useful to avoid that a date retrieved from a real-time data feed is misinterpreted<br />
by the client application.<br />
1.2.24. DfIsWD<br />
DfIsWD(Calendars As String, CalcDate As Variant, DfMode As String) As Variant<br />
Indicates whether a date is a working day or not.<br />
Arguments<br />
Calendars : String of calendar codes (example : "FRA,UKG")<br />
CalcDate : Calculation date<br />
DfMode : Extended argument customizing the return value<br />
Return Value<br />
The return value depends on the value of DfMode. The default value is a 2-cell vertical array<br />
containing:<br />
21
AdfinX Analytics 1.0 Function Library – User Guide<br />
Status : A Boolean (TRUE | FALSE) set to FALSE if CalcDate is found in any of the listed<br />
calendars<br />
Calendar : String of calendar codes for which CalcDate is a non-working day.<br />
When this array <strong>fun</strong>ction is used as a standard <strong>fun</strong>ction, just the first element is returned. To get the<br />
second element use "RET:2" as DfMode.<br />
1.2.25. DfLastWD<br />
DfLastWD(Calendars As String, CalcDate As Variant, DfMode As String) As Long<br />
Calculates the last working day of a month.<br />
Arguments<br />
Calendars : String of calendar codes (example : "FRA,UKG")<br />
CalcDate : Calculation date<br />
DfMode : # not currently used - leave blank #<br />
Return Value<br />
The last working day in the month of CalcDate common to all listed calendars.<br />
1.2.26. DfListHolidays<br />
DfListHolidays(Calendars As String, StartDate As Variant, EndDate As Variant,<br />
DfMode As String) As Variant<br />
Lists one or several calendar holidays between two dates.<br />
Arguments<br />
Calendars : String of calendar codes (example : "FRA,UKG")<br />
StartDate : Period start date<br />
EndDate : Period end date<br />
DfMode : Extended argument customizing the return value<br />
Return Value<br />
The return value depends on the value of DfMode. The default value is a vertical array containing<br />
holidays between StartDate and EndDate for all listed calendars.<br />
When this array <strong>fun</strong>ction is used as a standard <strong>fun</strong>ction, just the first element is returned. To get the<br />
second element use "RET:2" as DfMode.<br />
It is also possible to get both holiday names and dates using for instance "RET:B10" as DfMode.<br />
1.2.27. AdDefAttribute<br />
AdDefAttribute(DefCategory As String, DefAttribute As String) As String<br />
Returns the value of a default setting.<br />
22
AdfinX Analytics 1.0 Function Library – User Guide<br />
Arguments<br />
DefCategory : String argument defining the default settings category<br />
DefAttribute : Keyword of DefStructure corresponding to the default setting<br />
Return Value<br />
The value of the default setting.<br />
1.2.28. AdDefSet<br />
AdDefSet(DefCategory As String, DefStructure As String)<br />
Sets one or several default settings belonging to a same default setting category.<br />
The default settings category or nature is defined in the argument DefCategory. Hence, all settings<br />
grouped together in the DefStructure argument must belong to the same category.<br />
Arguments<br />
DefCategory : String argument defining the default settings category<br />
DefStructure : Extended argument defining the default settings<br />
1.2.29. AdDefStructure<br />
AdDefStructure(DefCategory As String) As String<br />
Returns all default settings for a default setting category.<br />
Arguments<br />
DefCategory : String argument defining the default settings category<br />
Return Value<br />
The DefStructure string corresponding to the default settings of the category.<br />
1.2.30. AdReadParam<br />
AdReadParam(Section As String, Entry As String) As String<br />
Reads information from the Adfin data file m_excel.dat.<br />
Arguments<br />
Section : Section name<br />
Entry : Entry name<br />
Return Value<br />
The value assigned to Entry from the section [Section] of the file m_excel.dat.<br />
Note<br />
This <strong>fun</strong>ction may be useful to initialize a parameter with a value previously saved with the <strong>fun</strong>ction<br />
AdWriteParam.<br />
23
AdfinX Analytics 1.0 Function Library – User Guide<br />
1.2.31. AdStyleAttribute<br />
AdStyleAttribute(StyleTable As String, StyleCode As String, StyleAttribute As<br />
String) As Variant<br />
The AdStyleAttribute method of the AdxModule control returns the value of a style attribute.<br />
Arguments<br />
StyleTable : String argument defining the style table<br />
StyleCode : Style Code<br />
StyleAttribute : Keyword corresponding to the style Attribute<br />
Return value<br />
The value of the style attribute.<br />
Example<br />
Dim dlg as AdxModule : Declare an object variable of type AdxModule<br />
Set dlg = New AdxModule : Create an AdxModule object<br />
MsgBox dlg.AdStyleAttribute(“BOND”,”GILT”,”ACC”) :<br />
Returns the value for the accrued interest attribute<br />
1.2.32. AdStyleDelete<br />
AdStyleDelete(StyleTable As String, StyleCode As String) As Boolean<br />
The AdStyleDelete method of the AdxModule deletes an existing style from a style table.<br />
Arguments<br />
StyleTable : String argument defining the style table<br />
StyleCode : Style Code<br />
Return value<br />
True or False depending on the success of the operation.<br />
Example<br />
Dim dlg as AdxModule : Declare an object variable of type AdxModule<br />
Set dlg = New AdxModule : Create an AdxModule object<br />
MsgBox dlg.AdStyleDelete(“BOND”,”OAT”) :<br />
Delete the style “OAT” from the style table bond<br />
1.2.33. AdStyleName<br />
AdStyleName(StyleTable As String, StyleCode As String) As String<br />
Returns the name of a style.<br />
24
AdfinX Analytics 1.0 Function Library – User Guide<br />
Arguments<br />
StyleTable : String argument defining the style table<br />
StyleCode : Style code<br />
Return Value<br />
The name of the style.<br />
1.2.34. AdStyleSet<br />
AdStyleSet(StyleTable As String, StyleCode As String, StyleName As String,<br />
StyleStructure As String, StyleMode As String) As Boolean<br />
The AdStyleSet method of the AdxModule creates or modifies a style in a style table.<br />
Arguments<br />
StyleTable : String argument defining the style table<br />
StyleCode : Style Code<br />
StyleName : Style Name<br />
StyleStructure : Style Structure<br />
StyleMode : Extended argument defining the operation<br />
Return value<br />
True if successful otherwise False.<br />
Note<br />
You can use the IndexHistoryStructure as StyleStructure argument.<br />
Example<br />
Dim dlg as AdxModule : Declare an object variable of type AdxModule<br />
Set dlg = New AdxModule : Create an AdxModule object<br />
MsgBox dlg.AdStyleSet(“BOND”,”GILT”,” UK Treasury Bonds”,“ACC:AA CM:AA<br />
RND:5 FRQ:2 XD:6WD EY:2 SETTLE:1WD CLDR:UKG”,”PUBLIC”) :<br />
Sets the style GILT in the style table BOND<br />
1.2.35. AdStyleStructure<br />
AdStyleStructure(StyleTable As String, StyleCode As String) As String<br />
The AdStyleStructure method of the AdxModule returns the structure of a style.<br />
Arguments<br />
StyleTable : String argument defining the style table<br />
StyleCode : Style Name<br />
Return value<br />
The structure of the style.<br />
25
AdfinX Analytics 1.0 Function Library – User Guide<br />
Example<br />
Dim dlg as AdxModule : Declare an object variable of type AdxModule<br />
Set dlg = New AdxModule : Create an AdxModule object<br />
MsgBox dlg.AdStyleStructure(“BOND”,”OAT”) :<br />
Returns the structure of the OAT<br />
1.2.36. AdWriteParam<br />
AdWriteParam(Section As String, Entry As String, Value As String)<br />
Writes information into the Adfin data file m_excel.dat.<br />
Arguments<br />
Section : Section name<br />
Entry : Entry name<br />
Value : Value of entry as a string<br />
Note<br />
This <strong>fun</strong>ction may be useful to save the value of a parameter. The entry in the m_excel.dat can be<br />
retrieved using the AdReadParam <strong>fun</strong>ction.<br />
1.2.37. DisplayDefaults<br />
DisplayDefaults()<br />
The DisplayDefaults method of the AdxModule control displays the default dialog box.<br />
Arguments<br />
This method takes no argument.<br />
Example<br />
Dim dlgDefault as AdxModule : Declare an object variable of type AdxModule<br />
Set dlgDefault = New AdxModule : Create an AdxModule object<br />
dlgDefault.DisplayDefaults : Display the default dialog box<br />
1.2.38. DisplayStyles<br />
DisplayStyles()<br />
The DisplayStyles method of the AdxModule control displays the style dialog box.<br />
Arguments<br />
This method takes no argument.<br />
Example<br />
Dim dlg as AdxModule : Declare an object variable of type AdxModule<br />
Set dlg = New AdxModule : Create an AdxModule object<br />
26
AdfinX Analytics 1.0 Function Library – User Guide<br />
dlg.DisplayStyles : Display the styles dialog box<br />
1.2.39. MaxDate<br />
MaxDate() As Long<br />
The MaxDate method of the AdxModule control returns the maximum date value set.<br />
Arguments<br />
This method takes no argument.<br />
Return Value<br />
A Long value, containing the maximum date.<br />
Example<br />
Dim dlg as AdxModule : Declare an object variable of type AdxModule<br />
Set dlg = New AdxModule : Create an AdxModule object<br />
MsgBox dlg.MaxDate : Get the Max date<br />
1.2.40. MinDate<br />
MinDate() As Long<br />
The MinDate method of the AdxModule control returns the minimum date value set.<br />
Arguments<br />
This method takes no argument.<br />
Return Value<br />
A Long value, containing the minimum date.<br />
Example<br />
Dim dlg as AdxModule : Declare an object variable of type AdxModule<br />
Set dlg = New AdxModule : Create an AdxModule object<br />
MsgBox dlg.MinDate : Get the Min date<br />
1.2.41. NormalC<br />
NormalC(Number As Double) As Double<br />
Calculates y=f(x) using a cumulative normal distribution.<br />
Arguments<br />
Number : x value<br />
27
AdfinX Analytics 1.0 Function Library – User Guide<br />
Return Value<br />
N ( x) = N( t)<br />
dt<br />
c<br />
x<br />
∫<br />
−∞<br />
1.2.42. NormalS<br />
NormalS(Number As Double) As Double<br />
Calculates y=f(x) using a normal distribution.<br />
Arguments<br />
Number : x value<br />
Return Value<br />
1 ( x−<br />
m)<br />
N( x) = exp[ −<br />
2<br />
2Πν<br />
2ν<br />
2<br />
]<br />
1.2.43. SetReferenceDates<br />
SetReferenceDates(DateOffset As Long, MinDate As Long, MaxDate As Long)<br />
The SetReferenceDates method of the AdxModule control sets the offset (base day), the<br />
minimum date and the maximum date. The default values are 0, 1, 65380, since AdfinX valid dates<br />
must be between 31 st December 1899 (1) and 31 st December 2078 (65380). The date minimum limit<br />
is 1 st January 100 and the maximum limit is 31 st December 3999. The offset is used to increase the<br />
lower range for the dates that can be handled. If an error is incurred whilst calling the <strong>fun</strong>ction then the<br />
reference dates will be reset to the default values. The <strong>fun</strong>ction can be used with MaxDate and<br />
MinDate as shown in the following coding example to obtain the maximum and minimum dates set:<br />
Arguments<br />
DateOffset : New offset (base day)<br />
MinDate : New minimum date<br />
MaxDate : New maximum date<br />
Example<br />
Dim dlg as AdxModule : Declare an object variable of type AdxModule<br />
Set dlg = New AdxModule : Create an AdxModule object<br />
dlg.SetReferenceDates 0, 1, 65380 : Set the reference dates<br />
MsgBox dlg.MinDate : Get the Min date set<br />
MsgBox dlg.MaxDate : Get the Max date<br />
28
AdfinX Analytics 1.0 Function Library – User Guide<br />
2. ADFINX ADXBONDMODULE CONTROL<br />
2.1. ADXBONDMODULE PROPERTIES<br />
2.1.1. ErrorCode<br />
ErrorCode() As Long<br />
The ErrorCode property of the AdxBondModule control retrieves the last error code generated by<br />
the object.<br />
Arguments<br />
This property takes no argument.<br />
Example<br />
Dim bd as AdxBondModule : Declares an object of type AdxBondModule<br />
Set bd = New AdxBondModule : Creates an AdxBondModule object<br />
If bd.ErrorCode 0 Then : bd.ErrorCode contains the error<br />
MsgBox (bd.ErrorCode) : Displays the error code in a message box<br />
End If<br />
2.1.2. ErrorMode<br />
ErrorMode() As AdxErrorMode<br />
The ErrorMode property of the AdxBondModule component sets the error mode. Three modes<br />
are defined:<br />
DIALOGBOX : In this mode a dialog box is displayed when an error occurs<br />
EXCEPTION : In this mode an exception is thrown when an error occurs<br />
NO_EXCEPTION : In this mode the user must call the property ErrorCode to know the error<br />
encountered<br />
Arguments<br />
This property takes no argument.<br />
Note<br />
By default the error mode is set to EXCEPTION.<br />
Example<br />
Dim bd as AdxBondModule : Declares an object of type AdxBondModule<br />
Set bd = New AdxBondModule : Creates an AdxBondModule object<br />
bd.ErrorMode = NO_EXCEPTION : bd.ErrorMode is set to NO_EXCEPTION<br />
2.1.3. ErrorString<br />
ErrorString() As String<br />
The ErrorString property of the AdxBondModule retrieves the last error code generated by the<br />
object with the associated error string.<br />
29
AdfinX Analytics 1.0 Function Library – User Guide<br />
Arguments<br />
This property takes no argument.<br />
Example<br />
Dim bd as AdxBondModule : Declares an object of variable type AdxBondModule<br />
Set bd = New AdxBondModule : Creates an AdxBondModule object<br />
bd.ErrorMode = EXCEPTION : bd.ErrorMode must be set to EXCEPTION to use the<br />
ErrorString<br />
On Error Go To Handle : Error handler executes code after Handle when an error<br />
occurs<br />
RES = bd.BdSettle("24-JAN-00", "GLT")<br />
: The style ‘GLT’ does not exist. The <strong>fun</strong>ction BdSettle returns<br />
an error<br />
Exit Sub : Exits sub or <strong>fun</strong>ction before the handle or code will be<br />
executed<br />
Handle<br />
MsgBox(bd.ErrorString) : Displays the ErrorString in a message box<br />
Bd.ErrorString contains the ErrorString (‘Error#7008 –<br />
SetStructure with an unrecognized keyword.’)<br />
2.2. ADXBONDMODULE METHODS<br />
2.2.1. Accrued<br />
Accrued(CalcDate As Variant, Maturity As Variant, Coupon As Double,<br />
BondStructure As String) As Double<br />
Calculates the accrued interest using a bond structure.<br />
Arguments<br />
CalcDate : Calculation date<br />
Maturity : Maturity date of the bond<br />
Coupon : Nominal coupon rate of the bond, expressed as a percentage<br />
BondStructure : Extended argument defining the bond structure<br />
Return Value<br />
The accrued interest expressed as a percentage.<br />
2.2.2. AdBondDeriv<br />
AdBondDeriv(SettlementDate As Variant, RateArray as Variant, Maturity As<br />
Variant, Coupon As Double, Spread As Double, BondStructure As String,<br />
RateStructure As String, CalcStructure As String, AdMode As String) As<br />
Variant<br />
Calculates the derivatives of the bond using a bond structure.<br />
30
AdfinX Analytics 1.0 Function Library – User Guide<br />
Arguments<br />
SettlementDate : Settlement date<br />
RateArray : Term structure array<br />
Depending on the model, this array has several forms:<br />
• a single value if the Yield To Maturity is used<br />
• a 1 dimensional array containing the Vasicek-Fong coefficients if<br />
VF is specified<br />
• a 2-dimensional array containing the dates (rows or columns<br />
depending on the orientation of the array specified by the LAY<br />
keyword), and the values for the rates if a ZCCurve is used<br />
• a 2-dimensional array containing the dates (rows or columns<br />
depending on the orientation of the array specified by the LAY<br />
keyword), the values for the rates, and the volatilities if BDT is<br />
used<br />
The model used is specified by the keyword RM (Rate Model) in the<br />
RateStructure argument.<br />
Maturity : Maturity date of the bond<br />
Coupon : Nominal coupon rate, expressed as a percentage<br />
Spread : Spread value expressed in basis points<br />
Depending on the rate model, the spread will be added either to a yield<br />
(RM:YTM), to a yield curve (RM:YC, RM:VF), or will be an option<br />
adjusted spread (RM:BDT).<br />
BondStructure : Extended argument defining the bond structure<br />
RateStructure : Extended argument defining the rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
AdMode : Extended argument customizing the return value<br />
Return value<br />
The return value depends on the value of AdMode. The default value is a vertical 8-cell array<br />
containing:<br />
Price : Price of the bond<br />
Option Free Price : Option Free Price of the bond<br />
Volatility : Volatility<br />
PVBP : Price variation per basis point<br />
Duration : Duration<br />
Average Life : Average life<br />
Convexity : Convexity<br />
Yield To Worst/Yield To best date : Yield to worst/yield to best date<br />
The value is the clean or the gross price of the bond depending on the value of the keyword PX in the<br />
BOND default settings. By default, the return value is the clean price.<br />
2.2.3. AdBondPrice<br />
AdBondPrice(SettlementDate As Variant, RateArray As Variant, Maturity As<br />
Variant, Coupon As Double, Spread As Double, BondStructure As String,<br />
RateStructure As String, CalcStructure As String, AdMode As String) As<br />
Variant<br />
Calculates the price of a bond using a bond structure.<br />
31
AdfinX Analytics 1.0 Function Library – User Guide<br />
Arguments<br />
SettlementDate : Settlement date<br />
RateArray : Term structure array<br />
Depending on the model, this array has several forms:<br />
• a single value if the Yield To Maturity is used<br />
• a 1 dimensional array containing the Vasicek-Fongs coefficient if<br />
VF is specified<br />
• a 2-dimensional array containing the dates (rows or columns<br />
depending on the orientation of the array specified by the LAY<br />
keyword), and the values for the rates if a ZCCurve is used<br />
• a 2-dimensional array containing the dates (rows or columns<br />
depending on the orientation of the array specified by the LAY<br />
keyword), the values for the rates, and the volatilities if BDT is used<br />
The model used is specified by the keyword RM (Rate Model) in the<br />
RateStructure argument.<br />
Maturity : Maturity date of the bond<br />
Coupon : Nominal coupon rate, expressed as a percentage<br />
Spread : Spread value expressed in basis points<br />
Depending on the rate model, the spread will be added either to a yield<br />
(RM:YTM), to a yield curve (RM:YC, RM:VF), or will be an option<br />
adjusted spread (RM:BDT).<br />
BondStructure : Extended argument defining the bond structure<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
AdMode : Extended argument customizing the return value<br />
Return Value<br />
The return value depends on the value of AdMode. The default value is a vertical array containing:<br />
Price : Price of the bond<br />
Option Free Price : Option Free Price of the bond<br />
The value is the clean or the gross price of the bond depending on the value of the keyword PX in the<br />
BOND default settings. By default, the return value is the gross price.<br />
2.2.4. AdBondSpread<br />
AdBondSpread(SettlementDate As Variant, RateArray As Variant, Price As<br />
Double, Maturity As Variant, Coupon As Double, BondStructure As String,<br />
RateStructure As String, CalcStructure As String, AdMode As String) As<br />
Double<br />
Calculates the spread of the bond using a bond structure.<br />
Arguments<br />
SettlementDate : Settlement date<br />
RateArray : Term structure array<br />
Depending on the model, this array has several forms:<br />
• a single value if the Yield To Maturity is used<br />
• a 1 dimensional array containing Vasicek-Fong coefficient if VF is<br />
specified<br />
32
AdfinX Analytics 1.0 Function Library – User Guide<br />
• a 2-dimensional array containing the dates (row or column<br />
depending on the orientation of the array specified by the LAY<br />
keyword) and the values for the rates if a ZCCurve is used<br />
• a 2-dimensional array containing the dates (row or column<br />
depending on the orientation of the array specified by the LAY<br />
keyword), the values for the rates, and the volatilities if BDT is<br />
used<br />
The model used is specified by the keyword RM (Rate Model) in the<br />
RateStructure argument.<br />
Price : Clean or gross price expressed as a percentage of the nominal<br />
Maturity : Maturity date of the bond<br />
Coupon : Nominal coupon rate, expressed as a percentage<br />
BondStructure : Extended argument defining the bond structure<br />
RateStructure : Extended argument defining the rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
AdMode : Extended argument customizing the return value<br />
Return Value<br />
The spread in basis point.<br />
The return value depends on the value of the RM keyword in the RateStructure.<br />
If the model is YTM and the RateArray is zero, the return value is the yield to maturity or<br />
the yield to worst/yield to best.<br />
If the model is static (i.e. constant yield curve, yield curve, Vasicek-Fong), the return value is the yield<br />
spread incremental return or the yield curve spread depending on the model used. It measures the<br />
spread between the yield of the bond and the benchmark yield calculated from the inputs.<br />
If the model is dynamic (i.e. BDT), the return value is the OAS.<br />
2.2.5. AdBondYield<br />
AdBondYield(SettlementDate As Variant, Price As Double, Maturity As Variant,<br />
Coupon As Double, BondStructure As String, RateStructure As String, AdMode<br />
As String) As Variant<br />
Calculates the Yield To Maturity of non optionable bonds. Calculates the yields at call/put dates of<br />
optionable bonds.<br />
Arguments<br />
SettlementDate : Settlement date<br />
Price : (Market) Price of the bond<br />
Maturity : Maturity date of the bond<br />
Coupon : Nominal coupon rate, expressed as a number or a percentage<br />
BondStructure : Extended argument defining the bond structure<br />
RateStructure : Extended argument defining the rate model<br />
AdMode : Extended argument customizing the return value<br />
Return Value<br />
The return value depends on the value of AdMode. The default value is a vertical 4-cell array<br />
containing:<br />
Yield<br />
Option date<br />
33
AdfinX Analytics 1.0 Function Library – User Guide<br />
Strike price<br />
Yield type<br />
2.2.6. BdCalcCpn<br />
BdCalcCpn(CalcDate As Variant, Maturity As Variant, Coupon As Double,<br />
BondStructure As String, BdMode As String) As Variant<br />
Returns all coupon features in an array using a bond structure.<br />
Arguments<br />
CalcDate : Calculation date<br />
Maturity : Maturity date of the bond<br />
Coupon : Nominal coupon rate expressed as a number or a percentage<br />
BondStructure : Extended argument defining the bond structure<br />
BdMode : Extended argument customizing the return value<br />
Return Value<br />
The return value depends on the value of BdMode. The default value is a vertical 6-cell array<br />
containing:<br />
PrevCpnDate : Previous coupon date<br />
NextCpnDate : Next coupon date<br />
ExDivDate : Ex-dividend date<br />
AccruedDays : Number of accrued days calculated according to the accrued basis<br />
AccruedInt : Accrued interest<br />
NextCpnValue : Next coupon value<br />
When this array <strong>fun</strong>ction is used as a standard <strong>fun</strong>ction, only the first element is returned. To return for<br />
instance the second element use "RET:2" as BdMode.<br />
Notes<br />
The ex-dividend date is equal to the next coupon date unless the BondStructure argument<br />
includes an ex-dividend attribute (XD) other than 0.<br />
Most elements calculated with this <strong>fun</strong>ction are calculated separately using other <strong>fun</strong>ctions. The<br />
same conventions apply.<br />
2.2.7. BdCashFlows<br />
BdCashFlows(CalcDate As Variant, Maturity As Variant, Coupon As Double,<br />
BondStructure As String, BdMode As String) As Variant<br />
Generates an array of the remaining cash flows using a bond structure.<br />
Arguments<br />
CalcDate : Calculation date<br />
Maturity : Maturity date of the bond<br />
Coupon : Nominal coupon rate of the bond, expressed as a number or a percentage<br />
BondStructure : Extended argument defining the bond structure<br />
BdMode : Extended argument customizing the return value<br />
34
AdfinX Analytics 1.0 Function Library – User Guide<br />
Return Value<br />
The return value depends on the value of BdMode. The default value is a vertical 2-column array<br />
containing all remaining cash flow dates and values (interest + principal). To return a 3-dimension<br />
array containing the dates, the interest cash flows and the principal cash flows, use "IAC" as<br />
BdMode.<br />
Note<br />
When the RET keyword is not specified in BdMode, the maximum number of cash flows returned by<br />
the <strong>fun</strong>ction is limited to 24. To return, for example, 30 cash flows for a long term bond, use<br />
"RET:A30".<br />
2.2.8. BdConvFactor<br />
BdConvFactor(BondFutStructure As String, MaturityCode As String, Maturity As<br />
Variant, Coupon As Double, ConvMode As String, BdMode As String) As Variant<br />
Calculates the conversion factor of a bond.<br />
Arguments<br />
BondFutStructure : Extended argument defining the bond futures structure<br />
MaturityCode : String defining the maturity of a 3-month futures contract<br />
Maturity : Maturity date of the bond<br />
Coupon : Nominal coupon rate expressed as a number or a percentage<br />
ConvMode : Extended argument defining deliverable bond oddities<br />
BdMode : Extended argument customizing the return value<br />
Return Value<br />
The return value depends on the value of BdMode. The default value is a vertical 3-cell array<br />
containing:<br />
ConvFactor : Conversion factor of the bond<br />
DelivStartDate : Start date of the delivery period<br />
DelivEndDate : End date of the delivery period<br />
Note<br />
You can use more than one character to define the year in the MaturityCode argument. For<br />
example, if the calculation date is February 27 th , 1994, you can differentiate between a June 94<br />
contract ("M4") and a June 2004 contract ("M04" or "M2004") using multiple characters.<br />
2.2.9. BdCpnCrv<br />
BdCpnCrv(CalcDate As Variant, Price As Double, DateArray As Variant, RateArray<br />
As Variant, Maturity As Variant, BondStructure As String, CalcMethod As String)<br />
As Double<br />
Calculates the nominal coupon rate from the bond price and a zero-coupon yield curve.<br />
35
AdfinX Analytics 1.0 Function Library – User Guide<br />
Arguments<br />
CalcDate : Calculation date<br />
Price : Gross price expressed as a percentage of the nominal<br />
DateArray : Array of zero-coupon dates<br />
RateArray : Array of zero-coupon rates or discount factors<br />
Maturity : Maturity date of the bond<br />
BondStructure : Extended argument defining the bond structure<br />
CalcMethod : Extended argument defining the calculation method<br />
Return Value<br />
The nominal coupon rate of the bond.<br />
2.2.10. BdCpnValue<br />
BdCpnValue(CalcDate As Variant, Maturity As Variant, Coupon As Double,<br />
BondStructure As String) As Double<br />
Calculates the value of the next coupon using a bond structure.<br />
Arguments<br />
CalcDate : Calculation date<br />
Maturity : Maturity date of the bond<br />
Coupon : Nominal coupon rate expressed as a number or a percentage<br />
BondStructure : Extended argument defining the bond structure<br />
Return Value<br />
The next coupon value of the bond.<br />
This value is equal to the nominal coupon rate Coupon unless the next coupon is the first one and<br />
the BondStructure argument includes an irregular coupon attribute (ISSUE).<br />
Ex-dividend situations (the purchaser of the bond is not entitled to receive the next coupon during a<br />
period defined by XD) and coupon date offset situations (the purchaser of the bond is entitled to<br />
receive the previous coupon during a period defined by CDO) are ignored for this <strong>fun</strong>ction.<br />
2.2.11. BdIrsStructure<br />
BdIrsStructure(BondStructure As String) As String<br />
Returns the interest rate swap structure corresponding to a swap in which fixed cash flows match the<br />
bond ones.<br />
Arguments<br />
BondStructure :<br />
Extended argument defining the bond structure<br />
Return Value<br />
The equivalent interest rate swap structure for the fixed leg.<br />
Note<br />
36
AdfinX Analytics 1.0 Function Library – User Guide<br />
This <strong>fun</strong>ction is dedicated to asset swaps pricing and assumes that the start date of the interest rate<br />
swap is equal to the settlement date of the bond.<br />
2.2.12. BdPvbpCrv<br />
BdPvbpCrv(CalcDate As Variant, Price As Double, DateArray As Variant, RateArray<br />
As Variant, Maturity As Variant, Coupon As Double, BondStructure As String,<br />
CalcMethod As String, BdMode As String) As Variant<br />
Calculates the price variation per basis point (PVBP) for each point of a zero-coupon yield curve.<br />
Arguments<br />
CalcDate : Calculation date<br />
Price : Clean or gross price expressed as a percentage of the nominal<br />
DateArray : Array of zero-coupon dates<br />
RateArray : Array of zero-coupon rates or discount factors<br />
Maturity : Maturity date of the bond<br />
Coupon : Nominal coupon rate expressed as a number or a percentage<br />
BondStructure : Extended argument defining the bond structure<br />
CalcMethod : Extended argument defining the calculation method<br />
BdMode : Extended argument customizing the return value<br />
Return Value<br />
The <strong>fun</strong>ction returns a 2-dimensional array containing the curve dates and the corresponding<br />
sensitivity values.<br />
Notes<br />
The credit spread, i.e. the difference between the yield to maturity and the yield calculated from the<br />
price derived from the yield curve, is by default ignored, but it can be taken into account using the<br />
"SPREAD" keyword in CalcMethod.<br />
The calculation is performed by default with a yield change epsilon equal to 1 basis point (0.01%), but<br />
this value can be changed using the "SHIFT" keyword in CalcMethod.<br />
If the curve is specified with discount factors, the calculated discount factors are converted into rates,<br />
then shifted applying the yield change, and finally converted back to discount factors.<br />
2.2.13. BdRepo<br />
BdRepo(CalcDate As Variant, HorizonDate As Variant, Npv As Double, Fv As<br />
Double, RepoRate As Double, Maturity As Variant, Coupon As Double,<br />
BondStructure As String, RepoMode As String) As Double<br />
Calculates the implied repo rate, the future value, or the present value of a repo using a bond<br />
structure.<br />
The expected result must be specified in RepoMode using the RES keyword.<br />
To define how the present value and/or the future value of the bond are expressed (clean price, gross<br />
price, or yield), use the NPV and FV keywords in RepoMode. To define the repo rate type (usually<br />
MMBA0 or MMBA5), use the RR keyword.<br />
37
AdfinX Analytics 1.0 Function Library – User Guide<br />
Arguments for implied repo rate calculation<br />
CalcDate : Calculation date<br />
HorizonDate : Horizon date of the repo<br />
Npv : Clean price (as a percentage of the nominal), or gross price (as a percentage<br />
of the nominal), or yield to maturity of the bond at CalcDate (present value)<br />
Fv : Clean price (as a percentage of the nominal), or gross price (as a percentage<br />
of the nominal), or yield to maturity of the bond at HorizonDate (future<br />
value)<br />
RepoRate : # not used - enter 0 #<br />
Maturity : Maturity date of the bond<br />
Coupon : Nominal coupon rate of the bond, expressed as a number or a percentage<br />
BondStructure : Extended argument defining the bond structure<br />
RepoMode : Extended argument defining the calculation<br />
If calculating the implied repo rate, RepoMode should include the argument "RES:IMPRATE".<br />
Arguments for future value calculation<br />
CalcDate : Calculation date<br />
HorizonDate : Horizon date of the repo<br />
Npv : Clean price (as a percentage of the nominal), or gross price (as a percentage<br />
of the nominal), or yield to maturity of the bond at CalcDate (present value)<br />
Fv : # not used - enter 0 #<br />
RepoRate : Repo rate<br />
Maturity : Maturity date of the bond<br />
Coupon : Nominal coupon rate of the bond, expressed as a number or a percentage<br />
BondStructure : Extended argument defining the bond structure<br />
RepoMode : Extended argument defining the calculation<br />
If calculating the future value, RepoMode should include the argument "RES:FV".<br />
Arguments for present value calculation<br />
CalcDate : Calculation date<br />
HorizonDate : Horizon date of the repo<br />
Npv : # not used - enter 0 #<br />
Fv : Clean price (as a percentage of the nominal), or gross price (as a percentage<br />
of the nominal), or yield to maturity of the bond at HorizonDate (future<br />
value)<br />
RepoRate : Repo rate<br />
Maturity : Maturity date of the bond<br />
Coupon : Nominal coupon rate of the bond, expressed as a number or a percentage<br />
BondStructure : Extended argument defining the bond structure<br />
RepoMode : Extended argument defining the calculation<br />
If calculating the present value, RepoMode should include the argument "RES:NPV".<br />
Return Value<br />
The implied repo rate, the future value, or the present value depending on the value of the RES<br />
keyword.<br />
2.2.14. BdSettle<br />
BdSettle(CalcDate As Variant, BondStructure As String) As Long<br />
38
AdfinX Analytics 1.0 Function Library – User Guide<br />
Calculates the settlement date using a bond structure.<br />
Arguments<br />
CalcDate : Calculation date<br />
BondStructure : Extended argument defining the bond structure<br />
Return Value<br />
The bond settlement date.<br />
2.2.15. BdSettleLock<br />
BdSettleLock(CalcDate As Variant, Maturity As Variant, BondStructure As String)<br />
As Long<br />
Calculates the settlement date for bonds with lock-out periods using a bond structure.<br />
Arguments<br />
CalcDate : Calculation date<br />
Maturity : Maturity date of the bond<br />
BondStructure : Extended argument defining the bond structure<br />
Return Value<br />
The return value is the settlement date. If the settlement date, calculated from the SETTLE keyword<br />
in BondStructure, falls within the lock-out period preceding the coupon date (defined by the LOCK<br />
keyword) then the settlement occurs on the next coupon date, adjusted to the next working day if<br />
necessary.<br />
2.2.16. CfAvgLife<br />
CfAvgLife(CalcDate As Variant, CfDates As Variant, Cf As Variant, CalcMethod As<br />
String) As Double<br />
Calculates the average life using cash flows.<br />
Arguments<br />
CalcDate : Calculation date<br />
CfDates : Array of cash flow dates corresponding to the bond principal reimbursement<br />
Cf : Array of cash flow values corresponding to the bond principal reimbursement<br />
CalcMethod : Extended argument defining the calculation method<br />
Return Value<br />
The average life of the bond.<br />
2.2.17. CfConv<br />
CfConv(CalcDate As Variant, Yield As Double, CfDates As Variant, Cf As Variant,<br />
CalcMethod As String) As Double<br />
Calculates the convexity using cash flows.<br />
39
AdfinX Analytics 1.0 Function Library – User Guide<br />
Arguments<br />
CalcDate : Calculation date<br />
Yield : Yield to maturity<br />
CfDates : Array of cash flow dates corresponding to the bond reimbursement<br />
Cf : Array of cash flow values corresponding to the bond reimbursement<br />
CalcMethod : Extended argument defining the calculation method<br />
Return Value<br />
The convexity of the bond.<br />
2.2.18. CfDur<br />
CfDur(CalcDate As Variant, Yield As Double, CfDates As Variant, Cf As Variant,<br />
CalcMethod As String) As Double<br />
Calculates the duration using cash flows.<br />
Arguments<br />
CalcDate : Calculation date<br />
Yield : Yield to maturity<br />
CfDates : Array of cash flow dates corresponding to the bond reimbursement<br />
Cf : Array of cash flow values corresponding to the bond reimbursement<br />
CalcMethod : Extended argument defining the calculation method<br />
Return Value<br />
The duration of the bond.<br />
2.2.19. CfPvbp<br />
CfPvbp(CalcDate As Variant, Yield As Double, CfDates As Variant, Cf As Variant,<br />
CalcMethod As String) As Double<br />
Calculates the price variation per basis point using cash flows.<br />
Arguments<br />
CalcDate : Calculation date<br />
Yield : Yield to maturity<br />
CfDates : Array of cash flow dates corresponding to the bond reimbursement<br />
Cf : Array of cash flow values corresponding to the bond reimbursement<br />
CalcMethod : Extended argument defining the calculation method<br />
Return Value<br />
The PVBP of the bond.<br />
40
AdfinX Analytics 1.0 Function Library – User Guide<br />
2.2.20. CfPx<br />
CfPx(CalcDate As Variant, Yield As Double, CfDates As Variant, Cf As Variant,<br />
CalcMethod As String) As Double<br />
Calculates the price from yield using cash flows.<br />
Arguments<br />
CalcDate : Calculation date<br />
Yield : Yield to maturity<br />
CfDates : Array of cash flow dates corresponding to the bond reimbursement<br />
Cf : Array of cash flow values corresponding to the bond reimbursement<br />
CalcMethod : Extended argument defining the calculation method<br />
Return Value<br />
The price of the bond in % of the nominal.<br />
2.2.21. CfPxCrv<br />
CfPxCrv(CalcDate As Variant, DateArray As Variant, RateArray As Variant,<br />
CfDates As Variant, Cf As Variant, CalcMethod As String) As Double<br />
Calculates the price from a yield curve using cash flows.<br />
Arguments<br />
CalcDate : Calculation date<br />
DateArray : Array of zero-coupon dates<br />
RateArray : Array of zero-coupon rates or discount factors<br />
CfDates : Array of cash flow dates corresponding to the bond reimbursement<br />
Cf : Array of cash flow values corresponding to the bond reimbursement<br />
CalcMethod : Extended argument defining the calculation method<br />
Return Value<br />
The price of the bond expressed as a percentage of the nominal.<br />
2.2.22. CfRepo<br />
CfRepo(CalcDate As Variant, HorizonDate As Variant, Npv As Double, Fv As<br />
Double, RepoRate As Double, CfDates As Variant, Cf As Variant, RepoMode As<br />
String) As Double<br />
Calculates the implied repo rate, the future value, or the present value of a repo using cash flows.<br />
The expected result must be specified in RepoMode using the RES keyword.<br />
To define how the present value and/or the future value of the bond are expressed (clean price, gross<br />
price, or yield), use the NPV and FV keywords in RepoMode. To define the repo rate type (usually<br />
MMBA0 or MMBA5), use the RR keyword.<br />
Arguments for implied repo rate calculation<br />
CalcDate : Calculation date<br />
41
AdfinX Analytics 1.0 Function Library – User Guide<br />
HorizonDate : Horizon date of the repo<br />
Npv : Clean price (as a percentage of the nominal), or gross price (as a percentage<br />
the nominal), or yield to maturity of the bond at CalcDate (present value)<br />
Fv : Clean price (as a percentage of the nominal), or gross price (as a percentage<br />
of the nominal), or yield to maturity of the bond at HorizonDate (future<br />
value)<br />
RepoRate : # not used - enter 0 #<br />
CfDates : Array of cash flow dates corresponding to the bond reimbursement<br />
Cf : Array of cash flow values corresponding to the bond reimbursement<br />
RepoMode : Extended argument defining the calculation<br />
If calculating the implied repo rate, RepoMode should include the argument "RES:IMPRATE".<br />
Arguments for future value calculation<br />
CalcDate : Calculation date<br />
HorizonDate : Horizon date of the repo<br />
Npv : Clean price (as a percentage of the nominal), or gross price (as a percentage<br />
of the nominal), or yield to maturity of the bond at CalcDate (present value)<br />
Fv : # not used - enter 0 #<br />
RepoRate : Repo rate<br />
CfDates : Array of cash flow dates corresponding to the bond reimbursement<br />
Cf : Array of cash flow values corresponding to the bond reimbursement<br />
RepoMode : Extended argument defining the calculation<br />
If calculating the future value, RepoMode should include the argument "RES:FV".<br />
Arguments for present value calculation<br />
CalcDate : Calculation date<br />
HorizonDate : Horizon date of the repo<br />
Npv : # not used - enter 0 #<br />
Fv : Clean price (as a percentage of the nominal), or gross price (as a percentage<br />
of the nominal), or yield to maturity of the bond at HorizonDate (future<br />
value)<br />
RepoRate : Repo rate<br />
CfDates : Array of cash flow dates corresponding to the bond reimbursement<br />
Cf : Array of cash flow values corresponding to the bond reimbursement<br />
RepoMode : Extended argument defining the calculation<br />
If calculating the present value, RepoMode should include the argument "RES:NPV".<br />
Return Value<br />
The implied repo rate, the future value, or the present value depending on the value of the RES<br />
keyword.<br />
2.2.23. CfVol<br />
CfVol(CalcDate As Variant, Yield As Double, CfDates As Variant, Cf As Variant,<br />
CalcMethod As String) As Double<br />
Calculates the volatility or modified duration using cash flows.<br />
42
AdfinX Analytics 1.0 Function Library – User Guide<br />
Arguments<br />
CalcDate : Calculation date<br />
Yield : Yield to maturity<br />
CfDates : Array of cash flow dates corresponding to the bond reimbursement<br />
Cf : Array of cash flow values corresponding to the bond reimbursement<br />
CalcMethod : Extended argument defining the calculation method<br />
Return Value<br />
The volatility of the bond.<br />
2.2.24. CfYld<br />
CfYld(CalcDate As Variant, GrossPrice As Double, CfDates As Variant, Cf As<br />
Variant, CalcMethod As String) As Double<br />
Calculates the yield from price using cash flows.<br />
Arguments<br />
CalcDate : Calculation date<br />
GrossPrice : Clean price plus accrued interest expressed in the same unit as cash flows<br />
CfDates : Array of cash flow dates corresponding to the bond reimbursement<br />
Cf : Array of cash flow values corresponding to the bond reimbursement<br />
CalcMethod : Extended argument defining the calculation method<br />
Return Value<br />
The yield to maturity of the bond.<br />
Note<br />
The <strong>fun</strong>ction only takes the cash flows into account that still have to occur.<br />
2.2.25. CpnNext<br />
CpnNext(CalcDate As Variant, Maturity As Variant, BondStructure As String) As<br />
Long<br />
Calculates the date of the next coupon using a bond structure.<br />
Arguments<br />
CalcDate : Calculation date<br />
Maturity : Maturity date of the bond<br />
BondStructure : Extended argument defining the bond structure<br />
Return Value<br />
The next coupon date of the bond.<br />
If there is a first long coupon (expressed by ISSUE and IC:L1 or IC:L1R), the null-value coupon<br />
is ignored.<br />
Similarly, in ex-dividend situations (the purchaser of the bond is not entitled to receive the next coupon<br />
during a period defined by XD) and situations where there is a coupon date offset (the purchaser of<br />
43
AdfinX Analytics 1.0 Function Library – User Guide<br />
the bond is entitled to receive the previous coupon during a period defined by CDO) the arguments are<br />
ignored for this <strong>fun</strong>ction.<br />
2.2.26. CpnNumber<br />
CpnNumber(CalcDate As Variant, Maturity As Variant, BondStructure As String)<br />
As Integer<br />
Calculates the number of coupons until maturity using a bond structure.<br />
Arguments<br />
CalcDate : Calculation date<br />
Maturity : Maturity date of the bond<br />
BondStructure : Extended argument defining the bond structure<br />
Return Value<br />
The number of coupons until maturity.<br />
If there is a first long coupon (expressed by ISSUE and IC:L1 or IC:L1R), the null-value coupon<br />
is ignored.<br />
Similarly, in ex-dividend situations (the purchaser of the bond is not entitled to receive the next coupon<br />
during a period defined by XD) and situations where there is a coupon date offset (the purchaser of<br />
the bond is entitled to receive the previous coupon during a period defined by CDO) these arguments<br />
are ignored for this <strong>fun</strong>ction.<br />
2.2.27. CpnPrev<br />
CpnPrev(CalcDate As Variant, Maturity As Variant, BondStructure As String) As<br />
Long<br />
Calculates the date of the previous coupon using a bond structure.<br />
Arguments<br />
CalcDate : Calculation date<br />
Maturity : Maturity date of the bond<br />
BondStructure : Extended argument defining the bond structure<br />
Return Value<br />
The previous coupon date of the bond.<br />
If there is no previous coupon, this <strong>fun</strong>ction returns the issue date of the bond.<br />
2.2.28. IlbCalcCpn<br />
IlbCalcCpn(CalcDate As Variant, Maturity As Variant, Coupon As Double,<br />
InflationRateArray As Variant, IlbStructure As String, IlbMode As String) As<br />
Variant<br />
Returns all coupon features of an index-linked bond in an array.<br />
44
AdfinX Analytics 1.0 Function Library – User Guide<br />
Arguments<br />
CalcDate : Calculation date<br />
Maturity : Maturity date of the bond<br />
Coupon : Nominal coupon rate expressed as a number or a percentage<br />
InflationRateArray : Array of anticipated inflation rates<br />
IlbStructure : Extended argument defining the index-linked bond structure<br />
IlbMode : Extended argument customizing the return value<br />
Return Value<br />
The return value depends on the value of IlbMode. The default value is a vertical 7-cell array<br />
containing:<br />
PrevCpnDate : Previous coupon date<br />
NextCpnDate : Next coupon date<br />
ExDivDate : Ex-dividend date<br />
AccruedDays : Number of accrued days calculated according to the accrued basis<br />
AccruedInt : Accrued interest<br />
NextCpnValue : Next coupon value<br />
IndexRatio : Index ratio<br />
Notes<br />
The InflationRateArray argument simulates three kinds of index scenarios:<br />
A single value defines a constant inflation rate during the remaining life of the bond.<br />
A one-dimensional array of inflation rates defines the values of the subsequent inflation rates (if<br />
there are more coupons than rates in the aray, the last rate will be applied to all remaining<br />
coupons).<br />
A two-dimensional array of dates and inflation rates is used to calculate the inflation rate curve.<br />
Linear interpolation is applied to this result to calculate the inflation rates.<br />
All the rates available in the index history style database are used, including future rates. In other<br />
words, it is also possible to simulate an index scenario by adding projected index values to the<br />
database.<br />
2.2.29. IlbCashFlows<br />
IlbCashFlows(CalcDate As Variant, Maturity As Variant, Coupon As Double,<br />
InflationRateArray As Variant, IlbStructure As String, IlbMode As String) As<br />
Variant<br />
Generates an array with the remaining cash flows of an index-linked bond.<br />
Arguments<br />
CalcDate : Calculation date<br />
Maturity : Maturity date of the bond<br />
Coupon : Nominal coupon rate expressed as a number or a percentage<br />
InflationRateArray : Array of anticipated inflation rates<br />
IlbStructure : Extended argument defining the index-linked bond structure<br />
IlbMode : Extended argument customizing the return value<br />
45
AdfinX Analytics 1.0 Function Library – User Guide<br />
Return Value<br />
The return value depends on the value of IlbMode. The default value is a vertical 2-column array<br />
containing all remaining cash flows dates and values (interest + principal).<br />
If the RET keyword is not specified in IlbMode, the maximum number of cash flows returned by the<br />
<strong>fun</strong>ction is limited to 24. To return, for example, 30 cash flows for a long term bond, use "RET:A30".<br />
Note<br />
The InflationRateArray argument simulates three kinds of index scenarios:<br />
A single value defines a constant inflation rate during the remaining life of the bond.<br />
A one-dimensional array of inflation rates defines the values of the subsequent inflation rates (if<br />
there are more coupons than rates in the aray, the last rate will be applied to all remaining<br />
coupons).<br />
A two-dimensional array of dates and inflation rates is used to calculate the inflation rate curve.<br />
Linear interpolation is applied to this result to calculate the inflation rates.<br />
All the rates available in the index history style database are used, including future rates. In other<br />
words, it is also possible to simulate an index scenario by adding projected index values to the<br />
database.<br />
2.2.30. IlbPx<br />
IlbPx(CalcDate As Variant, Maturity As Variant, Coupon As Double, Yield As<br />
Double, InflationRateArray As Variant, IlbStructure As String, IlbMode As<br />
String) As Double<br />
Calculates the price on an index-linked bond.<br />
Arguments<br />
CalcDate : Calculation date<br />
Maturity : Maturity date of the bond<br />
Coupon : Nominal coupon rate expressed as a number or a percentage<br />
Yield : Yield to maturity<br />
InflationRateArray : Array of anticipated inflation rates<br />
IlbStructure : Extended argument defining the index-linked bond structure<br />
IlbMode : Extended argument customizing the return value<br />
Return Value<br />
The price of the bond expressed as a percentage of the nominal.<br />
Note<br />
The InflationRateArray argument simulates three kinds of index scenarios:<br />
A single value defines a constant inflation rate during the remaining life of the bond.<br />
A one-dimensional array of inflation rates defines the values of the subsequent inflation rates (if<br />
there are more coupons than rates in the aray, the last rate will be applied to all remaining<br />
coupons).<br />
A two-dimensional array of dates and inflation rates is used to calculate the inflation rate curve.<br />
Linear interpolation is applied to this result to calculate the inflation rates.<br />
46
AdfinX Analytics 1.0 Function Library – User Guide<br />
All the rates available in the index history style database are used, including future rates. In other<br />
words, it is also possible to simulate an index scenario by adding projected index values to the<br />
database.<br />
2.2.31. IlbYld<br />
IlbYld(CalcDate As Variant, Maturity As Variant, Coupon As Double, Price As<br />
Double, InflationRateArray As Variant, IlbStructure As String, IlbMode As<br />
String) As Double<br />
Calculates the yield of an index-linked bond.<br />
Arguments<br />
CalcDate : Calculation date<br />
Maturity : Maturity date of the bond<br />
Coupon : Nominal coupon rate expressed as a number or a percentage<br />
Price : Clean or gross price expressed as a percentage of the nominal<br />
InflationRateArray : Array of anticipated inflation rates<br />
IlbStructure : Extended argument defining the index-linked bond structure<br />
IlbMode : Extended argument customizing the return value<br />
Return Value<br />
The yield to maturity of the bond.<br />
Note<br />
The InflationRateArray argument simulates three kinds of index scenarios:<br />
A single value defines a constant inflation rate during the remaining life of the bond.<br />
A one-dimensional array of inflation rates defines the values of the subsequent inflation rates (if<br />
there are more coupons than rates in the aray, the last rate will be applied to all remaining<br />
coupons).<br />
A two-dimensional array of dates and inflation rates is used to calculate the inflation rate curve.<br />
Linear interpolation is applied to this result to calculate the inflation rates.<br />
All the rates available in the index history style database are used, including future rates. In other<br />
words, it is also possible to simulate an index scenario by adding projected index values to the<br />
database.<br />
47
AdfinX Analytics 1.0 Function Library – User Guide<br />
3. ADFINX ADXCONVBONDMODULE CONTROL<br />
3.1. ADXCONVBONDMODULE PROPERTIES<br />
3.1.1. ErrorCode<br />
ErrorCode() As Long<br />
The ErrorCode property of the AdxConvBondModule control retrieves the last error code<br />
generated by the object.<br />
Arguments<br />
This property takes no argument.<br />
Example<br />
Dim cd as AdxConvBondModule : Declares an object of type AdxConvBondModule<br />
Set cd = New AdxConvBondModule : Creates an AdxConvBondModule object<br />
If cd.ErrorCode 0 Then : cd.ErrorCode contains the error<br />
MsgBox(cd.ErrorCode) : Displays the error code in a message box<br />
End If<br />
3.1.2. ErrorMode<br />
ErrorMode() As AdxErrorMode<br />
The ErrorMode property of the AdxConvBondModule component sets the error mode. Three<br />
modes are defined:<br />
DIALOGBOX : In this mode a dialog box is displayed when an error occurs<br />
EXCEPTION : In this mode an exception is thrown when an error occurs<br />
NO_EXCEPTION : In this mode the user must call the property ErrorCode to know the error<br />
encountered<br />
Arguments<br />
This property takes no argument.<br />
Note<br />
By default the error mode is set to EXCEPTION.<br />
Example<br />
Dim cd as AdxConvBondModule : Declares an object of type<br />
AdxConvBondModule<br />
Set cd = New AdxConvBondModule : Creates an AdxConvBondModule object<br />
cd.ErrorMode = NO_EXCEPTION : cd.ErrorMode is set to NO_EXCEPTION<br />
48
AdfinX Analytics 1.0 Function Library – User Guide<br />
3.1.3. ErrorString<br />
ErrorString() As String<br />
The ErrorString property of the AdxConvBondModule retrieves the last error code generated<br />
by the object with the associated error string.<br />
Arguments<br />
This property takes no argument.<br />
Example<br />
Dim cd as AdxConvBondModule : Declares an object of type AdxConvBondModule<br />
Set cd = New AdxConvBondModule : Creates an AdxConvBondModule object<br />
cd.ErrorMode = EXCEPTION : cd.ErrorMode must be set to EXCEPTION to use the<br />
ErrorString<br />
On Error Go To Handle : Error handler executes code after Handle when an<br />
error occurs<br />
RES = cd.AdConvCalcCpn("24-APR-01", "25-FEB-01", "0.08",<br />
"CONVSRATIO:05OCT00:01JAN04:1.12", "LAY:V")<br />
: The keyword CONVSRATIO does not exist. The <strong>fun</strong>ction<br />
AdConvCalcCpn returns an error<br />
Exit Sub : Exits sub or <strong>fun</strong>ction before the handle or code will be<br />
executed<br />
Handle<br />
MsgBox(cd.ErrorString) : Displays the ErrorString in a message box<br />
cd.ErrorString contains the ErrorString (‘Error#7008 –<br />
SetStructure with an unrecognized keyword.’)<br />
3.2. ADXCONVBONDMODULE METHODS<br />
3.2.1. AdConvBdDeriv<br />
=AdConvBdDeriv (SettlementDate As Variant, Maturity As Variant, Coupon As<br />
Double, RateArray As Variant, Spread As Double, ConvStructure As String,<br />
RateStructure As String, CalcStructure As String, AdMode As String) As<br />
Variant<br />
Returns all derivatives of the underlying bond in an array from the price of the convertible, using a<br />
conversion structure.<br />
Arguments<br />
SettlementDate : Settlement date<br />
Maturity : Maturity date of the convertible bond<br />
Coupon : Coupon rate, expressed as a percentage<br />
RateArray : Argument defining the interest rate model in the bond currency:<br />
• single-factor models: single interest rate or zero-coupon array<br />
• two-factor model: a [dates/rates/rate volatilities/mean reversions]<br />
array<br />
Spread : Credit spread of the issuer expressed in basis points<br />
49
AdfinX Analytics 1.0 Function Library – User Guide<br />
ConvStructure : Extended argument defining the conversion structure<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
AdMode : Extended argument customizing the return value<br />
Return Value<br />
The return value depends on the value of AdMode. The default value is a vertical 5-cell array<br />
containing:<br />
Price : Price<br />
Volatility : Volatility<br />
PVBP : Price variation per basis point<br />
Duration : Duration<br />
Convexity : Convexity<br />
3.2.2. AdConvCalcCpn<br />
=AdConvCalcCpn (SettlementDate As Variant, Maturity As Variant, Coupon As<br />
Double, ConvStructure As String, AdMode As String) As Variant<br />
Returns all coupon features of a convertible bond in an array using a conversion structure.<br />
Arguments<br />
SettlementDate : Settlement date<br />
Maturity : Maturity date of the convertible bond<br />
Coupon : Coupon rate, expressed as a percentage<br />
ConvStructure : Extended argument defining the conversion structure<br />
AdMode : Extended argument customizing the return value<br />
Return Value<br />
The return value depends on the value of AdMode. The default value is a vertical 6-cell array<br />
containing:<br />
PrevCpnDate : Previous coupon date<br />
NextCpnDate : Next coupon date<br />
ExDivDate : Ex-dividend date<br />
AccruedDays : Number of accrued days calculated according to the accrued basis<br />
AccruedInt : Accrued interest<br />
NextCpnValue : Next coupon value<br />
3.2.3. AdConvCashFlows<br />
=AdConvCashFlows (SettlementDate As Variant, Maturity As Variant, Coupon As<br />
Double, ConvStructure As String, AdMode As String) As Variant<br />
Generates an array with the remaining cash flows of a convertible bond.<br />
Arguments<br />
SettlementDate : Settlement date<br />
Maturity : Maturity date of the convertible bond<br />
50
AdfinX Analytics 1.0 Function Library – User Guide<br />
Coupon : Coupon rate, expressed as a percentage<br />
ConvStructure : Extended argument defining the conversion structure<br />
AdMode : Extended argument customizing the return value<br />
Return Value<br />
The return value depends on the value of AdMode. The default value is a vertical 2-column array<br />
containing all remaining cash flow dates and values (interest + principal).<br />
3.2.4. AdConvImpliedVol<br />
=AdConvImpliedVol (SettlementDate As Variant, Maturity As Variant, Price As<br />
Double, Coupon As Double, RateArray As Variant, EquityPrice As Double,<br />
EquityDivArray As Variant, SpotFX As Double, Spread As Double,<br />
ConvStructure As String, RateStructure As String, CalcStructure As String)<br />
As Double<br />
Calculates the volatility implied by the price of a convertible bond.<br />
Arguments<br />
SettlementDate : Settlement date<br />
Maturity : Maturity date of the convertible bond<br />
Price : Clean or gross price of the convertible bond expressed in the current currency.<br />
Coupon : Coupon rate, expressed as a percentage<br />
RateArray : Argument defining the interest rate model in the bond currency:<br />
• single-factor models: single interest rate or zero-coupon array<br />
• two-factor model: a [dates/rates/rate volatilities/mean reversions]<br />
array<br />
EquityPrice : Spot price of the underlying instrument<br />
EquityDivArray : Annual dividend rate or array of dividend dates and dividend amounts<br />
SpotFX : Spot rate ofor the cross currency<br />
Spread : Credit spread of the issuer expressed in basis points<br />
ConvStructure : Extended argument defining the conversion structure<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
Return Value<br />
Implied Volatility of the convertible bond.<br />
3.2.5. AdConvOpDeriv<br />
=AdConvOpDeriv (SettlementDate As Variant, Maturity As Variant, Coupon As<br />
Double, RateArray As Variant, EquityPrice As Double, EquityVolatility As<br />
Double, EquityDivArray As Variant, SpotFX As Double, Spread As Double,<br />
ConvStucture, RateStructure, CalcStructure, AdMode) As Variant<br />
Returns an array of all derivatives (Delta, Gamma, Rho, Theta, Vega) of the optional part of the bond.<br />
Arguments<br />
SettlementDate : Settlement date<br />
Maturity : Maturity date of the convertible bond<br />
51
AdfinX Analytics 1.0 Function Library – User Guide<br />
Coupon : Coupon rate, expressed as a percentage<br />
RateArray : Argument defining the interest rate model in the bond currency:<br />
• single-factor models: single interest rate or zero-coupon array<br />
• two-factor model: a [dates/rates/rate volatilities/mean reversions]<br />
array<br />
EquityPrice : Spot price of the underlying instrument<br />
EquityVolatility : Volatility of the underlying instrument<br />
EquityDivArray : Annual dividend rate or array of dividend dates and dividend amounts<br />
SpotFX : Spot rate for the cross currency<br />
Spread : Credit spread of the issuer expressed in basis points<br />
ConvStructure : Extended argument defining the conversion structure<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
AdMode : Extended argument customizing the return value<br />
Return Value<br />
The greeks Delta, Gamma, Rho, Theta, and Vega.<br />
3.2.6. AdConvPrice<br />
=AdConvPrice (SettlementDate As Variant, Maturity As Variant, Coupon As<br />
Double, RateArray As Variant, EquityPrice As Double, EquityVolatility As<br />
Double, EquityDivArray As Variant, SpotFX As Double, Spread As Double,<br />
ConvStructure As String, RateStructure As String, CalcStructure As String,<br />
AdMode As String) As Variant<br />
Calculates the price of a convertible bond using a conversion structure.<br />
Arguments<br />
SettlementDate : Settlement date<br />
Maturity : Maturity date of the convertible bond<br />
Coupon : Coupon rate, expressed as a percentage<br />
RateArray : Argument defining the interest rate model in the bond currency:<br />
• single-factor models: single interest rate or zero-coupon array<br />
• two-factor model: a [dates/rates/rate volatilities/mean reversions]<br />
array<br />
EquityPrice : Spot price of the underlying instrument<br />
EquityVolatility : Volatility of the underlying instrument<br />
EquityDivArray : Annual dividend rate or array of dividend dates and dividend amounts<br />
SpotFX : Spot rate for the cross currency<br />
Spread : Credit spread of the issuer expressed in basis points<br />
ConvStructure : Extended argument defining the conversion structure<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
AdMode : Extended argument customizing the return value<br />
Return Values<br />
Theoretical price: the convertible bond price calculated by the model<br />
Equity Premium<br />
Option Premium<br />
Total Premium (Equity Premium + Option Premium)<br />
Break-even period<br />
Straight value<br />
52
AdfinX Analytics 1.0 Function Library – User Guide<br />
3.2.7. AdConvRatios<br />
=AdConvRatios (SettlementDate As Variant, Maturity As Variant, Price As<br />
Double, EquityPrice As Double, SpotFX As Double, ConvStructure As String,<br />
AdMode As String) As Variant<br />
Calculates the main characteristics of a convertible bond using a conversion structure.<br />
Arguments<br />
SettlementDate : Settlement date<br />
Maturity : Maturity date of the convertible bond<br />
Price : Clean or gross price of the convertible bond expressed as a percentage of<br />
the nominal<br />
EquityPrice : Spot price of the underlying instrument<br />
SpotFX : Spot rate for the cross currency<br />
ConvStructure : Extended argument defining the conversion structure<br />
AdMode : Extended argument customizing the return value<br />
Return Value<br />
Conversion value<br />
Market conversion premium<br />
Conversion price<br />
Parity<br />
3.2.8. AdConvYield<br />
=AdConvYield (SettlementDate As Variant, Price As Double, Maturity As<br />
Variant, Coupon As Double, ConvStructure As String, RateStructure As String)<br />
As Double<br />
Calculates the yield of the underlying bond from the price of the convertible, using a conversion<br />
structure.<br />
Arguments<br />
SettlementDate : Settlement date<br />
Price : Clean or gross price of the convertible bond in current currency<br />
Maturity : Maturity date of the convertible bond<br />
Coupon : Coupon rate expressed as a percentage<br />
ConvStructure : Extended argument defining the conversion structure<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
Return Value<br />
The yield of the underlying bond.<br />
53
AdfinX Analytics 1.0 Function Library – User Guide<br />
4. ADFINX ADXCREDITMODULE CONTROL<br />
4.1. ADXCREDITMODULE PROPERTIES<br />
4.1.1. ErrorCode<br />
ErrorCode() As Long<br />
The ErrorCode property of the AdxCreditModule control retrieves the last error code generated<br />
by the object.<br />
Arguments<br />
This property takes no argument.<br />
Example<br />
Dim ct as AdxCreditModule : Declares an object of type AdxCreditModule<br />
Set ct = New AdxCreditModule : Creates an AdxCreditModule object<br />
If ct.ErrorCode 0 Then : ct.ErrorCode contains the error<br />
MsgBox (ct.ErrorCode) : Displays the error code in a message box<br />
End If<br />
4.1.2. ErrorMode<br />
ErrorMode() As AdxErrorMode<br />
The ErrorMode property of the AdxCreditModule component sets the error mode. Three modes<br />
are defined:<br />
DIALOGBOX : In this mode a dialog box is displayed when an error occurs<br />
EXCEPTION : In this mode an exception is thrown when an error occurs<br />
NO_EXCEPTION : In this mode the user must call the property ErrorCode to know the error<br />
encountered<br />
Arguments<br />
This property takes no argument.<br />
Note<br />
By default the error mode is set to EXCEPTION.<br />
Example<br />
Dim ct as AdxCreditModule : Declares an object of type AdxCreditModule<br />
Set ct = New AdxCreditModule : Creates an AdxCreditModule object<br />
ct.ErrorMode = NO_EXCEPTION : ct.ErrorMode is set to NO_EXCEPTION<br />
4.1.3. ErrorString<br />
ErrorString() As String<br />
The ErrorString property of the AdxCreditModule retrieves the last error code generated by<br />
the object with the associated error string.<br />
54
AdfinX Analytics 1.0 Function Library – User Guide<br />
Arguments<br />
This property takes no argument.<br />
Example<br />
Dim ct as AdxCreditModule : Declares an object of type AdxCreditModule<br />
Set ct = New AdxCreditModule : Creates an AdxCreditModule object<br />
ct.ErrorMode = EXCEPTION : ct.ErrorMode must be set to EXCEPTION to use the<br />
ErrorString<br />
On Error Go To Handle : Error handler executes code after Handle when an error<br />
occurs<br />
Res = ct.AdCdsNpv("19SEP02", "15SEP02", "5Y", 200, 0.3, [ratea].Value,<br />
[credita].Value, "RATETYPE:CMP CDSTYPE:AMERCDS CLDR:EMU_FI LFLOAT AOD:YES<br />
LFIXED FRQ:4 CCM:MMA0", "RISKMODEL:CURVE RECOVERY:0.3 NBDAYS:5 ND:DIS",<br />
"RM:YC ZCTYPE:DF IMCUBD")<br />
: The RateStructure is incorrect. The <strong>fun</strong>ction<br />
AdCdsNpv returns an error<br />
Exit Sub : Exits sub or <strong>fun</strong>ction before the handle or code will be<br />
executed<br />
Handle<br />
MsgBox(ct.ErrorString) : Displays the ErrorString in a message box<br />
ct.ErrorString contains the ErrorString (‘Error#7601 –<br />
RateStructure: invalid keyword.’)<br />
4.2. ADXCREDITMODULE METHODS<br />
4.2.1. AdCdsNpv<br />
AdCdsNpv(SettlementDate As Variant, StartDate As Variant, Maturity As<br />
Variant, Spread As Double, RateArray As Variant, CreditArray As Variant,<br />
CdsStructure As String, CreditStructure As String, RateStructure As String)<br />
As Double<br />
Depending on the model specified by the RISKMODEL keyword, the <strong>fun</strong>ction calculates the net present<br />
value of a credit default swap, using:<br />
the Cox, Ingersoll, and Ross model<br />
a credit event probability curve<br />
Arguments<br />
SettlementDate : Settlement date<br />
StartDate : Start date of the credit default swap<br />
Maturity : Maturity of the credit default swap, expressed as a date or code<br />
Spread : Spread of the credit default swap, expressed as basis points<br />
RateArray : Interest rate model<br />
CreditArray : Credit model<br />
CdsStructure : Extended argument defining the structure of the credit default swap<br />
CreditStructure : Extended argument defining the credit model<br />
RateStructure : Extended argument defining the interest rate model<br />
55
AdfinX Analytics 1.0 Function Library – User Guide<br />
Return value<br />
The return value is the net present value of the credit default swap.<br />
Notes<br />
You can specify CDSTYPE:AMERCDS or CDSTYPE:EURCDS in CdsStructure, to calculate the net<br />
present value of an American or European credit default swap.<br />
CreditArray defines the credit model, using either the Cox, Ingersoll, and Ross model or a credit<br />
event probability curve:<br />
If you specify in CreditStructure<br />
RISKMODEL:CIR<br />
RISKMODEL:CURVE<br />
Then CreditArray is<br />
a 1-dimension array containing (Initial default intensity,<br />
Long-term default intensity, Convergence speed)<br />
a 2-dimension array containing (Maturity, Credit event<br />
probability)<br />
4.2.2. AdCdsSpread<br />
AdCdsSpread(SettlementDate As Variant, StartDate As Variant, Maturity As<br />
Variant, Npv As Double, RateArray As Variant, CreditArray As Variant,<br />
CdsStructure As String, CreditStructure As String, RateStructure As String)<br />
As Double<br />
Depending on the model specified by the RISKMODEL keyword, the <strong>fun</strong>ction calculates the spread of a<br />
credit default swap from the net present value, using:<br />
the Cox, Ingersoll, and Ross model<br />
a credit event probability curve<br />
Arguments<br />
SettlementDate : Settlement date<br />
StartDate : Start date of the credit default swap<br />
Maturity : Maturity of the credit default swap, expressed as a date or code<br />
Npv : Net present value of the credit default swap<br />
RateArray : Interest rate model<br />
CreditArray : Credit model<br />
CdsStructure : Extended argument defining the structure of the credit default swap<br />
CreditStructure : Extended argument defining the credit model<br />
RateStructure : Extended argument defining the interest rate model<br />
Return Value<br />
The spread of the credit default swap, expressed as basis points.<br />
Notes<br />
You can specify CDSTYPE:AMERCDS or CDSTYPE:EURCDS in CdsStructure, to calculate the<br />
spread of an American or European credit default swap.<br />
CreditArray defines the credit model, using either the Cox, Ingersoll, and Ross model or a credit<br />
event probability curve:<br />
If you specify in CreditStructure<br />
RISKMODEL:CIR<br />
Then CreditArray is<br />
a 1-dimension array containing (Initial default intensity,<br />
Long-term default intensity, Convergence speed)<br />
56
AdfinX Analytics 1.0 Function Library – User Guide<br />
RISKMODEL:CURVE<br />
a 2-dimension array containing (Maturity, Credit event<br />
probability)<br />
4.2.3. AdFxCdsNpv<br />
AdFxCdsNpv(SettlementDate As Variant, StartDate As Variant, Maturity As<br />
Variant, Spread As Double, PaidRate As Double, ReceivedRate As Double,<br />
FxArray As Variant, CreditArray As Variant, CdsStructure As String,<br />
CreditStructure As String, RateStructure As String) As Double<br />
Depending on the model specified by the RISKMODEL keyword, the <strong>fun</strong>ction calculates the net present<br />
value of a Quanto credit default swap, using:<br />
the Cox, Ingersoll, and Ross model<br />
a credit event probability curve<br />
Arguments<br />
SettlementDate : Settlement date<br />
StartDate : Start date of the credit default swap<br />
Maturity : Maturity of the credit default swap, expressed as a date or code<br />
Spread : Spread of the credit default swap, expressed as basis points<br />
PaidRate : Interest rate model of the paid leg<br />
ReceivedRate : Interest rate model of the received leg<br />
FxArray : Array of dates and swap points<br />
CreditArray : Credit model<br />
CdsStructure : Extended argument defining the structure of the credit default swap<br />
CreditStructure : Extended argument defining the credit model<br />
RateStructure : Extended argument defining the interest rate model<br />
Return value<br />
The return value is the net present value of the Quanto credit default swap.<br />
Notes<br />
You can specify CDSTYPE:AMERCDS or CDSTYPE:EURCDS in CdsStructure, to calculate the net<br />
present value of an American or European Quanto credit default swap.<br />
FxArray is a 2-column array of N+1 swap points and dates, where N is the number of periods.<br />
CreditArray defines the credit model, using either the Cox, Ingersoll, and Ross model or a credit<br />
event probability curve:<br />
If you specify in CreditStructure<br />
RISKMODEL:CIR<br />
RISKMODEL:CURVE<br />
Then CreditArray is<br />
a 1-dimension array containing (Initial default intensity,<br />
Long-term default intensity, Convergence speed)<br />
a 2-dimension array containing (Maturity, Credit event<br />
probability)<br />
4.2.4. AdFxCdsSpread<br />
AdFxCdsSpread(SettlementDate As Variant, StartDate As Variant, Maturity As<br />
Variant, Npv As Double, PaidRate As Double, ReceivedRate As Double, FxArray<br />
As Variant, CreditArray As Variant, CdsStructure As String, CreditStructure<br />
As String, RateStructure As String) As Double<br />
57
AdfinX Analytics 1.0 Function Library – User Guide<br />
Depending on the model specified by the RISKMODEL keyword, the <strong>fun</strong>ction calculates the spread of a<br />
Quanto credit default swap from the net present value, using:<br />
the Cox, Ingersoll, and Ross model<br />
a credit event probability curve<br />
Arguments<br />
SettlementDate : Settlement date<br />
StartDate : Start date of the credit default swap<br />
Maturity : Maturity of the credit default swap, expressed as a date or code<br />
Npv : Net present value of the credit default swap<br />
PaidRate : Interest rate model of the paid leg<br />
ReceivedRate : Interest rate model of the received leg<br />
FxArray : Array of dates and swap points<br />
CreditArray : Credit model<br />
CdsStructure : Extended argument defining the structure of the credit default swap<br />
CreditStructure : Extended argument defining the credit model<br />
RateStructure : Extended argument defining the interest rate model<br />
Return Value<br />
The spread of the Quanto credit default swap, expressed as basis points.<br />
Notes<br />
You can specify CDSTYPE:AMERCDS or CDSTYPE:EURCDS in CdsStructure, to calculate the<br />
spread of an American or European Quanto credit default swap.<br />
FxArray is a 2-column array of N+1 swap points and dates, where N is the number of periods.<br />
CreditArray defines the credit model, using either the Cox, Ingersoll, and Ross model or a credit<br />
event probability curve:<br />
If you specify in CreditStructure<br />
RISKMODEL:CIR<br />
RISKMODEL:CURVE<br />
Then CreditArray is<br />
a 1-dimension array containing (Initial default intensity,<br />
Long-term default intensity, Convergence speed)<br />
a 2-dimension array containing (Maturity, Credit event<br />
probability)<br />
4.2.5. AdCreditStructure<br />
AdCreditStructure(RateArray As Variant, InstrumentArray As Double,<br />
CreditStructure As String, RateStructure As String, AdMode As String) As<br />
Variant<br />
Depending on the model specified by the RISKMODEL keyword, the <strong>fun</strong>ction calibrates the Cox,<br />
Ingersoll, and Ross model or the credit event probability curve, either from an array of credit default<br />
swaps, or from a credit zero-coupon curve.<br />
Arguments<br />
RateArray : Interest rate model<br />
InstrumentArray : Array of instruments<br />
CreditStructure : Extended argument defining the credit model<br />
RateStructure : Extended argument defining the interest rate model<br />
AdMode : Extended argument customizing the return value<br />
58
AdfinX Analytics 1.0 Function Library – User Guide<br />
Return Value<br />
The return value depends on the credit model you want to calibrate and the AdMode structure.<br />
Cox, Ingersoll, and Ross model:<br />
The return value is an array containing the:<br />
• initial default intensity<br />
• long-term default intensity<br />
• convergence speed of the default intensity<br />
Probability curve:<br />
The return value depends on AdMode. The default value is a 2-column array containing:<br />
the maturity of each credit default swap<br />
the probability for each swap to default before maturity<br />
The array represents the credit event probability curve.<br />
Notes<br />
You must specify either RISKMODEL:CIR keyword in CreditStructure to calibrate the Cox,<br />
Ingersoll, and Ross model, or RISKMODEL:CURVE to calibrate the probability curve.<br />
RateArray is not taken into account if you calibrate the Cox, Ingersoll, and Ross model using the<br />
approximated formula from an array of instruments.<br />
InstrumentArray specifies either the set of instruments or the credit zero-coupon curve used to<br />
calibrate the credit model:<br />
If you specify in CreditStructure<br />
INSTTYPE:CDS<br />
INSTTYPE:DF<br />
Then InstrumentArray must contain<br />
the columns (Cds Start Date, Maturity, Spread,<br />
CdsStructure)<br />
the columns (Maturity, Rate)<br />
Adfin Analytics does not limit the size of InstrumentArray.<br />
4.2.6. AdCreditZcCurve<br />
AdCreditZcCurve(SettlementDate As Variant, RateArray As Variant, CreditArray<br />
As Variant, CreditStructure As String, RateStructure As String, AdMode As<br />
String) As Variant<br />
Depending on the model specified by the RISKMODEL keyword, the <strong>fun</strong>ction builds a credit zerocoupon<br />
curve, using:<br />
the Cox, Ingersoll, and Ross model<br />
the credit event probability curve<br />
Arguments<br />
SettlementDate : Settlement date<br />
RateArray : Interest rate model<br />
CreditArray : Credit model<br />
CreditStructure : Extended argument defining the credit model<br />
RateStructure : Extended argument defining the interest rate model<br />
59
AdfinX Analytics 1.0 Function Library – User Guide<br />
AdMode : Extended argument customizing the return value<br />
Return Value<br />
The return value is a 2-column array containing the credit discount factor at each date of RateArray.<br />
The return value depends on the AdMode structure.<br />
Notes<br />
CreditArray specifies the credit model:<br />
If you specify in CreditStructure<br />
RISKMODEL:CIR<br />
RISKMODEL:CURVE<br />
Then CreditArray is<br />
a 1-dimension array containing (Initial default intensity,<br />
Long-term default intensity, Convergence speed)<br />
a 2-dimension array containing (Maturity, Credit event<br />
probability)<br />
You must specify either RISKMODEL:CIR keyword in CreditStructure to use the Cox,<br />
Ingersoll, and Ross model, or RISKMODEL:CURVE to use the credit event probability curve.<br />
You must specify RM:YC ZCTYPE:DF in RateStructure to use AdCreditZcCurve.<br />
4.2.7. AdDefaultProba<br />
AdDefaultProba(SettlementDate As Variant, DateArray As Variant, CreditArray<br />
As Variant, CreditStructure As String, AdMode As String) As Variant<br />
Depending on the model specified by the RISKMODEL keyword, the <strong>fun</strong>ction calculates the<br />
probabilities of default for an array of dates, using the Cox, Ingersoll, and Ross model or a curve credit<br />
model.<br />
Arguments<br />
SettlementDate : Settlement date<br />
DateArray : Array of dates<br />
CreditArray : Credit model<br />
CreditStructure : Extended argument defining the credit model<br />
AdMode : Extended argument customizing the return value<br />
Return Value<br />
The return value depends on AdMode. The return value is a 2-column array containing for each date in<br />
DateArray the credit event probability computed either with the Cox, Ingersoll, and Ross parameters<br />
or by interpolation of the credit event probability curve.<br />
Notes<br />
DateArray is generally the maturities of the credit default swaps.<br />
CreditArray defines the credit model, using either the Cox, Ingersoll, and Ross model or a credit<br />
event probability curve:<br />
If you specify in CreditStructure<br />
RISKMODEL:CIR<br />
RISKMODEL:CURVE<br />
Then CreditArray is<br />
a 1-dimension array containing (Initial default intensity,<br />
Long-term default intensity, Convergence speed)<br />
a 2-dimension array containing (Maturity, Credit event<br />
probability)<br />
60
AdfinX Analytics 1.0 Function Library – User Guide<br />
4.2.8. AdJLTCreditStructure<br />
AdJLTCreditStructure(RateArray As Variant, RiskyZcArray As Variant,<br />
TransitionArray As Variant, CreditStructure As String, RateStructure As<br />
String, AdMode As String) As Variant<br />
Calibrates a credit event probability curve from a rating transition matrix, using the Jarrow, Lando, and<br />
Turnbull model.<br />
Arguments<br />
RateArray : Array of risk-free zero-coupon prices<br />
RiskyZcArray : Array of credit zero-coupon curves<br />
TransitionArray : Ratings transition matrix<br />
CreditStructure : Extended argument defining the credit model<br />
RateStructure : Extended argument defining the interest rate model<br />
AdMode : Extended argument customizing the return value<br />
Return Value<br />
The return value is a 2-column array, containing the credit event probabilities for the maturities defined<br />
in RiskyZcArray.<br />
Notes<br />
RiskyZcArray must specify as many credit zero-coupon curves as the transition matrix specifies<br />
credit ratings, the default state excepted. It is represented by an array containing the zero-coupon<br />
dates and rates of each curve.<br />
TransitionArray defines a square transition matrix, which describes the ratings for instruments<br />
maturing in one year. The last line and column represent the default state.<br />
You must specify RISKMODEL:CURVE keyword in CreditStructure.<br />
You must specify RATING:i and CREDITEVENT:j in CreditStructure to indicate the issuing<br />
firm rating i and the credit event rating j.<br />
61
AdfinX Analytics 1.0 Function Library – User Guide<br />
5. ADFINX ADXEXOTICMODULE CONTROL<br />
5.1. ADXEXOTICMODULE PROPERTIES<br />
5.1.1. ErrorCode<br />
ErrorCode() As Long<br />
The ErrorCode property of the AdxExoticModule control retrieves the last error code generated<br />
by the object.<br />
Arguments<br />
This property takes no argument.<br />
Example<br />
Dim ex as AdxExoticModule : Declares an object of type AdxExoticModule<br />
Set ex = New AdxExoticModule : Creates an AdxExoticModule object<br />
If ex.ErrorCode 0 Then : ex.ErrorCode contains the error<br />
MsgBox (ex.ErrorCode) : Displays the error code in a message box<br />
End If<br />
5.1.2. ErrorMode<br />
ErrorMode() As AdxErrorMode<br />
The ErrorMode property of the AdxExoticModule component sets the error mode. Three modes<br />
are defined:<br />
DIALOGBOX : In this mode a dialog box is displayed when an error occurs<br />
EXCEPTION : In this mode an exception is thrown when an error occurs<br />
NO_EXCEPTION : In this mode the user must call the property ErrorCode to know the error<br />
encountered<br />
Arguments<br />
This property takes no argument.<br />
Note<br />
By default the error mode is set to EXCEPTION.<br />
Example<br />
Dim ex as AdxExoticModule : Declares an object of type AdxExoticModule<br />
Set ex = New AdxExoticModule : Creates an AdxExoticModule object<br />
ex.ErrorMode = NO_EXCEPTION : ex.ErrorMode is set to NO_EXCEPTION<br />
62
AdfinX Analytics 1.0 Function Library – User Guide<br />
5.1.3. ErrorString<br />
ErrorString() As String<br />
The ErrorString property of the AdxExoticModule retrieves the last error code generated by<br />
the object with the associated error string.<br />
Arguments<br />
This property takes no argument.<br />
Example<br />
Dim ex as AdxExoticModule : Declares an object of type AdxExoticModule<br />
Set ex = New AdxExoticModule : Creates an AdxExoticModule object<br />
ex.ErrorMode = EXCEPTION : ex.ErrorMode must be set to EXCEPTION to use the<br />
ErrorString<br />
On Error Go To Handle : Error handler executes code after Handle when an error<br />
occurs<br />
Res = ex.OpBasketPremium("1-MAR-04", "31Aug04", [pricea].Value, "70",<br />
[corra].Value, "0.064", [returnar].Value, _[weighta].Value, "EXM:EURO",<br />
"RM:YTM", "CMTFORM")<br />
: The CalcStructure is incorrect. The <strong>fun</strong>ction<br />
OpBasketPremium returns an error<br />
Exit Sub : Exits sub or <strong>fun</strong>ction before the handle or code will be<br />
executed<br />
Handle<br />
MsgBox(ex.ErrorString) : Displays the ErrorString in a message box.<br />
ex.ErrorString contains the ErrorString (‘Error#7601 –<br />
CalcStructure: invalid keyword.’)<br />
5.2. ADXEXOTICMODULE METHODS<br />
5.2.1. OpAsianDeriv<br />
OpAsianDeriv(CalcDate As Variant, FirstFixingDate As Variant, ExpiryDate As<br />
Variant, SpotPrice As Double, StrikePrice As Double, AveragePrice As Double,<br />
NbFixing As Long, Volatility As Double, RiskFreeRateArray As Variant,<br />
ReturnArray As Variant, ExoticStructure As String, RateStructure As String,<br />
CalcStructure As String, AdMode As String) As Variant<br />
Returns all derivatives (delta, gamma, rho, theta, and vega) of an Asian option in an array. At maturity,<br />
this type of option pays either the difference between the average of the underlying prices and the<br />
strike price, or the difference between the underlying price at maturity and the average of the<br />
underlying prices.<br />
Arguments<br />
CalcDate : Calculation date<br />
FirstFixingDate : Date of the first fixing for the average calculation<br />
ExpiryDate : Expiry date of the option<br />
SpotPrice : Market or spot price of the underlying instrument<br />
StrikePrice : Exercise or strike price of the option, ignored for average strike options<br />
63
AdfinX Analytics 1.0 Function Library – User Guide<br />
AveragePrice : Average of the underlying prices from the first fixing date to the<br />
calculation date<br />
NbFixing : Number of fixings used to calculate the average<br />
Volatility : Anticipated volatility of the underlying instrument<br />
RiskFreeRateArray : Array of data depending on the rate model chosen<br />
ReturnArray : Array of annualized dividend rates<br />
ExoticStructure : Extended argument defining the exotic option structure<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
AdMode : Extended argument customising the return value<br />
Return Value<br />
The return value depends on the value of AdMode. The default value is a vertical 5-element array<br />
containing:<br />
Delta : Delta ratio<br />
Gamma : Gamma ratio<br />
Rho : Rho ratio<br />
Theta : Theta ratio<br />
Vega : Vega ratio<br />
Notes<br />
The <strong>fun</strong>ction assumes that the fixings are performed at regular dates between FirstFixingDate<br />
and ExpiryDate. If the average calculation period has not started yet, the argument<br />
AveragePrice is ignored.<br />
The ReturnArray and RiskFreeRateArray arguments can be defined respectively in<br />
ExoticStructure and RateStructure through the keywords RATETYPE, RATEFRQ, RM or DCB.<br />
You must include at least the option type in the ExoticStructure, using the CALL and PUT<br />
keywords, and the Asian type using the ASIAN keyword.<br />
You can define the type of average using the AVE keyword in ExoticStructure.<br />
You can calculate only one derivative if this derivative is specified in AdMode, using the RES<br />
keyword.<br />
5.2.2. OpAsianImpliedVol<br />
OpAsianImpliedVol(CalcDate As Variant, FirstFixingDate As Variant, ExpiryDate As<br />
Variant, SpotPrice As Double, StrikePrice As Double, AveragePrice As Double,<br />
NbFixing As Long, Premium As Double, RiskFreeRateArray As Variant, ReturnArray<br />
As Variant, ExoticStructure As String, RateStructure As String,<br />
CalcStructure As String) As Double<br />
Calculates the implied volatility of an Asian option. At maturity, this type of option pays either the<br />
difference between the average of the underlying prices and the strike price, or the difference between<br />
the underlying price at maturity and the average of the underlying prices.<br />
Arguments<br />
CalcDate : Calculation date<br />
FirstFixingDate : Date of the first fixing for the average calculation<br />
ExpiryDate : Expiry date of the option (also date of the last fixing)<br />
SpotPrice : Market or spot price of the underlying instrument<br />
StrikePrice : Exercise or strike price of the option, ignored for average strike options<br />
AveragePrice : Average of the underlying prices from the first fixing date to the<br />
calculation date<br />
64
AdfinX Analytics 1.0 Function Library – User Guide<br />
NbFixing : Number of fixings used to calculate the average<br />
Premium : Premium of the option<br />
RiskFreeRateArray : Array of data depending on the rate model chosen<br />
ReturnArray : Array of annualized dividend rates<br />
ExoticStructure : Extended argument defining the exotic option structure<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
Return Value<br />
The implied volatility of the option.<br />
Notes<br />
The <strong>fun</strong>ction assumes that the fixings are performed at regular dates between FirstFixingDate<br />
and ExpiryDate. If the average calculation period has not started yet, the argument<br />
AveragePrice is ignored.<br />
The ReturnArray and RiskFreeRateArray arguments can be defined respectively in<br />
ExoticStructure and RateStructure through the keywords RATETYPE, RATEFRQ, RM or DCB.<br />
You must include at least the option type in the ExoticStructure, using the CALL and PUT<br />
keywords, and the Asian type using the ASIAN keyword.<br />
You can define the type of average using the AVE keyword in ExoticStructure.<br />
5.2.3. OpAsianPremium<br />
OpAsianPremium(CalcDate As Variant, FirstFixingDate As Variant, ExpiryDate As<br />
Variant, SpotPrice As Double, StrikePrice As Double, AveragePrice As Double,<br />
NbFixing As Long, Volatility As Double, RiskFreeRateArray As Variant,<br />
ReturnArray As Variant, ExoticStructure As String, RatesStructure As String,<br />
CalcStructure As String) As Double<br />
Calculates the premium of an Asian option. At maturity, this type of option pays either the difference<br />
between the average of the underlying prices and the strike price, or the difference between the<br />
underlying price at maturity and the average of the underlying prices.<br />
Arguments<br />
CalcDate : Calculation date<br />
FirstFixingDate : Date of the first fixing for the calculation of the averages<br />
ExpiryDate : Expiry date of the option (also date of the last fixing)<br />
SpotPrice : Market or spot price of the underlying instrument<br />
StrikePrice : Exercise or strike price of the option, ignored for average strike options<br />
AveragePrice : Average of the underlying prices from the first fixing date to the<br />
calculation date<br />
NbFixing : Number of fixings used to calculate the average<br />
Volatility : Anticipated volatility of the underlying instrument<br />
RiskFreeRateArray : Array of data depending on the rate model chosen<br />
ReturnArray : Array of annualized dividend rates<br />
ExoticStructure : Extended argument defining the exotic option structure<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
Return Value<br />
The premium of the option.<br />
65
AdfinX Analytics 1.0 Function Library – User Guide<br />
Notes<br />
The <strong>fun</strong>ction assumes that the fixings are performed at regular dates between FirstFixingDate<br />
and ExpiryDate. If the average calculation period has not started yet, the argument<br />
AveragePrice is ignored.<br />
The ReturnArray and RiskFreeRateArray arguments can be defined respectively in<br />
ExoticStructure and RateStructure through the keywords RATETYPE, RATEFRQ, RM or DCB.<br />
You must include at least the option type in the ExoticStructure, using the CALL and PUT<br />
keywords, and the Asian type using the ASIAN keyword.<br />
You can define the type of average using the AVE keyword in ExoticStructure.<br />
5.2.4. OpBarrierDeriv<br />
OpBarrierDeriv(CalcDate As Variant, ExpiryDate As Variant, SpotPrice As Double,<br />
StrikePrice As Double, BarrierPrice As Double, Volatility As Double,<br />
RiskFreeRateArray As Variant, ReturnArray As Variant, ExoticStructure As<br />
String, RateStructure As String, CalcStructure As String, AdMode As String)<br />
As Variant<br />
Returns all derivatives (delta, gamma, rho, theta, and vega) of a Barrier option in an array. At maturity,<br />
this type of option pays either the difference between the strike price and the underlying price if<br />
activated, or an agreed rebate if the option is knocked out or if it fails to knock-in.<br />
Arguments<br />
CalcDate : Calculation date<br />
ExpiryDate : Expiry date of the option (also date of the last fixing)<br />
SpotPrice : Market or spot price of the underlying instrument<br />
StrikePrice : Exercise or strike price of the option<br />
BarrierPrice : Price of the barrier of the option<br />
Volatility : Anticipated volatility of the underlying instrument<br />
RiskFreeRateArray : Array of data depending on the rate model chosen<br />
ReturnArray : Array of annualized dividend rates<br />
ExoticStructure : Extended argument defining the exotic option structure<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
AdMode : Extended argument customising the return value<br />
Return Value<br />
The return value depends on the value of AdMode. The default value is a vertical 5-element array<br />
containing:<br />
Delta : Delta ratio<br />
Gamma : Gamma ratio<br />
Rho : Rho ratio<br />
Theta : Theta ratio<br />
Vega : Vega ratio<br />
Notes<br />
The ReturnArray and RiskFreeRateArray arguments can be defined respectively in<br />
ExoticStructure and RateStructure through the keywords RATETYPE, RATEFRQ, RM or DCB.<br />
You must include at least the option type in the ExoticStructure, using the CALL and PUT<br />
keywords, and the Barrier type using the KI, KO or WIN keywords.<br />
You can calculate only one derivative if this derivative is specified in AdMode, using the RES<br />
66
AdfinX Analytics 1.0 Function Library – User Guide<br />
keyword.<br />
5.2.5. OpBarrierImpliedVol<br />
OpBarrierImpliedVol(CalcDate As Variant, ExpiryDate As Variant, SpotPrice As<br />
Double, StrikePrice As Double, BarrierPrice As Double, Premium As Double,<br />
RiskFreeRateArray As Variant, ReturnArray As Variant, ExoticStructure As<br />
String, RateStructure As String, CalcStructure As String) As Double<br />
Calculates the implied volatility of a Barrier option. At maturity, this option pays either the difference<br />
between the strike price and the underlying price if activated, or an agreed rebate if the option is<br />
knocked out or if it fails to knock-in.<br />
Arguments<br />
CalcDate : Calculation date<br />
ExpiryDate : Expiry date of the option (also date of the last fixing)<br />
SpotPrice : Market or spot price of the underlying instrument<br />
StrikePrice : Exercise or strike price of the option<br />
BarrierPrice : Price of the barrier of the option<br />
Premium : Premium of the option<br />
RiskFreeRateArray : Array of data depending on the rate model chosen<br />
ReturnArray<br />
: Array of annualized dividend rates<br />
ExoticStructure : Extended argument defining the exotic option structure<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
Return Value<br />
The implied volatility of the option.<br />
Notes<br />
The ReturnArray and RiskFreeRateArray arguments can be defined respectively in<br />
ExoticStructure and RateStructure through the keywords RATETYPE, RATEFRQ, RM or DCB.<br />
You must include at least the option type in the ExoticStructure, using the CALL and PUT<br />
keywords, and the Barrier type using the KI, KO or WIN keywords.<br />
5.2.6. OpBarrierPremium<br />
OpBarrierPremium(CalcDate As Variant, ExpiryDate As Variant, SpotPrice As<br />
Double, StrikePrice As Double, BarrierPrice As Double, Volatility As Double,<br />
RiskFreeRateArray As Variant, ReturnArray As Variant, ExoticStructure As<br />
String, RateStructure As String, CalcStructure As String) As Double<br />
Calculates the premium of a Barrier option. At maturity, this type of option pays either the difference<br />
between the strike price and the underlying price if activated, or an agreed rebate if the option is<br />
knocked out or if it fails to knock-in.<br />
Arguments<br />
CalcDate : Calculation date<br />
ExpiryDate : Expiry date of the option (also date of the last fixing)<br />
SpotPrice : Market or spot price of the underlying instrument<br />
StrikePrice : Exercise or strike price of the option<br />
67
AdfinX Analytics 1.0 Function Library – User Guide<br />
BarrierPrice : Price of the barrier of the option<br />
Volatility : Anticipated volatility of the underlying instrument<br />
RiskFreeRateArray : Array of data depending on the rate model chosen<br />
ReturnArray : Array of annualized dividend rates<br />
ExoticStructure : Extended argument defining the exotic option structure<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
Return Value<br />
The premium of the option.<br />
Notes<br />
The ReturnArray and RiskFreeRateArray arguments can be defined respectively in<br />
ExoticStructure and RateStructure through the keywords RATETYPE, RATEFRQ, RM or DCB.<br />
You must include at least the option type in the ExoticStructure, using the CALL and PUT<br />
keywords, and the Barrier type using the KI, KO or WIN keywords.<br />
5.2.7. OpBasketDeriv<br />
OpBasketDeriv(CalcDate As Variant, ExpiryDate As Variant, SpotPriceArray As<br />
Variant, StrikePrice As Double, CorrelationArray As Variant,<br />
RiskFreeRateArray As Variant, ReturnArray As Variant, NbSharesArray As<br />
Variant, ExoticStucture As String, RateStructure As String, CalcStructure<br />
As String, AdMode As String) As Variant<br />
Returns all derivatives (delta, gamma, rho, theta, and vega) of a Basket option in an array. Basket<br />
options, also called portfolio options, are a variation of Rainbow options. Their payoff is the weighted<br />
average of the prices within the basket of underlying assets.<br />
Arguments<br />
CalcDate : Calculation date<br />
ExpiryDate : Expiry date of the option<br />
SpotPriceArray : Array containing the spot prices of the underlying instruments<br />
StrikePrice : Strike price of the option<br />
CorrelationArray : Array containing the volatilities of the assets on the diagonal and the<br />
correlation coefficients<br />
RiskFreeRateArray<br />
: Array of data depending on the rate model chosen:<br />
• constant risk free rate<br />
• zero-coupon curve<br />
ReturnArray : Array containing the annualized dividend rates of the underlying<br />
instruments<br />
NbSharesArray : To specify the number of shares for each asset<br />
ExoticStructure : Extended argument defining the exotic option structure<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
AdMode : Extended argument customising the return value<br />
Return Value<br />
The return value depends on the value of AdMode. The default value is a vertical 9-cell array<br />
containing:<br />
Delta : Delta ratio<br />
Gamma : Gamma ratio<br />
68
AdfinX Analytics 1.0 Function Library – User Guide<br />
Rho : Rho ratio<br />
Theta : Theta ratio<br />
Vega : Vega ratio<br />
Delta:i : Delta ratio of the i th asset of the Basket option<br />
Gamma:i : Gamma ratio of the i th asset of the Basket option<br />
Gamma:i:j : Cross Gamma ratio of the i th and j th assets of the Basket option<br />
Vega:i : Vega of the i th asset of the Basket option<br />
Note<br />
The ReturnArray and RiskFreeRateArray arguments can be defined respectively in<br />
ExoticStructure and RateStructure through the keywords RATETYPE, RATEFRQ, RM or DCB.<br />
5.2.8. OpBasketPremium<br />
OpBasketPremium(CalcDate As Variant, ExpiryDate As Variant, SpotPriceArray<br />
As Variant, StrikePrice As Double, CorrelationArray As Variant,<br />
RiskFreeRateArray As Variant, ReturnArray As Variant, NbSharesArray As<br />
Variant, ExoticStucture As String, RateStructure As String, CalcStructure<br />
As String) As Double<br />
Calculates the premium of a Basket option. Basket options, also called portfolio options, are a variation<br />
of Rainbow options. Their payoff is the weighted average of the prices within the basket of underlying<br />
assets.<br />
Arguments<br />
CalcDate : Calculation date<br />
ExpiryDate : Expiry date of the option<br />
SpotPriceArray : Array containing the spot prices of the underlying instruments<br />
StrikePrice : Strike price of the option<br />
CorrelationArray : Array containing the volatilities of the assets on the diagonal and the<br />
correlation coefficients<br />
RiskFreeRateArray : Array of data depending on the rate model chosen:<br />
• constant risk free rate<br />
• zero-coupon curve<br />
ReturnArray : Array containing the annualized dividend rates of the underlying<br />
instruments<br />
NbSharesArray : Specifies the number of shares for each asset<br />
ExoticStructure : Extended argument defining the exotic option structure<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
Return Value<br />
The premium of the option.<br />
Note<br />
The ReturnArray and RiskFreeRateArray arguments can be defined respectively in<br />
ExoticStructure and RateStructure through the keywords RATETYPE, RATEFRQ, RM or DCB.<br />
5.2.9. OpBinaryDeriv<br />
OpBinaryDeriv(CalcDate As Variant, ExpiryDate As Variant, SpotPrice As Double,<br />
BarrierPrice As Double, StrikePrice As Double, CashAmount As Double,<br />
69
AdfinX Analytics 1.0 Function Library – User Guide<br />
Volatility As Double, RiskFreeRateArray As Variant, ReturnArray As Variant,<br />
ExoticStructure As String, RateStructure As String, CalcStructure As String,<br />
AdMode As String) As Variant<br />
Returns all derivatives (delta, gamma, rho, theta, and vega) of an All-or-Nothing Binary option or One-<br />
Touch/No-Touch Binary option in an array. At maturity or when the barrier is reached, this type of<br />
option pays a fixed amount of cash or the asset.<br />
Arguments<br />
CalcDate : Calculation date<br />
ExpiryDate : Expiry date of the option (also date of the last fixing)<br />
SpotPrice : Market or spot price of the underlying instrument<br />
BarrierPrice : Price of the barrier of the option<br />
StrikePrice : Exercise or strike price of the option<br />
CashAmount : Fixed amount of cash paid if applicable<br />
Volatility : Anticipated volatility of the underlying instrument<br />
RiskFreeRateArray : Array of data depending on the rate model chosen<br />
ReturnArray : Array of annualized dividend rates<br />
ExoticStructure : Extended argument defining the exotic option structure<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
AdMode : Extended argument customising the return value<br />
Return Value<br />
The return value depends on the value of AdMode. The default value is a vertical 5-element array<br />
containing:<br />
Delta : Delta ratio<br />
Gamma : Gamma ratio<br />
Rho : Rho ratio<br />
Theta : Theta ratio<br />
Vega : Vega ratio<br />
Notes<br />
The argument BarrierPrice is ignored for Binary options without barriers.<br />
The ReturnArray and RiskFreeRateArray arguments can be defined respectively in<br />
ExoticStructure and RateStructure through the keywords RATETYPE, RATEFRQ, RM or DCB.<br />
You must include at least the option type in the ExoticStructure, using the CALL and PUT<br />
keywords, and the Binary type using the BINARY and/or TOUCH keywords.<br />
You can calculate only one derivative if this derivative is specified in AdMode, using the RES<br />
keyword.<br />
5.2.10. OpBinaryImpliedVol<br />
OpBinaryImpliedVol(CalcDate As Variant, ExpiryDate As Variant, SpotPrice As<br />
Double, BarrierPrice As Double, StrikePrice As Double, CashAmount As Double,<br />
Premium As Double, RiskFreeRateArray As Variant, ReturnArray As Variant,<br />
ExoticStructure As String, RateStructure As String, CalcStructure As String)<br />
As Double<br />
Calculates the implied volatility of an All-or-Nothing Binary option or One-Touch/No-Touch Binary<br />
option. At maturity or when the barrier is reached, this type of option pays a fixed amount of cash or<br />
the asset.<br />
70
AdfinX Analytics 1.0 Function Library – User Guide<br />
Arguments<br />
CalcDate : Calculation date<br />
ExpiryDate : Expiry date of the option (also date of the last fixing)<br />
SpotPrice : Market or spot price of the underlying instrument<br />
BarrierPrice : Price of the barrier of the option<br />
StrikePrice : Exercise or strike price of the option<br />
CashAmount : Fixed amount of cash paid if applicable<br />
Premium : Market or spot price of the option<br />
RiskFreeRateArray : Array of data depending on the rate model chosen<br />
ReturnArray : Array of annualized dividend rates<br />
ExoticStructure : Extended argument defining the exotic option structure<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
Return Value<br />
The implied volatility of the option.<br />
Notes<br />
The argument BarrierPrice is ignored for Binary options without barriers.<br />
The ReturnArray and RiskFreeRateArray arguments can be defined respectively in<br />
ExoticStructure and RateStructure through the keywords RATETYPE, RATEFRQ, RM or DCB.<br />
You must include at least the option type in the ExoticStructure, using the CALL and PUT<br />
keywords, and the Binary type using the BINARY and/or TOUCH keywords.<br />
5.2.11. OpBinaryPremium<br />
OpBinaryPremium(CalcDate As Variant, ExpiryDate As Variant, SpotPrice As<br />
Double, BarrierPrice As Double, StrikePrice As Double, CashAmount As Double,<br />
Volatility As Double, RiskFreeRateArray As Variant, ReturnArray As Variant,<br />
ExoticStructure As String, RateStructure As String, CalcStructure As String)<br />
As Double<br />
Calculates the premium of an All-or-Nothing Binary option or One-Touch/No-Touch Binary option. At<br />
maturity or when the barrier is reached, this type of option pays a fixed amount of cash or the asset.<br />
Arguments<br />
CalcDate : Calculation date<br />
ExpiryDate : Expiry date of the option (also date of the last fixing)<br />
SpotPrice : Market or spot price of the underlying instrument<br />
BarrierPrice : Price of the barrier of the option<br />
StrikePrice : Exercise or strike price of the option<br />
CashAmount : Fixed amount of cash paid if applicable<br />
Volatility : Anticipated volatility of the underlying instrument<br />
RiskFreeRateArray : Array of data depending on the rate model chosen<br />
ReturnArray : Array of annualized dividend rates<br />
ExoticStructure : Extended argument defining the exotic option structure<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
71
AdfinX Analytics 1.0 Function Library – User Guide<br />
Return Value<br />
The premium of the option.<br />
Notes<br />
The argument BarrierPrice is ignored for Binary options without barriers.<br />
The ReturnArray and RiskFreeRateArray arguments can be defined respectively in<br />
ExoticStructure and RateStructure through the keywords RATETYPE, RATEFRQ, RM or DCB.<br />
You must include at least the option type in the ExoticStructure, using the CALL and PUT<br />
keywords, and the Binary type using the BINARY and/or TOUCH keywords.<br />
5.2.12. OpChooserDeriv<br />
OpChooserDeriv(CalcDate As Variant, ExpiryDate As Variant, PutExpiryDate As<br />
Variant, CallExpiryDate As Variant, SpotPrice As Double, PutStrikePrice As<br />
Double, CallStrikePrice As Double, Volatility As Double, RiskFreeRateArray As<br />
Variant, ReturnArray As Variant, ExoticStructure As String, RateStructure As<br />
String, CalcStructure As String, AdMode As String) As Variant<br />
Returns all derivatives (delta, gamma, rho theta, vega) of a Chooser option in an array. Chooser<br />
options allow the holder to choose at some pre-determined future date whether the option is a call or a<br />
put, with the same predefined strike price and expiry date.<br />
Arguments<br />
CalcDate : Calculation date<br />
ExpiryDate : Expiry date of the option<br />
PutExpiryDate : Expiry date of the underlying put option<br />
CallExpiryDate : Expiry date of the underlying call option<br />
SpotPrice : Market or spot price of the underlying instrument<br />
PutStrikePrice : Exercise or strike price of the underlying put option<br />
CallStrikePrice : Exercise or strike price of the underlying call option<br />
Volatility : Anticipated volatility of the underlying instrument<br />
RiskFreeRateArray : Array of data depending on the rate model chosen<br />
ReturnArray : Array of annualized dividend rates<br />
ExoticStructure : Extended argument defining the exotic option structure<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
AdMode : Extended argument customising the return value<br />
Return Value<br />
The return value depends on the value of AdMode. The default value is a vertical 5-element array<br />
containing:<br />
Delta : Delta ratio<br />
Gamma : Gamma ratio<br />
Rho : Rho ratio<br />
Theta : Theta ratio<br />
Vega : Vega ratio<br />
Notes<br />
You must include at least the option type in the ExoticStructure, using the CALL and PUT<br />
keywords.<br />
72
AdfinX Analytics 1.0 Function Library – User Guide<br />
The ReturnArray and RiskFreeRateArray arguments can be defined respectively in<br />
ExoticStructure and RateStructure through the keywords RATETYPE, RATEFRQ, RM or DCB.<br />
You can calculate only one derivative if this derivative is specified in AdMode, using the RES<br />
keyword.<br />
5.2.13. OpChooserImpliedVol<br />
OpChooserImpliedVol(CalcDate As Variant, ExpiryDate As Variant, PutExpiryDate<br />
As Variant, CallExpiryDate As Variant, SpotPrice As Double, PutStrikePrice As<br />
Double, CallStrikePrice As Double, Premium As Double, RiskFreeRateArray As<br />
Variant, ReturnArray As Variant, ExoticStructure As String, RateStructure As<br />
String, CalcStructure As String) As Double<br />
Calculates the implied volatility of a Chooser option. Chooser options allow the holder to choose at<br />
some pre-determined future date whether the option is a call or a put, with the same predefined strike<br />
price and expiry date.<br />
Arguments<br />
CalcDate : Calculation date<br />
ExpiryDate : Expiry date of the option<br />
PutExpiryDate : Expiry date of the underlying put option<br />
CallExpiryDate : Expiry date of the underlying call option<br />
SpotPrice : Market or spot price of the underlying instrument<br />
PutStrikePrice : Exercise or strike price of the underlying put option<br />
CallStrikePrice : Exercise or strike price of the underlying call option<br />
Premium : Premium of the option<br />
RiskFreeRateArray : Array of data depending on the rate model chosen<br />
ReturnArray : Array of annualized dividend rates<br />
ExoticStructure : Extended argument defining the exotic option structure<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
Return Value<br />
The implied volatility of the option.<br />
Notes<br />
The ReturnArray and RiskFreeRateArray arguments can be defined respectively in<br />
ExoticStructure and RateStructure through the keywords RATETYPE, RATEFRQ, RM or DCB.<br />
You must include at least the option type in the ExoticStructure, using the CALL and PUT<br />
keywords.<br />
5.2.14. OpChooserPremium<br />
OpChooserPremium(CalcDate As Variant, ExpiryDate As Variant, PutExpiryDate As<br />
Variant, CallExpiryDate As Variant, SpotPrice As Double, PutStrikePrice As<br />
Double, CallStrikePrice As Double, Volatility As Double, RiskFreeRateArray As<br />
Variant, ReturnArray As Variant, ExoticStructure As String, RateStructure As<br />
String, CalcStructure As String) As Double<br />
Calculates the premium of a Chooser option. Chooser options allow the holder to choose at some predetermined<br />
future date whether the option is a call or a put, with the same predefined strike price and<br />
expiry date.<br />
73
AdfinX Analytics 1.0 Function Library – User Guide<br />
Arguments<br />
CalcDate : Calculation date<br />
ExpiryDate : Expiry date of the option<br />
PutExpiryDate : Expiry date of the underlying put option<br />
CallExpiryDate : Expiry date of the underlying call option<br />
SpotPrice : Market or spot price of the underlying instrument<br />
PutStrikePrice : Exercise or strike price of the underlying put option<br />
CallStrikePrice : Exercise or strike price of the underlying call option<br />
Volatility : Anticipated volatility of the underlying instrument<br />
RiskFreeRateArray : Array of data depending on the rate model chosen<br />
ReturnArray : Array of annualized dividend rates<br />
ExoticStructure : Extended argument defining the exotic option structure<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
Return Value<br />
The premium of the option.<br />
Notes<br />
The ReturnArray and RiskFreeRateArray arguments can be defined respectively in<br />
ExoticStructure and RateStructure through the keywords RATETYPE, RATEFRQ, RM or DCB.<br />
You must include at least the option type in the ExoticStructure, using the CALL and PUT<br />
keywords.<br />
5.2.15. OpCliquetDeriv<br />
OpCliquetDeriv(CalcDate As Variant, StartDateArray As Variant, ExpiryDateArray<br />
As Variant, SpotPrice As Double, StrikePrice As Double, Volatility As Double,<br />
RiskFreeRateArray As Variant, ReturnArray As Variant, ExoticStructure As<br />
String, RateStructure As String, CalcStructure As String, AdMode As String)<br />
As Variant<br />
Returns in an array all derivatives (delta, gamma, rho, theta, vega) of a Cliquet option or a Forward-<br />
Start option. A Cliquet or Ratchet option is essentially a series of Forward-Start options with increasing<br />
maturities and strike prices set at the maturity date of the previous option.<br />
Arguments<br />
CalcDate : Calculation date<br />
StartDateArray : Array of start dates of each Forward-Start option<br />
ExpiryDateArray : Array of expiry dates of each Forward-Start option<br />
SpotPrice : Market or spot price of the underlying instrument<br />
StrikePrice : Exercise or strike price of the option<br />
Volatility : Anticipated volatility of the underlying instrument<br />
RiskFreeRateArray : Array of data depending on the rate model chosen<br />
ReturnArray : Array of annualized dividend rates<br />
ExoticStructure : Extended argument defining the exotic option structure<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
AdMode : Extended argument customising the return value<br />
74
AdfinX Analytics 1.0 Function Library – User Guide<br />
Return Value<br />
The return value depends on the value of AdMode. The default value is a vertical 5-element array<br />
containing:<br />
Delta : Delta ratio<br />
Gamma : Gamma ratio<br />
Rho : Rho ratio<br />
Theta : Theta ratio<br />
Vega : Vega ratio<br />
Notes<br />
The ReturnArray and RiskFreeRateArray arguments can be defined respectively in<br />
ExoticStructure and RateStructure through the keywords RATETYPE, RATEFRQ, RM or DCB.<br />
You must include at least the option type in the ExoticStructure, using the CALL and PUT<br />
keywords.<br />
You can calculate only one derivative if this derivative is specified in AdMode, using the RES<br />
keyword.<br />
5.2.16. OpCliquetImpliedVol<br />
OpCliquetImpliedVol(CalcDate As Variant, StartDateArray As Variant,<br />
ExpiryDateArray As Variant, SpotPrice As Double, StrikePrice As Double,<br />
Premium As Double, RiskFreeRateArray As Variant, ReturnArray As Variant,<br />
ExoticStructure As String, RateStructure As String, CalcStructure As String)<br />
As Double<br />
Calculates the implied volatility of a Cliquet option or a Forward-Start optionA Cliquet or Ratchet option<br />
is essentially a series of Forward-Start options with increasing maturities and strike prices set at the<br />
maturity date of the previous option.<br />
Arguments<br />
CalcDate : Calculation date<br />
StartDateArray : Array of start dates of each Forward-Start option<br />
ExpiryDateArray : Array of expiry dates of each Forward-Start option<br />
SpotPrice : Market or spot price of the underlying instrument<br />
StrikePrice : Exercise or strike price of the option<br />
Premium : Market or spot price of the option<br />
RiskFreeRateArray : Array of data depending on the rate model chosen<br />
ReturnArray : Array of annualized dividend rates<br />
ExoticStructure : Extended argument defining the exotic option structure<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
Return Value<br />
The implied volatility of the option.<br />
Notes<br />
The ReturnArray and RiskFreeRateArray arguments can be defined respectively in<br />
ExoticStructure and RateStructure through the keywords RATETYPE, RATEFRQ, RM or DCB.<br />
You must include at least the option type in the ExoticStructure, using the CALL and PUT<br />
keywords.<br />
75
AdfinX Analytics 1.0 Function Library – User Guide<br />
5.2.17. OpCliquetPremium<br />
OpCliquetPremium(CalcDate As Variant, StartDateArray As Variant,<br />
ExpiryDateArray As Variant, SpotPrice As Double, StrikePrice As Double,<br />
Volatility As Double, RiskFreeRateArray As Variant, ReturnArray As Variant,<br />
ExoticStructure As String, RateStructure As String, CalcStructure As String)<br />
As Double<br />
Calculates the premium of a Cliquet option or a Forward-Start option. A Cliquet or Ratchet option is<br />
essentially a series of Forward-Start options with increasing maturities and strike prices set at the<br />
maturity date of the previous option.<br />
Arguments<br />
CalcDate : Calculation date<br />
StartDateArray : Array of start dates of each Forward-Start option<br />
ExpiryDateArray : Array of expiry dates of each Forward-Start option<br />
SpotPrice : Market or spot price of the underlying instrument<br />
StrikePrice : Exercise or strike price of the option<br />
Volatility : Anticipated volatility of the underlying instrument<br />
RiskFreeRateArray : Array of data depending on the rate model chosen<br />
ReturnArray : Array of annualized dividend rates<br />
ExoticStructure : Extended argument defining the exotic option structure<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
Return Value<br />
The premium of the option.<br />
Notes<br />
The ReturnArray and RiskFreeRateArray arguments can be defined respectively in<br />
ExoticStructure and RateStructure through the keywords RATETYPE, RATEFRQ, RM or DCB.<br />
You must include at least the option type in the ExoticStructure, using the CALL and PUT<br />
keywords.<br />
5.2.18. OpCompoundDeriv<br />
OpCompoundDeriv(CalcDate As Variant, ExpiryDate As Variant, CmpExpiryDate As<br />
Variant, SpotPrice As Double, StrikePrice As Double, CmpStrikePrice As Double,<br />
Volatility As Double, RiskFreeRateArray As Variant, ReturnArray As Variant,<br />
ExoticStructure As String, RateStructure As String, CalcStructure As String,<br />
AdMode As String) As Variant<br />
Returns all derivatives (delta, gamma, rho, theta, and vega) of a Compound option in an arrray. This<br />
<strong>fun</strong>ction calculates the derivatives of European Compound options also known as options on options.<br />
An option on option gives the option holder the right to sell or buy an option.<br />
Arguments<br />
CalcDate : Calculation date<br />
ExpiryDate : Expiry date of the option<br />
CmpExpiryDate : Expiry date of the Compound option<br />
SpotPrice : Market or spot price of the underlying instrument<br />
StrikePrice : Exercise or strike price of the option<br />
CmpStrikePrice : Exercise or strike price of the Compound option<br />
76
AdfinX Analytics 1.0 Function Library – User Guide<br />
Volatility : Anticipated volatility of the underlying instrument<br />
RiskFreeRateArray : Array of data depending on the rate model chosen<br />
ReturnArray : Array of annualized dividend rates<br />
ExoticStructure : Extended argument defining the exotic option structure<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
AdMode : Extended argument customising the return value<br />
Return Value<br />
The return value depends on the value of AdMode. The default value is a vertical 5-element array<br />
containing:<br />
Delta : Delta ratio<br />
Gamma : Gamma ratio<br />
Rho : Rho ratio<br />
Theta : Theta ratio<br />
Vega : Vega ratio<br />
Notes<br />
The ReturnArray and RiskFreeRateArray arguments can be defined respectively in<br />
ExoticStructure and RateStructure through the keywords RATETYPE, RATEFRQ, RM or DCB.<br />
You must include at least the option type in the ExoticStructure, using the CALL and PUT<br />
keywords, and the Compound type using the UO keyword.<br />
You can calculate only one derivative if this derivative is specified in AdMode, using the RES<br />
keyword.<br />
5.2.19. OpCompoundImpliedVol<br />
OpCompoundImpliedVol(CalcDate As Variant, ExpiryDate As Variant, CmpExpiryDate<br />
As Variant, SpotPrice As Double, StrikePrice As Double, CmpStrikePrice As<br />
Double, Premium As Double, RiskFreeRateArray As Variant, ReturnArray As<br />
Variant, ExoticStructure As String, RateStructure As String, CalcStructure<br />
As String) As Double<br />
Calculates the implied volatility of a Compound option. This <strong>fun</strong>ction calculates the implied volatility of<br />
European Compound options also known as options on options. An option on option gives the option<br />
holder the right to sell or buy an option.<br />
Arguments<br />
CalcDate : Calculation date<br />
ExpiryDate : Expiry date of the option<br />
CmpExpiryDate : Expiry date of the Compound option<br />
SpotPrice : Market or spot price of the underlying instrument<br />
StrikePrice : Exercise or strike price of the option<br />
CmpStrikePrice : Exercise or strike price of the Compound option<br />
Premium : Premium of the option<br />
RiskFreeRateArray : Array of data depending on the rate model chosen<br />
ReturnArray : Array of annualized dividend rates<br />
ExoticStructure : Extended argument defining the exotic option structure<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
77
AdfinX Analytics 1.0 Function Library – User Guide<br />
Return Value<br />
The implied volatility of the option.<br />
Notes<br />
The ReturnArray and RiskFreeRateArray arguments can be defined respectively in<br />
ExoticStructure and RateStructure through the keywords RATETYPE, RATEFRQ, RM or DCB.<br />
You must include at least the option type in the ExoticStructure, using the CALL and PUT<br />
keywords, and the Compound type using the UO keyword.<br />
5.2.20. OpCompoundPremium<br />
OpCompoundPremium(CalcDate As Variant, ExpiryDate As Variant, CmpdExpiryDate<br />
As Variant, SpotPrice As Double, StrikePrice As Double, CmpStrikePrice As<br />
Double, Volatility As Double, RiskFreeRateArray As Variant, ReturnArray As<br />
Variant, ExoticStructure As String, RateStructure As String, CalcStructure<br />
As String) As Double<br />
Calculates the premium of a Compound option. This <strong>fun</strong>ction calculates the premium of European<br />
Compound options also known as options on options. An option on option gives the option holder the<br />
right to sell or buy an option.<br />
Arguments<br />
CalcDate : Calculation date<br />
ExpiryDate : Expiry date of the option<br />
CmpExpiryDate : Expiry date of the Compound option<br />
SpotPrice : Market or spot price of the underlying instrument<br />
StrikePrice : Exercise or strike price of the option<br />
CmpStrikePrice : Exercise or strike price of the Compound option<br />
Volatility : Anticipated volatility of the underlying instrument<br />
RiskFreeRateArray : Array of data depending on the rate model chosen<br />
ReturnArray<br />
: Array of annualized dividend rates<br />
ExoticStructure : Extended argument defining the exotic option structure<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
Return Value<br />
The premium of the option.<br />
Notes<br />
The ReturnArray and RiskFreeRateArray arguments can be defined respectively in<br />
ExoticStructure and RateStructure through the keywords RATETYPE, RATEFRQ, RM or DCB.<br />
You must include at least the option type in the ExoticStructure, using the CALL and PUT<br />
keywords, and the Compound type using the UO keyword.<br />
78
AdfinX Analytics 1.0 Function Library – User Guide<br />
5.2.21. OpDoubleBarrierDeriv<br />
OpDoubleBarrierDeriv(CalcDate As Variant, ExpiryDate As Variant, SpotPrice As<br />
Double, StrikePrice As Double, LowerBarrierPrice As Double, UpperBarrierPrice<br />
As Double, Volatility As Double, RiskFreeRateArray As Variant, ReturnArray As<br />
Variant, ExoticStructure As String, RateStructure As String, CalcStructure As<br />
String, AdMode As String) As Variant<br />
Returns in an array all derivatives (delta, gamma, rho, theta, vega) of a Double Barrier option. Barrier<br />
options are options where the right to exercise depends on whether the underlying asset price reaches<br />
a predefined barrier level during the lifetime of the option. Double Barrier options have two barrier<br />
levels, one above and one below the current price of the underlying asset.<br />
Arguments<br />
CalcDate : Calculation date<br />
ExpiryDate : Expiry date of the option (also date of the last fixing)<br />
SpotPrice : Market or spot price of the underlying instrument<br />
StrikePrice : Exercise or strike price of the option<br />
LowerBarrierPrice : Price of the lower barrier of the option<br />
UpperBarrierPrice : Price of the upper barrier of the option<br />
Volatility : Anticipated volatility of the underlying instrument<br />
RiskFreeRateArray : Array of data depending on the rate model chosen<br />
ReturnArray<br />
: Array of annualized dividend rates<br />
ExoticStructure : Extended argument defining the exotic option structure<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
AdMode : Extended argument customising the return value<br />
Return Value<br />
The return value depends on the value of AdMode. The default value is a vertical 5-element array<br />
containing:<br />
Delta : Delta ratio<br />
Gamma : Gamma ratio<br />
Rho : Rho ratio<br />
Theta : Theta ratio<br />
Vega : Vega ratio<br />
Notes<br />
The ReturnArray and RiskFreeRateArray arguments can be defined respectively in<br />
ExoticStructure and RateStructure through the keywords RATETYPE, RATEFRQ, RM or DCB.<br />
You must include at least the option type in the ExoticStructure, using the CALL and PUT<br />
keywords, and the Barrier type using the KI, KIKO, or KOKI keywords.<br />
You can calculate only one derivative if this derivative is specified in AdMode, using the RES<br />
keyword.<br />
79
AdfinX Analytics 1.0 Function Library – User Guide<br />
5.2.22. OpDoubleBarrierImpliedVol<br />
OpDoubleBarrierImpliedVol(CalcDate As Variant, ExpiryDate As Variant, SpotPrice<br />
As Double, StrikePrice As Double, LowerBarrierPrice As Double,<br />
UpperBarrierPrice As Double, Premium As Double, RiskFreeRateArray As Variant,<br />
ReturnArray As Variant, ExoticStructure As String, RateStructure As String,<br />
CalcStructure As String) As Double<br />
Calculates the implied volatility of a Double Barrier option. Barrier options are options where the right<br />
to exercise depends on whether the underlying asset price reaches a predefined barrier level during<br />
the lifetime of the option. Double Barrier options have two barrier levels, one above and one below the<br />
current price of the underlying asset.<br />
Arguments<br />
CalcDate : Calculation date<br />
ExpiryDate : Expiry date of the option (also date of the last fixing)<br />
SpotPrice : Market or spot price of the underlying instrument<br />
StrikePrice : Exercise or strike price of the option<br />
LowerBarrierPrice : Price of the lower barrier of the option<br />
UpperBarrierPrice : Price of the upper barrier of the option<br />
Premium : Premium of the option<br />
RiskFreeRateArray : Array of data depending on the rate model chosen<br />
ReturnArray<br />
: Array of annualized dividend rates<br />
ExoticStructure : Extended argument defining the exotic option structure<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
Return Value<br />
The implied volatility of the option.<br />
Notes<br />
The ReturnArray and RiskFreeRateArray arguments can be defined respectively in<br />
ExoticStructure and RateStructure through the keywords RATETYPE, RATEFRQ, RM or DCB.<br />
You must include at least the option type in the ExoticStructure, using the CALL and PUT<br />
keywords, and the Barrier type using the KI, KIKO, or KOKI keywords.<br />
5.2.23. OpDoubleBarrierPremium<br />
OpDoubleBarrierPremium(CalcDate As Variant, ExpiryDate As Variant, SpotPrice As<br />
Double, StrikePrice As Double, LowerBarrierPrice As Double, UpperBarrierPrice<br />
As Double, Volatility As Double, RiskFreeRateArray As Variant, ReturnArray As<br />
Variant, ExoticStructure As String, RateStructure As String, CalcStructure<br />
As String) As Double<br />
Calculates the premium of a double barrier option. Barrier options are options where the right to<br />
exercise depends on whether the underlying asset price reaches a predefined barrier level during the<br />
lifetime of the option. Double Barrier options have two barrier levels, one above and one below the<br />
current price of the underlying asset.<br />
Arguments<br />
CalcDate : Calculation date<br />
ExpiryDate : Expiry date of the option (also date of the last fixing)<br />
80
AdfinX Analytics 1.0 Function Library – User Guide<br />
SpotPrice : Market or spot price of the underlying instrument<br />
StrikePrice : Exercise or strike price of the option<br />
LowerBarrierPrice : Price of the lower barrier of the option<br />
UpperBarrierPrice : Price of the upper barrier of the option<br />
Volatility : Anticipated volatility of the underlying<br />
RiskFreeRateArray : Array of data depending on the rate model chosen<br />
ReturnArray<br />
: Array of annualized dividend rates<br />
ExoticStructure : Extended argument defining the exotic option structure<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
Return Value<br />
The premium of the option.<br />
Notes<br />
The ReturnArray and RiskFreeRateArray arguments can be defined respectively in<br />
ExoticStructure and RateStructure through the keywords RATETYPE, RATEFRQ, RM or DCB.<br />
You must include at least the option type in the ExoticStructure, using the CALL and PUT<br />
keywords, and the Barrier type using the KI, KIKO, or KOKI keywords.<br />
5.2.24. OpExLookbackDeriv<br />
OpExLookbackDeriv(CalcDate As Variant, ExpiryDate As Variant, SpotPrice As<br />
Double, StrikePrice As Double, Min/Max As Double, VolatilityArray As Variant,<br />
RiskFreeRateArray As Variant, ReturnArray As Variant, ExoticStructure As<br />
String, RateStructure As String, CalcStructure As String, AdMode As String)<br />
As Variant<br />
Returns all derivatives (delta, gamma, rho, theta, and vega) of a Lookback Strike option or Lookback<br />
Spot option in an array. At maturity, this type of option pays either the difference between the<br />
underlying spot price and the lowest (highest) price achieved during the life of the call (put), or the<br />
difference between the highest (lowest) price achieved during the life of the call (put) and the strike<br />
price.<br />
Arguments<br />
CalcDate : Calculation date<br />
ExpiryDate : Expiry date of the option (also date of the last fixing)<br />
SpotPrice : Market or spot price of the underlying instrument<br />
StrikePrice : Strike price of the option, ignored for Lookback Strike options<br />
Min/Max : Lowest price for a call or highest price for a put achieved so far for<br />
Lookback Strike options<br />
Highest price for a call or lowest price for a put achieved so far for<br />
Lookback Spot options<br />
VolatilityArray : Array of anticipated volatilities of the underlying instrument<br />
RiskFreeRateArray : Array of data depending on the rate model chosen<br />
ReturnArray<br />
: Array of annualized dividend rates<br />
ExoticStructure : Extended argument defining the exotic option structure<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
AdMode : Extended argument customising the return value<br />
81
AdfinX Analytics 1.0 Function Library – User Guide<br />
Return Value<br />
The return value depends on the value of AdMode. The default value is a vertical 5-element array<br />
containing:<br />
Delta : Delta ratio<br />
Gamma : Gamma ratio<br />
Rho : Rho ratio<br />
Theta : Theta ratio<br />
Vega : Vega ratio<br />
Notes<br />
The ReturnArray and RiskFreeRateArray arguments can be defined respectively in<br />
ExoticStructure and RateStructure through the keywords RATETYPE, RATEFRQ, RM or DCB.<br />
You must include at least the option type in the ExoticStructure, using the CALL or PUT<br />
keywords.<br />
You can calculate the price of ladder options using the LADDER keyword.<br />
You can calculate only one derivative if this derivative is specified in AdMode, using the RES<br />
keyword.<br />
5.2.25. OpExLookbackImpliedVol<br />
OpExLookbackImpliedVol(CalcDate As Variant, ExpiryDate As Variant, SpotPrice As<br />
Double, StrikePrice As Double, Min/Max As Double, Premium As Double,<br />
RiskFreeRateArray As Variant, ReturnArray As Variant, ExoticStructure As<br />
String, RateStructure As String, CalcStructure As String) As Double<br />
Calculates the implied volatility of a Lookback Strike option or Lookback Spot option. At maturity, this<br />
type of option pays either the difference between the underlying spot price and the lowest (highest)<br />
price achieved during the life of the call (put), or the difference between the highest (lowest) price<br />
achieved during the life of the call (put) and the strike price.<br />
Arguments<br />
CalcDate : Calculation date<br />
ExpiryDate : Expiry date of the option (also date of the last fixing)<br />
SpotPrice : Market or spot price of the underlying instrument<br />
StrikePrice : Exercise or strike of the option, ignored for Lookback Strike options<br />
Min/Max : Lowest price for a call or highest price for a put achieved so far for<br />
Lookback Strike options<br />
Highest price for a call or lowest price for a put achieved so far for<br />
Lookback Spot options<br />
Premium : Market or spot price of the option<br />
RiskFreeRateArray : Array of data depending on the rate model chosen<br />
ReturnArray<br />
: Array of annualized dividend rates<br />
ExoticStructure : Extended argument defining the exotic option structure<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
Return Value<br />
The implied volatility of the option.<br />
82
AdfinX Analytics 1.0 Function Library – User Guide<br />
Notes<br />
The ReturnArray and RiskFreeRateArray arguments can be defined respectively in<br />
ExoticStructure and RateStructure through the keywords RATETYPE, RATEFRQ, RM or DCB.<br />
You must include at least the option type in the ExoticStructure, using the CALL or PUT<br />
keywords.<br />
You can calculate the price of Ladder options using the LADDER keyword.<br />
5.2.26. OpExLookbackPremium<br />
OpExLookbackPremium(CalcDate As Variant, ExpiryDate As Variant, SpotPrice As<br />
Double, StrikePrice As Double, Min/Max As Double, VolatilityArray As Variant,<br />
RiskFreeRateArray As Variant, ReturnArray As Variant, ExoticStructure As<br />
String, RateStructure As String, CalcStructure As String) As Double<br />
Calculates the premium of a Lookback Strike option or Lookback Spot option. At maturity, this type of<br />
option pays either the difference between the underlying spot price and the lowest (highest) price<br />
achieved during the life of the call (put), or the difference between the highest (lowest) price achieved<br />
during the life of the call (put) and the strike price.<br />
Arguments<br />
CalcDate : Calculation date<br />
ExpiryDate : Expiry date of the option (also date of the last fixing)<br />
SpotPrice : Market or spot price of the underlying instrument<br />
StrikePrice : Exercise or strike price of the option, ignored for Lookback Strike<br />
options<br />
Min/Max : Lowest price for a call or highest price for a put achieved so far for<br />
Lookback Strike options<br />
Highest price for a call or lowest price for a put achieved so far for<br />
Lookback Spot options<br />
VolatilityArray : Array of anticipated volatilities of the underlying instrument<br />
RiskFreeRateArray : Array of data depending on the rate model chosen<br />
ReturnArray<br />
: Array of annualized dividend rates<br />
ExoticStructure : Extended argument defining the exotic option structure<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
Return Value<br />
The premium of the option.<br />
Notes<br />
The ReturnArray and RiskFreeRateArray arguments can be defined respectively in<br />
ExoticStructure and RateStructure through the keywords RATETYPE, RATEFRQ, RM or DCB.<br />
You must include at least the option type in the ExoticStructure, using the CALL or PUT<br />
keywords.<br />
You can calculate the price of Ladder options using the LADDER keyword.<br />
5.2.27. OpFxLinkedDeriv<br />
OpFxLinkedDeriv(CalcDate As Variant, ExpiryDate As Variant, ExchangeRate As<br />
Double, SpotPrice As Double, StrikePrice As Double, ERVolatility As Double,<br />
Volatility As Double, Correlation As Double, RiskFreeRateArray As Variant,<br />
ForeignRateArray As Variant, ReturnArray As Variant, ExoticStructure As<br />
83
AdfinX Analytics 1.0 Function Library – User Guide<br />
String, RateStructure As String, CalcStructure As String, AdMode As String)<br />
As Variant<br />
Returns all derivatives (delta, gamma, rho, theta, and vega) of a Quanto, Composite, or Equity Linked<br />
Foreign Exchange option in an array. Quanto (quantity-adjusting) options are mainly used to eliminate<br />
the foreign exchange risk when the underlying asset is denominated in a currency other than the<br />
currency of the option, exchange rate being fixed to the calculation date. A Composite option is an<br />
option on a foreign equity where the strike is denominated in domestic currency. A Composite option<br />
has an exposure on the exchange risk. In an Equity Linked Foreign Exchange option, the face value is<br />
linked to the forward price of a stock or equity index. This is an ideal option for an investor who wants<br />
to speculate directly in a foreign equity market but wishes to place a floor on the currency exposure.<br />
Arguments<br />
CalcDate : Calculation date<br />
ExpiryDate : Expiry date of the option<br />
ExchangeRate : Exercise or spot exchange rate specified in units of the domestic<br />
currency per unit of the foreign currency<br />
SpotPrice : Market or spot price of the underlying instrument<br />
StrikePrice : Exercise or strike price of the option<br />
ERVolatility : Anticipated volatility of the exchange rate<br />
Volatility : Anticipated volatility of the underlying instrument<br />
Correlation : Correlation between asset and domestic exchange rate<br />
RiskFreeRateArray : Array of data depending on the rate model chosen<br />
ForeignRateArray : Yearly rate of the foreign market for an equivalent risk-free investment<br />
ReturnArray : Array of annualized dividend rates<br />
ExoticStructure : Extended argument defining the exotic option structure<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
AdMode : Extended argument customising the return value<br />
Return Value<br />
The return value depends on the value of AdMode. The default value is a vertical 9-element array<br />
containing:<br />
Delta : Delta ratio<br />
ForeignDelta : Delta ratio in the foreign currency<br />
Gamma : Gamma ratio<br />
ForeignGamma : Delta ratio in the foreign currency<br />
Rho : Rho ratio<br />
ForeignRho : Rho ratio in the foreign currency<br />
Theta : Theta ratio<br />
Vega : Vega ratio<br />
ForeignVega : Vega ratio in the foreign currency<br />
Notes<br />
The ReturnArray and RiskFreeRateArray arguments can be defined respectively in<br />
ExoticStructure and RateStructure through the keywords RATETYPE, RATEFRQ, RM or DCB.<br />
You must include at least the option type in the ExoticStructure, using the CALL or PUT<br />
keywords, and the foreign exchange link type using the FXLINK keyword.<br />
You can now calculate the derivatives of a Quanto or Composite option with an American or<br />
Bermudan exercise mode, using the EXM keyword in ExoticStructure. EXM is incompatible with<br />
FXLINK:ELFX. In these cases, you must use CMT:TREE in CalcStructure.<br />
You can calculate only one derivative if this derivative is specified in AdMode, using the RES<br />
keyword.<br />
84
AdfinX Analytics 1.0 Function Library – User Guide<br />
5.2.28. OpFxLinkedImpliedVol<br />
=OpFxLinkedImpliedVol(CalcDate As Variant, ExpiryDate As Variant, ExchangeRate<br />
As Variant, SpotPrice As Double, StrikePrice As Double, Premium As Double,<br />
ERVolatility As Double, Correlation As Double, RiskFreeRateArray As Variant,<br />
ForeignRateArray As Variant, ReturnArray As Variant, ExoticStucture As String,<br />
RateStructure As String, CalcStructure As String) As Double<br />
Returns:<br />
the relative implied volatility of a Composite option<br />
the underlying volatility of a Quanto or Equity Linked Foreign Exchange option in an array<br />
Quanto (quantity-adjusting) options are mainly used to eliminate the foreign exchange risk when the<br />
underlying asset is denominated in a currency other than the currency of the option, exchange rate<br />
being fixed to the calculation date. A Composite option is an option on a foreign equity where the strike<br />
is denominated in domestic currency. A Composite option has an exposure on the exchange risk. In<br />
an Equity Linked Foreign Exchange option, the face value is linked to the forward price of a stock or<br />
equity index. This is an ideal option for an investor who wants to speculate directly in a foreign equity<br />
market but wishes to place a floor on the currency exposure.<br />
Arguments<br />
CalcDate : Calculation date<br />
ExpiryDate : Expiry date of the option<br />
ExchangeRate : Spot exchange rate specified in units of the domestic currency per unit of<br />
the foreign currency<br />
SpotPrice : Market or spot price of the underlying instrument<br />
StrikePrice : Exercise or strike price of the option<br />
Premium : Premium of the option<br />
ERVolatility : Anticipated volatility of the exchange rate if applicable<br />
Correlation : Correlation between asset and domestic exchange rate if applicable<br />
RiskFreeRateArray : Array of data depending on the rate model chosen<br />
ForeignRateArray : Yearly rate of the foreign market for an equivalent risk-free investment<br />
ReturnArray : Array of annualized dividend rates<br />
ExoticStructure : Extended argument defining the exotic option structure<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
Return Value<br />
The implied volatility of the option.<br />
Notes<br />
The ReturnArray and RiskFreeRateArray arguments can be defined respectively in<br />
ExoticStructure and RateStructure through the keywords RATETYPE, RATEFRQ, RM or DCB.<br />
You must include at least the option type in the ExoticStructure, using the CALL or PUT<br />
keywords, and the foreign exchange link type using the FXLINK keyword. You can also specify the<br />
SOLVER keyword in CalcStructure to calculate the implied volatility with a specific method<br />
(Newton-Raphson, Ridder, or dichotomy).<br />
You can now calculate the implied volatility of a Quanto or Composite option with an American or<br />
Bermudan exercise mode, using the EXM keyword in ExoticStructure.<br />
You cannot calculate the implied volatility of a Quanto or Composite option using FXLINK:ELFX in<br />
ExoticStructure.<br />
You must use CMT:TREE NBBRANCH:3 in CalcStructure to calculate the implied volatility of a<br />
Quanto or Composite option.<br />
85
AdfinX Analytics 1.0 Function Library – User Guide<br />
For more information on the relative implied volatility, see the Trinomial model section of the Adfin<br />
Options Theory Guide.<br />
5.2.29. OpFxLinkedPremium<br />
OpFxLinkedPremium(CalcDate As Variant, ExpiryDate As Variant, ExchangeRate As<br />
Double, SpotPrice As Double, StrikePrice As Double, ERVolatility As Double,<br />
Volatility As Double, Correlation As Double, RiskFreeRateArray As Variant,<br />
ForeignRiskFreeRateArray As Variant, ReturnArray As Variant, ExoticStructure<br />
As String, RateStructure As String, CalcStructure As String) As Double<br />
Calculates the premium of a Quanto, Composite or Equity Linked Foreign Exchange option. Quanto<br />
(quantity-adjusting) options are mainly used to eliminate the foreign exchange risk when the underlying<br />
asset is denominated in a currency other than the currency of the option, exchange rate being fixed to<br />
the calculation date. A Composite option is an option on a foreign equity where the strike is<br />
denominated in domestic currency. A Composite option has an exposure on the exchange risk. In an<br />
Equity Linked Foreign Exchange option, the face value is linked to the forward price of a stock or<br />
equity index. This is an ideal option for an investor who wants to speculate directly in a foreign equity<br />
market but wishes to place a floor on the currency exposure.<br />
Arguments<br />
CalcDate : Calculation date<br />
ExpiryDate : Expiry date of the option<br />
ExchangeRate : Spot exchange rate specified in units of the domestic currency per unit<br />
of the foreign currency<br />
SpotPrice : Market or spot price of the underlying instrument<br />
StrikePrice : Exercise or strike price of the option.<br />
ERVolatility : Anticipated volatility of the exchange rate<br />
Volatility : Anticipated volatility of the underlying instrument<br />
Correlation : Correlation between asset and domestic exchange rate<br />
RiskFreeRateArray : Array of data depending on the rate model chosen<br />
ForeignRateArray : Yearly rate of the foreign market for an equivalent risk-free investment<br />
ReturnArray : Array of annualized dividend rates<br />
ExoticStructure : Extended argument defining the exotic option structure<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
Return Value<br />
The premium of the option.<br />
Notes<br />
The ReturnArray and RiskFreeRateArray arguments can be defined respectively in<br />
ExoticStructure and RateStructure through the keywords RATETYPE, RATEFRQ, RM or DCB.<br />
You must include at least the option type in the ExoticStructure, using the CALL or PUT<br />
keywords, and the Foreign Exchange Link type using the FXLINK keyword.<br />
You can now calculate the premium of a Quanto or Composite option with an American or<br />
Bermudan exercise mode, using the EXM keyword in ExoticStructure. EXM is incompatible with<br />
FXLINK:ELFX. In these cases, you must use CMT:TREE in CalcStructure.<br />
5.2.30. OpPowerDeriv<br />
OpPowerDeriv(CalcDate As Variant, ExpiryDate As Variant, SpotPrice As Double,<br />
StrikePrice As Double, Alpha As Double, Power As Double, Volatility As Double,<br />
86
AdfinX Analytics 1.0 Function Library – User Guide<br />
RiskFreeRateArray As Variant, ReturnArray As Variant, ExoticStructure As<br />
String, RateStructure As String, CalcStructure As String, AdMode As String)<br />
As Variant<br />
Returns in an array all derivatives (delta, gamma, rho, theta, and vega) of an asymmetric Power option<br />
where the payoff is expressed as:<br />
Arguments<br />
max( α S<br />
ν − X , 0 )<br />
CalcDate : Calculation date<br />
ExpiryDate : Expiry date of the option<br />
SpotPrice : Spot price of the underlying stock (S)<br />
StrikePrice : Strike price of the option (X)<br />
Alpha : Polynomial coefficient (α)<br />
Power : Power coefficient (v)<br />
Volatility : Anticipated volatility of the underlying instrument<br />
RiskFreeRateArray : Array of data depending on the rate model chosen<br />
ReturnArray : Array of annualized dividend rates<br />
ExoticStructure : Extended argument defining the exotic option structure<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
AdMode : Extended argument customising the return value<br />
Return Value<br />
The return value depends on the value of AdMode. The default value is a vertical 5-element array<br />
containing:<br />
Delta : Delta ratio<br />
Gamma : Gamma ratio<br />
Rho : Rho ratio<br />
Theta : Theta ratio<br />
Vega : Vega ratio<br />
Notes<br />
The ReturnArray and RiskFreeRateArray arguments can be defined respectively in<br />
ExoticStructure and RateStructure through the keywords RATETYPE, RATEFRQ, RM or DCB.<br />
You must include at least the option type in the ExoticStructure, using the CALL or PUT<br />
keywords.<br />
You can calculate only one derivative if this derivative is specified in AdMode, using the RES<br />
keyword.<br />
5.2.31. OpPowerImpliedVol<br />
OpPowerImpliedVol(CalcDate As Variant, ExpiryDate As Variant, SpotPrice As<br />
Double, StrikePrice As Double, Alpha As Double, Power As Double, Premium As<br />
Double, RiskFreeRateArray As Variant, ReturnArray As Variant, ExoticStructure<br />
As String, RateStructure As String, CalcStructure As String) As Double<br />
Calculates the implied volatility of an asymmetric Power option where the payoff is expressed as:<br />
max( α S<br />
ν − X , 0 ) .<br />
87
AdfinX Analytics 1.0 Function Library – User Guide<br />
Arguments<br />
CalcDate : Calculation date<br />
ExpiryDate : Expiry date of the option<br />
SpotPrice : Spot price of the underlying stock (S)<br />
StrikePrice : Strike price of the option (X)<br />
Alpha : Polynomial coefficient (α)<br />
Power : Power coefficient (v)<br />
Premium : Market or spot price of the option<br />
RiskFreeRateArray : Array of data depending on the rate model chosen<br />
ReturnArray : Array of annualized dividend rates<br />
ExoticStructure : Extended argument defining the exotic option structure<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
Return Value<br />
The implied volatility of the option.<br />
Notes<br />
The ReturnArray and RiskFreeRateArray arguments can be defined respectively in<br />
ExoticStructure and RateStructure through the keywords RATETYPE, RATEFRQ, RM or DCB.<br />
You must include at least the option type in the ExoticStructure, using the CALL or PUT<br />
keywords.<br />
5.2.32. OpPowerPremium<br />
OpPowerPremium(CalcDate As Variant, ExpiryDate As Variant, SpotPrice As<br />
Double, StrikePrice As Double, Alpha As Double, Power As Double, Volatility As<br />
Double, RiskFreeRateArray As Variant, ReturnArray As Variant, ExoticStructure<br />
As String, RateStructure As String, CalcStructure As String) As Double<br />
Calculates the premium of an asymmetric Power option where the payoff is expressed as:<br />
Arguments<br />
max( α S<br />
ν − X , 0 ) .<br />
CalcDate : Calculation date<br />
ExpiryDate : Expiry date of the option<br />
SpotPrice : Spot price of the underlying stock (S)<br />
StrikePrice : Strike price of the option (X)<br />
Alpha : Polynomial coefficient (α)<br />
Power : Power coefficient (v)<br />
Volatility : Anticipated volatility of the underlying<br />
RiskFreeRateArray : Array of data depending on the rate model chosen<br />
ReturnArray<br />
: Array of annualized dividend rates<br />
ExoticStructure : Extended argument defining the exotic option structure<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
88
AdfinX Analytics 1.0 Function Library – User Guide<br />
Return Value<br />
The premium of the option.<br />
Notes<br />
The ReturnArray and RiskFreeRateArray arguments can be defined respectively in<br />
ExoticStructure and RateStructure through the keywords RATETYPE, RATEFRQ, RM or DCB.<br />
You must include at least the option type in the ExoticStructure, using the CALL or PUT<br />
keywords.<br />
5.2.33. OpRainbowDeriv<br />
OpRainbowDeriv(CalcDate As Variant, ExpiryDate As Variant, SpotPriceArray As<br />
Variant, StrikePriceArray As Variant, CorrelationArray As Variant,<br />
RiskFreeRateArray As Variant, ReturnArray As Variant, ExoticStructure As<br />
String, RateStructure As String, CalcStructure As String, AdMode As String)<br />
As Variant<br />
Returns all derivatives (delta, gamma, rho, theta, and vega) of a Spread or a Two-Color Rainbow<br />
option in an array. Rainbow options are options for which final payoff is determined by the highest<br />
performance achieved at the expiration date by two or more underlying assets. Rainbow options can<br />
be either American or European options.<br />
Arguments<br />
CalcDate : Calculation date<br />
ExpiryDate : Expiry date of the option<br />
SpotPriceArray : Market or spot price of the underlying instruments<br />
StrikePriceArray : Strike price, and second strike price of a Dual-Strike option<br />
CorrelationArray : Array containing the volatilities of the assets on the diagonal and the<br />
correlation coefficient<br />
RiskFreeRateArray : Array of data depending on the rate model chosen:<br />
• constant risk free rate<br />
• zero-coupon curve<br />
ReturnArray : Array containing the annualized dividend rates of the underlying<br />
instruments<br />
ExoticStructure : Extended argument defining the exotic option structure<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
AdMode : Extended argument customising the return value.<br />
Return Value<br />
The return value depends on the value of AdMode. The default value is a vertical 8-element array<br />
containing:<br />
Delta1 : Delta ratio of the first asset<br />
Delta2 : Delta ratio of the second asset<br />
Gamma1 : Gamma ratio of the first asset<br />
Gamma2 : Gamma ratio of the second asset<br />
Rho : Rho ratio<br />
Theta : Theta ratio<br />
Vega1 : Vega ratio of the first asset<br />
Vega2 : Vega ratio of the second asset<br />
89
AdfinX Analytics 1.0 Function Library – User Guide<br />
Notes<br />
The ReturnArray and RiskFreeRateArray arguments can be defined respectively in<br />
ExoticStructure and RateStructure through the keywords RATETYPE, RATEFRQ, RM or DCB.<br />
You must include at least the option type in the ExoticStructure, using the CALL or PUT<br />
keywords, and the Rainbow type using the RAIN keyword.<br />
The Rainbow option must not have more than two assets when using CMT:TREE in<br />
CalcStructure.<br />
You must use CMT:TREE in CalcStructure to calculate the derivatives of an American Rainbow<br />
option.<br />
You must use the keywords NBBRANCH:2 and NBFACTOR:2 in CalcStructure when the<br />
calculation method is specified by CMT:TREE.<br />
You can calculate only one derivative when this derivative is specified in AdMode, using the RES<br />
keyword.<br />
5.2.34. OpRainbowPremium<br />
OpRainbowPremium(CalcDate As Variant, ExpiryDate As Variant, SpotPriceArray<br />
As Variant, StrikePriceArray As Variant, CorrelationArray As Variant,<br />
RiskFreeRateArray As Variant, ReturnArray As Variant, ExoticStructure As<br />
String, RateStructure As String, CalcStructure As String) As Double<br />
Calculates the premium of a Spread or a Two-Color Rainbow option. Rainbow options are options for<br />
which final payoff is determined by the highest performance achieved at the expiration date by two or<br />
more underlying assets. Rainbow options can be either American or European options.<br />
Arguments<br />
CalcDate : Calculation date<br />
ExpiryDate : Expiry date of the option<br />
SpotPriceArray : Market or spot price of the underlying instruments<br />
StrikePriceArray : Exercise or strike price of the option. Can be a table in the case of a<br />
Dual-Strike option<br />
CorrelationArray<br />
: Array containing the volatilities of the assets on the diagonal and the<br />
correlation coefficient<br />
RiskFreeRateArray : Array of data depending on the rate model chosen:<br />
• constant risk free rate<br />
• zero-coupon curve<br />
ReturnArray : Array containing the annualized dividend rates of the underlying<br />
instruments<br />
ExoticStructure : Extended argument defining the exotic option structure<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
Return Value<br />
The premium of the option.<br />
Notes<br />
The ReturnArray and RiskFreeRateArray arguments can be defined respectively in<br />
ExoticStructure and RateStructure through the keywords RATETYPE, RATEFRQ, RM or DCB.<br />
You must include at least the option type in the ExoticStructure, using the CALL or PUT<br />
keywords, and the Rainbow type using the RAIN keyword.<br />
The Rainbow option must not have more than two assets when using CMT:TREE in<br />
CalcStructure.<br />
90
AdfinX Analytics 1.0 Function Library – User Guide<br />
You must use CMT:TREE in CalcStructure to price an American Rainbow option.<br />
You must use the keywords NBBRANCH:2 and NBFACTOR:2 in CalcStructure when the<br />
calculation method is specified by CMT:TREE.<br />
91
AdfinX Analytics 1.0 Function Library – User Guide<br />
6. ADFINX ADXFOREXMODULE CONTROL<br />
6.1. ADXFOREXMODULE PROPERTIES<br />
6.1.1. ErrorCode<br />
ErrorCode() As Long<br />
The ErrorCode property of the AdxForexModule control retrieves the last error code generated<br />
by the object.<br />
Arguments<br />
This property takes no argument.<br />
Example<br />
Dim fx as AdxForexModule : Declares an object of type AdxForexModule<br />
Set fx = New AdxForexModule : Creates an AdxForexModule object<br />
If fx.ErrorCode 0 Then : fx.ErrorCode contains the error<br />
MsgBox (fx.ErrorCode) : Displays the error code in a message box<br />
End If<br />
6.1.2. ErrorMode<br />
ErrorMode() As AdxErrorMode<br />
The ErrorMode property of the AdxForexModule component sets the error mode of the<br />
AdxForexModule. Three modes are defined:<br />
DIALOGBOX : In this mode a dialog box is displayed when an error occurs<br />
EXCEPTION : In this mode an exception is thrown when an error occurs<br />
NO_EXCEPTION : In this mode the user must call the property ErrorCode to know the error<br />
encountered<br />
Arguments<br />
This property takes no argument.<br />
Note<br />
By default the error mode is set to EXCEPTION.<br />
Example<br />
Dim fx as AdxForexModule : Declares an object of type AdxForexModule<br />
Set fx = New AdxForexModule : Creates an AdxForexModule object<br />
fx.ErrorMode = NO_EXCEPTION : fx.ErrorMode is set to NO_EXCEPTION<br />
6.1.3. ErrorString<br />
ErrorString() As String<br />
The ErrorString property of the AdxForexModule retrieves the last error code generated by<br />
the object with the associated error string.<br />
92
AdfinX Analytics 1.0 Function Library – User Guide<br />
Arguments<br />
This property takes no argument.<br />
Example<br />
Dim fx as AdxForexModule : Declares an object of type AdxForexModule<br />
Set fx = New AdxForexModule : Creates an AdxForexModule object<br />
fx.ErrorMode = EXCEPTION : fx.ErrorMode must be set to EXCEPTION to use the<br />
ErrorString<br />
On Error Go To Handle : Error handler executes code after Handle when an error<br />
occurs<br />
RES = fx.FxCurInfo("GFP", "LAY:V")<br />
: The currency code GFP is incorrect. The <strong>fun</strong>ction<br />
FxCurInfo returns an error<br />
Exit Sub : Exits sub or <strong>fun</strong>ction before the handle or code will be<br />
executed<br />
Handle<br />
MsgBox(fx.ErrorString) : Displays the ErrorString in a message box<br />
fx.ErrorString contains the ErrorString (‘Error#8200 –<br />
Currency: invalid currency code.’)<br />
6.2. ADXFOREXMODULE METHODS<br />
6.2.1. FxCalcPeriod<br />
FxCalcPeriod(CalcDate As Variant, Cur1Cur2 As String, Period As String, FxMode<br />
As String) As Variant<br />
Calculates the start date and the end date of a period.<br />
The CalcDate argument stands by default for the trading date. To calculate the period end date<br />
directly from the spot date (it may be useful to do so for instance when applying an offset to the spot<br />
date), or to choose between the Forex and the Money markets, use the FROM keyword in FxMode.<br />
Arguments<br />
CalcDate : Calculation date (trading date or spot date)<br />
Cur1Cur2 : Cross currency code (example : "EURGBP")<br />
Period : Period code (example : "1M")<br />
FxMode : Extended argument customizing the return value<br />
Return Value<br />
The return value depends on the value of FxMode. The default value is an array containing:<br />
StartDate : Period start date<br />
EndDate : Period end date<br />
Adjustment : String indicated why EndDate was adjusted if applicable<br />
93
AdfinX Analytics 1.0 Function Library – User Guide<br />
Notes<br />
If any of the two currencies is the USD, the other currency code can be used directly in the<br />
Cur1Cur2 argument to avoid the burden of determining which of Cur1 or Cur2 stands for the<br />
USD. Similarly, if the base currency is not the USD, it is possible to use a 9-character code that<br />
includes in the middle the base currency (e.g. "EURDEMGBP").<br />
If the base currency is the USD, American holidays are taken into account for determining the<br />
period start date and end date. Similarly, if another base currency is specified, the corresponding<br />
holiday dates are used for the calculation.<br />
6.2.2. FxCross<br />
FxCross(Cur1Cur2 As String, Spot1BA As Variant, Spot2BA As Variant, FxMode As<br />
String) As Variant<br />
Calculates the spot cross rate assuming that the cross value date and the spot dates are equal.<br />
The cross spot rate is returned by default in a two element array. To get the cross rate in the Bid/Ask<br />
or Ask/Bid format, this <strong>fun</strong>ction can be combined with the AdFormat <strong>fun</strong>ction.<br />
Arguments<br />
Cur1Cur2 : Cross currency code (example : "EURGBP")<br />
Spot1BA : Cur1 spot rates (array Bid/Ask)<br />
Spot2BA : Cur2 spot rates (array Bid/Ask)<br />
FxMode : Extended argument customizing the return value<br />
Return Value<br />
The return value depends on the value of FxMode. The default value is an array containing:<br />
Spot12B : Bid side of the spot cross rate<br />
Spot12A : Ask side of the spot cross rate<br />
6.2.3. FxCrossA<br />
FxCrossA(CalcDate As Variant, Cur1Cur2 As String, Spot1BA As Variant, Spot2BA<br />
As Variant, Dep1BA As Variant, Dep2BA As Variant, DepUsdBa As Variant, FxMode<br />
As String) As Variant<br />
Calculates the spot cross rate correcting the spot rates if the cross spot date and the spot date of each<br />
currency are not equal.<br />
The cross spot rate is returned by default in a two element array. To get the cross rate in the Bid/Ask<br />
or Ask/Bid format, this <strong>fun</strong>ction can be combined with the AdFormat <strong>fun</strong>ction.<br />
Arguments<br />
CalcDate : Calculation date (contract or trading date)<br />
Cur1Cur2 : Cross currency code (example : "EURGBP")<br />
Spot1BA : Cur1 spot rates (array Bid/Ask)<br />
Spot2BA : Cur2 spot rates (array Bid/Ask)<br />
Dep1BA : Cur1 deposit rates (in real value) for the shortest period (array Bid/Ask)<br />
Dep2BA : Cur2 deposit rates (in real value) for the shortest period (array Bid/Ask)<br />
DepUsdBA : USD deposit rates (in real value) for the shortest period (array Bid/Ask)<br />
FxMode : Extended argument customizing the return value<br />
94
AdfinX Analytics 1.0 Function Library – User Guide<br />
Return Value<br />
The return value depends on the value of FxMode. The default value is an array containing:<br />
Spot12B : Bid side of the spot cross rate<br />
Spot12A : Ask side of the spot cross rate<br />
SpotDate12 : Spot value date of the cross currency<br />
SpotDate1 : Spot value date of Cur1<br />
SpotDate2 : Spot value date of Cur2<br />
6.2.4. FxCrossD<br />
FxCrossD(SpotDate12 As Variant, SpotDate1 As Variant, SpotDate2 As Variant,<br />
Cur1Cur2 As String, Spot1BA As Variant, Spot2BA As Variant, Dep1BA As Variant,<br />
Dep2BA As Variant, DepUsdBA As Variant, FxMode As String) As Variant<br />
Calculates the spot cross rate correcting the spot rates if the cross spot date SpotDate12 and the<br />
currency spot dates SpotDate1 and SpotDate2 are not equal.<br />
The cross spot rate is returned by default in a two element array. To get the cross rate in the Bid/Ask<br />
or Ask/Bid format, this <strong>fun</strong>ction can be combined with the AdFormat <strong>fun</strong>ction.<br />
Arguments<br />
SpotDate12 : Spot value date of the cross currency Cur1Cur2<br />
SpotDate1 : Spot value date of Cur1<br />
SpotDate2 : Spot value date of Cur2<br />
Cur1Cur2 : Cross currency code (example: "EURGBP")<br />
Spot1BA : Cur1 spot rates (array Bid/Ask)<br />
Spot2BA : Cur2 spot rates (array Bid/Ask)<br />
Dep1BA : Cur1 deposit rates (in real value) for the shortest period (array Bid/Ask)<br />
Dep2BA : Cur2 deposit rates (in real value) for the shortest period (array Bid/Ask)<br />
DepUsdBA : USD deposit rates (in real value) for the shortest period (array Bid/Ask)<br />
FxMode : Extended argument customizing the return value<br />
Return Value<br />
The return value depends on the value of FxMode. The default value is an array containing:<br />
Spot12B : Bid side of the spot cross rate<br />
Spot12A : Ask side of the spot cross rate<br />
6.2.5. FxDepToSwpD<br />
FxDepToSwpD(NbDays As Integer, Cur1Cur2 As String, Spot12BA As Variant, Dep1BA<br />
As Variant, Dep2BA As Variant, FxMode As String) As Variant<br />
Calculates the synthetic swap point from deposit using a number of days. If any of the two currencies<br />
is the USD, an alternate set of arguments can be used to avoid the burden of determining which of<br />
Cur1 or Cur2 stands for the USD. To distinguish from both cases, the expected result must be<br />
specified in FxMode using the RES keyword.<br />
To get outrights instead of swap points, this <strong>fun</strong>ction can be combined with the FxSwpToOut <strong>fun</strong>ction.<br />
95
AdfinX Analytics 1.0 Function Library – User Guide<br />
The cross swap point is returned by default in a two element array. To get the swap point in the<br />
Bid/Ask or Ask/Bid format, this <strong>fun</strong>ction can be combined with the AdFormat <strong>fun</strong>ction.<br />
Arguments for two non-USD currencies<br />
NbDays : Number of days of Cur1Cur2 swap point period<br />
Cur1Cur2 : Cross currency code (example : "EURGBP")<br />
Spot12BA : Cur1Cur2 spot rates (array Bid/Ask)<br />
Dep1BA : Cur1 deposit rates (in real value) for approximately NbDays (array Bid/Ask)<br />
Dep2BA : Cur2 deposit rates (in real value) for approximately NbDays (array Bid/Ask)<br />
FxMode : Extended argument customizing the return value<br />
In that case, FxMode should include the argument "RES:SWP12".<br />
Arguments for one currency against USD<br />
NbDays : Number of days of Currency swap point period<br />
Cur1Cur2 : Currency ISO code (example : "EUR") referred to as Currency<br />
Spot12BA : Currency spot rates (array Bid/Ask)<br />
Dep1BA : Currency deposit rates (in real value) for approximately NbDays (array Bid/Ask)<br />
Dep2BA : USD deposit rates (in real value) for approximately NbDays (array Bid/Ask)<br />
FxMode : Extended argument customizing the return value<br />
In that case, FxMode should include the argument "RES:SWPCUR".<br />
Return Value<br />
The return value depends on the value of FxMode. The default value is an array containing:<br />
Swp12B : Bid side of the cross swap point (or the currency swap point with USD)<br />
Swp12A : Ask side of the cross swap point (or the currency swap point with USD)<br />
6.2.6. FxDepToSwpP<br />
FxDepToSwpP(CalcDate As Variant, Period As String, Cur1Cur2 As String,<br />
Spot12BA As Variant, Dep1BA As Variant, Dep2BA As Variant, FxMode As String) As<br />
Variant<br />
Calculates the synthetic swap point from deposit using a period. If either of the two currencies is the<br />
USD, an alternate set of arguments can be used to avoid the burden of determining which of Cur1 or<br />
Cur2 stands for the USD. To distinguish from both cases, the expected result must be specified in<br />
FxMode using the RES keyword.<br />
To get outrights instead of swap points, this <strong>fun</strong>ction can be combined with the FxSwpToOut <strong>fun</strong>ction.<br />
The cross swap point is returned by default in a two element array. To get the swap point in the<br />
Bid/Ask or Ask/Bid format, this <strong>fun</strong>ction can be combined with the AdFormat <strong>fun</strong>ction.<br />
Arguments for two non-USD currencies<br />
CalcDate : Calculation date (contract or trading date)<br />
Period : Period code (example : "1W")<br />
Cur1Cur2 : Cross currency code (example : "EURGBP")<br />
Spot12BA : Cur1Cur2 spot rates (array Bid/Ask)<br />
Dep1BA : Cur1 deposit rates (in real value) for the period (array Bid/Ask)<br />
Dep2BA : Cur2 deposit rates (in real value) for the period (array Bid/Ask)<br />
FxMode : Extended argument customizing the return value<br />
96
AdfinX Analytics 1.0 Function Library – User Guide<br />
In that case, FxMode should include the argument "RES:SWP12".<br />
Arguments for one currency against USD<br />
CalcDate : Calculation date (contract or trading date)<br />
Period : Period code (example : "1W")<br />
Cur1Cur2 : Currency ISO code (example : "EUR") referred to as Currency<br />
Spot12BA : Currency spot rates (array Bid/Ask)<br />
Dep1BA : Currency deposit rates (in real value) for the period (array Bid/Ask)<br />
Dep2BA : USD deposit rates (in real value) for the period (array Bid/Ask)<br />
FxMode : Extended argument customizing the return value<br />
In that case, FxMode should include the argument "RES:SWPCUR".<br />
Return Value<br />
The return value depends on the value of FxMode. The default value is an array containing:<br />
Swp12B : Bid side of the cross swap point (or the currency swap point with USD)<br />
Swp12A : Ask side of the cross swap point (or the currency swap point with USD)<br />
StartDate : Start date of the period<br />
EndDate : End date of the period<br />
6.2.7. FxGenCalc<br />
FxGenCalc(InstrumentCode As String, CurrencyList As String, CalcDate As<br />
Variant, Spot1BA As Variant, Spot2BA As Variant, Spot12BA As Variant, Swp1Array<br />
As Variant, Swp2Array As Variant, Dep1Array As Variant, Dep2Array As Variant,<br />
DepUsdArray As Variant, FxMode As String) As Variant<br />
Performs any kind of Forex or Money market calculation from an instrument code. The integration of<br />
the FxGenCalc <strong>fun</strong>ction within models can be made easier with the FxGenParse <strong>fun</strong>ction.<br />
Arguments<br />
InstrumentCode : Instrument code corresponding to the calculation<br />
CurrencyList : List of the available currencies (string with the comma "," as separator)<br />
CalcDate : Calculation date (contract or trading date)<br />
Spot1BA : Cur1 spot rates (array Bid/Ask)<br />
Spot2BA : Cur2 spot rates (array Bid/Ask)<br />
Spot12BA : Cur1Cur2 spot rates (array Bid/Ask)<br />
Swp1Array : Cur1 array of dates and swap points<br />
Swp2Array : Cur2 array of dates and swap points<br />
Dep1Array : Cur1 array of dates and deposit rates<br />
Dep2Array : Cur2 array of dates and deposit rates<br />
DepUsdArray : USD array of dates and deposit rates<br />
FxMode : Extended argument customizing the return value<br />
Return Value<br />
The return value depends on the value of FxMode. The default value is an array containing:<br />
Bid : Bid side of the calculation<br />
Ask : Ask side of the calculation<br />
SpotDate12 : Spot date of the cross currency (if applicable)<br />
97
AdfinX Analytics 1.0 Function Library – User Guide<br />
EndDate1 : End date of the 1st currency period (if applicable)<br />
EndDate2 : End date of the 2nd currency period (if applicable)<br />
Note<br />
The argument Spot12BA can be left to 0 to indicate that the cross spot rate must be calculated from<br />
Spot1BA and Spot2BA.<br />
6.2.8. FxGenParse<br />
FxGenParse(InstrumentCode As String, CurrencyList As String, FxMode As String)<br />
As Variant<br />
Returns information concerning the calculation that corresponds to an instrument code. This<br />
information can be used to select the proper arguments in the FxGenCalc <strong>fun</strong>ction.<br />
Arguments<br />
InstrumentCode : Instrument code corresponding to the calculation<br />
CurrencyList : List of the available currencies (string with the comma "," as separator)<br />
FxMode : Extended argument customizing the return value<br />
Return Value<br />
The return value depends on the value of FxMode. The default value is an array containing:<br />
InfoMsg : Message describing the instrument and the calculation<br />
InfoCode : Code describing the instrument and the calculation<br />
Cur1 : 1st currency code<br />
Cur2 : 2nd currency code (if applicable)<br />
CurDep : Currency code for deposit calculation (if applicable)<br />
Period1 : 1st period code<br />
Period2 : 2nd period code (if applicable)<br />
IdnFlag : 1 if the data comes directly from IDN, 0 otherwise<br />
6.2.9. FxSwpToDepD<br />
FxSwpToDepD(NbDays As Integer, Cur1Cur2 As String, Spot12BA As Variant, DepBA<br />
As Variant, Swp12BA As Variant, FxMode As String) As Variant<br />
Calculates the synthetic deposit from swap point using a number of days. If any of the two currencies<br />
is the USD, an alternate set of arguments can be used to avoid the burden of determining which of<br />
Cur1 or Cur2 stands for the USD. To distinguish from both cases, the expected result must be<br />
specified in FxMode using the RES keyword.<br />
The deposit rate is returned by default in a two element array. To get the rate in the Bid/Ask or Ask/Bid<br />
format, this <strong>fun</strong>ction can be combined with the AdFormat <strong>fun</strong>ction.<br />
Arguments for two non-USD currencies<br />
NbDays : Number of days of Currency swap point period<br />
Cur1Cur2 : Cross currency code (example : "EURGBP")<br />
Spot12BA : Cur1Cur2 spot rates (array Bid/Ask)<br />
DepBA : Cur1 or Cur2 deposit rates (in real value) for approximately NbDays (array<br />
Bid/Ask)<br />
Swp12BA : Cur1Cur2 swap points (array Bid/Ask)<br />
98
AdfinX Analytics 1.0 Function Library – User Guide<br />
FxMode : Extended argument customizing the return value<br />
In that case, FxMode should include the argument "RES:DEP1" if the deposit rate of Cur1 is<br />
calculated from that of Cur2, or "RES:DEP2" if the deposit rate of Cur2 is calculated from that of<br />
Cur1.<br />
Arguments for one currency against USD<br />
NbDays : Number of days of Currency swap point period<br />
Cur1Cur2 : Currency ISO code (example : "EUR") referred to as Currency<br />
Spot12BA : Currency spot rates (array Bid/Ask)<br />
DepBA : Currency or USD deposit rates (in real value) for approx. NbDays (array Bid/Ask)<br />
Swp12BA : Currency swap points (array Bid/Ask)<br />
FxMode : Extended argument customizing the return value<br />
In that case, FxMode should include the argument "RES:DEPCUR" if the deposit rate of Currency<br />
is calculated from that of USD, or "RES:DEPUSD" if the deposit rate of USD is calculated from that<br />
of Currency.<br />
Return Value<br />
The return value depends on the value of FxMode. The default value is an array containing:<br />
DepB : Bid side of Currency or USD deposit rate (in real value)<br />
DepA : Ask side of Currency or USD deposit rate (in real value)<br />
6.2.10. FxSwpToDepP<br />
FxSwpToDepP(CalcDate As Variant, Period As String, Cur1Cur2 As String,<br />
Spot12BA As Variant, DepBA As Variant, Swp12BA As Variant, FxMode As String) As<br />
Variant<br />
Calculates the synthetic deposit from swap point using a period. If any of the two currencies is the<br />
USD, an alternate set of arguments can be used to avoid the burden of determining which of Cur1 or<br />
Cur2 stands for the USD. To distinguish from both cases, the expected result must be specified in<br />
FxMode using the RES keyword.<br />
The deposit rate is returned by default in a two element array. To get the rate in the Bid/Ask or Ask/Bid<br />
format, this <strong>fun</strong>ction can be combined with the AdFormat <strong>fun</strong>ction.<br />
Arguments for two non-USD currencies<br />
CalcDate : Calculation date (contract or trading date)<br />
Period : Period code (example : "1W")<br />
Cur1Cur2 : Cross currency code (example : "EURGBP")<br />
Spot12BA : Cur1Cur2 spot rates (array Bid/Ask)<br />
DepBA : Cur1 or Cur2 deposit rates (in real value) for the period (array Bid/Ask)<br />
Swp12BA : Cur1Cur2 swap points (array Bid/Ask)<br />
FxMode : Extended argument customizing the return value<br />
In that case, FxMode should include the argument "RES:DEP1" if the deposit rate of Cur1 is<br />
calculated from that of Cur2, or "RES:DEP2" if the deposit rate of Cur2 is calculated from that of<br />
Cur1.<br />
99
AdfinX Analytics 1.0 Function Library – User Guide<br />
Arguments for one currency against USD<br />
CalcDate : Calculation date (contract or trading date)<br />
Period : Period code (example : "1W")<br />
Cur1Cur2 : Currency ISO code (example : "EUR") referred to as Currency<br />
Spot12BA : Currency spot rates (array Bid/Ask)<br />
DepBA : Currency or USD deposit rates (in real value) for the period (array Bid/Ask)<br />
Swp12BA : Currency swap points (array Bid/Ask)<br />
FxMode : Extended argument customizing the return value<br />
In that case, FxMode should include the argument "RES:DEPCUR" if the deposit rate of Currency<br />
is calculated from that of USD, or "RES:DEPUSD" if the deposit rate of USD is calculated from that<br />
of Currency.<br />
Return Value<br />
The return value depends on the value of FxMode. The default value is an array containing:<br />
DepB : Bid side of Currency or USD deposit rate (in real value)<br />
DepA : Ask side of Currency or USD deposit rate (in real value)<br />
StartDate : Start date of the period<br />
EndDate : End date of the period<br />
6.2.11. FxSwpToOut<br />
FxSwpToOut(Cur1Cur2 As String, Spot12BA As Variant, Swp12BA As Variant, FxMode<br />
As String) As Variant<br />
Calculates outright rates from swap points.<br />
This <strong>fun</strong>ction is likely to be used to display a forward quotation of a cross currency as both swap points<br />
(argument of the <strong>fun</strong>ction) and outrights (result of the <strong>fun</strong>ction).<br />
The outright rate is returned by default in a two element array. To get the rate in the Bid/Ask or Ask/Bid<br />
format, this <strong>fun</strong>ction can be combined with the AdFormat <strong>fun</strong>ction.<br />
Arguments<br />
Cur1Cur2 : Cross currency code (example : "EURGBP")<br />
Spot12BA : Cur1Cur2 spot rates (array Bid/Ask)<br />
Swp12BA : Cur1Cur2 swap points (array Bid/Ask)<br />
FxMode : Extended argument customizing the return value<br />
Return Value<br />
The return value depends on the value of FxMode. The default value is an array containing:<br />
Out12B : Bid side of the cross outright<br />
Out12A : Ask side of the cross outright<br />
100
AdfinX Analytics 1.0 Function Library – User Guide<br />
6.2.12. FxSwpToSwp<br />
FxSwpToSwp(Cur1Cur2 As String, Spot1BA As Variant, Spot2BA As Variant, Swp1BA<br />
As Variant, Swp2BA As Variant, FxMode As String) As Variant<br />
Calculates the cross swap point from swap points assuming that the cross value date and the spot<br />
dates are equal.<br />
To get outrights instead of swap points, this <strong>fun</strong>ction can be combined with the FxSwpToOut <strong>fun</strong>ction.<br />
The cross swap point is returned by default in a two element array. To get the swap point in the<br />
Bid/Ask or Ask/Bid format, this <strong>fun</strong>ction can be combined with the AdFormat <strong>fun</strong>ction.<br />
Arguments<br />
Cur1Cur2 : Cross currency code (example : "EURGBP")<br />
Spot1BA : Cur1 spot rates (array Bid/Ask)<br />
Spot2BA : Cur2 spot rates (array Bid/Ask)<br />
Swp1BA : Cur1 swap points (array Bid/Ask)<br />
Swp2BA : Cur2 swap points (array Bid/Ask)<br />
FxMode : Extended argument customizing the return value<br />
Return Value<br />
The return value depends on the value of FxMode. The default value is an array containing:<br />
Swp12B : Bid side of the cross swap point<br />
Swp12A : Ask side of the cross swap point<br />
6.2.13. FxSwpToSwpD<br />
FxSwpToSwpD(NbDays12 As Variant, NbDays1 As Variant, NbDays2 As Variant,<br />
Cur1Cur2 As String, Spot1BA As Variant, Spot2BA As Variant, Swp1BA As Variant,<br />
Swp2BA As Variant, FxMode As String) As Variant<br />
Calculates the cross swap point from swap points, using either the numbers of days or an array of<br />
Start Dates and End Dates, to correct the calculation when the cross value date is different from the<br />
spot date.<br />
To get outrights instead of swap points, this <strong>fun</strong>ction can be combined with the FxSwpToOut <strong>fun</strong>ction.<br />
The cross swap point is by default returned in two cells. To get the swap point in the Bid/Ask or<br />
Ask/Bid format, this <strong>fun</strong>ction can be combined with the AdFormat <strong>fun</strong>ction.<br />
Arguments<br />
NbDays12 : Number of days of Cur1Cur2 swap point period or an array of Start Dates and End<br />
Dates<br />
NbDays1 : Number of days of Cur1USD swap point period or an array of Start Dates and End<br />
Dates<br />
NbDays2 : Number of days of Cur2USD swap point period or an array of Start Dates and End<br />
Dates<br />
Cur1Cur2 : Cross currency code (example : "EURGBP")<br />
Spot1BA : Cur1 spot rates (array Bid/Ask)<br />
Spot2BA : Cur2 spot rates (array Bid/Ask)<br />
Swp1BA : Cur1 swap points (array Bid/Ask)<br />
Swp2BA : Cur2 swap points (array Bid/Ask)<br />
101
AdfinX Analytics 1.0 Function Library – User Guide<br />
FxMode : Extended argument customizing the return value<br />
Return Value<br />
The return value depends on the value of FxMode. The default value is an array containing:<br />
Swp12B : Bid side of the cross swap point<br />
Swp12A : Ask side of the cross swap point<br />
6.2.14. FxSwpToSwpP<br />
FxSwpToSwpP(CalcDate As Variant, Period As String, Cur1Cur2 As String, Spot1BA<br />
As Variant, Spot2BA As Variant, Swp1BA As Variant, Swp2BA As Variant, FxMode As<br />
String) As Variant<br />
Calculates the cross swap point from swap points using a period to correct the calculation when the<br />
cross value date is different from the spot dates.<br />
To get outrights instead of swap points, this <strong>fun</strong>ction can be combined with the FxSwpToOut <strong>fun</strong>ction.<br />
The cross swap point is returned by default in a two element array. To get the swap point in the<br />
Bid/Ask or Ask/Bid format, this <strong>fun</strong>ction can be combined with the AdFormat <strong>fun</strong>ction.<br />
Arguments<br />
CalcDate : Calculation date (contract or trading date)<br />
Period : Period code (example : "1W")<br />
Cur1Cur2 : Cross currency code (example : "EURGBP")<br />
Spot1BA : Cur1 spot rates (array Bid/Ask)<br />
Spot2BA : Cur2 spot rates (array Bid/Ask)<br />
Swp1BA : Cur1 swap points (array Bid/Ask)<br />
Swp2BA : Cur2 swap points (array Bid/Ask)<br />
FxMode : Extended argument customizing the return value<br />
Return Value<br />
The return value depends on the value of FxMode. The default value is an array containing:<br />
Swp12B : Bid side of the cross swap point<br />
Swp12A : Ask side of the cross swap point<br />
StartDate : Start date of the period<br />
EndDate : End date of the period<br />
102
AdfinX Analytics 1.0 Function Library – User Guide<br />
7. ADFINX ADXOPTIONMODULE CONTROL<br />
7.1. ADXOPTIONMODULE PROPERTIES<br />
7.1.1. ErrorCode<br />
ErrorCode() As Long<br />
The ErrorCode property of the AdxOptionModule control retrieves the last error code generated<br />
by the object.<br />
Arguments<br />
This property takes no argument.<br />
Example<br />
Dim op as AdxOptionModule : Declares an object of type AdxOptionModule<br />
Set op = New AdxOptionModule : Creates an AdxOptionModule object<br />
If op.ErrorCode 0 Then : op.ErrorCode contains the error<br />
MsgBox (op.ErrorCode) : Displays the error code in a message box<br />
End If<br />
7.1.2. ErrorMode<br />
ErrorMode() As AdxErrorMode<br />
The ErrorMode property of the AdxOptionModule component sets the error mode of the<br />
AdxOptionModule. Three modes are defined<br />
DIALOGBOX : In this mode a dialog box is displayed when an error occurs<br />
EXCEPTION : In this mode an exception is thrown when an error occurs<br />
NO_EXCEPTION : In this mode the user must call the property ErrorCode to know the error<br />
encountered<br />
Arguments<br />
This property takes no argument.<br />
Note<br />
By default the error mode is set to EXCEPTION.<br />
Example<br />
Dim op as AdxOptionModule : Declares an object of type AdxOptionModule<br />
Set op = New AdxOptionModule : Creates an AdxOptionModule object<br />
op.ErrorMode = NO_EXCEPTION : op.ErrorMode is set to NO_EXCEPTION<br />
7.1.3. ErrorString<br />
ErrorString() As String<br />
The ErrorString property of the AdxOptionModule retrieves the last error code generated by<br />
the object with the associated error string.<br />
103
AdfinX Analytics 1.0 Function Library – User Guide<br />
Arguments<br />
This property takes no argument.<br />
Example<br />
Dim op as AdxOptionModule : Declares an object of type AdxOptionModule<br />
Set op = New AdxOptionModule : Creates an AdxOptionModule object<br />
op.ErrorMode = EXCEPTION : op.ErrorMode must be set to EXCEPTION to use the<br />
ErrorString<br />
On Error Go To Handle : Error handler executes code after Handle when an error<br />
occurs<br />
RES = op.OpPremium("24-APR-97", "25-FEB-96", "1.69", "1.55", "1.55",<br />
"0.1976", "0.0197", "0.0207", "CALL EXM:AMER")<br />
: The maturity date is before the calculation date. The<br />
<strong>fun</strong>ction OpPremium returns an error<br />
Exit Sub : Exits sub or <strong>fun</strong>ction before the handle or code will be<br />
executed<br />
Handle<br />
MsgBox(op.ErrorString) : Displays the ErrorString in a message box<br />
op.ErrorString contains the ErrorString (‘Error#7012 –<br />
Invalid maturity date.’)<br />
7.2. ADXOPTIONMODULE METHODS<br />
7.2.1. AdBarrierCapFloorCaplets<br />
=AdBarrierCapFloorCaplets(SettlementDate As Variant, RateArray As Variant,<br />
StartDate As Variant, Maturity As Variant, CapStrikePrice As Double,<br />
FloorStrikePrice As Double, FirstRate As Double, UpperBarrier As Variant,<br />
LowerBarrier As Variant, UpperRebate As Variant, LowerRebate As Variant,<br />
CapFloorStructure As String, RateStructure As String, CalcStructure As<br />
String, AdMode As String) As Variant<br />
Generates an array with the caplet or floorlet premiums of a Barrier cap or floor.<br />
Arguments<br />
SettlementDate : Settlement date<br />
RateArray : Term structure array<br />
StartDate : Start date of the Barrier cap or floor<br />
Maturity : Maturity date of the Barrier cap or floor<br />
CapStrikePrice : Exercise or strike price of the Barrier cap<br />
FloorStrikePrice : Exercise or strike price of the Barrier floor<br />
FirstRate : Rate of the Barrier cap or floor for the current calculation period<br />
UpperBarrier : Upper barrier of the Barrier cap or floor<br />
LowerBarrier : Lower barrier of the Barrier cap or floor<br />
UpperRebate : Upper rebate of the Barrier cap or floor<br />
LowerRebate : Lower rebate of the Barrier cap or floor<br />
CapFloorStructure : Extended argument defining the instrument<br />
RateStructure : Extended argument defining the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
104
AdfinX Analytics 1.0 Function Library – User Guide<br />
AdMode : Extended argument customizing the return value<br />
Return Value<br />
The return value is a vertical 6-column array, containing the following values for all caplets or floorlets:<br />
start date<br />
strike price<br />
volatility<br />
forward rate<br />
premium<br />
remaining notional<br />
Notes<br />
RateArray is a “Dates, Rates” array with a constant volatility in a third column. You must use<br />
RM:BS in CapFloorStructure.<br />
Maturity is expressed as a date or a code, such as “1Y”.<br />
You must specify the rate of the current caplet or floorlet in the FirstRate argument, if the<br />
instrument is already issued. You cannot calculate it from the zero-coupon yield curve.<br />
If you do not specify a value for UpperBarrier or LowerBarrier, you must include “0” in both<br />
arguments of the <strong>fun</strong>ction.<br />
If the cap or floor is out-of-the-money, you can specify a rebate array by using UpperRebate or<br />
LowerRebate. Otherwise, you must include “0” in both arguments of the <strong>fun</strong>ction.<br />
UpperBarrier, LowerBarrier, UpperRebate and LowerRebate can be a single value or an<br />
array of size N, where N is the number of caplets or floorlets of the cap or floor.<br />
You cannot use UpperRebate to value caplets or floorlets of a double knock in a Barrier cap or<br />
floor.<br />
You must specify CAP, FLOOR, and FRQ keywords in the CapFloorStructure.<br />
7.2.2. AdBarrierCapFloorDeriv<br />
=AdBarrierCapFloorDeriv(SettlementDate As Variant, RateArray As Variant,<br />
StartDate As Variant, Maturity As Variant, CapStrikePrice As Double,<br />
FloorStrikePrice As Double, FirstRate As Double, UpperBarrier As Variant,<br />
LowerBarrier As Variant, UpperRebate As Variant, LowerRebate As Variant,<br />
CapFloorStructure As String, RateStructure As String, CalcStructure As<br />
String, AdMode As String) As Double<br />
Generates an array with the derivatives of a Barrier cap or floor.<br />
Arguments<br />
SettlementDate : Settlement date<br />
RateArray : Term structure array<br />
StartDate : Start date of the Barrier cap or floor<br />
Maturity : Maturity date of the Barrier cap or floor<br />
CapStrikePrice : Exercise or strike price of the Barrier cap<br />
FloorStrikePrice : Exercise or strike price of the Barrier floor<br />
FirstRate : Rate of the Barrier cap or floor for the current calculation period<br />
UpperBarrier : Upper barrier of the Barrier cap or floor<br />
LowerBarrier : Lower barrier of the Barrier cap or floor<br />
UpperRebate : Upper rebate of the Barrier cap or floor<br />
LowerRebate : Lower rebate of the Barrier cap or floor<br />
CapFloorStructure : Extended argument defining the instrument<br />
RateStructure : Extended argument defining the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
AdMode : Extended argument customizing the return value<br />
105
AdfinX Analytics 1.0 Function Library – User Guide<br />
Return Value<br />
The return value is a vertical 6-column array, containing the global, global forward and caplet values<br />
for each of the following derivatives:<br />
delta<br />
gamma<br />
vega<br />
theta<br />
basis point value (BPV)<br />
convexity<br />
The <strong>fun</strong>ction returns “0” as global forward value for vega, theta, BPV and convexity. The first row of the<br />
return array contains the global values; the second contains the global forward values, and the third,<br />
the values of the derivatives for each caplet.<br />
Notes<br />
RateArray is a “Dates, Rates” array with a constant volatility in a third column. You must use<br />
RM:BS in CapFloorStructure.<br />
You must specify the rate of the current caplet or floorlet in the FirstRate argument, if the<br />
instrument is already issued. You cannot calculate it from the zero-coupon yield curve.<br />
If you do not specify a value for UpperBarrier or LowerBarrier, you must include “0” in both<br />
arguments of the <strong>fun</strong>ction.<br />
If the cap or floor is out-of-the-money, you can specify a rebate array by using UpperRebate or<br />
LowerRebate. Otherwise, you must include “0” in both arguments of the <strong>fun</strong>ction.<br />
UpperBarrier, LowerBarrier, UpperRebate and LowerRebate can be a single value or an<br />
array of size N, where N is the number of caplets or floorlets of the cap or floor.<br />
You cannot use UpperRebate to calculate the derivatives of a double knock in a Barrier cap or<br />
floor.<br />
You must specify CAP, FLOOR, and FRQ keywords in the CapFloorStructure.<br />
7.2.3. AdBarrierCapFloorImpliedVol<br />
=AdBarrierCapFloorImpliedVol(SettlementDate As Variant, RateArray As Variant,<br />
StartDate As Variant, Maturity As Variant, CapStrikePrice As Double,<br />
FloorStrikePrice As Double, FirstRate As Double, Premium As Double,<br />
UpperBarrier As Variant, LowerBarrier As Variant, UpperRebate As Variant,<br />
LowerRebate As Variant, CapFloorStructure As String, RateStructure As<br />
String, CalcStructure As String) As Double<br />
Calculates the implied volatility of a Barrier cap or floor.<br />
Arguments<br />
SettlementDate : Settlement date<br />
RateArray : Term structure array<br />
StartDate : Start date of the Barrier cap or floor<br />
Maturity : Maturity date of the Barrier cap or floor<br />
CapStrikePrice : Exercise or strike price of the Barrier cap<br />
FloorStrikePrice : Exercise or strike price of the Barrier floor<br />
FirstRate : Rate of the Barrier cap or floor for the current calculation period<br />
Premium : Market or spot price of the Barrier cap or floor<br />
UpperBarrier : Upper barrier of the Barrier cap or floor<br />
LowerBarrier : Lower barrier of the Barrier cap or floor<br />
UpperRebate : Upper rebate of the Barrier cap or floor<br />
LowerRebate : Lower rebate of the Barrier cap or floor<br />
106
AdfinX Analytics 1.0 Function Library – User Guide<br />
CapFloorStructure : Extended argument defining the instrument<br />
RateStructure : Extended argument defining the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
Return Value<br />
The implied volatility of the Barrier cap or floor.<br />
Notes<br />
RateArray is a “Dates, Rates” array with a constant volatility in a third column. You must use<br />
RM:BS in CapFloorStructure.<br />
You must specify the rate of the current caplet or floorlet in the FirstRate argument, if the<br />
instrument is already issued. You cannot calculate it from the zero-coupon yield curve.<br />
If you do not specify a value for UpperBarrier or LowerBarrier, you must include “0” in both<br />
arguments of the <strong>fun</strong>ction.<br />
If the cap or floor is out-of-the-money, you can specify a rebate array by using UpperRebate or<br />
LowerRebate. Otherwise, you must include “0” in both arguments of the <strong>fun</strong>ction.<br />
UpperBarrier, LowerBarrier, UpperRebate and LowerRebate can be a single value or an<br />
array of size N, where N is the number of caplets or floorlets of the cap or floor.<br />
You cannot use UpperRebate to calculate the implied volatility of a double knock in a Barrier cap<br />
or floor.<br />
You must specify CAP, FLOOR, and FRQ keywords in the CapFloorStructure.<br />
7.2.4. AdBarrierCapFloorPremium<br />
=AdBarrierCapFloorPremium(SettlementDate As Variant, RateArray As Variant,<br />
StartDate As Variant, Maturity As Variant, CapStrikePrice As Double,<br />
FloorStrikePrice As Double, FirstRate As Double, UpperBarrier As Variant,<br />
LowerBarrier As Variant, UpperRebate As Variant, LowerRebate As Variant,<br />
CapFloorStructure As String, RateStructure As String, CalcStructure As<br />
String) As Double<br />
Calculates the premium of a Barrier cap or floor.<br />
Arguments<br />
SettlementDate : Settlement date<br />
RateArray : Term structure array<br />
StartDate : Start date of the Barrier cap or floor<br />
Maturity : Maturity date of the Barrier cap or floor<br />
CapStrikePrice : Exercise or strike price of the Barrier cap<br />
FloorStrikePrice : Exercise or strike price of the Barrier floor<br />
FirstRate : Rate of the Barrier cap or floor for the current calculation period<br />
UpperBarrier : Upper barrier of the Barrier cap or floor<br />
LowerBarrier : Lower barrier of the Barrier cap or floor<br />
UpperRebate : Upper rebate of the Barrier cap or floor<br />
LowerRebate : Lower rebate of the Barrier cap or floor<br />
CapFloorStructure : Extended argument defining the instrument<br />
RateStructure : Extended argument defining the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
Return Value<br />
The premium of a Barrier cap or floor.<br />
107
AdfinX Analytics 1.0 Function Library – User Guide<br />
Notes<br />
RateArray is a “Dates, Rates” array with a constant volatility in a third column. You must use<br />
RM:BS in CapFloorStructure.<br />
If you do not specify a value for UpperBarrier or LowerBarrier, you must include “0” in both<br />
arguments of the <strong>fun</strong>ction.<br />
If the cap or floor is out-of-the-money, you can specify a rebate array by using UpperRebate or<br />
LowerRebate. Otherwise, you must include “0” in both arguments of the <strong>fun</strong>ction.<br />
UpperBarrier, LowerBarrier, UpperRebate and LowerRebate can be a single value or an<br />
array of size N, where N is the number of caplets or floorlets of the cap or floor.<br />
You cannot use UpperRebate to price a double knock in a Barrier cap or floor.<br />
You must specify CAP, FLOOR, and FRQ keywords in the CapFloorStructure.<br />
7.2.5. AdBondOptionDeriv<br />
AdBondOptionDeriv(CalcDate As Variant, RateArray As Variant, BondMaturity As<br />
Variant, Coupon As Double, ExpiryDate As Variant, StrikePrice As Double,<br />
BondStructure As String, OptionStructure As String, RateStructure As<br />
String, CalcStructure As String, AdMode As String) As Double<br />
Returns an array of all the derivatives (delta, gamma, rho, theta, vega) of a bond option defined from a<br />
bond structure.<br />
Arguments<br />
CalcDate : Calculation date<br />
RateArray : Term structure array<br />
BondMaturity : Maturity date of the bond<br />
Coupon : Coupon<br />
ExpiryDate : Expiry date of the option<br />
StrikePrice : Strike of the option<br />
BondStructure : Extended argument defining the bond structure<br />
OptionStructure : Extended argument defining the option structure<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
AdMode : Extended argument customizing the return value<br />
Return Value<br />
The return value depends on the value of AdMode. The default value is a vertical 5-cell array<br />
containing:<br />
Delta : Delta ratio<br />
Gamma : Gamma ratio<br />
Rho : Rho ratio<br />
Theta : Theta ratio<br />
Vega : Vega ratio<br />
Notes<br />
The table below describes the different forms of RateArray:<br />
If you specify<br />
RM:BDT<br />
RM:HW<br />
Then RateArray has the following columns<br />
Dates, Rates, Volatilities<br />
Dates, Rates, and constant volatility and mean-reversion<br />
108
AdfinX Analytics 1.0 Function Library – User Guide<br />
AdfinX Analytics assumes that the StrikePrice argument stands for the gross price of the bond.<br />
You must specify the PX keyword in CalcStructure to make the <strong>fun</strong>ction use the clean price of<br />
the bond.<br />
You must include at least the option type in the OptionStructure, using the CALL or PUT<br />
keywords.<br />
7.2.6. AdBondOptionPremium<br />
AdBondOptionPremium(CalcDate As Variant, RateArray As Variant, BondMaturity<br />
As Variant, Coupon As Double, ExpiryDate As Variant, StrikePrice As Double,<br />
BondStructure As String, OptionStructure As String, RateStructure As<br />
String, CalcStructure As String, AdMode As String) As Double<br />
Calculates the premium of a bond option defined from a bond structure.<br />
Arguments<br />
CalcDate : Calculation date<br />
RateArray : Term structure array<br />
BondMaturity : Maturity date of the bond<br />
Coupon : Coupon<br />
ExpiryDate : Expiry date of the option<br />
StrikePrice : Strike price of the option<br />
BondStructure : Extended argument defining the bond structure<br />
OptionStructure : Extended argument defining the option structure<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
AdMode : Extended argument customizing the return value<br />
Return Value<br />
The return value depends on the value of AdMode. The default value is the bond option premium. If<br />
needed the second returned value is the bond price.<br />
Notes<br />
The table below describes the different forms of RateArray:<br />
If you specify<br />
RM:BDT<br />
RM:HW<br />
Then RateArray has the following columns<br />
Dates, Rates, Volatilities<br />
Dates, Rates, and constant volatility and mean-reversion<br />
AdfinX Analytics assumes that the StrikePrice argument stands for the gross price of the bond.<br />
You must specify the PX keyword in CalcStructure to make the <strong>fun</strong>ction use the clean price of<br />
the bond.<br />
You must include at least the option type in the OptionStructure, using the CALL or PUT<br />
keywords.<br />
7.2.7. AdCapFloorCaplets<br />
AdCapFloorCaplets(SettlementDate As Variant, RateArray As Variant, StartDate<br />
As Variant, Maturity as Variant, CapStrikePrice As Double, FloorStrikePrice<br />
As Double, FirstRate As Double, CapFloorStructure As String, RateStructure<br />
As String, CalcStructure As String, AdMode As String) As Variant<br />
109
AdfinX Analytics 1.0 Function Library – User Guide<br />
Generates an array with the caplet or floorlet values of a Vanilla cap, floor, or collar.<br />
Arguments<br />
SettlementDate : Settlement date<br />
RateArray : Term structure array<br />
StartDate : Start date of the cap, floor, or collar<br />
Maturity : Maturity date of the cap, floor, or collar<br />
FirstRate : Rate of the cap, floor, or collar for the current calculation period<br />
CapStrikePrice : Exercise or strike price of the cap<br />
FloorStrikePrice : Exercise or strike price of the floor<br />
CapFloorStructure : Extended argument defining the instrument<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
AdMode : Extended argument customizing the return value<br />
Return Value<br />
The return value is a vertical 6-column array, containing the following values for all caplets or floorlets:<br />
start date<br />
strike price<br />
volatility<br />
forward rate<br />
premium<br />
remaining notional<br />
If you price a collar, the <strong>fun</strong>ction returns both caplet and floorlet strike prices in two separate columns.<br />
Notes<br />
The table below describes the different forms of RateArray:<br />
If you specify<br />
RM:BS<br />
RM:BDT<br />
RM:HW<br />
Then RateArray has the following columns<br />
Dates, Rates, and a constant volatility<br />
Dates, Rates, Volatilities<br />
Dates, Rates, and constant volatility and mean-reversion<br />
Maturity is expressed as a date or a code, such as “1Y”.<br />
You must specify the rate of the current caplet or floorlet in the FirstRate argument, if the<br />
instrument is already issued. You cannot calculate it from the zero-coupon yield curve.<br />
You must specify CAP, FLOOR, or COLLAR and FRQ keywords in the CapFloorStructure.<br />
You can only price caps and floors with money market rates, if you use the Hull and White model.<br />
7.2.8. AdCapFloorDeriv<br />
AdCapFloorDeriv(SettlementDate As Variant, RateArray As Variant, StartDate<br />
As Variant, Maturity As Variant, CapStrikePrice As Double, FloorStrikePrice<br />
As Double, FirstRate As Double, CapFloorStructure As String, RateStructure<br />
As String, CalcStructure As String, AdMode As String) As Double<br />
Generates an array with the derivatives of a Vanilla cap, floor, or collar.<br />
110
AdfinX Analytics 1.0 Function Library – User Guide<br />
Arguments<br />
SettlementDate : Settlement date<br />
RateArray : Term structure array<br />
StartDate : Start date of the cap, floor, or collar<br />
Maturity : Maturity date of the cap, floor, or collar<br />
CapStrikePrice : Exercise or strike price of the cap<br />
FloorStrikePrice : Exercise or strike price of the floor<br />
FirstRate : Rate of the cap, floor, or collar for the current calculation period<br />
CapFloorStructure : Extended argument defining the instrument<br />
RateStructure : Extended argument defining the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
AdMode : Extended argument customizing the return value<br />
Return Value<br />
The return value is a vertical 6-column array, containing the global, global forward and caplet values<br />
for each of the following derivatives:<br />
delta<br />
gamma<br />
vega<br />
theta<br />
basis point value (BPV)<br />
convexity<br />
The <strong>fun</strong>ction returns “0” as global forward value for vega, theta, BPV and convexity. The first row of the<br />
return array contains the global values; the second contains the global forward values, and the third,<br />
the values for each caplet.<br />
Notes<br />
The table below describes the different forms of RateArray:<br />
If you specify<br />
RM:BS<br />
RM:BDT<br />
RM:HW<br />
Then RateArray has the following columns<br />
Dates, Rates, and a constant volatility<br />
Dates, Rates, Volatilities<br />
Dates, Rates, and constant volatility and mean-reversion<br />
Maturity is expressed as a date or a code, such as “1Y”.<br />
You must specify the rate of the current caplet or floorlet in the FirstRate argument, if the<br />
instrument is already issued. You cannot calculate it from the zero-coupon yield curve.<br />
You must specify CAP, FLOOR, or COLLAR and FRQ keywords in the CapFloorStructure.<br />
You can only price caps and floors with money market rates, if you use the Hull and White model.<br />
7.2.9. AdCapFloorImpliedVol<br />
AdCapFloorlImpliedVol(SettlementDate As Variant, RateArray As Variant,<br />
StartDate As Variant, Maturity As Variant, CapStrikePrice As Double,<br />
FloorStrikePrice As Double, FirstRate As Double, Premium As Double,<br />
CapFloorStructure As String, RateStructure As String, CalcStructure As<br />
String) As Double<br />
Calculates the implied volatility of a Vanilla cap, floor, or collar.<br />
111
AdfinX Analytics 1.0 Function Library – User Guide<br />
Arguments<br />
SettlementDate : Settlement date<br />
RateArray : Term structure array<br />
StartDate : Start date of the cap, floor, or collar<br />
Maturity : Maturity date of the cap, floor, or collar<br />
CapStrikePrice : Exercise or strike price of the cap<br />
FloorStrikePrice : Exercise or strike price of the floor<br />
FirstRate : Rate of the cap, floor, or collar for the current calculation period<br />
Premium : Market or spot price of the cap, floor, or collar<br />
CapFloorStructure : Extended argument defining the instrument<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
Return Value<br />
The implied volatility of the cap, floor, or collar.<br />
Notes<br />
The table below describes the different forms of RateArray:<br />
If you specify<br />
RM:BS<br />
RM:BDT<br />
RM:HW<br />
Then RateArray has the following columns<br />
Dates, Rates, and a constant volatility<br />
Dates, Rates, Volatilities<br />
Dates, Rates, and constant volatility and mean-reversion<br />
Maturity is expressed as a date or a code, such as “1Y”.<br />
You must specify the rate of the current caplet or floorlet in the FirstRate argument, if the<br />
instrument is already issued. You cannot calculate it from the zero-coupon yield curve.<br />
You must specify CAP, FLOOR, or COLLAR and FRQ keywords in CapFloorStructure.<br />
7.2.10. AdCapFloorPremium<br />
AdCapFloorPremium(SettlementDate As Variant, RateArray As Variant, StartDate<br />
As Variant, Maturity as Variant, CapStrikePrice As Double, FloorStrikePrice<br />
As Double, FirstRate As Double, CapFloorStructure As String, RateStructure<br />
As String, CalcStructure As String) As Double<br />
Calculates the premium of a Vanilla cap, floor, or collar.<br />
Arguments<br />
SettlementDate : Settlement date<br />
RateArray : Term structure array<br />
StartDate : Start date of the cap, floor, or collar<br />
Maturity : Maturity date of the cap, floor, or collar<br />
CapStrikePrice : Exercise or strike price of the cap<br />
FloorStrikePrice : Exercise or strike price of the floor<br />
FirstRate : Rate of the cap, floor, or collar for the current calculation period<br />
CapFloorStructure : Extended argument defining the instrument<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
112
AdfinX Analytics 1.0 Function Library – User Guide<br />
Return Value<br />
The premium of a cap, floor or collar.<br />
Notes<br />
The table below describes the different forms of RateArray:<br />
If you specify<br />
RM:BS<br />
RM:BDT<br />
RM:HW<br />
Then RateArray has the following columns<br />
Dates, Rates, and a constant volatility<br />
Dates, Rates, Volatilities<br />
Dates, Rates, and constant volatility and mean-reversion<br />
Maturity is expressed as a date or a code, such as “1Y”.<br />
You can only price caps and floors with money market rates, if you use the Hull and White model.<br />
7.2.11. AdDigitalCapFloorCaplets<br />
AdDigitalCapFloorCaplets(SettlementDate As Variant, RateArray As Variant,<br />
StartDate As Variant, Maturity As Variant, CapStrikePrice As Double,<br />
FloorStrikePrice As Double, FirstRate As Double, CapFixedAmount As Variant,<br />
FloorFixedAmount As Variant, CapFloorStructure As String, RateStructure As<br />
String, CalcStructure As String, AdMode As String) As Variant<br />
Generates an array with the caplet or floorlet premiums of a Digital cap, floor, or collar.<br />
Arguments<br />
SettlementDate : Calculation date<br />
RateArray : Term structure array<br />
StartDate : Start date of the Digital cap, floor, or collar<br />
Maturity : Maturity date of the Digital cap, floor, or collar<br />
CapStrikePrice : Exercise or strike price of the Digital cap<br />
FloorStrikePrice : Exercise or strike price of the Digital floor<br />
FirstRate : Rate of the Digital cap, floor, or collar for the current calculation period<br />
CapFixedAmount : Rebate array of the Digital cap<br />
FloorFixedAmount : Rebate array of the Digital floor<br />
CapFloorStructure : Extended argument defining the instrument<br />
RateStructure : Extended argument defining the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
AdMode : Extended argument customizing the return value<br />
Return Value<br />
The return value is a vertical 6-column array, containing the following values for all caplets or floorlets:<br />
start date<br />
strike price<br />
volatility<br />
forward rate<br />
premium<br />
remaining notional<br />
If you price a collar, the <strong>fun</strong>ction returns both caplet and floorlet strike prices in two separate columns.<br />
113
AdfinX Analytics 1.0 Function Library – User Guide<br />
Notes<br />
RateArray is a “Dates, Rates” array with a constant volatility in a third column. You must use<br />
RM:BS in CapFloorStructure.<br />
Maturity is expressed as a date or a code, such as “1Y”.<br />
You must specify the rate of the current caplet or floorlet in the FirstRate argument, if the<br />
instrument is already issued. You cannot calculate it from the zero-coupon yield curve.<br />
CapFixedAmount and FloorFixedAmount can be a single value or an array of size N, where N<br />
is the number of caplets or floorlets of the cap or floor. You must include “0” in CapFixedAmount<br />
or FloorFixedAmount if you do not want to enter a rebate array in the <strong>fun</strong>ction.<br />
You must specify CAP, FLOOR, or COLLAR and FRQ keywords in the CapFloorStructure.<br />
7.2.12. AdDigitalCapFloorDeriv<br />
AdDigitalCapFloorDeriv(SettlementDate As Variant, RateArray As Variant,<br />
StartDate As Variant, Maturity As Variant, CapStrikePrice As Double,<br />
FloorStrikePrice As Double, FirstRate As Double, CapFixedAmount As Variant,<br />
FloorFixedAmount As Variant, CapFloorStructure As String, RateStructure As<br />
String, CalcStructure As String, AdMode As String) As Double<br />
Generates an array with the derivatives of a Digital cap, floor, or collar.<br />
Arguments<br />
SettlementDate : Settlement date<br />
RateArray : Term structure array<br />
StartDate : Start date of the Digital cap, floor, or collar<br />
Maturity : Maturity date of the Digital cap, floor, or collar<br />
CapStrikePrice : Exercise or strike price of the Digital cap<br />
FloorStrikePrice : Exercise or strike price of the Digital floor<br />
FirstRate : Rate of the Digital cap, floor, or collar for the current calculation period<br />
CapFixedAmount : Rebate array of the Digital cap<br />
FloorFixedAmount : Rebate array of the Digital floor<br />
CapFloorStructure : Extended argument defining the instrument<br />
RateStructure : Extended argument defining the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
AdMode : Extended argument customizing the return value<br />
Return Value<br />
The return value is a vertical 6-column array, containing the global, global forward and caplet values<br />
for each of the following derivatives:<br />
delta<br />
gamma<br />
vega<br />
theta<br />
basis point value (BPV)<br />
convexity<br />
The <strong>fun</strong>ction returns “0” as global forward value for vega, theta, BPV and convexity. The first row of the<br />
return array contains the global values; the second contains the global forward values, and the third,<br />
the values for each caplet.<br />
Notes<br />
RateArray is a “Dates, Rates” array with a constant volatility in a third column. You must use<br />
RM:BS in CapFloorStructure.<br />
114
AdfinX Analytics 1.0 Function Library – User Guide<br />
Maturity is expressed as a date or a code, such as “1Y”.<br />
You must specify the rate of the current caplet or floorlet in the FirstRate argument, if the<br />
instrument is already issued. You cannot calculate it from the zero-coupon yield curve.<br />
CapFixedAmount and FloorFixedAmount can be a single value or an array of size N, where N<br />
is the number of caplets or floorlets of the cap or floor. You must include “0” in CapFixedAmount<br />
or FloorFixedAmount if you do not want to enter a rebate array in the <strong>fun</strong>ction.<br />
You must specify CAP, FLOOR, or COLLAR and FRQ keywords in the CapFloorStructure.<br />
7.2.13. AdDigitalCapFloorImpliedVol<br />
AdDigitalCapFloorImpliedVol(SettlementDate As Variant, RateArray As Variant,<br />
StartDate As Variant, Maturity As Variant, CapStrikePrice As Double,<br />
FloorStrikePrice As Double, FirstRate As Double, Premium As Double,<br />
CapFixedAmount As Variant, FloorFixedAmount As Variant, CapFloorStructure<br />
As String, RateStructure As String, CalcStructure As String) As Double<br />
Calculates the implied volatility of a Digital cap, floor, or collar.<br />
Arguments<br />
SettlementDate : Settlement date<br />
RateArray : Term structure array<br />
StartDate : Start date of the Digital cap, floor, or collar<br />
Maturity : Maturity date of the Digital cap, floor, or collar<br />
CapStrikePrice : Exercise or strike price of the Digital cap<br />
FloorStrikePrice : Exercise or strike price of the Digital floor<br />
FirstRate : Rate of the Digital cap, floor, or collar for the current calculation period<br />
Premium : Market or spot price of the Digital cap, floor, or collar<br />
CapFixedAmount : Rebate array of the Digital cap<br />
FloorFixedAmount : Rebate array of the Digital floor<br />
CapFloorStructure : Extended argument defining the instrument<br />
RateStructure : Extended argument defining the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
Return Value<br />
The return value is a vertical 6-column array, containing the global, global forward and caplet values<br />
for each of the following derivatives:<br />
delta<br />
gamma<br />
vega<br />
theta<br />
basis point value (BPV)<br />
convexity<br />
The <strong>fun</strong>ction returns “0” as global forward value for vega, theta, BPV and convexity. The first row of the<br />
return array contains the global values; the second contains the global forward values, and the third,<br />
the values for each caplet.<br />
Notes<br />
RateArray is a “Dates, Rates” array with a constant volatility in a third column. You must use<br />
RM:BS in CapFloorStructure.<br />
Maturity is expressed as a date or a code, such as “1Y”.<br />
You must specify the rate of the current caplet or floorlet in the FirstRate argument, if the<br />
instrument is already issued. You cannot calculate it from the zero-coupon yield curve.<br />
115
AdfinX Analytics 1.0 Function Library – User Guide<br />
CapFixedAmount and FloorFixedAmount can be a single value or an array of size N, where N<br />
is the number of caplets or floorlets of the cap or floor. You must include “0” in CapFixedAmount<br />
or FloorFixedAmount if you do not want to enter a rebate array in the <strong>fun</strong>ction.<br />
You must specify CAP, FLOOR, or COLLAR and FRQ keywords in the CapFloorStructure.<br />
7.2.14. AdDigitalCapFloorPremium<br />
AdDigitalCapFloorPremium(SettlementDate As Variant, RateArray As Variant,<br />
StartDate As Variant, Maturity As Variant, CapStrikePrice As Double,<br />
FloorStrikePrice As Double, FirstRate As Double, CapFixedAmount As Variant,<br />
FloorFixedAmount As Variant, CapFloorStructure As String, RateStructure As<br />
String, CalcStructure As String) As Double<br />
Calculates the premium of a Digital cap, floor, or collar.<br />
Arguments<br />
SettlementDate : Settlement date<br />
RateArray : Term structure array<br />
StartDate : Start date of the Digital cap, floor, or collar<br />
Maturity : Maturity date of the Digital cap, floor, or collar<br />
CapStrikePrice : Exercise or strike price of the Digital cap<br />
FloorStrikePrice : Exercise or strike price of the Digital floor<br />
FirstRate : Rate of the Digital cap, floor, or collar for the current calculation period<br />
CapFixedAmount : Rebate array of the Digital cap<br />
FloorFixedAmount : Rebate array of the Digital floor<br />
CapFloorStructure : Extended argument defining the instrument<br />
RateStructure : Extended argument defining the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
Return Value<br />
The premium of a Digital cap, floor, or collar.<br />
Notes<br />
RateArray is a “Dates, Rates” array with a constant volatility in a third column. You must use<br />
RM:BS in CapFloorStructure.<br />
Maturity is expressed as a date or a code, such as “1Y”.<br />
You must specify the rate of the current caplet or floorlet in the FirstRate argument, if the<br />
instrument is already issued. You cannot calculate it from the zero-coupon yield curve.<br />
CapFixedAmount and FloorFixedAmount can be a single value or an array of size N, where N<br />
is the number of caplets or floorlets of the cap or floor. You must include “0” in CapFixedAmount<br />
or FloorFixedAmount if you do not want to enter a rebate array in the <strong>fun</strong>ction.<br />
You must specify CAP, FLOOR, or COLLAR and FRQ keywords in the CapFloorStructure.<br />
7.2.15. AdSwaptionDeriv<br />
AdSwaptionDeriv(CalcDate As Variant, RateArray As Variant, SwapStartDate As<br />
Variant, SwapMaturity As Variant, ExpiryDate As Variant, SpotPrice As<br />
Double, StrikePrice As Double, SwapStructure As String, OptionStructure As<br />
String, RateStructure As String, CalcStructure As String, AdMode As String)<br />
As Variant<br />
Returns in an array all derivatives (delta, gamma, theta, vega) of an option on a swap.<br />
116
AdfinX Analytics 1.0 Function Library – User Guide<br />
Arguments<br />
CalcDate : Settlement date<br />
RateArray : Term structure array<br />
SwapStartDate : Start date of the swap<br />
SwapMaturity : Maturity date of the swap<br />
ExpiryDate : Expiry date of the option<br />
SpotPrice : Spot market rate of the swap<br />
StrikePrice : Exercise or strike rate of the swap<br />
SwapStructure : Extended argument defining the underlying swap<br />
OptionStructure : Extended argument defining the option<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
AdMode : Extended argument customizing the return value<br />
Return Value<br />
The return value depends on the value of AdMode. The default value is a vertical 4-cell array<br />
containing:<br />
Delta : Delta ratio<br />
Gamma : Gamma ratio<br />
Theta : Theta ratio<br />
Vega : Vega ratio<br />
Notes<br />
The table below describes the different forms of RateArray:<br />
If you specify<br />
RM:BS<br />
RM:BDT<br />
RM:HW<br />
Then RateArray has the following columns<br />
Dates, Rates, and a constant volatility<br />
Dates, Rates, Volatilities<br />
Dates, Rates, and constant volatility and mean-reversion<br />
ExpiryDate is expressed as a date or a code, such as “1Y”.<br />
7.2.16. AdSwaptionPremium<br />
AdSwaptionPremium(CalcDate As Variant, RateArray As Variant, SwapStartDate<br />
As Variant, SwapMaturity As Variant, ExpiryDate As Variant, SpotPrice As<br />
Double, StrikePrice As Double, SwapStructure As String, OptionStructure As<br />
String, RateStructure As String, CalcStructure As String) As Double<br />
Calculates the premium of a swaption.<br />
Arguments<br />
CalcDate : Settlement date<br />
RateArray : Term structure array<br />
SwapStartDate : Start date of the swap<br />
SwapMaturity : Maturity date of the swap<br />
ExpiryDate : Expiry date of the option<br />
SpotPrice : Spot market rate of the swap<br />
StrikePrice : Exercise or strike rate of the swap<br />
117
AdfinX Analytics 1.0 Function Library – User Guide<br />
SwapStructure : Extended argument defining the underlying swap<br />
OptionStructure : Extended argument defining the option<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
Return Value<br />
The premium of the option on a swap.<br />
Notes<br />
The table below describes the different forms of RateArray:<br />
If you specify<br />
RM:BS<br />
RM:BDT<br />
RM:HW<br />
Then RateArray has the following columns<br />
Dates, Rates, and a constant volatility<br />
Dates, Rates, Volatilities<br />
Dates, Rates, and constant volatility and mean-reversion<br />
ExpiryDate is expressed as a date or a code, such as “1Y”.<br />
The European mode is the only exercise mode available for a swaption when the keyword RM has<br />
the values RM:BS or RM:HW.<br />
7.2.17. OpCalcDeriv<br />
OpCalcDeriv(CalcDate As Variant, ExpiryDate As Variant, SpotPrice As Double,<br />
StrikePrice As Double, Volatility As Double, RiskFreeRateArray As Variant,<br />
ReturnArray As Variant, OptionStructure As String, RateStructure As String,<br />
CalcStructure As String, AdMode As String) As Variant<br />
Returns in an array all derivatives (delta, gamma, rho, theta, and vega) of an option on a security<br />
(index, stock), a future, a commodity, or a currency.<br />
Arguments<br />
CalcDate : Calculation date of the option<br />
ExpiryDate : Expiry date of the option<br />
SpotPrice : Market or spot price of the underlying instrument<br />
StrikePrice : Strike price of the option<br />
Volatility : Volatility of the underlying instrument<br />
RiskFreeRateArray : Term structure array<br />
ReturnArray : Constant yield or dividend array (Date, Dividend)<br />
OptionStructure : Extended argument defining the option structure<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
AdMode : Extended argument customising the return value<br />
Return Value<br />
The return value depends on the value of AdMode. The default value is a vertical 5-cell array<br />
containing:<br />
Delta : Delta ratio<br />
Gamma : Gamma ratio<br />
Rho : Rho ratio<br />
118
AdfinX Analytics 1.0 Function Library – User Guide<br />
Theta : Theta ratio<br />
Vega : Vega ratio<br />
The following values are also returned in the case of currency options:<br />
ForeignDelta : Delta ratio in the foreign currency<br />
ForeignRho : Rho ratio in the foreign currency<br />
ForiegnTheta : Theta ratio in the foreign currency<br />
ForeignVega : Vega ratio in the foreign currency<br />
Notes<br />
Depending on the model, the RiskFreeRateArray argument can be a constant yield or a (Date,<br />
Rate) array, representing the zero-coupon curve.<br />
The ReturnArray argument means:<br />
- the carrying costs, in case of an option on a commodity<br />
- the risk free rate of the foreign currency, in case of an option on a currency<br />
- 0, in case of an option on a future<br />
- the annual security yield, in case of an option on a stock<br />
The ReturnArray and RiskFreeRateArray arguments can be defined respectively in<br />
OptionStructure and RateStructure, through the keywords RATETYPE, RATEFRQ, RM or<br />
DCB.<br />
In the case of an option on a stock, the dividend rate(s) specified in ReturnArray can be<br />
continuous, proportional, discounted or fixed. See Dividend Types section in the Adfin Options<br />
Theory Guide.<br />
You must include at least the option type in the OptionStructure, using the CALL or PUT<br />
keywords.<br />
You can calculate only one derivative when this derivative is specified in AdMode, by using the RES<br />
keyword.<br />
The RES:FDELTA , RES:FRHO , RES:FVEGA , and RES:FTHETA keywords in AdMode are only<br />
available for a European currency option priced using the Black and Scholes Model.<br />
You can calculate the derivatives of a Vanilla option with variable strike price, using the<br />
EXM:DDMMMYY:DDMMMYY:i keyword in OptionStructure. See OptionStructure in the Adfin<br />
Analytics Structures User Guide.<br />
7.2.18. OpHistVol<br />
OpHistVol(PriceArray As Variant, OpMode As String) As Double<br />
Calculates the historical volatility of an option on a security (index, stock), a future, a commodity, or a<br />
currency, from a set of underlying prices.<br />
To define the type of prices used (either close prices, or high and low prices), use the HVM keyword in<br />
AdMode.<br />
Arguments<br />
PriceArray : 1-dimensional (for HVM:CLOSE) or 2-dimensional (for HVM:HL) array containing<br />
the prices (the orientation of this array should be specified with the LAY<br />
keyword in OpMode if it is different from the default orientation)<br />
OpMode : Extended argument customizing the return value<br />
Return Value<br />
The historical volatility of the option.<br />
119
AdfinX Analytics 1.0 Function Library – User Guide<br />
7.2.19. OpImpliedVol<br />
OpImpliedVol(CalcDate As Variant, ExpiryDate As Variant, SpotPrice As Double,<br />
StrikePrice As Double, Premium As Double, RiskFreeRateArray As Variant,<br />
ReturnArray As Variant, OptionStructure As String, RateStructure As String,<br />
CalcStructure As String) As Double<br />
Calculates the implied volatility of an option on a security (index, stock), a future, a commodity, or a<br />
currency, from the option premium.<br />
Arguments<br />
CalcDate : Calculation date of the option<br />
ExpiryDate : Expiry date of the option<br />
SpotPrice : Market or spot price of the underlying instrument<br />
StrikePrice : Strike price of the option<br />
Premium : Premium of the option<br />
RiskFreeRateArray : Term structure array<br />
ReturnArray : Constant yield or dividend array (Date, Dividend)<br />
OptionStructure : Extended argument defining the option structure<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
Return Value<br />
The implied volatility of the option.<br />
Notes<br />
Depending on the model, the RiskFreeRateArray argument can be a constant yield or a (Date,<br />
Rate) array, representing the zero-coupon curve.<br />
The ReturnArray argument means:<br />
- the carrying costs, in case of an option on commodities<br />
- the risk free rate of the foreign currency, in case of an option on currencies<br />
- 0, in case of an option on futures<br />
- the annual security yield, in case of an option on stocks<br />
The ReturnArray and RiskFreeRateArray arguments can be defined respectively in<br />
OptionStructure and RateStructure, through the keywords RATETYPE, RATEFRQ, RM or<br />
DCB.<br />
In the case of an option on a stock, the dividend rate(s) specified in ReturnArray can be<br />
continuous, proportional, discounted or fixed. See Dividend Types section in the Adfin Options<br />
Theory Guide.<br />
You must include at least the option type in the OptionStructure, using the CALL or PUT<br />
keywords.<br />
If you want to calculate the implied volatility of an equity option and if you do not use SOLVER in<br />
CalcStructure, Adfin Analytics applies the Newton-Raphson, dichotomy and Ridder methods<br />
consecutively, until the implied volatility of the option is found. Adfin Analytics returns an error<br />
message if the implied volatility cannot be calculated.<br />
You can calculate the implied volatility of a Vanilla option with variable strike price, by using the<br />
EXM:DDMMMYY:DDMMMYY:i keyword in OptionStructure. See OptionStructure in the Adfin<br />
Analytics Structures User Guide.<br />
7.2.20. OpPremium<br />
OpPremium (CalcDate As Variant, ExpiryDate As Variant, SpotPrice As Double,<br />
StrikePrice As Double, Volatility As Double, RiskFreeRateArray As Variant,<br />
120
AdfinX Analytics 1.0 Function Library – User Guide<br />
ReturnArray As Variant, OptionStructure As String, RateStructure As String,<br />
CalcStructure As String) As Double<br />
Calculates the premium of an option on a security (index, stock), a future, a commodity, or a currency.<br />
Arguments<br />
CalcDate : Calculation date of the option<br />
ExpiryDate : Expiry date of the option<br />
SpotPrice : Market or spot price of the underlying instrument<br />
StrikePrice : Strike price of the option<br />
Volatility : Anticipated volatility of the underlying instrument<br />
RiskFreeRateArray : Term structure array<br />
ReturnArray : Constant yield or dividend array (Date, Dividend)<br />
OptionStructure : Extended argument defining the option structure<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
Return Value<br />
The premium of the option.<br />
Notes<br />
Depending on the model, the RiskFreeRateArray argument can be a constant yield or a (Date,<br />
Rate) array, representing the zero-coupon curve.<br />
The ReturnArray argument means:<br />
- the carrying costs, in case of an option on commodities<br />
- the risk free rate of the foreign currency, in case of an option on currencies<br />
- 0, in case of an option on futures<br />
- the annual security yield, in case of an option on stocks<br />
The ReturnArray and RiskFreeRateArray arguments can be defined respectively in<br />
OptionStructure and RateStructure, through the keywords RATETYPE, RATEFRQ, RM or<br />
DCB.<br />
In the case of an option on a stock, the dividend rate(s) specified in ReturnArray can be<br />
continuous, proportional, discounted or fixed. See Dividend Types section in the Adfin Options<br />
Theory Guide.<br />
You must include at least the option type in the OptionStructure, using the CALL or PUT<br />
keywords.<br />
You can calculate the premium of a Vanilla option with variable strike price, by using the<br />
EXM:DDMMMYY:DDMMMYY:i keywords in OptionStructure. See OptionStructure in the<br />
Adfin Analytics Structures User Guide.<br />
121
AdfinX Analytics 1.0 Function Library – User Guide<br />
8. ADFINX ADXSWAPMODULE CONTROL<br />
8.1. ADXSWAPMODULE PROPERTIES<br />
8.1.1. ErrorCode<br />
ErrorCode() As Long<br />
The ErrorCode property of the AdxSwapModule control retrieves the last error code generated by<br />
the object.<br />
Arguments<br />
This property takes no argument.<br />
Example<br />
Dim sw as AdxSwapModule : Declares an object of type AdxSwapModule<br />
Set sw = New AdxSwapModule : Creates an AdxSwapModule object<br />
If sw.ErrorCode 0 Then : sw.ErrorCode contains the error<br />
MsgBox (sw.ErrorCode) : Displays the error code in a message box<br />
End If<br />
8.1.2. ErrorMode<br />
ErrorMode() As AdxErrorMode<br />
The ErrorMode property of the AdxSwapModule component sets the error mode of the<br />
AdxSwapModule. Three modes are defined:<br />
DIALOGBOX : In this mode a dialog box is displayed when an error occurs<br />
EXCEPTION : In this mode an exception is thrown when an error occurs<br />
NO_EXCEPTION : In this mode the user must call the property ErrorCode to know the error<br />
encountered<br />
Arguments<br />
This property takes no argument.<br />
Note<br />
By default the error mode is set to EXCEPTION.<br />
Example<br />
Dim sw as AdxSwapModule : Declares an object of type AdxSwapModule<br />
Set sw = New AdxSwapModule : Creates an AdxSwapModule object<br />
sw.ErrorMode = NO_EXCEPTION : sw.ErrorMode is set to NO_EXCEPTION<br />
8.1.3. ErrorString<br />
ErrorString() As String<br />
The ErrorString property of the AdxSwapModule retrieves the last error code generated by the<br />
object with the associated error string.<br />
122
AdfinX Analytics 1.0 Function Library – User Guide<br />
Arguments<br />
This property takes no argument.<br />
Example<br />
Dim sw as AdxSwapModule : Declares an object of type AdxSwapModule<br />
Set sw = New AdxSwapModule : Creates an AdxSwapModule object<br />
sw.ErrorMode = EXCEPTION : sw.ErrorMode must be set to EXCEPTION to use the<br />
ErrorString<br />
On Error Go To Handle : Error handler executes code after Handle when an error<br />
occurs<br />
Res = sw.SwIrsCpnDates("1-MAR-04", "31Aug04", "1-Jun-02", "LBOTH FRQ:1<br />
ACC:AA", "LAY:V")<br />
: The RES keyword is not in AdMode. The <strong>fun</strong>ction<br />
SwIrsCpnDates returns an error<br />
Exit Sub : Exits sub or <strong>fun</strong>ction before the handle or code will be<br />
executed<br />
Handle<br />
MsgBox(sw.ErrorString) : Displays the ErrorString in a message box<br />
sw.ErrorString contains the ErrorString (‘Error#40cb –<br />
SwMode: invalid value for RES keyword.’)<br />
8.2. ADXSWAPMODULE METHODS<br />
8.2.1. FrnCalcCpn<br />
FrnCalcCpn(CalcDate As Variant, StartDate As Variant, Maturity As Variant,<br />
CurrentIndex As Double, QuotedMargin As Double, FrnStructure As String,<br />
FrnMode As String) As Variant<br />
Returns all coupon features of a FRN in an array.<br />
Arguments<br />
CalcDate : Calculation date<br />
StartDate : Start date of the FRN (issue date)<br />
Maturity : Maturity date of the FRN<br />
CurrentIndex : Index rate for the current coupon<br />
QuotedMargin : Margin applied to the index<br />
FrnStructure : Extended argument defining the FRN structure<br />
FrnMode : Extended argument customizing the return value<br />
Return Value<br />
The return value depends on the value of FrnMode. The default value is a vertical 5-cell array<br />
containing:<br />
PrevCpnDate : Previous coupon date<br />
NextCpnDate : Next coupon date<br />
AccruedDays : Number of accrued days calculated according to the accrued basis<br />
AccruedInt : Accrued interest<br />
123
AdfinX Analytics 1.0 Function Library – User Guide<br />
NextCpnValue : Next coupon value<br />
Note<br />
The QM keyword in FrnStructure dedicated to the quoted margin is an alternative to the<br />
QuotedMargin argument. When this keyword is used within the structure, a zero value in the<br />
argument is required.<br />
8.2.2. FrnCashFlows<br />
FrnCashFlows(CalcDate As Variant, ZcDates As Variant, ZcRates As Variant,<br />
StartDate As Variant, Maturity As Variant, QuotedMargin As Double,<br />
FloatingRateArray As Variant, FrnStructure As String, FrnMode As String) As<br />
Variant<br />
Generates an array with the remaining cash flows of a floating rate instrument.<br />
Arguments<br />
CalcDate : Calculation date<br />
ZcDates : Array of zero-coupon dates<br />
ZcRates : Array of zero-coupon rates or discount factors<br />
StartDate : Start date of the FRN (issue date)<br />
Maturity : Maturity date of the FRN (expressed as a date or a code such as "1Y")<br />
QuotedMargin : Margin applied to the index<br />
FloatingRateArray : Array of floating leg rates<br />
FrnStructure : Extended argument defining the FRN structure<br />
FrnMode : Extended argument customizing the return value<br />
Return Value<br />
The return value depends on the value of FrnMode. The default value is a 4-column array containing<br />
the following:<br />
Payment Date<br />
Cash flows expressed as a percentage<br />
Rate expressed as a percentage<br />
Discount factor expressed as a percentage<br />
Notes<br />
The QM keyword in FrnStructure dedicated to the quoted margin is an alternative to the<br />
QuotedMargin argument. When this keyword is used within the structure, a zero value in the<br />
argument is required.<br />
The FloatingRateArray argument allows the simulation of the current index and the projected<br />
index. In the case of a scenario without a date, the first index applies to the first cash flow, the<br />
second index to the second cash flow, and so on. If there are more cash flows than indexes, the<br />
remaining cash flows are derived from the last available index. When the current index is a<br />
constant yield curve, the FloatingRateArray parameter is considered as the current index and<br />
every forward cash flow is derived from the zero-coupon curve.<br />
The LAY:H keyword, which describe the orientation of the result array in the FrnMode argument, is<br />
mandatory when used in the FrnCashFlows <strong>fun</strong>ction.<br />
124
AdfinX Analytics 1.0 Function Library – User Guide<br />
8.2.3. FrnMargin<br />
FrnMargin(CalcDate As Variant, StartDate As Variant, Maturity As Variant, Px As<br />
Double, QuotedMargin As Double, FloatingRateArray As Variant, FrnStructure As<br />
String, FrnMode As String) As Double<br />
Calculates the FRN price, margin or yield.<br />
The expected result must be specified in FrnMode using the TO keyword. Similarly, the type of data<br />
used in the Px argument must be specified using the FROM keyword.<br />
Arguments<br />
CalcDate : Calculation date<br />
StartDate : Start date of the FRN (issue date)<br />
Maturity : Maturity date of the FRN (expressed as a date or a code such as "1Y")<br />
Px : Margin or yield expressed as a percentage or price expressed as a<br />
percentage of the nominal<br />
QuotedMargin : Margin applied to the index<br />
FloatingRateArray :<br />
Two-row array defining the value of the current index and the value of<br />
the projected index<br />
FrnStructure : Extended argument defining the FRN structure<br />
FrnMode : Extended argument customizing the return value<br />
Return Value<br />
The return value is one of the following:<br />
the clean price<br />
the gross price<br />
the adjusted price<br />
the simple margin<br />
the adjusted simple margin<br />
the adjusted total margin<br />
the discounted margin<br />
the yield to maturity<br />
the yield to maturity spread<br />
Notes<br />
The QM keyword in FrnStructure dedicated to the quoted margin is an alternative to the<br />
QuotedMargin argument. When the QM keyword is used in the structure, a zero value in the<br />
argument is required.<br />
The FROM keyword of the FrnMode Argument specifies the data type of the Px argument of the<br />
<strong>fun</strong>ction. When it takes the value YS (“yield to maturity spread”), the user must be aware that the<br />
input yield is always expressed in the FRN frequency.<br />
8.2.4. FrnPx<br />
FrnPx(CalcDate As Variant, ZcDates As Variant, ZcRates As Variant, StartDate As<br />
Variant, Maturity As Variant, QuotedMargin As Double, FloatingRateArray As<br />
Variant, FrnStructure As String, FrnMode As String) As Double<br />
Calculates the price from a yield curve of a floating rate instrument.<br />
Arguments<br />
CalcDate : Calculation date<br />
125
AdfinX Analytics 1.0 Function Library – User Guide<br />
ZcDates : Array of zero-coupon dates<br />
ZcRates : Array of zero-coupon rates or discount factors<br />
StartDate : Start date of the FRN (issue date)<br />
Maturity : Maturity date of the FRN (expressed as a date or a code such as "1Y")<br />
QuotedMargin : Margin applied to the index<br />
FloatingRateArray : Array of floating leg rates<br />
FrnStructure : Extended argument defining the FRN structure<br />
FrnMode : Extended argument customizing the return value<br />
Return Value<br />
The price of the FRN.<br />
Notes<br />
The QM keyword in FrnStructure dedicated to the quoted margin is an alternative to the<br />
QuotedMargin argument. When the QM keyword is used in the structure, a zero value in the<br />
argument is required.<br />
The FloatingRateArray argument allows the simulation of the current index and the projected<br />
index. In the case of a scenario without a date, the first index applies to the first cash flow, the<br />
second index to the second cash flow and so on. If there are more cash flows than indexes, the<br />
remaining cash flows are derived from the last available index. When the current index is a<br />
constant yield curve, the FloatingRateArray parameter is considered as the current index and<br />
every forward cash flow is derived from the zero-coupon curve.<br />
8.2.5. SwCsCashFlows<br />
SwCsCashFlows(CalcDate As Variant, StartDate As Variant, Maturity As Variant,<br />
PaidRate As Double, CurPaidArray As Variant, ReceivedRate As Double,<br />
CurReceivedArray As Variant, ZcPaidArray As Variant, ZcReceivedArray As<br />
Variant, FxArray As Variant, CsStructure As String, SwMode As String) As<br />
Variant<br />
Generates an array with the remaining cash flows of the currency swap.<br />
Arguments<br />
CalcDate : Calculation date<br />
StartDate : Start date of the currency swap (effective date)<br />
Maturity : Maturity date of the currency swap (expressed as a date or a code<br />
such as "1Y")<br />
PaidRate : Fixed rate if the paid leg is fixed, floating rate spread as a percentage if<br />
the paid leg is floating<br />
CurPaidArray : Floating rate of the paid leg for the current calculation period if<br />
applicable<br />
ReceivedRate : Fixed rate if the received leg is fixed, floating rate spread as a<br />
percentage if the received leg is floating<br />
CurReceivedArray : Floating rate of the received leg for the current calculation period if<br />
applicable<br />
ZcPaidArray : Array of zero-coupon dates and rates or discount factors for the paid<br />
leg<br />
ZcReceivedArray : Array of zero-coupon dates and rates or discount factors for the<br />
received leg<br />
FxArray : Array of (N+1) cells x 2 cells (dates, rates) where N is the number of<br />
swap point periods<br />
126
AdfinX Analytics 1.0 Function Library – User Guide<br />
The first line (row or column depending on the array orientation<br />
specified with the LAY keyword) contains the spot date and the spot<br />
rate for the cross-currency.<br />
The other lines contain swap point period end dates and corresponding<br />
swap point values for the cross-currency.<br />
CsStructure : Extended argument defining the currency swap structure<br />
SwMode : Extended argument customizing the return value<br />
Return Value<br />
The return value depends on the value of SwMode. The default value is a 18-column array containing<br />
the following data for all remaining cash flows:<br />
Column #1 : Date<br />
Column #2 : Principal payment of the paid leg in the payment currency<br />
Column #3 : Interest payment of the paid leg in the payment currency<br />
Column #4 : Principal payment of the received leg in the received currency<br />
Column #5 : Interest payment of the received leg in the received currency<br />
Column #6 : Zero-coupon rate of the payment currency<br />
Column #7 : Discount factor of the payment currency<br />
Column #8 : Zero-coupon rate of the received currency<br />
Column #9 : Discount factor of the received currency<br />
Column #10 : Outright rate<br />
Column #11 : Conversion rate to the discount currency for the paid leg<br />
Column #12 : Conversion rate to the discount currency for the received leg<br />
Column #13 : Discount factor in discount currency for the paid leg<br />
Column #14 : Discount factor in discount currency for the received leg<br />
Column #15 : Principal payment of the paid leg in the discount currency<br />
Column #16 : Interest payment of the paid leg in the discount currency<br />
Column #17 : Principal payment of the received leg in the discount currency<br />
Column #18 : Interest payment of the received leg in the discount currency<br />
Notes<br />
The string value used for CsStructure cannot be empty. It must include at least the crosscurrency<br />
("CROSS") and for each leg the leg type ("LTYPE") and the leg currency ("CUR").<br />
If the current coupon period has not begun, the arguments CurPaidRate and<br />
CurReceivedRate can be left to 0 to indicate that floating rates for the current calculation period<br />
must be calculated from the zero-coupon yield curves<br />
When the RET keyword is not specified in SwMode, the maximum number of cash flow returned<br />
by the <strong>fun</strong>ction is limited to 24. To return for instance 30 cash flows for a long term swap, use<br />
"RET:A30".<br />
8.2.6. SwCsPx<br />
SwCsPx(CalcDate As Variant, StartDate As Variant, Maturity As Variant,<br />
PaidRate As Double, CurPaidArray As Variant, ReceivedRate As Double,<br />
CurReceivedArray As Variant, ZcPaidArray As Variant, ZcReceivedArray As<br />
Variant, FxArray As Variant, CsStructure As String, SwMode As String) As<br />
Variant<br />
Calculates the net present value of a currency swap or one of its legs.<br />
Arguments<br />
CalcDate : Calculation date<br />
127
AdfinX Analytics 1.0 Function Library – User Guide<br />
StartDate : Start date of the currency swap (effective date)<br />
Maturity : Maturity date of the currency swap (expressed as a date or a code<br />
such as "1Y")<br />
PaidRate : Fixed rate if the paid leg is fixed, floating rate spread as a percentage if<br />
the paid leg is floating<br />
CurPaidArray : Floating rate of the paid leg for the current calculation period if<br />
applicable<br />
ReceivedRate : Fixed rate if the received leg is fixed, floating rate spread as a<br />
percentage if the received leg is floating<br />
CurReceivedArray : Floating rate of the received leg for the current calculation period if<br />
applicable<br />
ZcPaidArray : Array of zero-coupon dates and rates or discount factors for the<br />
payment currency<br />
ZcReceivedArray : Array of zero-coupon dates and rates or discount factors for the<br />
received currency<br />
FxArray : Array of (N+1) cells x 2 cells (dates, rates) where N is the number of<br />
swap point periods<br />
The first line (row or column depending on the array orientation<br />
specified with the LAY keyword) contains the spot date and the spot<br />
rate for the cross-currency.<br />
The other lines contain swap point period end dates and corresponding<br />
swap point values for the cross-currency.<br />
CsStructure : Extended argument defining the currency swap structure<br />
SwMode : Extended argument customizing the return value<br />
Return Value<br />
The return value depends on the value of SwMode. The default value is a 3-row array containing:<br />
SwapNPV : Net present value of the swap in the discount currency<br />
FloatingLegNPV : Net present value of the floating leg in the discount currency<br />
FixedLegNPV : Net present value of the fixed leg in the discount currency<br />
Notes<br />
The string value used for CsStructure cannot be empty. It must include at least the crosscurrency<br />
("CROSS") and for each leg the leg type ("LTYPE") and the leg currency ("CUR").<br />
If the current coupon period has not begun, the arguments CurPaidRate and<br />
CurReceivedRate can be left to 0 to indicate that floating rates for the current calculation period<br />
must be calculated from the zero-coupon yield curves<br />
8.2.7. SwCsSolve<br />
SwCsSolve(CalcDate As Variant, StartDate As Variant, Maturity As Variant,<br />
PaidRate As Double, CurPaidArray As Variant, ReceivedRate As Double,<br />
CurReceivedArray As Variant, ZcPaidArray As Variant, ZcReceivedArray As<br />
Variant, FxArray As Variant, NetPresentValue As Double, CsStructure As String,<br />
SwMode As String) As Double<br />
Calculates the paid rate or the received rate spread for any leg equivalent to a predefined net present<br />
value.<br />
To specify for which leg the fixed rate or the floating rate spread is calculated, use the RES keyword<br />
in SwMode ("RES:PAID" or "RES:RECEIVED").<br />
128
AdfinX Analytics 1.0 Function Library – User Guide<br />
Arguments<br />
CalcDate : Calculation date<br />
StartDate : Start date of the currency swap (effective date)<br />
Maturity : Maturity date of the currency swap (expressed as a date or a code<br />
such as "1Y")<br />
PaidRate : Fixed rate if the paid leg is fixed, floating rate spread as a percentage if<br />
the paid leg is floating<br />
CurPaidArray : Floating rate of the paid leg for the current calculation period if<br />
applicable<br />
ReceivedRate : Fixed rate if the received leg is fixed, floating rate spread as a<br />
percentage if the received leg is floating<br />
CurReceivedArray : Floating rate of the received leg for the current calculation period if<br />
applicable<br />
ZcPaidArray : Array of zero-coupon dates and rates or discount factors for the<br />
payment currency<br />
ZcReceivedArray : Array of zero-coupon dates and rates or discount factors for the<br />
received currency<br />
FxArray : Array of (N+1) cells x 2 cells (dates, rates) where N is the number of<br />
swap point periods<br />
The first line (row or column depending on the array orientation<br />
specified with the LAY keyword) contains the spot date and the spot<br />
rate for the cross-currency.<br />
The other lines contain swap point period end dates and corresponding<br />
swap point values for the cross-currency.<br />
NetPresentValue : Present value of the swap or one of its legs in the discount currency<br />
CsStructure : Extended argument defining the currency swap structure<br />
SwMode : Extended argument customizing the return value<br />
Return Value<br />
The fixed rate expressed as a real value or the floating rate spread in basis points for the paid leg (with<br />
"RES:PAID") or the received leg (with "RES:RECEIVED").<br />
Notes<br />
The string value used for CsStructure cannot be empty. It must include at least the crosscurrency<br />
("CROSS") and for each leg the leg type ("LTYPE") and the leg currency ("CUR").<br />
If NetPresentValue stands for the net present value of the paid leg ("PXT:PAID"), only the<br />
fixed rate or floating rate spread of the paid leg is calculated. Similarly, if NetPresentValue<br />
stands for the net present value of the received leg ("PXT:RECEIVED"), only the fixed rate or the<br />
floating rate spread of the received leg is calculated.<br />
If the current coupon period has not begun, the arguments CurPaidRate and<br />
CurReceivedRate can be left to 0 to indicate that floating rates for the current calculation period<br />
must be calculated from the zero-coupon yield curves<br />
8.2.8. SwIrsCashFlows<br />
SwIrsCashFlows(CalcDate As Variant, ZcDates As Variant, ZcRates As Variant,<br />
StartDate As Variant, Maturity As Variant, FixedRate As Double,<br />
CurFloatingRate As Variant, IrsStructure As String, SwMode As String) As<br />
Variant<br />
Generates an array with the remaining cash flows of the interest rate swap.<br />
129
AdfinX Analytics 1.0 Function Library – User Guide<br />
Arguments<br />
CalcDate : Calculation date<br />
ZcDates : Array of zero-coupon dates<br />
ZcRates : Array of zero-coupon rates or discount factors<br />
StartDate : Start date of the interest rate swap (effective date)<br />
Maturity : Maturity date of the interest rate swap (expressed as a date or a code<br />
such as "1Y")<br />
FixedRate : Rate of the swap fixed leg<br />
CurFloatingRate : Rate of the swap floating leg for the current calculation period<br />
IrsStructure : Extended argument defining the interest rate swap structure<br />
SwMode : Extended argument customizing the return value<br />
Return Value<br />
The return value depends on the value of SwMode. The default value is a vertical 5-column array<br />
("RET:Ai:ABCDE") containing the following data for all remaining cash flows:<br />
Column A : Date<br />
Column B : Floating payment (if applicable)<br />
Column C : Fixed payment (if applicable)<br />
Column D : Zero-coupon rate<br />
Column E : Discount factor<br />
The following array configurations are also provided:<br />
RET:Ai:AB+{D,E} : Floating payment schedule (the zero-coupon rates or discount factors<br />
are optional)<br />
RET:Ai:AC+{D,E} : Fixed payment schedule (the zero-coupon rates or discount factors are<br />
optional)<br />
When this array <strong>fun</strong>ction is used as a standard <strong>fun</strong>ction, only the first element is returned. Similarly,<br />
when used with a horizontal array, only the first element is returned into all cells of the array. To return<br />
a correct array use "LAY:H" as SwMode.<br />
Notes<br />
By default, Adfin Swaps assumes that the fixed rate is paid and the floating rate is received.<br />
Otherwise, use "PAID:FLOAT" in the IrsStructure argument.<br />
If the current coupon period has not begun, the argument CurFloatingRate can be left to 0 to<br />
indicate that the floating rate for the current calculation period must be calculated from the zerocoupon<br />
yield curve.<br />
When the RET keyword is not specified in SwMode, the maximum number of cash flow returned<br />
by the <strong>fun</strong>ction is limited to 24. To return for instance 30 cash flows for a long term swap, use<br />
"RET:A30".<br />
8.2.9. SwIrsCpnDates<br />
SwIrsCpnDates (CalcDate As Variant, StartDate As Variant, Maturity As Variant,<br />
IrsStructure As String, SwMode As String) As Variant<br />
Generates an array with the coupon dates of one swap leg.<br />
The leg type must be specified in SwMode using the RES keyword ("RES:FIXED" or<br />
"RES:FLOAT").<br />
130
AdfinX Analytics 1.0 Function Library – User Guide<br />
Arguments<br />
CalcDate : Calculation date<br />
StartDate : Start date of the interest rate swap (effective date)<br />
Maturity : Maturity date of the interest rate swap (expressed as a date or a code such as<br />
"1Y")<br />
IrsStructure : Extended argument defining the interest rate swap structure<br />
SwMode : Extended argument customizing the return value<br />
Return Value<br />
The return value is a 1-column array containing the fixed leg coupon dates (with "RES:FIXED") or<br />
the floating leg coupon dates (with "RES:FLOAT").<br />
8.2.10. SwIrsPvbpCrv<br />
SwIrsPx(CalcDate As Variant, ZcDates As Variant, ZcRates As Variant, StartDate<br />
As Variant, Maturity As Variant, FixedRate As Double, CurFloatingRate As<br />
Variant, IrsStructure As String, SwMode As String) As Variant<br />
Calculates the price variation per basis point of a swap or one of its legs for each point of a zerocoupon<br />
yield curve.<br />
Arguments<br />
CalcDate : Calculation date<br />
ZcDates : Array of zero-coupon dates<br />
ZcRates : Array of zero-coupon rates or discount factors<br />
StartDate : Start date of the interest rate swap (effective date)<br />
Maturity : Maturity date of the interest rate swap (expressed as a date or a code such<br />
as "1Y")<br />
FixedRate : Rate of the swap fixed leg<br />
CurFloatingRate : Rate of the swap floating leg for the current calculation period<br />
IrsStructure : Extended argument defining the interest rate swap structure<br />
SwMode : Extended argument customizing the return value<br />
Return Value<br />
The <strong>fun</strong>ction returns a 2-dimensional array containing the curve dates and corresponding sensitivity<br />
values for the swap, for the floating leg of the swap, and for the fixed leg of the swap.<br />
Notes<br />
If the current coupon period has not begun, the argument CurFloatingRate can be left to 0 to<br />
indicate that the floating rate for the current calculation period must be calculated from the zerocoupon<br />
yield curve.<br />
The calculation is performed by default with a zero-coupon rate or discount factor change epsilon<br />
equal to 1 basis point (0.01%), but this value can be changed using the "SHIFT" keyword in<br />
SwMode.<br />
131
AdfinX Analytics 1.0 Function Library – User Guide<br />
8.2.11. SwIrsPx<br />
SwIrsPx(CalcDate As Variant, ZcDates As Variant, ZcRates As Variant, StartDate<br />
As Variant, Maturity As Variant, FixedRate As Double, CurFloatingRate As<br />
Variant, IrsStructure As String, SwMode As String) As Variant<br />
Calculates the net present value of a swap or one of its legs.<br />
Arguments<br />
CalcDate : Calculation date<br />
ZcDates : Array of zero-coupon dates<br />
ZcRates : Array of zero-coupon rates or discount factors<br />
StartDate : Start date of the interest rate swap (effective date)<br />
Maturity : Maturity date of the interest rate swap (expressed as a date or a code such<br />
as "1Y")<br />
FixedRate : Rate of the swap fixed leg<br />
CurFloatingRate : Rate of the swap floating leg for the current calculation period<br />
IrsStructure : Extended argument defining the interest rate swap structure<br />
SwMode : Extended argument customizing the return value<br />
Return Value<br />
The return value depends on the value of SwMode. The default value is a vertical 3-cell array<br />
containing:<br />
SwapNPV : Net present value of the swap<br />
FloatingLegNPV : Net present value of the floating leg<br />
FixedLegNPV : Net present value of the fixed leg<br />
Notes<br />
By default, AdfinX Swaps assumes that the fixed rate is paid and the floating rate is received.<br />
Otherwise, use "PAID:FLOAT" in the IrsStructure.<br />
If the current coupon period has not begun, the argument CurFloatingRate can be left to 0 to<br />
indicate that the floating rate for the current calculation period must be calculated from the zerocoupon<br />
yield curve.<br />
8.2.12. SwIrsSolve<br />
SwIrsSolve(CalcDate As Variant, ZcDates As Variant, ZcRates As Variant,<br />
StartDate As Variant, Maturity As Variant, FixedRate As Double,<br />
CurFloatingRate As Variant, NetPresentValue As Double, IrsStructure As String,<br />
SwMode As String) As Double<br />
Calculates the fixed rate or the floating rate spread equivalent to a predefined net present value.<br />
To distinguish from both cases, the expected result must be specified in SwMode using the RES<br />
keyword ("RES:FIXED" or "RES:FLOAT").<br />
By default, AdfinX Swaps assumes that the NetPresentValue argument stands for the net present<br />
value of the swap. To use the net present value of one of the swap legs, use the PXT keyword in<br />
SwMode.<br />
Arguments<br />
CalcDate : Calculation date<br />
132
AdfinX Analytics 1.0 Function Library – User Guide<br />
ZcDates : Array of zero-coupon dates<br />
ZcRates : Array of zero-coupon rates or discount factors<br />
StartDate : Start date of the interest rate swap (effective date)<br />
Maturity : Maturity date of the interest rate swap (expressed as a date or a code such<br />
as "1Y")<br />
FixedRate : Rate of the swap fixed leg<br />
CurFloatingRate : Rate of the swap floating leg for the current calculation period<br />
NetPresentValue : Present value of the swap or one of its legs<br />
IrsStructure : Extended argument defining the interest rate swap structure<br />
SwMode : Extended argument customizing the return value<br />
Return Value<br />
The fixed rate expressed as a real value (with "RES:FIXED") or the floating rate spread in basis<br />
points (with "RES:FLOAT").<br />
Notes<br />
If NetPresentValue stands for the net present value of the fixed leg ("PXT:FIXED"), only the<br />
fixed rate is calculated. Similarly, if NetPresentValue stands for the net present value of the<br />
floating leg ("PXT:FLOAT"), only the floating rate spread is calculated.<br />
If the current coupon period has not begun, the argument CurFloatingRate can be left to 0 to<br />
indicate that the floating rate for the current calculation period must be calculated from the zerocoupon<br />
yield curve.<br />
8.2.13. SwSwpExtend<br />
SwSwpExtend(CalcDate As Variant, StartDate As Variant, Maturity As Variant,<br />
PaidRate As Double, CurPaidArray As Variant, ReceivedRate As Double,<br />
CurReceivedArray As Variant, ZcPaidArray As Variant, ZcReceivedArray As<br />
Variant, FxArray As Variant, NetPresentValue As Double, CsStructure As String,<br />
SwMode As String) As Variant<br />
Calculates the swap point at maturity date equivalent to a spread/fixed rate and to a predefined net<br />
present value.<br />
Arguments<br />
CalcDate : Calculation date<br />
StartDate : Start date of the currency swap (effective date)<br />
Maturity : Maturity date of the currency swap (expressed as a date or a code<br />
such as "1Y")<br />
PaidRate : Fixed rate if the paid leg is fixed, floating rate spread as a percentage if<br />
the paid leg is floating<br />
CurPaidArray : Floating rate if the paid leg for the current calculation period if<br />
applicable<br />
ReceivedRate : Fixed rate of the received leg is fixed, floating rate spread if the<br />
received leg is floating<br />
CurReceivedArray : Floating rate of the received leg for the current calculation period if<br />
applicable<br />
ZcPaidArray : Array of zero-coupon dates and rates or discount factors for the<br />
payment currency<br />
ZcReceivedArray : Array of zero-coupon dates and rates or discount factors for the<br />
received currency<br />
FxArray : Array of (N+1) cells x 2 cells (dates, rates) where N is the number of<br />
swap point periods<br />
133
AdfinX Analytics 1.0 Function Library – User Guide<br />
The first line (row or column depending on the array orientation<br />
specified with the LAY keyword) contains the spot date and the spot<br />
rate for the cross-currency.<br />
The other lines contain swap point period end dates and<br />
corresponding swap point values for the cross-currency.<br />
NetPresentValue : Present value of the swap or one of its legs in discount currency<br />
CsStructure : Extended argument defining the currency swap structure<br />
SwMode : Extended argument customizing the return value<br />
Return Value<br />
The return value depends on the value of SwMode. The default value is a 2-row array containing:<br />
Date : Date<br />
SwapPoint : Swap point corresponding to NetPresentValue<br />
Notes<br />
The string value used for CsStructure cannot be empty. It must include at least the crosscurrency<br />
("CROSS") and for each leg the leg type ("LTYPE") and the leg currency ("CUR").<br />
If NetPresentValue stands for the net present value of the paid leg ("PXT:PAID"), only the<br />
fixed rate or floating rate spread of the paid leg is calculated. Similarly, if NetPresentValue<br />
stands for the net present value of the received leg ("PXT:RECEIVED"), only the fixed rate or the<br />
floating rate spread of the received leg is calculated.<br />
If the current coupon period has not begun, the arguments CurPaidRate and<br />
CurReceivedRate can be left to 0 to indicate that floating rates for the current calculation period<br />
must be calculated from the zero-coupon yield curves<br />
134
AdfinX Analytics 1.0 Function Library – User Guide<br />
9. ADFINX ADXYIELDCURVEMODULE CONTROL<br />
9.1. ADXYIELDCURVEMODULE PROPERTIES<br />
9.1.1. ErrorCode<br />
ErrorCode() As Long<br />
The ErrorCode property of the AdxYieldCurveModule control retrieves the last error code<br />
generated by the object.<br />
Arguments<br />
This property takes no argument.<br />
Example<br />
Dim yc as AdxYieldCurveModule : Declares an object of type<br />
AdxYieldCurveModule<br />
Set yc = New AdxYieldCurveModule : Creates an AdxYieldCurveModule object<br />
If yc.ErrorCode 0 Then : yc.ErrorCode contains the error<br />
MsgBox (yc.ErrorCode) : Displays the error code in a message box<br />
End If<br />
9.1.2. ErrorMode<br />
ErrorMode() As AdxErrorMode<br />
The ErrorMode property of the AdxYieldCurveModule component sets the error mode. Three<br />
modes are defined:<br />
DIALOGBOX : In this mode a dialog box is displayed when an error occurs<br />
EXCEPTION : In this mode an exception is thrown when an error occurs<br />
NO_EXCEPTION : In this mode the user must call the property ErrorCode to know the error<br />
encountered<br />
Arguments<br />
This property takes no argument.<br />
Note<br />
By default the error mode is set to EXCEPTION.<br />
Example<br />
Dim yc as AdxYieldCurveModule : Declares an object of type<br />
AdxYieldCurveModule<br />
Set yc = New AdxYieldCurveModule : Creates an AdxYieldCurveModule object<br />
yc.ErrorMode = NO_EXCEPTION : yc.ErrorMode is set to NO_EXCEPTION<br />
135
AdfinX Analytics 1.0 Function Library – User Guide<br />
9.1.3. ErrorString<br />
ErrorString() As String<br />
The ErrorString property of the AdxYieldCurveModule retrieves the last error code<br />
generated by the object with the associated error string.<br />
Arguments<br />
This property takes no argument.<br />
Example<br />
Dim yc as AdxYieldCurveModule : Declares an object of variable type<br />
AdxYieldCurveModule<br />
Set yc = New AdxYieldCurveModule : Creates an AdxYieldCurveModule object<br />
yc.ErrorMode = EXCEPTION : yc.ErrorMode must be set to EXCEPTION to use the<br />
ErrorString<br />
On Error Go To Handle : Error handler executes code after Handle when an<br />
error occurs<br />
Res = yc.AdFutDates("CLDR:CAN YB:360 CUR:CAB NBQC:8 NBMC:3", "Mo", "LAY:V")<br />
: The maturity code should be MO. The <strong>fun</strong>ction<br />
AdFutDates returns an error<br />
Exit Sub : Exits sub or <strong>fun</strong>ction before the handle or code will be<br />
executed<br />
Handle<br />
MsgBox(yc.ErrorString) : Displays the ErrorString in a message box<br />
yc.ErrorString contains the ErrorString (‘Error#4009 –<br />
Maturity code: invalid value.’)<br />
9.2. ADXYIELDCURVEMODULE METHODS<br />
9.2.1. AdCalibrate<br />
=AdCalibrate(InputArray As Variant, ZCArray As Variant, StartOutputArray As<br />
Variant, RateStructure As String, CalcStructure As String, AdMode As<br />
String) As Variant<br />
Calculates the model parameters (dates, rates and volatility curve or dates, rates, volatility plus meanreversion<br />
curve) from an array of instruments.<br />
Arguments<br />
InputArray : Array of instruments as described later<br />
ZCArray : (Date, Zero-coupon yield) array describing the zero-coupon curve<br />
StartOutputArray : Start points of the output parameters<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
CalcStructure : Extended argument defining the calculation method<br />
AdMode:<br />
Extended argument customizing the return value<br />
Return Value<br />
The return value depends on the rate model specified in the RateStructure and on the AdMode.<br />
136
AdfinX Analytics 1.0 Function Library – User Guide<br />
Black, Derman, and Toy model:<br />
The return value depends on AdMode. The default value is a vertical array (RET:Ai) containing the<br />
following data:<br />
Dates : Zero-coupon dates<br />
Rates : Zero-coupon rates<br />
Volatilities : Short rate volatilities if VOLTYPE:SR is specified and yield volatilities of<br />
the zero-coupon maturing at this date if VOLTYPE:ZC is specified in<br />
the RateStructure.<br />
Hull and White model:<br />
The return value depends on AdMode. The default value is a vertical array (RET:Ai) containing the<br />
following parameter array:<br />
Dates : Zero-coupon dates<br />
Rates : Zero-coupon rates<br />
Volatilities : Short rate volatilities<br />
Mean-Reversion : Mean-reversion curve<br />
If not already in the ZCArray, the returned value adds the dates and the rates, volatilities and<br />
mean-reversions at these dates corresponding to the dates of the StartOutputArray.<br />
If not specified, the volatility and mean-reversion is presumed constant in the case of the Hull and<br />
White model. Their start values are respectively 0.01 and 0.1 (arbitrary choice).<br />
In the case of the Black, Derman, and Toy model, the start values are the spot volatilities of the<br />
forward rates, or of the swap rates induced from the market volatilities.<br />
Notes<br />
The InputArray can contain any subset of the following groups of instruments: caps, floors, or<br />
swaptions. However, cap, floors, and swaptions cannot be mixed when calibrating the Hull and<br />
White or the Black, Derman, and Toy model. Caps and floors can be mixed in the InputArray.<br />
The maturity dates must be strictly increasing in the case of the Black, Derman, and Toy model.<br />
InputArray must contain the following data:<br />
Type StartDate Maturity Spot rate Expiry Date Market Structure1<br />
Volatilities<br />
Structure2<br />
“C” for<br />
caps<br />
Start date<br />
of the cap<br />
Maturity date<br />
or code of<br />
the cap<br />
Spot rate Not applicable Market<br />
Volatilities<br />
Not applicable<br />
CapFloorStructure<br />
“F” for<br />
floors<br />
Start date<br />
of the floor<br />
Maturity date<br />
or code of<br />
the floor<br />
Spot rate Not applicable Market<br />
Volatilities<br />
Not applicable<br />
CapFloorStructure<br />
“S” for<br />
swaptions<br />
Start date<br />
of the<br />
swap<br />
Maturity date<br />
or code of<br />
the swap<br />
Spot rate<br />
Expiry Date of<br />
the swaption<br />
Market<br />
Volatilities<br />
OptionStructure<br />
SwapStructure<br />
When using BDT, the TITER keyword in the Calcstructure should be the same to calibrate the<br />
model as the one to price instruments with this model in order to limit numeric noise.<br />
When using HW, the calculation method should be CMT:FORM as caps, floors and (European)<br />
swaptions can be computed analytically.<br />
137
AdfinX Analytics 1.0 Function Library – User Guide<br />
9.2.2. AdFutCodes<br />
=AdFutCodes(CalcDate As Variant, StirFutStructure As String, YcMode As String)<br />
As Variant<br />
Calculates the next maturity codes for a STIR futures contract.<br />
Arguments<br />
CalcDate : Calculation date<br />
StirFutStructure : Extended argument defining the STIR futures contract<br />
YcMode : Extended argument customizing the return value<br />
Return Value<br />
The return value depends on the value of YcMode. The default value is vertical array containing the 2-<br />
character codes of contracts (e.g. "Z6") maturing after CalcDate.<br />
When the RET keyword is not specified in YcMode, the maximum number of codes returned by the<br />
<strong>fun</strong>ction is limited to 15. To return for instance 30 codes, use RET:A30.<br />
The resulting array can serve as a basis for determining instrument codes and hedging period dates.<br />
Notes<br />
The next futures contract maturity can be skipped using the keyword ROLL in YcMode.<br />
Odd contracts (i.e. contract maturities, which do not fall in either March, June, September or<br />
December) can be skipped using the keyword ODD in YcMode.<br />
9.2.3. AdFutDates<br />
=AdFutDates(StirFutStructure As String, MaturityCode, YcMode As String)<br />
Calculates the start date and the end date of a STIR futures contract hedging period.<br />
Arguments<br />
StirFutStructure : Extended argument defining the STIR futures contract<br />
MaturityCode : 2-character string defining the contract maturity (example : "Z6" , codes<br />
can be obtained using AdFutCodes)<br />
YcMode : Extended argument customizing the return value<br />
Return Value<br />
The return value depends on the value of YcMode. The default value is a vertical 2-cell array<br />
containing:<br />
FutStartDate : Start date of the period (third Wednesday of the contract delivery month)<br />
FutEndDate : End date of the period (FutStartDate + 3 months)<br />
The resulting array can serve as a basis for determining a zero-coupon yield curve from futures.<br />
9.2.4. AdRate<br />
=AdRate(CalcDate As Variant, DateArray As Variant, RateArray As Variant,<br />
RateStructure As String, AdMode As String) As Variant<br />
138
AdfinX Analytics 1.0 Function Library – User Guide<br />
Calculates the discount factors for an array of dates, using one of the following term structure models:<br />
Vasicek-Fong model<br />
standard bootstrapping model<br />
basis-spline models<br />
Black, Derman, and Toy<br />
Hull and White yield-to-maturity model<br />
Arguments<br />
CalcDate : Calculation date of the yield curve<br />
DateArray : Input array of dates<br />
RateArray : Term structure array<br />
RateStructure : Extended argument defining the structure of the interest rate model<br />
AdMode : Extended argument customizing the return value<br />
Return value<br />
The return value is a vertical column array containing for each date in DateArray the discount factor<br />
computed with the model specified by the RateStructure.<br />
Notes<br />
The table below describes you the different forms of RateArray:<br />
If you specify<br />
RM:YTM<br />
RM:VF<br />
RM:BSPLINE<br />
RM:YC<br />
RM:BDT<br />
RM:HW<br />
Then RateArray is<br />
a single value<br />
a 1-column array, which contains the Vasicek-Fong coefficients<br />
a 2-column array, which contains the dates and rates<br />
a 2-column array, which contains the dates and discount factors (or<br />
rates) of a zero-coupon yield curve<br />
a 3-column array, which contains the dates, rates and volatilities<br />
a 3-column array, which contains the dates, rates, volatilities and meanreversion<br />
In standard bootstrapping, Black, Derman, and Toy, and Hull and White models, the discount<br />
factors are interpolated from the dates defined in RateArray.<br />
Use the IM keyword in RateStructure to define the type of interpolation.<br />
Use the ZCTYPE keyword in RateStructure to specify the values of RateArray as rates or<br />
discount factors.<br />
If the dates in DateArray used for the interpolation are not within the range of the RateArray,<br />
the <strong>fun</strong>ction may either extrapolate or return an error message depending on value of the OBC<br />
keyword.<br />
9.2.5. AdTermStructure<br />
=AdTermStructure(InstrumentArray As Variant, RateStructure As String, AdMode<br />
As String) As Variant<br />
Depending on the model specified by the RM keyword, the <strong>fun</strong>ction calculates a zero-coupon yield<br />
curve from an array of instruments, using:<br />
Vasicek-Fong model<br />
standard Bootstrapping model<br />
139
AdfinX Analytics 1.0 Function Library – User Guide<br />
regression or smoothing basis-spline models<br />
Arguments<br />
InstrumentArray : Array of instruments<br />
RateStructure : Extended argument defining the structure of the interest rate structure<br />
AdMode : Extended argument customizing the return value<br />
Return value<br />
The return value depends on the method used to calculate the yield curve and the AdMode structure.<br />
Bootstrapping model:<br />
The return value is a vertical 2-column array ("RET:Ai") containing the following data for each start<br />
date and end date in the input array:<br />
Date : Zero-coupon date<br />
Rate : Zero-coupon rate or discount factor depending on the ZCTYPE keyword<br />
Vasicek-Fong model:<br />
The return value depends on AdMode. The default value is a vertical array containing:<br />
Yield Curve Start Date<br />
Alpha : Alpha coefficient<br />
Beta0 : Beta0 coefficient<br />
Beta1 : Beta1 coefficient<br />
Beta2 : Beta2 coefficient<br />
Beta3 : Beta3 coefficient<br />
Basis-spline model:<br />
The return value depends on AdMode. The default value is a vertical 2-column array containing:<br />
• dates of knots and fitness and smoothness parameters in the two last rows of the array<br />
• linear coefficients of the forward <strong>fun</strong>ction in the basis-sline base<br />
Notes<br />
You must specify either RM:YC keyword in RateStructure to use the bootstrapping model,<br />
RM:VF to use the Vasicek-Fong model, or RM:BSPLINE to use the basis-spline model.<br />
Bootstrapping model:<br />
The InstrumentArray can contain any subset of the following groups of instruments: deposits,<br />
bonds, STIR futures, or interest rate swaps. The rule for overlapping is that the longer-term<br />
instruments have priority. For example, deposits are used only until the first futures maturity; futures<br />
are used only until the first IRS maturity. However, it is possible to mix bonds and swaps.<br />
The InstrumentArray must contain the following data:<br />
Type StartDate Maturity Coupon Market Price<br />
& Rate<br />
Structure<br />
“D” for<br />
deposits<br />
Start date of<br />
the period (1)<br />
End date of<br />
the period (1)<br />
Not<br />
applicable<br />
Rate<br />
Currency<br />
Style<br />
“F” for STIR Start date of End date of Not Implied STIR<br />
140
AdfinX Analytics 1.0 Function Library – User Guide<br />
futures the period (2) the period (2) applicable forward rate Future style<br />
“S” for IRS<br />
Start date of<br />
the swap<br />
Maturity code<br />
or maturity<br />
date<br />
Current<br />
floating rate<br />
(3)<br />
Fixed swap<br />
rate<br />
Swap<br />
Structure<br />
“B” for bonds<br />
Settlement<br />
date of the<br />
bond (4)<br />
Maturity date<br />
of the bond<br />
Coupon<br />
rate of the<br />
bond<br />
Price (5)<br />
Bond Style<br />
or Structure<br />
(1) The date can be calculated using FxCalcPeriod<br />
(2) The date can be calculated using AdFutCodes and AdFutDates<br />
(3) If left at 0, the current floating rate is interpolated from the yield curve<br />
(4) The date can be calculated using BdSettle<br />
(5) Clean price or gross price according to the default setting in the BOND category<br />
The “Coupon” column must be included in the InstrumentArray even if you are not using bonds to<br />
generate the zero-coupon curve. The column must contain either “0” or no value.<br />
The size of the InstrumentArray cannot exceed 48 instruments. If the size exceeds 23<br />
instruments, use the keyword RET to display all the dates and zero-coupon rates or discount factors.<br />
Vasicek-Fong model:<br />
The InstrumentArray contains only bond instruments:<br />
Type StartDate Maturity Coupon Market Price Structure<br />
“B” for<br />
Maturity date<br />
Price<br />
Bond Style<br />
bonds<br />
of the bond<br />
or Structure<br />
Settlement<br />
date of the<br />
bond<br />
Coupon<br />
rate of the<br />
bond<br />
The instrument array does not handle callable and puttable bonds, index-linked bonds, and FRNs. The<br />
bonds sample must be homogenous. The model should have at least between 10 and 15 bonds to<br />
ensure accuracy. You can choose the value of the Vasicek-Fong coefficient Alpha using the<br />
VFALPHA keyword in RateStructureYou can also specify a model with duration using the MDWA<br />
keyword in RateStructure<br />
Basis-spline models:<br />
The InstrumentArray contains zero-coupon or fixed-coupon bonds, which have the same rating<br />
and liquidity:<br />
Type StartDate Maturity Coupon Market Price Structure<br />
“B” for<br />
Maturity date<br />
Price (2) Bond Style<br />
bonds<br />
of the bond<br />
or Structure<br />
Settlement<br />
date of the<br />
bond (1)<br />
Coupon<br />
rate of the<br />
bond<br />
(1) The date can be calculated using BdSettle<br />
(2) Clean price or gross price according to the default setting in the BOND category (expressed as a<br />
percentage of the nominal)<br />
The instrument array does not handle callable and puttable bonds, index-linked bonds, and FRNs. You<br />
choose the number of knot-points of the basis-spline <strong>fun</strong>ction using the NBKNOT keyword in<br />
RateStructure. You specify the SMOOTH keyword value in RateStructure to apply the related basisspline<br />
method. You specify the MDWA keyword value in RateStructure to choose a type of<br />
minimization of the residual errors between market and model prices.<br />
141
AdfinX Analytics 1.0 Function Library – User Guide<br />
10. GENERAL IDENTIFIERS<br />
10.1. ERRORMODE<br />
10.1.1. AdxErrorMode<br />
AdxErrorMode<br />
DIALOGBOX : In this mode a dialog box is displayed when an error occurs.<br />
EXCEPTION : In this mode an exception is thrown when an error occurs.<br />
NO_EXCEPTION : In this mode the user must call the property ErrorCode to know the error<br />
encountered.<br />
142
AdfinX Analytics 1.0 Function Library – User Guide<br />
11. BACKWARD COMPATIBILITY<br />
This section explains the compatibility issues between AdfinX Analytics 1.0 Function Library and the<br />
previous version.<br />
11.1. COMPATIBILITY<br />
The new version of AdfinX Analytics Function Library is compatible with the previous ones. The<br />
<strong>fun</strong>ctions and modules that can be exposed in your VBA editor are the same.<br />
New <strong>fun</strong>ctions are available in the Bonds, Options, YieldCurves and Exotics Modules. A new module<br />
called “AdxConvBondModule” is also added.<br />
11.2. NAMING DIFFERENCES<br />
This section describes the differences between old and new AdfinX Analytics Libraries.<br />
The following table explains the naming differences.<br />
The name of Was in PowerPlus Pro 4.0 Is in Power Plus Pro 4.5<br />
The library<br />
Note:<br />
YOU CAN FIND THE<br />
LIBRARY LABELS IN<br />
THE REFERENCES<br />
ITEM OF THE<br />
PROJECT MENU OF<br />
YOUR VBA EDITOR.<br />
THE DYNAMIC<br />
LINKED LIBRARY<br />
The library used in the<br />
source code<br />
A control<br />
Note:<br />
You can find the control<br />
labels in the Object…<br />
item of the Insert menu<br />
of Excel.<br />
A control used in the<br />
source code<br />
…<br />
…<br />
…<br />
…<br />
“AdfinX Analytics Bonds 1.2<br />
Library”<br />
“AdfinX Analytics Dates 1.2<br />
Library”<br />
“AdfinX Analytics Exotics 1.2<br />
Library”<br />
Bdx.dll for Bonds module<br />
Dfx.dll for Dates module<br />
Exx.dll for Exotics module<br />
“AdfinXBonds”<br />
“AdfinXDates”<br />
“AdfinXExotics”<br />
“AdfinX Analytics<br />
BondModule Control”<br />
“AdfinX Analytics DateModule<br />
Control”<br />
“AdfinX Analytics<br />
ExoticModule Control”<br />
“AdxBondModule”<br />
“AdxDateModule”<br />
“AdfinX Analytics 1.0 Function<br />
Library”<br />
Note:<br />
All AdfinX Analytics libraries are<br />
now grouped under one name.<br />
AdXfo.dll<br />
Note:<br />
All AdfinX Analytics dlls are now<br />
grouped under one name.<br />
“ADFINXANALYTICSFUNCTIONS”<br />
Note:<br />
All AdfinX Analytics libraries are<br />
now grouped under one name.<br />
…<br />
“AdfinX Analytics 1.0<br />
AdxBondModule Control”<br />
“AdfinX Analytics 1.0<br />
AdxDateModule Control”<br />
“AdfinX Analytics 1.0<br />
AdxExoticModule Control”<br />
“AdxBondModule”<br />
“AdxDateModule”<br />
143
AdfinX Analytics 1.0 Function Library – User Guide<br />
“AdxExoticModule”<br />
“AdxExoticModule”<br />
Note:<br />
The other modules concerned by these changes are:<br />
Forex<br />
Options<br />
Swaps<br />
Utilities<br />
Yield Curves<br />
11.3. HOW TO MIGRATE YOUR CODE<br />
This section explains how to migrate your code written with the old version of the AdfinX Analytics<br />
Function Library to the new one.<br />
You must make a series of changes to reuse your old code with AdfinX Analytics 1.0 Function Library.<br />
The table below shows you how to migrate your code.<br />
IF<br />
You use C++ samples<br />
THEN<br />
1 Import the dynamic linked library in you code:<br />
#IMPORT “ADXFO.DLL”<br />
2 Replace the library names with “AdfinXAnalyticsFunctions”<br />
You use VBA code<br />
1 Remove the old controls from your spreadsheet.<br />
2 Replace the library names with “AdfinXAnalyticsFunctions”<br />
See Naming Differences.<br />
Note:<br />
The spreadsheet you use may be corrupted when<br />
removing references to the old version of AdfinX Analytics.<br />
In this case, make sure that all references are removed<br />
and save the spreadsheet with a different name.<br />
3 Insert new controls using the same names as old ones.<br />
Your VBA code then does not change.<br />
144
AdfinX Analytics 1.0 Function Library – User Guide<br />
12. TROUBLESHOOTING<br />
This section introduces a particular feature in AdfinX Analytics 1.0 Function Library. If you use VBA<br />
code, you must specify Variant <strong>fun</strong>ction parameters with the .Value extension. The following code<br />
is an example of how to use this extension in the OpHistVol <strong>fun</strong>ction.<br />
Example<br />
Public Function OpxHistVol(PriceArray As Variant, OpMode As String) As<br />
Variant<br />
On Error GoTo ErrHnd<br />
Dim fn As New AdfinXAnalyticsFunctions.AdxOptionModule<br />
OpxHistVol = fn.OpHistVol(PriceArray.Value, OpMode)<br />
Exit Function<br />
ErrHnd:<br />
OpxHistVol = Err.Source & " " & Err.Description<br />
End Function<br />
If you do not use the .Value extension, an error message appears:<br />
AdfinXAnalyticsFunctions.AdxOptionModule.1 ERROR #0 - Missing<br />
or invalid Resource<br />
145