QuantLib | The QuantLib C++ library

 by   lballabio C++ Version: QuantLib-v1.30 License: Non-SPDX

kandi X-RAY | QuantLib Summary

kandi X-RAY | QuantLib Summary

QuantLib is a C++ library. QuantLib has no bugs, it has no vulnerabilities and it has medium support. However QuantLib has a Non-SPDX License. You can download it from GitHub.

The QuantLib project (is aimed at providing a comprehensive software framework for quantitative finance. QuantLib is a free/open-source library for modeling, trading, and risk management in real-life. QuantLib is Non-Copylefted Free Software and OSI Certified Open Source Software.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              QuantLib has a medium active ecosystem.
              It has 3976 star(s) with 1543 fork(s). There are 240 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 52 open issues and 457 have been closed. On average issues are closed in 272 days. There are 4 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of QuantLib is QuantLib-v1.30

            kandi-Quality Quality

              QuantLib has 0 bugs and 0 code smells.

            kandi-Security Security

              QuantLib has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              QuantLib code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              QuantLib has a Non-SPDX License.
              Non-SPDX licenses can be open source with a non SPDX compliant license, or non open source licenses, and you need to review them closely before use.

            kandi-Reuse Reuse

              QuantLib releases are available to install and integrate.
              Installation instructions are available. Examples and code snippets are not available.
              It has 313 lines of code, 6 functions and 8 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of QuantLib
            Get all kandi verified functions for this library.

            QuantLib Key Features

            No Key Features are available at this moment for QuantLib.

            QuantLib Examples and Code Snippets

            No Code Snippets are available at this moment for QuantLib.

            Community Discussions

            QUESTION

            Why does the Quantlib::Error class allocate a std::string on the heap?
            Asked 2022-Mar-11 at 02:18

            In a code review recently, I had some less than kind words for something I thought awful. It turns out that it was obviously inspired by the QuantLib::Error class, which looks like this:

            ...

            ANSWER

            Answered 2022-Mar-11 at 02:18

            This is following the behavior of standard library exception types.

            They are supposed to be copyable without throwing exceptions, since throwing an exception during construction of an exception handler parameter would cause a call to std::terminate (and possibly in some other situations requiring a copy of the exception as well).

            If std::string was used directly, copying the exception could cause for example a std::bad_alloc to be thrown. Using a reference-counted pointer instead avoids that.

            Source https://stackoverflow.com/questions/71432796

            QUESTION

            The canonical way to structure a Class (and to avoid the "name 'self' is not defined") error
            Asked 2022-Jan-26 at 23:39

            I'm new to classes in Python and could use some assistance.

            I have the following (admittedly poorly-written) class:

            ...

            ANSWER

            Answered 2022-Jan-26 at 23:39

            I recommend a reading of the Python documentation about classes.

            Q1. What is causing the NameError: name 'self' is not defined error in the class above?

            A: self refers to an object of a class. You cannot reference an object before you create one.

            Q2. Would someone kindly show me the correct (i.e. canonical) way to write this class?

            A: You could add the class properties you defined to the __init__ method, as you did with some properties.

            Source https://stackoverflow.com/questions/70871483

            QUESTION

            Compare QuantLib bond pricing with Excel functions YIELD and PRICE when doing stress testing
            Asked 2021-Nov-23 at 08:29

            I calculated bond price and stressed bond price (shocking up yield) in both Excel and Python Quantlib. As the following table shows, weird results were generated: base bond price matches well between Excel and Quantlib but the stressed bond prices have more gaps (1.5% relative difference). Yields also show some gaps. Can you please provide some comments?

            Excel Code:

            ...

            ANSWER

            Answered 2021-Nov-23 at 08:29

            QUESTION

            brace-enclosed initializer list conversion error
            Asked 2021-Sep-29 at 18:58

            I have the following old code that used to work on "older" combinations/versions of C++, QuantLib and Boost. While was playing around with the idea of upgrading to newer versions ie C++11, QuantLib >= 1.76, boost >= 1_71 building now throws the following "conversion" error(s).
            I am using [options] g++ -std=gnu++11

            ...

            ANSWER

            Answered 2021-Sep-29 at 18:58

            The errors are narrowing conversions, which are never allowed in uniform initializers.

            That's relevant because aggregate initialization existed all along and did not have that restriction. Now in C++11 world, aggregate initialization is just a form of uniform initialization, with ditto narrowing rules.

            You should explicitly convert the respective values (checking that the conversion is safe!)

            E.g.

            Source https://stackoverflow.com/questions/69380633

            QUESTION

            Pricing a Forward Rate Agreement using QuantLib Python
            Asked 2021-Sep-07 at 14:13

            Can someone please help with the pricing of the following forward rate agreement using QuantLib Python?

            A 3x6 forward rate agreement, with a notional of $100,000, the FRA rate being 6%, The FRA settlement date is after 3 months (90 days) and the settlement is based on a 90-day USDLIBOR.

            My valuation date is 30 June 2020.

            This is my attempt:

            ...

            ANSWER

            Answered 2021-Sep-07 at 14:13

            First off (for accuracy) the daycount for USD FRAs is Act/360, ie ql.Actual360(). Also bear in mind that the fixing calendar for FRAs is based on the UK calendar (BBA Libor), which may be different from the settlement calendar (so 4th July is not a fixing holiday, but is a settlement holiday).

            The main issue with the OP code is that the FRA start date is the same as the evaluation date. Once you know the fixing, then the FRA is effectively settled, so has a NPV of zero and a cashflow.

            The first parameter of ForwardRateAgreement() is the settle date of the FRA. The second, maturity, is the end date. So for a spot 3x6, the start date is 3m from now, and the maturity is 6m from now.

            Amending this line to:

            dayConvention = ql.Actual360()

            and

            fra = ql.ForwardRateAgreement(calendar.advance(startDate,ql.Period(3,ql.Months)), calendar.advance(startDate,ql.Period(6,ql.Months)), ql.Position.Long, rate, notional, index, spotCurveHandle)

            will give you the dates for a spot 3x6 FRA (30-Sep-20 -> 30-Dec-20).

            Output: NPV: -262.08622386063985

            NB. In the QuantLib example for FRA's, they use a selection of FRA market rates to build a PiecewiseLogLinearDiscount curve to value the FRA, rather than a zero curve, and I guess it is the subtle differences between the two which is leading to the slight change in forward rate (and hence NPV). The implied forward rate for the FRA comes out at 4.937% ... ie not 5%, which also increases the NPV. In practice, if you are trying to price FRAs then build a curve using market FRA quotes.

            Source https://stackoverflow.com/questions/69085278

            QUESTION

            Undefined Boost symbol when linking to pre-compiled QuantLib binaries on MacOS
            Asked 2021-Aug-09 at 13:33

            I am trying to compile some C++ that depends on QuantLib, which in turn depends on Boost. I am working on a MacBook Pro M1 (ARM architecture). I installed Boost and QuantLib using the instructions on this page: https://www.quantlib.org/install/macosx.shtml. I then tried to compile the following source code:

            ...

            ANSWER

            Answered 2021-Aug-09 at 13:33

            I think you're missing a -lQuantLib in your command line? You're telling the compiler where to look for the libraries (the -L switches`) but not which libraries to link.

            Also, check whether homebrew also installed a quantlib-config script on your computer. If so, it should provide the switches you need; try running

            Source https://stackoverflow.com/questions/68710967

            QUESTION

            New object within for loop
            Asked 2021-Aug-05 at 10:30

            What's wrong with my code? I wanted to make a new xts object to store data from the first loop and to be used in subsequent loops but I got this error message:

            ...

            ANSWER

            Answered 2021-Aug-05 at 10:30
            if(i < 1){
                    fund_table_xts_fin <- fund_table_xts
                  } else {
                    fund_table_xts_fin <- merge(fund_table_xts, fund_table_xts_fin)
                  }
            
            
            In the above section when i = 1 then you are in the else block but there is no 'fund_table_xts_fin' object created yet. You can try this:
            
            `if(i == 1){
                fund_table_xts_fin <- fund_table_xts
              } else {
                fund_table_xts_fin <- merge(fund_table_xts, fund_table_xts_fin)
              }`
            

            Source https://stackoverflow.com/questions/68664408

            QUESTION

            module 'QuantLib' has no attribute 'CallabilityPrice'
            Asked 2021-Aug-01 at 17:49

            I have pip installed newest QuantLib for python 1.23 for Windows.
            ql.Callability() is available but ql.CallabilityPrice is not provided.
            Is there any issue?

            ...

            ANSWER

            Answered 2021-Aug-01 at 06:07

            CallabilityPrice was renamed to BondPrice in the underlying C++ library a couple of versions ago. The Python module kept the old version for a while but eventually did the same.

            Source https://stackoverflow.com/questions/68607187

            QUESTION

            ValueError: too many values to unpack Pandas
            Asked 2021-Jun-11 at 16:14

            I have the following code. However i am having error when executing same. I want the function to calculate the schedule date and ouput same to a new dataframe. It seems the error is in the for loop. I am new to this so just trying to figure out

            ...

            ANSWER

            Answered 2021-Jun-11 at 16:14

            I assume what you are wanting to do is to modify a dataframe row by row (if there is more to it there may be a better solution) :

            Source https://stackoverflow.com/questions/67790546

            QUESTION

            Date Difference QuantLib
            Asked 2021-May-15 at 05:37

            I want to calculate days difference between the dates using 360 days basis .Code is as per below but is not working

            ...

            ANSWER

            Answered 2021-May-14 at 22:01

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install QuantLib

            QuantLib can be downloaded from http://quantlib.org/download.shtml; installation instructions are available at http://quantlib.org/install.shtml for most platforms. Documentation for the usage and the design of the QuantLib library is available from http://quantlib.org/docs.shtml. A list of changes for each past versions of the library can be browsed at http://quantlib.org/reference/history.html.

            Support

            The preferred channel for questions (and the one with the largest audience) is the quantlib-users mailing list. Instructions for subscribing are at http://quantlib.org/mailinglists.shtml. Bugs can be reported as a GitHub issue at https://github.com/lballabio/QuantLib/issues; if you have a patch available, you can open a pull request instead (see "Contributing" below).
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/lballabio/QuantLib.git

          • CLI

            gh repo clone lballabio/QuantLib

          • sshUrl

            git@github.com:lballabio/QuantLib.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link