Example #1
0
        public virtual void test_of_wrongCounterCurrency()
        {
            ResolvedFxSingle nearLeg = ResolvedFxSingle.of(USD_P1550, EUR_P1590.negated(), DATE_2011_11_21);
            ResolvedFxSingle farLeg  = ResolvedFxSingle.of(GBP_M1000, EUR_P1590, DATE_2011_12_21);

            assertThrowsIllegalArg(() => ResolvedFxSwap.of(nearLeg, farLeg));
        }
Example #2
0
        internal static ResolvedFxSwap sut2()
        {
            ResolvedFxSingle nearLeg = ResolvedFxSingle.of(CurrencyAmount.of(GBP, 1_100), CurrencyAmount.of(USD, -1_650), DATE_2011_11_21);
            ResolvedFxSingle farLeg  = ResolvedFxSingle.of(CurrencyAmount.of(GBP, -1_100), CurrencyAmount.of(USD, 1_750), DATE_2011_12_21);

            return(ResolvedFxSwap.of(nearLeg, farLeg));
        }
Example #3
0
        //-------------------------------------------------------------------------
        public virtual void test_of()
        {
            ResolvedFxSwap test = sut();

            assertEquals(test.NearLeg, NEAR_LEG);
            assertEquals(test.FarLeg, FAR_LEG);
        }
 private ResolvedFxSwapTrade(TradeInfo info, ResolvedFxSwap product)
 {
     JodaBeanUtils.notNull(info, "info");
     JodaBeanUtils.notNull(product, "product");
     this.info    = info;
     this.product = product;
 }
Example #5
0
        //-------------------------------------------------------------------------
        public virtual void test_resolve()
        {
            FxSwap         @base = sut();
            ResolvedFxSwap test  = @base.resolve(REF_DATA);

            assertEquals(test.NearLeg, NEAR_LEG.resolve(REF_DATA));
            assertEquals(test.FarLeg, FAR_LEG.resolve(REF_DATA));
        }
Example #6
0
        public virtual void test_ofForwardPoints()
        {
            double           nearRate   = 1.6;
            double           fwdPoint   = 0.1;
            ResolvedFxSwap   test       = ResolvedFxSwap.ofForwardPoints(GBP_P1000, USD, nearRate, fwdPoint, DATE_2011_11_21, DATE_2011_12_21);
            ResolvedFxSingle nearLegExp = ResolvedFxSingle.of(GBP_P1000, CurrencyAmount.of(USD, -1000.0 * nearRate), DATE_2011_11_21);
            ResolvedFxSingle farLegExp  = ResolvedFxSingle.of(GBP_M1000, CurrencyAmount.of(USD, 1000.0 * (nearRate + fwdPoint)), DATE_2011_12_21);

            assertEquals(test.NearLeg, nearLegExp);
            assertEquals(test.FarLeg, farLegExp);
        }
Example #7
0
 //-----------------------------------------------------------------------
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         ResolvedFxSwap other = (ResolvedFxSwap)obj;
         return(JodaBeanUtils.equal(nearLeg, other.nearLeg) && JodaBeanUtils.equal(farLeg, other.farLeg));
     }
     return(false);
 }
            public override Builder set(string propertyName, object newValue)
            {
                switch (propertyName.GetHashCode())
                {
                case 3237038:         // info
                    this.info_Renamed = (TradeInfo)newValue;
                    break;

                case -309474065:         // product
                    this.product_Renamed = (ResolvedFxSwap)newValue;
                    break;

                default:
                    throw new NoSuchElementException("Unknown property: " + propertyName);
                }
                return(this);
            }
Example #9
0
        public virtual void test_of_sameSign()
        {
            ResolvedFxSingle farLeg = ResolvedFxSingle.of(GBP_M1000.negated(), USD_P1550.negated(), DATE_2011_12_21);

            assertThrowsIllegalArg(() => ResolvedFxSwap.of(NEAR_LEG, farLeg));
        }
Example #10
0
        public virtual void test_of_wrongBaseCurrency()
        {
            ResolvedFxSingle nearLeg = ResolvedFxSingle.of(EUR_P1590, USD_M1600, DATE_2011_11_21);

            assertThrowsIllegalArg(() => ResolvedFxSwap.of(nearLeg, FAR_LEG));
        }
Example #11
0
 public virtual void test_of_wrongOrder()
 {
     assertThrowsIllegalArg(() => ResolvedFxSwap.of(FAR_LEG, NEAR_LEG));
 }
Example #12
0
 //-------------------------------------------------------------------------
 internal static ResolvedFxSwap sut()
 {
     return(ResolvedFxSwap.of(NEAR_LEG, FAR_LEG));
 }
 //-------------------------------------------------------------------------
 /// <summary>
 /// Obtains an instance of a resolved FX swap trade.
 /// </summary>
 /// <param name="info">  the trade info </param>
 /// <param name="product">  the product </param>
 /// <returns> the resolved trade </returns>
 public static ResolvedFxSwapTrade of(TradeInfo info, ResolvedFxSwap product)
 {
     return(new ResolvedFxSwapTrade(info, product));
 }
 /// <summary>
 /// Sets the resolved FX swap product.
 /// <para>
 /// The product captures the contracted financial details of the trade.
 /// </para>
 /// </summary>
 /// <param name="product">  the new value, not null </param>
 /// <returns> this, for chaining, not null </returns>
 public Builder product(ResolvedFxSwap product)
 {
     JodaBeanUtils.notNull(product, "product");
     this.product_Renamed = product;
     return(this);
 }
 /// <summary>
 /// Restricted copy constructor. </summary>
 /// <param name="beanToCopy">  the bean to copy from, not null </param>
 internal Builder(ResolvedFxSwapTrade beanToCopy)
 {
     this.info_Renamed    = beanToCopy.Info;
     this.product_Renamed = beanToCopy.Product;
 }