11 Feb 2005 01:35:43 UTC
- Distribution: finance-bdt
- Module version: 0.01
- Source (raw)
- Browse (raw)
- How to Contribute
- Testers (443 / 0 / 13)
- KwaliteeBus factor: 0
- % Coverage
- License: unknown
- Activity24 month
- Download (4.05KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest versionSMALHOTRA Sidharth Malhotra
Finance::BDT - Implements BDT yield curve model
use Finance::BDT; use Data::Dumper my @y = (0, 0.0283, 0.029, 0.0322, 0.0401, 0.0435, 0.0464, 0.0508, 0.0512); ## YTM on strips my $vol = 0.20; ## constant volatility my $epsilon = 0.01; my ($r, $d, $A) = Finance::BDT::bdt( -yields => \@y, -epsilon => $epsilon, -volatility => $vol ); print "Short Rates: \n", Dumper $r; print "Discount Prices: \n", Dumper $d; print "Asset State Prices: \n", Dumper $A;
Sample implementation of Black-Derman-Toy model.
Finance::BDT implements a constant volatility Black-Derman-Toy model in Perl. Not that you should be building your curves in perl, but now you can. The current implementation works with constant volatility but I am testing a version which allows you to pass in a term structure of volatilities. The input is the zero curve (as observed yields), a constant volatility, and a limit for the numerical solution. The function returns the interest rate tree as a list of lists (first index being the time period, and second being the position with the lowest rate having index 0). Three trees are returned: the short rates at each period, the discount prices and most importantly the state prices.
The examples directory has an untested sample implementation in C for the brave.
- Use a term structure of volatilies - Be able to price an interest rate derivative based on the asset prices - Be able to perturb and re-price the instrument - Implement the actual calculation in C (maybe using Inline::C)
None by default.
Black, F., Derman, E., and Toy, W. "A one-factor model of interest rates and its application to treasury bond options," Financial Analysts Journal, 46 (1990), 33-39.
Hull, J. and White, A., "One-Factor interest Rate Models and the Valuation of Interest Rate Derivative Securities," Journal of Financial and Quantitive Analysis, 28 (1993), 235-254.
Klose, Chrisoph and Yuan, Li Chang. Implementation of the Black, Derman and Toy Model. http://www.lcy.net/files/BDT_Seminar_Paper.pdf
Sidharth Malhotra, sidharth dot malhotra at gmail dot com
Copyright 2005 by Sidharth Malhotra
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.