# Tag Info

## Hot answers tagged quantlib

10

I've been using QuantLib for quite a while. Let me share some experience: QuantLib is a highly sophisticated quantitative framework. It can do much and much more than a simple pricing of European option. For example, in your example, you could have changed the payoff to binary payoff or giving a monte-carlo pricing engine (rather than ...

6

And don't forget that there are wrappers as eq RQuantLib which I use on the command-line here: edd@max:~$r -l RQuantLib -e 'print(EuropeanOption("call", 47, 40, 0.05, 0.0, 4/12, 0.2))' Concise summary of valuation for EuropeanOption value delta gamma vega theta rho divRho 6.4728 0.8899 0.0307 4.5139 0.7372 ... 5 To add to Student T's answer, which I second: the complex setup starts making sense (and its cost gets amortized) once you start keeping the instruments around instead of throwing them away after the pricing. For instance, once the option above is built, you can change the market price of the underlying (or its volatility, or the risk free rate) by just ... 4 The QuantLib you installed is just a C++ library. If you were on a Windows machine, you'd need the QuantLibXL addin to use it in Excel (http://quantlib.org/quantlibxl/). But on a Mac, you've no such luck. As far as I know, Excel for Mac only allows addins written in VBA, so QuantLibXL can't be built for it. 4 At this time, there's no specific documentation for QuantLib-Python, except for a series of screencasts that I started a while ago (you can find them on YouTube at https://www.youtube.com/playlist?list=PLu_PrO8j6XAvOAlZND9WUPwTHY_GYhJVr) but which is far from exhaustive; there's just a few of them for now, and there's no definite learning path. However, the ... 3 No, I don't think the raw solution you sketch is going to work. First and foremost, by extracting the cash flows from the bond you're discarding the dynamics of their rate under the Hull/White model you're using. You should both forecast and discount them on the tree; the way to do it correctly is implemented, e.g., in the DiscretizedSwap class (and ... 3 fixedLegBPS is the basis-point sensitivity of the fixed leg, that is, how much its NPV changes when the fixed rate changes by one basis point: it's calculated as the NPV corresponding to a fixed rate of 1 bps. Since the NPV of the fixed leg is linearly proportional to the fixed rate, you can write the equation targetNPV : fixedRate = BPS : 1 basis point ... 3 Sigh. I'm not sure that there's a best way to do multi-threaded MC in QuantLib. I'm afraid that you're underestimating the amount of development you'd need for option 2. You're not going to get away with some OpenMP code as you suggest, because calculations on different paths are not trivially parallel: the RNGs we have are not parallel, and even if you ... 3 The time to expiry is required, but it's included in the inputs: the two discounts$e^{-rT}$and$e^{-qT}$and the standard deviation$\sigma\sqrt{T}$. You might argue it could be documented more clearly, and I might agree with you. 3 You're not the first to trip on this, and unfortunately the fact that the provided example is from a different era doesn't help. Quite simply, you're not writing rates correctly. The 5-years swap rate, 0.3523%, must be written in decimal form as 0.003523. The same goes for the deposit rates. As your code is now, you're writing that the 4-years rate is ... 3 Yes, your solution is correct, given the implementation of McSimulation and the interface of SequenceStatistics. We should probably have defined SequenceStatistics as returning instances of Array... As you might have seen, trying to return std::vector<Real> from the path pricer wouldn't work; the result type needs to define arithmetic operations such ... 2 Touch option is simply a barrier option in QuantLib. You could create one like a down-in barrier type. You can also set the payoff to a binary payoff. The payoff is represented by the StrikePayOff class. A comprehensible example is available on github here. 2 At first sight, I'd say it's ok. You'll have to let the constructor of your process class take the maturity time, so you can create different instances with different$T\$.

2

It is all in the code:: Rcpp::List rl = Rcpp::List::create(Rcpp::Named("value") = opt.NPV(), Rcpp::Named("delta") = opt.delta(), Rcpp::Named("gamma") = opt.gamma(), Rcpp::Named("vega") = (excType=="european") ? opt.vega() : R_NaN, ...

2

While @Baruch Youssin answers correctly in the general sense, the first part of his answer isn't what happened in the example code. While QLNet is a port of QuantLib, it's not a direct port. Your quoted example doesn't show up in QLNet. The example in QuantLib was written in a very complicated way, in fact it's a simple example. discountingTermStructure is ...

2

I do not yet know QuantLib but one question is general and easy to answer: My first question is why do they use different yield curve? These two curves differ by risk levels inherent in them - the credit spreads over the risk-free yield curve (e.g., the OIS curve). The discounting curve, discountingTermStructure, embeds the risk that this particular ...

2

QSTK is nice and open source , it is the QuantSciTookKit and it has some good functionality if you are interested in python programming. Here is the link: http://wiki.quantsoftware.org/index.php?title=QuantSoftware_ToolKit

2

FRARateHelper takes a number of constructors. You should take a look at the ones that take Period. The definition for Period is: class Period { public: Period() : length_(0), units_(Days) {} Period(Integer n, TimeUnit units) : length_(n), units_(units) {} explicit Period(Frequency f); Integer length() const { return length_; } ...

1

You will find a tutorial of QuantLib using python with simple examples here: http://gouthamanbalaraman.com/blog/quantlib-python-tutorials-with-examples.html I have been writing these as a means to be instructive to others going through the process of learning and working with QuantLib. If you have suggestions on what topics you would like to read, please ...

Only top voted, non community-wiki answers of a minimum length are eligible