⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rq_fpml_product_capfloor.c

📁 风险财务控制库 Risk Quantify is an open source financial library, with a focus on managing the risk of fi
💻 C
字号:
/*** rq_fpml_product_capfloor.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_capfloor.h"#include <stdlib.h>#include <string.h>/* -- structures --------------------------------------------------- */struct rq_fpml_product_capfloor {    const char *payer_party_id;    const char *receiver_party_id;    struct rq_fpml_calculation_period_dates calculation_period_dates;};/* -- globals ------------------------------------------------------ */const char *rq_fpml_product_capfloor_product_type = "capfloor";/* -- code --------------------------------------------------------- */static void rq_fpml_product_capfloor_free(void *product_data){    struct rq_fpml_product_capfloor *p =         (struct rq_fpml_product_capfloor *)product_data;    free(p);}intrq_fpml_product_capfloor_write_xml(void *product_data, rq_stream_t output_stream){    struct rq_fpml_product_capfloor *p =         (struct rq_fpml_product_capfloor *)product_data;    int status = 0;    rq_stream_write_string(output_stream, "<capFloor>");    rq_stream_write_string(output_stream, "<capFloorStream>");    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-06-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-06-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>GBLO</businessCenter>");    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>");    rq_stream_write_string(output_stream, "<calculationPeriodDatesAdjustments>");    rq_stream_write_string(output_stream, "<businessDayConvention>MODFOLLOWING</businessDayConvention>");    rq_stream_write_string(output_stream, "<businessCentersReference href=\"#accrualBusinessCenters0\"/>");    rq_stream_write_string(output_stream, "</calculationPeriodDatesAdjustments>");    rq_stream_write_string(output_stream, "<calculationPeriodFrequency>");    rq_stream_write_string(output_stream, "<periodMultiplier>6</periodMultiplier>");    rq_stream_write_string(output_stream, "<period>M</period>");    rq_stream_write_string(output_stream, "<rollConvention>30</rollConvention>");    rq_stream_write_string(output_stream, "</calculationPeriodFrequency>");    rq_stream_write_string(output_stream, "</calculationPeriodDates>");    rq_stream_write_string(output_stream, "<paymentDates>");    rq_stream_write_string(output_stream, "<calculationPeriodDatesReference href=\"#CalcPeriodDates0\"/>");    rq_stream_write_string(output_stream, "<paymentFrequency>");    rq_stream_write_string(output_stream, "<periodMultiplier>6</periodMultiplier>");    rq_stream_write_string(output_stream, "<period>M</period>");    rq_stream_write_string(output_stream, "</paymentFrequency>");    rq_stream_write_string(output_stream, "<payRelativeTo>CalculationPeriodEndDate</payRelativeTo>");    rq_stream_write_string(output_stream, "<paymentDatesAdjustments>");    rq_stream_write_string(output_stream, "<businessDayConvention>MODFOLLOWING</businessDayConvention>");    rq_stream_write_string(output_stream, "<businessCenters id=\"paymentBusinessCenters0\">");    rq_stream_write_string(output_stream, "<businessCenter>GBLO</businessCenter>");    rq_stream_write_string(output_stream, "<businessCenter>EUTA</businessCenter>");    rq_stream_write_string(output_stream, "</businessCenters>");    rq_stream_write_string(output_stream, "</paymentDatesAdjustments>");    rq_stream_write_string(output_stream, "</paymentDates>");    rq_stream_write_string(output_stream, "<resetDates id=\"resetDates0\">");    rq_stream_write_string(output_stream, "<calculationPeriodDatesReference href=\"#CalcPeriodDates0\"/>");    rq_stream_write_string(output_stream, "<resetRelativeTo>CalculationPeriodStartDate</resetRelativeTo>");    rq_stream_write_string(output_stream, "<fixingDates>");    rq_stream_write_string(output_stream, "<periodMultiplier>-2</periodMultiplier>");    rq_stream_write_string(output_stream, "<period>D</period>");    rq_stream_write_string(output_stream, "<dayType>Business</dayType>");    rq_stream_write_string(output_stream, "<businessDayConvention>NONE</businessDayConvention>");    rq_stream_write_string(output_stream, "<businessCenters id=\"resetBusinessCenters0\">");    rq_stream_write_string(output_stream, "<businessCenter>EUTA</businessCenter>");    rq_stream_write_string(output_stream, "</businessCenters>");    rq_stream_write_string(output_stream, "<dateRelativeTo href=\"#resetDates0\">ResetDate</dateRelativeTo>");    rq_stream_write_string(output_stream, "</fixingDates>");    rq_stream_write_string(output_stream, "<resetFrequency>");    rq_stream_write_string(output_stream, "<periodMultiplier>6</periodMultiplier>");    rq_stream_write_string(output_stream, "<period>M</period>");    rq_stream_write_string(output_stream, "</resetFrequency>");    rq_stream_write_string(output_stream, "<resetDatesAdjustments>");    rq_stream_write_string(output_stream, "<businessDayConvention>MODFOLLOWING</businessDayConvention>");    rq_stream_write_string(output_stream, "<businessCentersReference href=\"#resetBusinessCenters0\"/>");    rq_stream_write_string(output_stream, "</resetDatesAdjustments>");    rq_stream_write_string(output_stream, "</resetDates>");    rq_stream_write_string(output_stream, "<calculationPeriodAmount>");    rq_stream_write_string(output_stream, "<calculation>");    rq_stream_write_string(output_stream, "<notionalSchedule>");    rq_stream_write_string(output_stream, "<notionalStepSchedule>");    rq_stream_write_string(output_stream, "<initialValue>100000000</initialValue>");    rq_stream_write_string(output_stream, "<currency>EUR</currency>");    rq_stream_write_string(output_stream, "</notionalStepSchedule>");    rq_stream_write_string(output_stream, "</notionalSchedule>");    rq_stream_write_string(output_stream, "<floatingRateCalculation>");    rq_stream_write_string(output_stream, "<floatingRateIndex>EUR-EURIBOR-Telerate</floatingRateIndex>");    rq_stream_write_string(output_stream, "<indexTenor>");    rq_stream_write_string(output_stream, "<periodMultiplier>6</periodMultiplier>");    rq_stream_write_string(output_stream, "<period>M</period>");    rq_stream_write_string(output_stream, "</indexTenor>");    rq_stream_write_string(output_stream, "<floorRateSchedule>");    rq_stream_write_string(output_stream, "<initialValue>0.04</initialValue>");    rq_stream_write_string(output_stream, "<step>");    rq_stream_write_string(output_stream, "<stepDate>2002-06-30</stepDate>");    rq_stream_write_string(output_stream, "<stepValue>0.0425</stepValue>");    rq_stream_write_string(output_stream, "</step>");    rq_stream_write_string(output_stream, "<step>");    rq_stream_write_string(output_stream, "<stepDate>2003-06-30</stepDate>");    rq_stream_write_string(output_stream, "<stepValue>0.045</stepValue>");    rq_stream_write_string(output_stream, "</step>");    rq_stream_write_string(output_stream, "<step>");    rq_stream_write_string(output_stream, "<stepDate>2004-06-30</stepDate>");    rq_stream_write_string(output_stream, "<stepValue>0.0475</stepValue>");    rq_stream_write_string(output_stream, "</step>");    rq_stream_write_string(output_stream, "<step>");    rq_stream_write_string(output_stream, "<stepDate>2005-06-30</stepDate>");    rq_stream_write_string(output_stream, "<stepValue>0.05</stepValue>");    rq_stream_write_string(output_stream, "</step>");    rq_stream_write_string(output_stream, "<buyer>Receiver</buyer>");    rq_stream_write_string(output_stream, "<seller>Payer</seller>");    rq_stream_write_string(output_stream, "</floorRateSchedule>");    rq_stream_write_string(output_stream, "</floatingRateCalculation>");    rq_stream_write_string(output_stream, "<dayCountFraction>ACT/360</dayCountFraction>");    rq_stream_write_string(output_stream, "</calculation>");    rq_stream_write_string(output_stream, "</calculationPeriodAmount>");    rq_stream_write_string(output_stream, "</capFloorStream>");    rq_stream_write_string(output_stream, "</capFloor>");    return status;}rq_fpml_product_t rq_fpml_product_capfloor_alloc(){    struct rq_fpml_product_capfloor *p =         (struct rq_fpml_product_capfloor *)calloc(1, sizeof(struct rq_fpml_product_capfloor));    rq_fpml_product_t product = _rq_fpml_product_alloc(        rq_fpml_product_capfloor_product_type,        p,        rq_fpml_product_capfloor_write_xml,        rq_fpml_product_capfloor_free        );    return product;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -