コード例 #1
0
        /// <summary>
        /// Returns value of this field for specified profile in textual representation.
        /// </summary>
        /// <param name="ip">Profile fot which get field.</param>
        /// <returns>Value of this field for specified profile in textual representation.</returns>
        /// <exception cref="System.InvalidOperationException">Can't format certain field.</exception>
        public string GetField(InstrumentProfile ip)
        {
            try
            {
                switch (Name)
                {
                case F_TYPE: return(ip.GetTypeName());

                case F_SYMBOL: return(ip.GetSymbol());

                case F_DESCRIPTION: return(ip.GetDescription());

                case F_LOCAL_SYMBOL: return(ip.GetLocalSymbol());

                case F_LOCAL_DESCRIPTION: return(ip.GetLocalDescription());

                case F_COUNTRY: return(ip.GetCountry());

                case F_OPOL: return(ip.GetOPOL());

                case F_EXCHANGE_DATA: return(ip.GetExchangeData());

                case F_EXCHANGES: return(ip.GetExchanges());

                case F_CURRENCY: return(ip.GetCurrency());

                case F_BASE_CURRENCY: return(ip.GetBaseCurrency());

                case F_CFI: return(ip.GetCFI());

                case F_ISIN: return(ip.GetISIN());

                case F_SEDOL: return(ip.GetSEDOL());

                case F_CUSIP: return(ip.GetCUSIP());

                case F_ICB: return(FormatNumber(ip.GetICB()));

                case F_SIC: return(FormatNumber(ip.GetSIC()));

                case F_MULTIPLIER: return(FormatNumber(ip.GetMultiplier()));

                case F_PRODUCT: return(ip.GetProduct());

                case F_UNDERLYING: return(ip.GetUnderlying());

                case F_SPC: return(FormatNumber(ip.GetSPC()));

                case F_ADDITIONAL_UNDERLYINGS: return(ip.GetAdditionalUnderlyings());

                case F_MMY: return(ip.GetMMY());

                case F_EXPIRATION: return(FormatDate(ip.GetExpiration()));

                case F_LAST_TRADE: return(FormatDate(ip.GetLastTrade()));

                case F_STRIKE: return(FormatNumber(ip.GetStrike()));

                case F_OPTION_TYPE: return(ip.GetOptionType());

                case F_EXPIRATION_STYLE: return(ip.GetExpirationStyle());

                case F_SETTLEMENT_STYLE: return(ip.GetSettlementStyle());

                case F_PRICE_INCREMENTS: return(ip.GetPriceIncrements());

                case F_TRADING_HOURS: return(ip.GetTradingHours());

                default: throw new InvalidOperationException("cannot process field " + this);
                }
            }
            catch (Exception exc)
            {
                throw new InvalidOperationException(String.Format("Can't get field '{0}': {1}", this, exc));
            }
        }