public override EvaluationResult evaluate(Security security, CalculationFunctions functions, string firstToken, IList <string> remainingTokens)
        {
            MetaBean metaBean = MetaBean.of(security.GetType());

            // security
            Optional <string> securityPropertyName = metaBean.metaPropertyMap().Keys.Where(p => p.equalsIgnoreCase(firstToken)).First();

            if (securityPropertyName.Present)
            {
                object propertyValue = metaBean.metaProperty(securityPropertyName.get()).get((Bean)security);
                return(propertyValue != null?EvaluationResult.success(propertyValue, remainingTokens) : EvaluationResult.failure("Property '{}' not set", firstToken));
            }

            // security info
            Optional <string> securityInfoPropertyName = security.Info.propertyNames().Where(p => p.equalsIgnoreCase(firstToken)).First();

            if (securityInfoPropertyName.Present)
            {
                object propertyValue = security.Info.property(securityInfoPropertyName.get()).get();
                return(propertyValue != null?EvaluationResult.success(propertyValue, remainingTokens) : EvaluationResult.failure("Property '{}' not set", firstToken));
            }

            // security price info
            Optional <string> securityPriceInfoPropertyName = security.Info.PriceInfo.propertyNames().Where(p => p.equalsIgnoreCase(firstToken)).First();

            if (securityPriceInfoPropertyName.Present)
            {
                object propertyValue = security.Info.PriceInfo.property(securityPriceInfoPropertyName.get()).get();
                return(propertyValue != null?EvaluationResult.success(propertyValue, remainingTokens) : EvaluationResult.failure("Property '{}' not set", firstToken));
            }

            // not found
            return(invalidTokenFailure(security, firstToken));
        }
示例#2
0
        public override EvaluationResult evaluate(Trade trade, CalculationFunctions functions, string firstToken, IList <string> remainingTokens)
        {
            MetaBean metaBean = MetaBean.of(trade.GetType());

            // trade
            Optional <string> tradePropertyName = metaBean.metaPropertyMap().Keys.Where(p => p.equalsIgnoreCase(firstToken)).First();

            if (tradePropertyName.Present)
            {
                object propertyValue = metaBean.metaProperty(tradePropertyName.get()).get((Bean)trade);
                if (propertyValue == null)
                {
                    return(EvaluationResult.failure("Property '{}' not set", firstToken));
                }
                return(EvaluationResult.success(propertyValue, remainingTokens));
            }

            // trade info
            Optional <string> tradeInfoPropertyName = trade.Info.propertyNames().Where(p => p.equalsIgnoreCase(firstToken)).First();

            if (tradeInfoPropertyName.Present)
            {
                object propertyValue = trade.Info.property(tradeInfoPropertyName.get()).get();
                if (propertyValue == null)
                {
                    return(EvaluationResult.failure("Property '{}' not set", firstToken));
                }
                return(EvaluationResult.success(propertyValue, remainingTokens));
            }
            return(invalidTokenFailure(trade, firstToken));
        }
        public override EvaluationResult evaluate(Position position, CalculationFunctions functions, string firstToken, IList <string> remainingTokens)
        {
            MetaBean metaBean = MetaBean.of(position.GetType());

            // position
            Optional <string> positionPropertyName = metaBean.metaPropertyMap().Keys.Where(p => p.equalsIgnoreCase(firstToken)).First();

            if (positionPropertyName.Present)
            {
                object propertyValue = metaBean.metaProperty(positionPropertyName.get()).get((Bean)position);
                return(propertyValue != null?EvaluationResult.success(propertyValue, remainingTokens) : EvaluationResult.failure("Property '{}' not set", firstToken));
            }

            // position info
            Optional <string> positionInfoPropertyName = position.Info.propertyNames().Where(p => p.equalsIgnoreCase(firstToken)).First();

            if (positionInfoPropertyName.Present)
            {
                object propertyValue = position.Info.property(positionInfoPropertyName.get()).get();
                return(propertyValue != null?EvaluationResult.success(propertyValue, remainingTokens) : EvaluationResult.failure("Property '{}' not set", firstToken));
            }

            // not found
            return(invalidTokenFailure(position, firstToken));
        }
 static HalfUpRounding()
 {
     for (int i = 0; i < 16; i++)
     {
         CACHE[i] = new HalfUpRounding(i, 0);
     }
     MetaBean.register(HalfUpRounding.Meta.INSTANCE);
 }
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: @Override public org.joda.beans.MetaProperty<?> findMetaProperty(Class beanType, org.joda.beans.MetaBean metaBean, String propertyName)
        public override MetaProperty <object> findMetaProperty(Type beanType, MetaBean metaBean, string propertyName)
        {
            try
            {
                return(metaBean.metaProperty(propertyName));
            }
            catch (NoSuchElementException ex)
            {
                if (HOLIDAYS.name().Equals(propertyName))
                {
                    return(HOLIDAYS);
                }
                if (WEEKEND_DAYS.name().Equals(propertyName))
                {
                    return(WEEKEND_DAYS);
                }
                throw ex;
            }
        }
示例#6
0
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: @Override public org.joda.beans.MetaProperty<?> findMetaProperty(Class beanType, org.joda.beans.MetaBean metaBean, String propertyName)
        public override MetaProperty <object> findMetaProperty(Type beanType, MetaBean metaBean, string propertyName)
        {
            try
            {
                return(metaBean.metaProperty(propertyName));
            }
            catch (NoSuchElementException ex)
            {
                if (BASE_CURRENCY_AMOUNT.name().Equals(propertyName))
                {
                    return(BASE_CURRENCY_AMOUNT);
                }
                if (COUNTER_CURRENCY_AMOUNT.name().Equals(propertyName))
                {
                    return(COUNTER_CURRENCY_AMOUNT);
                }
                if (PAYMENT_DATE.name().Equals(propertyName))
                {
                    return(PAYMENT_DATE);
                }
                throw ex;
            }
        }
 static BlackFxOptionFlatVolatilities()
 {
     MetaBean.register(BlackFxOptionFlatVolatilities.Meta.INSTANCE);
 }
 static BlackIborCapletFloorletExpiryStrikeVolatilities()
 {
     MetaBean.register(BlackIborCapletFloorletExpiryStrikeVolatilities.Meta.INSTANCE);
 }
示例#9
0
 static OvernightIborSwapTemplate()
 {
     MetaBean.register(OvernightIborSwapTemplate.Meta.INSTANCE);
 }
 static ConstantRecoveryRates()
 {
     MetaBean.register(ConstantRecoveryRates.Meta.INSTANCE);
 }
 static SwaptionSurfaceExpiryStrikeParameterMetadata()
 {
     MetaBean.register(SwaptionSurfaceExpiryStrikeParameterMetadata.Meta.INSTANCE);
 }
示例#12
0
 static CompositeCalculationFunctions()
 {
     MetaBean.register(META_BEAN);
 }
 static DefaultFxOptionScenarioMarketData()
 {
     MetaBean.register(META_BEAN);
 }
 static MoneynessStrike()
 {
     MetaBean.register(MoneynessStrike.Meta.INSTANCE);
 }
示例#15
0
 static FxSwapTemplate()
 {
     MetaBean.register(FxSwapTemplate.Meta.INSTANCE);
 }
示例#16
0
 static SimpleRatesProvider()
 {
     MetaBean.register(META_BEAN);
 }
示例#17
0
 static ResolvedBulletPaymentTrade()
 {
     MetaBean.register(ResolvedBulletPaymentTrade.Meta.INSTANCE);
 }
 static InflationEndMonthRateComputation()
 {
     MetaBean.register(InflationEndMonthRateComputation.Meta.INSTANCE);
 }
 static DummyPointSensitivity()
 {
     MetaBean.register(META_BEAN);
 }
示例#20
0
 static SeasonalityDefinition()
 {
     MetaBean.register(SeasonalityDefinition.Meta.INSTANCE);
 }
 static ObjIntPair()
 {
     MetaBean.register(ObjIntPair.Meta.INSTANCE);
 }
 static ConstantCurve()
 {
     MetaBean.register(ConstantCurve.Meta.INSTANCE);
 }
 static ResolvedIborCapFloor()
 {
     MetaBean.register(ResolvedIborCapFloor.Meta.INSTANCE);
 }
 static YearMonthDateParameterMetadata()
 {
     MetaBean.register(YearMonthDateParameterMetadata.Meta.INSTANCE);
 }
示例#25
0
 static FxRate()
 {
     MetaBean.register(FxRate.Meta.INSTANCE);
 }
示例#26
0
 static MockSerBean()
 {
     MetaBean.register(META_BEAN);
 }
示例#27
0
 static IndexQuoteId()
 {
     MetaBean.register(META_BEAN);
 }
 static NotionalExchange()
 {
     MetaBean.register(NotionalExchange.Meta.INSTANCE);
 }
 static IborCapletFloorletVolatilitiesId()
 {
     MetaBean.register(META_BEAN);
 }
示例#30
0
 static KnownAmountBondPaymentPeriod()
 {
     MetaBean.register(KnownAmountBondPaymentPeriod.Meta.INSTANCE);
 }