📄 rq_fpml_product_swaption.c
字号:
/*** rq_fpml_product_swaption.c**** Written by Brett Hutley - brett@hutley.net**** Copyright (C) 2001 Brett Hutley**** This file is part of the Risk Quantify Library**** Risk Quantify is free software; you can redistribute it and/or** modify it under the terms of the GNU Library General Public** License as published by the Free Software Foundation; either** version 2 of the License, or (at your option) any later version.**** Risk Quantify is distributed in the hope that it will be useful,** but WITHOUT ANY WARRANTY; without even the implied warranty of** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU** Library General Public License for more details.**** You should have received a copy of the GNU Library General Public** License along with Risk Quantify; if not, write to the Free** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA*/#include "fpml/rq_fpml_product_swaption.h"#include "fpml/rq_fpml_swap.h"#include "fpml/rq_fpml_swaption_adjusted_dates.h"#include "fpml/rq_fpml_cash_settlement.h"#include "fpml/rq_fpml_exercise_procedure.h"#include "fpml/rq_fpml_american_exercise.h"#include "fpml/rq_fpml_bermudan_exercise.h"#include "fpml/rq_fpml_european_exercise.h"#include "fpml/rq_fpml_payment.h"#include <stdlib.h>#include <string.h>/* -- structures --------------------------------------------------- */struct rq_fpml_product_swaption { const char * product_type; const char * product_id; const char * buyer_party_reference; const char * seller_party_reference; struct rq_fpml_payment premium; struct rq_fpml_european_exercise *european_exercise; struct rq_fpml_bermudan_exercise *bermudan_exercise; struct rq_fpml_american_exercise *american_exercise; struct rq_fpml_exercise_procedure exercise_procedure; const char * calculation_agent_party_reference; struct rq_fpml_cash_settlement cash_settlement; short swaption_straddle; struct rq_fpml_swaption_adjusted_dates swaption_adjusted_dates; struct rq_fpml_swap swap;};/* -- globals ------------------------------------------------------ */const char *rq_fpml_product_swaption_product_type = "swaption";/* -- code --------------------------------------------------------- */static void rq_fpml_product_swaption_free(void *product_data){ struct rq_fpml_product_swaption *p = (struct rq_fpml_product_swaption *)product_data; free(p);}intrq_fpml_product_swaption_write_xml(void *product_data, rq_stream_t output_stream){ struct rq_fpml_product_swaption *p = (struct rq_fpml_product_swaption *)product_data; int status = 0; rq_stream_write_string(output_stream, "<swaption>"); rq_stream_write_string(output_stream, "<buyerPartyReference href=\"#partyA\"/>"); rq_stream_write_string(output_stream, "<sellerPartyReference href=\"#partyB\"/>"); rq_stream_write_string(output_stream, "<premium>"); rq_stream_write_string(output_stream, "<payerPartyReference href=\"#partyA\"/>"); rq_stream_write_string(output_stream, "<receiverPartyReference href=\"#partyB\"/>"); rq_stream_write_string(output_stream, "<paymentAmount>"); rq_stream_write_string(output_stream, "<currency>EUR</currency>"); rq_stream_write_string(output_stream, "<amount>100000</amount>"); rq_stream_write_string(output_stream, "</paymentAmount>"); rq_stream_write_string(output_stream, "<paymentDate>"); rq_stream_write_string(output_stream, "<unadjustedDate>2000-08-30</unadjustedDate>"); rq_stream_write_string(output_stream, "<dateAdjustments>"); rq_stream_write_string(output_stream, "<businessDayConvention>FOLLOWING</businessDayConvention>"); rq_stream_write_string(output_stream, "<businessCenters>"); rq_stream_write_string(output_stream, "<businessCenter>EUTA</businessCenter>"); rq_stream_write_string(output_stream, "</businessCenters>"); rq_stream_write_string(output_stream, "</dateAdjustments>"); rq_stream_write_string(output_stream, "</paymentDate>"); rq_stream_write_string(output_stream, "</premium>"); rq_stream_write_string(output_stream, "<europeanExercise>"); rq_stream_write_string(output_stream, "<expirationDate>"); rq_stream_write_string(output_stream, "<adjustableDate>"); rq_stream_write_string(output_stream, "<unadjustedDate>2001-08-28</unadjustedDate>"); rq_stream_write_string(output_stream, "<dateAdjustments>"); rq_stream_write_string(output_stream, "<businessDayConvention>FOLLOWING</businessDayConvention>"); rq_stream_write_string(output_stream, "<businessCenters>"); rq_stream_write_string(output_stream, "<businessCenter>EUTA</businessCenter>"); rq_stream_write_string(output_stream, "<businessCenter>GBLO</businessCenter>"); rq_stream_write_string(output_stream, "</businessCenters>"); rq_stream_write_string(output_stream, "</dateAdjustments>"); rq_stream_write_string(output_stream, "</adjustableDate>"); rq_stream_write_string(output_stream, "</expirationDate>"); rq_stream_write_string(output_stream, "<earliestExerciseTime>"); rq_stream_write_string(output_stream, "<hourMinuteTime>09:00</hourMinuteTime>"); rq_stream_write_string(output_stream, "<businessCenter>BEBR</businessCenter>"); rq_stream_write_string(output_stream, "</earliestExerciseTime>"); rq_stream_write_string(output_stream, "<expirationTime>"); rq_stream_write_string(output_stream, "<hourMinuteTime>11:00</hourMinuteTime>"); rq_stream_write_string(output_stream, "<businessCenter>BEBR</businessCenter>"); rq_stream_write_string(output_stream, "</expirationTime>"); rq_stream_write_string(output_stream, "</europeanExercise>"); rq_stream_write_string(output_stream, "<exerciseProcedure>"); rq_stream_write_string(output_stream, "<manualExercise>"); rq_stream_write_string(output_stream, "<exerciseNotice>"); rq_stream_write_string(output_stream, "<partyReference href=\"#partyB\"/>"); rq_stream_write_string(output_stream, "<businessCenter>GBLO</businessCenter>"); rq_stream_write_string(output_stream, "</exerciseNotice>"); rq_stream_write_string(output_stream, "</manualExercise>"); rq_stream_write_string(output_stream, "<followUpConfirmation>true</followUpConfirmation>"); rq_stream_write_string(output_stream, "</exerciseProcedure>"); rq_stream_write_string(output_stream, "<calculationAgentPartyReference href=\"#partyB\"/>"); rq_stream_write_string(output_stream, "<swaptionStraddle>false</swaptionStraddle>"); rq_stream_write_string(output_stream, "<swap>"); rq_stream_write_string(output_stream, "<swapStream>"); rq_stream_write_string(output_stream, "<payerPartyReference href=\"#partyA\"/>"); rq_stream_write_string(output_stream, "<receiverPartyReference href=\"#partyB\"/>"); rq_stream_write_string(output_stream, "<calculationPeriodDates id=\"CalcPeriodDates0\">"); rq_stream_write_string(output_stream, "<effectiveDate>"); rq_stream_write_string(output_stream, "<unadjustedDate>2001-08-30</unadjustedDate>"); rq_stream_write_string(output_stream, "<dateAdjustments>"); rq_stream_write_string(output_stream, "<businessDayConvention>NONE</businessDayConvention>"); rq_stream_write_string(output_stream, "</dateAdjustments>"); rq_stream_write_string(output_stream, "</effectiveDate>"); rq_stream_write_string(output_stream, "<terminationDate>"); rq_stream_write_string(output_stream, "<unadjustedDate>2006-08-30</unadjustedDate>"); rq_stream_write_string(output_stream, "<dateAdjustments>"); rq_stream_write_string(output_stream, "<businessDayConvention>MODFOLLOWING</businessDayConvention>"); rq_stream_write_string(output_stream, "<businessCenters id=\"accrualBusinessCenters0\">"); rq_stream_write_string(output_stream, "<businessCenter>EUTA</businessCenter>"); rq_stream_write_string(output_stream, "</businessCenters>"); rq_stream_write_string(output_stream, "</dateAdjustments>"); rq_stream_write_string(output_stream, "</terminationDate>");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -