예제 #1
0
        //-------------------------------------------------------------------------
        /// <summary>
        /// Creates an identifier for a contract specification.
        /// <para>
        /// This will have the format:
        /// {@code 'OG-ETD~F-ECAG-FGBS'} or {@code 'OG-ETD~O-ECAG-OGBS'}.
        ///
        /// </para>
        /// </summary>
        /// <param name="type">  type of the contract - future or option </param>
        /// <param name="exchangeId">  the MIC code of the exchange where the instruments are traded </param>
        /// <param name="contractCode">  the code supplied by the exchange for use in clearing and margining, such as in SPAN </param>
        /// <returns> the identifier </returns>
        public static EtdContractSpecId contractSpecId(EtdType type, ExchangeId exchangeId, EtdContractCode contractCode)
        {
            ArgChecker.notNull(type, "type");
            ArgChecker.notNull(exchangeId, "exchangeId");
            ArgChecker.notNull(contractCode, "contractCode");
            switch (type.innerEnumValue)
            {
            case com.opengamma.strata.product.etd.EtdType.InnerEnum.FUTURE:
                return(EtdContractSpecId.of(ETD_SCHEME, FUT_PREFIX + exchangeId + SEPARATOR + contractCode));

            case com.opengamma.strata.product.etd.EtdType.InnerEnum.OPTION:
                return(EtdContractSpecId.of(ETD_SCHEME, OPT_PREFIX + exchangeId + SEPARATOR + contractCode));

            default:
                throw new System.ArgumentException("Unknown ETD type: " + type);
            }
        }
 public virtual void test_of_lookup_null()
 {
     assertThrows(() => EtdType.of(null), typeof(System.ArgumentException));
 }
 public virtual void test_of_lookup_notFound()
 {
     assertThrows(() => EtdType.of("Rubbish"), typeof(System.ArgumentException));
 }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(dataProvider = "name") public void test_of_lookup(EtdType convention, String name)
        public virtual void test_of_lookup(EtdType convention, string name)
        {
            assertEquals(EtdType.of(name), convention);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(dataProvider = "name") public void test_toString(EtdType convention, String name)
        public virtual void test_toString(EtdType convention, string name)
        {
            assertEquals(convention.ToString(), name);
        }
 /// <summary>
 /// Sets the type of the contract specification.
 /// </summary>
 /// <param name="productType">  the new value, not null </param>
 /// <returns> this, for chaining, not null </returns>
 public EtdContractSpecBuilder type(EtdType productType)
 {
     JodaBeanUtils.notNull(productType, "productType");
     this.type_Renamed = productType;
     return(this);
 }