![]() | ||||
| ||||||
| Applications, Enhancements and Modifications Share your Symphony DE applications, enhancements and modifications with the community here. |
![]() |
| | LinkBack | Thread Tools | Search this Thread | Display Modes |
| ||||
| 1. Introduction QuantLib is a C++ Open Source library for financial quantitative analysis that contains several kinds of source code; code that perform mathematical operations, such as constrained and unconstrained optimization and/or interpolation, code that generates random numbers sampled from a given probability distribution and code that computes the price of derivative contracts with assigned parameters. QuantLib usually requires another library called the Boost library. ![]() bs_symphony and mc_symphony are packages containing Symphony applications that implement, using the QuantLib API, the evaluation of the price of a call option with the prescribed values of underlying volatility, discount factor and strike price with Black Scholes formula (bs_symphony) and a Monte Carlo method (mc_symphony), respectively. The two packages have the following structure: bs_symphony/ README black.xml: Application profile client/: Application client code service/: Application service code mathlib/: Library of Black and Scholes engine written with QuantLib API. common/: Message classes used by client and service mc_symphony/ README mc.xml: Application profile client/: Application client code service/: Application service code mathlib/: Library of QuantLib Monte Carlo engine written with QuantLib API tools/: Tools to read files and process user input common/: Message classes for by client and service The Symphony environment can be configured to have service code depend on any libraries. In this case, it is necessary to convert the application originally written with C++ QuantLib into a static library with the extension 'a' (for example math.a). This library is put in a bigger library that also contains the Symphony libraries needed for the input/output operations. Note that the input/output instructions must be adapted to the input/output needs of the application. In Section 2, instructions for the QuantLib installation are briefly explained. In Section 3, we describe the steps that must be performed to make the pricing engines available in the Symphony environment as services. 2. QuantLib installation The QuantLib applications were tested on Linux with kernel 2.4 and 2.6. The QuantLib applications were written in QuantLib 0.9.0, Boost 1.34.1 and Symphony DE 4.0 API and compiled with g++ 3.4.3 We assume that Symphony DE is installed in the directory ${HOME}/SymphonyDE To install two libraries, Boost 1.34.1 and QuantLib 0.9.0, it is necessary to download the following compressed files: boost-1_34_1.tar.gz and boost-jam-3.1.13-1-linuxx86.tar in ${HOME}/boost/ from the website and QuantLib-0.90.tar.gz in /home/quantlib/ from the website To install Boost 1.34.1 the following commands are necessary (we assume Bash): >> cd ${HOME}/boost/To install QuantLib-0.9.0 the following commands are necessary: >> cd ${HOME}/quantlib/Finally, update the library path: >> export LD_LIBRARY_PATH = ${HOME}/boost/3. How to run bs_symphony To make the Black Scholes pricing engine in QuantLib available in the Symphony environment as a service, you must perform the following steps: 1) Connect to the server where Symphony, Quantlib and Boost are installed. Source the necessary Symphony environment and start up Symphony through the following commands: >> . profile.soam2) Uncompress the bs_symphony package, in ${HOME}/SymphonyDE/4.0/ 3) Build the application with following commands; >> cd ${HOME}/SymphonyDE/4.04) In the directory ${HOME}/SymphonyDE/4.0/bs_symphony/output/, compress the file service and deploy the compressed file with the following commands; >> tar cvf service.tar service5) In the directory ${HOME}/SymphonyDE/4.0/bs_symphony/, create the application profile, black.xml. >> soamreg ${HOME}/SymphonyDE/4.0/bs_symphony/black.xml6) Confirm that the registration worked by running the following command; >> soamview appVerify that the application, BlackScholes, is enabled. 7) Now you can run the client of new Symphony application, BlackScholes (bs_symphony), in the directory ${HOME}/SymphonyDE/4.0/bs_symphony/output/ with: >>./client [input file name] [number of tasks]Note: [input file name] is a text file containing input data. Each line in the file that consists of 4 input parameters, value of underlying, volatility, discount factor and striking price, is separated by comma. [number of tasks] is a number of splits applied to your tasks input. If the input file contains 10,000 lines and [number of tasks] = 4, then there will be 4 tasks, each containing 2,500 lines of input data. 4. How to run mc_symphony 1) Make sure you did step 1) in section 3. 2) Uncompress the bs_symphony package, in ${HOME}/SymphonyDE/4.0/ 3) Build the application with following commands; >> cd ${HOME}/SymphonyDE/4.04) In the directory ${HOME}/SymphonyDE/4.0/mc_symphony/output/, compress the service executable file and deploy the compressed file with the following commands; >> tar cvf service.tar service5) In the directory ${HOME}/SymphonyDE/4.0/mc_symphony/, create the application profile, mc.xml. >> soamreg ${HOME}/SymphonyDE/4.0/mc_symphony/mc.xml6) Confirm the registration by running the following command; >> soamview appVerify that the application, MonteCarlo, is enabled. 7) Now you can run the client of new Symphony application, MonteCarlo (mc_symphony), in the directory ${HOME}/SymphonyDE/4.0/bs_symphony/output/ with: >> ./clientNote: The program will prompt the user for the following parameters: strike price, dividend, risk free rate, volatility. Once all parameters are entered, the client passes the input parameters to the Monte-Carlo engine in the Symphony service and the service will return the result. The user is then prompted for a new set of values. To exit from the program press enter entering an empty line or press ctrl^D. Example: >> ./client 5. Performance implication Note that bs_symphony is slightly different from mc_symphony in terms of client interface. It takes multiple sets of inputs and creates tasks in larger chunks, because sending small tasks one by one is less efficient due to the network overhead. You may control the size of a chunk by specifying the second argument, [number_of_tasks] to the client command of bs_symphony, to find the optimal task granularity. 6. Acknowledgement Francesca Mariani (fra_mariani@libero.it) and Francesco Zirilli (f.zirilli@caspur.it) from CERI University of Roma have contributed to the implementation of samples. Last edited by Ajith; March 28th, 2008 at 03:10 PM.. |
| |||
|
thank you to young for posting this thread i am a high school student, currently working at the university of alberta for my thesis (IB Extended Essay) i chose to develop a simple options pricing model and it looks like if i implement symphony, quantlib, and boost i will have some success i do have background in C++, so i should be able to work with this code do you think i am going about this the right way, or i have i misunderstood something? |
| |||
|
Below some facts and a request for your help. Facts: 1 the bs_symphony available in the Forum for Symphony DE done by Young has been downloaded and compiled in the Symphony DE 4.0 environment installed by David on the ENEA lin4p machines, 2 the client and service make files of bs_symphony give some compilation errors, 3 the MyMessage.Cpp and the MyMessage.h files of the Symphony DE 4.0 and of the Symphony 3.0 are different and incompatible.Is this the way it should be? Help: 1 can you give us a version of the work of Young that works in the Symphony DE 4.0 environment installed by David on the ENEA machines ? Thank you very much for your help. Regards Francesco |
| ||||
| Quote:
If you are familiar with coding in C++ and have Windows or a Supported Linux version, then you should have no trouble building our sample. If you are just interested in creating an option pricing model, start with Quantlib and see whether you can implement what you want with it. Check the Quantlib community forums for more information about it; Nabble - QuantLib forum Symphony will grid-enable Quantlib. This means that if you have 1000's of sets of parameters you want calculated, Symphony will run those calculations in parallel and give you a result faster than running all those calculations on one machine. This project is still in progress, so we still need to do some optimizations to make Quantlib run well on Symphony. - Ajith |
| |||
|
The archive vanillaDE.zip contains a Symphony DE 4.0 application named vanillaDE that computes the modules of the Vanilla Option Engine of the library QuantLib 0.9.0. In particular 25 functions are implemented: 01. Black-Scholes 02. Barone-Adesi/Whaley 03. Bierksund/Stensland 04. Integral 05. Finite Differences 06. Binomial Jarrow-Rudd 07. Binomial Cox-Ross-Rubistein 08. Binomial equiprobabilities 09. Binomial Trigeorgis 10. Binomial Tian 11. Binomial Leisen-Reimer 12. Binomial Joshi 13. MC (crude) 14. QMC (Sobol) 15. MC (Longstaff Svhwartz) 16. Digital payoff 17. Discrete dividends 18. Bates 19. Ju 20. FD for dividend options 21. Heston 22. Black-Scholes with Hull-White 23. Heston with Hull-White 24. MC (crude) Heston 25. QMC (Sobol) Heston The vanillaDE application reads the input data from a file and writes the results on a file named result.txt and on the video. We provide two files: template_data.txt and example.txt a) template_data.txt explains how the user must provide the input data according with the module number (i.e.: 01 (Black Scholes), 02 (Barone Adesi/Whaley, ...,25 (QMC (Sobol) Heston)). b) example.txt is an input file that contains a test case for each set of input parameters required by the modules. Remind that in order to generate the executable version of vanillaDE the user must run the makefile contained in the directories: mathlib, common, service, client. Note that in the makefile contained in the directory mathlib the user must change two paths that refer to the QuantLib-0.9.0.a: LIBF2C = insert the path to /lib/libQuantLib-0.9.0.a and that refer to the boost: $(G++) -I insert path to Quantlib --> /include -I insert path to boost --> /boost/include/boost-1_33_1 -c EquityOption1.cpp Note that in the makefile contained in the directory service the user must change a path that refers to the QuantLib-0.9.0.a: MATT= insert the path to /lib/libQuantLib-0.9.0.a Regards Francesco |
![]() |
| Tags |
| black-scholes, boost, monte carlo, option pricing, quantitative analysis, quantlib, symphony |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|