示例#1
0
 private FxSwapTemplate(Period periodToNear, Period periodToFar, FxSwapConvention convention)
 {
     JodaBeanUtils.notNull(periodToNear, "periodToNear");
     JodaBeanUtils.notNull(periodToFar, "periodToFar");
     JodaBeanUtils.notNull(convention, "convention");
     this.periodToNear = periodToNear;
     this.periodToFar  = periodToFar;
     this.convention   = convention;
     validate();
 }
示例#2
0
        private static CurveNode curveFxSwapCurveNode(string conventionStr, string timeStr, string label, QuoteId quoteId, double spread, CurveNodeDate date, CurveNodeDateOrder order)
        {
            if (!DoubleMath.fuzzyEquals(spread, 0d, 1e-10d))
            {
                throw new System.ArgumentException("Additional spread must be zero for FX swaps");
            }
            Matcher matcher = SIMPLE_YMD_TIME_REGEX.matcher(timeStr.ToUpper(Locale.ENGLISH));

            if (!matcher.matches())
            {
                throw new System.ArgumentException(Messages.format("Invalid time format for FX swap: {}", timeStr));
            }
            Period           periodToEnd = Period.parse("P" + matcher.group(1));
            FxSwapConvention convention  = FxSwapConvention.of(conventionStr);
            FxSwapTemplate   template    = FxSwapTemplate.of(periodToEnd, convention);

            return(FxSwapCurveNode.builder().template(template).farForwardPointsId(quoteId).label(label).date(date).dateOrder(order).build());
        }
示例#3
0
            public override Builder set(string propertyName, object newValue)
            {
                switch (propertyName.GetHashCode())
                {
                case -18701724:         // periodToNear
                    this.periodToNear_Renamed = (Period)newValue;
                    break;

                case -970442405:         // periodToFar
                    this.periodToFar_Renamed = (Period)newValue;
                    break;

                case 2039569265:         // convention
                    this.convention_Renamed = (FxSwapConvention)newValue;
                    break;

                default:
                    throw new NoSuchElementException("Unknown property: " + propertyName);
                }
                return(this);
            }
示例#4
0
 //-------------------------------------------------------------------------
 /// <summary>
 /// Obtains a template based on the specified period and convention.
 /// <para>
 /// The near date is equal to the spot date.
 /// The period from the spot date to the far date is specified
 /// </para>
 /// <para>
 /// For example, a '6M' FX swap has a near leg on the spot date and a period from spot to the far date of 6 months
 ///
 /// </para>
 /// </summary>
 /// <param name="periodToFar">  the period between the spot date and the far date </param>
 /// <param name="convention">  the market convention </param>
 /// <returns> the template </returns>
 public static FxSwapTemplate of(Period periodToFar, FxSwapConvention convention)
 {
     return(FxSwapTemplate.builder().periodToNear(Period.ZERO).periodToFar(periodToFar).convention(convention).build());
 }
示例#5
0
 /// <summary>
 /// Sets the underlying FX Swap convention.
 /// <para>
 /// This specifies the market convention of the FX Swap to be created.
 /// </para>
 /// </summary>
 /// <param name="convention">  the new value, not null </param>
 /// <returns> this, for chaining, not null </returns>
 public Builder convention(FxSwapConvention convention)
 {
     JodaBeanUtils.notNull(convention, "convention");
     this.convention_Renamed = convention;
     return(this);
 }
示例#6
0
 /// <summary>
 /// Restricted copy constructor. </summary>
 /// <param name="beanToCopy">  the bean to copy from, not null </param>
 internal Builder(FxSwapTemplate beanToCopy)
 {
     this.periodToNear_Renamed = beanToCopy.PeriodToNear;
     this.periodToFar_Renamed  = beanToCopy.PeriodToFar;
     this.convention_Renamed   = beanToCopy.Convention;
 }