Example #1
0
  /**
   * Creates a trade based on this template.
   *
   * <p>This returns a trade based on the specified date. The notional is unsigned, with buy/sell
   * determining the direction of the trade. If buying the FRA, the floating rate is received from
   * the counterparty, with the fixed rate being paid. If selling the FRA, the floating rate is paid
   * to the counterparty, with the fixed rate being received.
   *
   * @param tradeDate the date of the trade
   * @param buySell the buy/sell flag, see {@link Fra#getBuySell()}
   * @param notional the notional amount, in the payment currency of the template
   * @param fixedRate the fixed rate, typically derived from the market
   * @param refData the reference data, used to resolve the trade dates
   * @return the trade
   * @throws ReferenceDataNotFoundException if an identifier cannot be resolved in the reference
   *     data
   */
  public FraTrade createTrade(
      LocalDate tradeDate,
      BuySell buySell,
      double notional,
      double fixedRate,
      ReferenceData refData) {

    return convention.createTrade(
        tradeDate, periodToStart, periodToEnd, buySell, notional, fixedRate, refData);
  }
Example #2
0
 /**
  * Obtains a template based on the specified period and index.
  *
  * <p>The period from the spot date to the start date is specified. The period from the spot date
  * to the end date will be the period to start plus the tenor of the index.
  *
  * <p>For example, a '2 x 5' FRA has a period to the start date of 2 months. The index will be a 3
  * month index, such as 'USD-LIBOR-3M'. The period to the end date will be the period to the start
  * date plus the index tenor.
  *
  * @param periodToStart the period between the spot date and the start date
  * @param index the index that defines the market convention
  * @return the template
  */
 public static FraTemplate of(Period periodToStart, IborIndex index) {
   return of(
       periodToStart, periodToStart.plus(index.getTenor().getPeriod()), FraConvention.of(index));
 }