Exemplo n.º 1
0
        /// <summary>
        /// Sets value of this field (in textual representation) to specified profile.
        /// </summary>
        /// <param name="ip">Profile to set field.</param>
        /// <param name="value">Value that set into field.</param>
        /// <exception cref="System.InvalidOperationException">If text uses wrong format or contains invalid values.</exception>
        public void SetField(InstrumentProfile ip, string value)
        {
            try
            {
                switch (Name)
                {
                case F_TYPE: ip.SetType(value); return;

                case F_SYMBOL: ip.SetSymbol(value); return;

                case F_DESCRIPTION: ip.SetDescription(value); return;

                case F_LOCAL_SYMBOL: ip.SetLocalSymbol(value); return;

                case F_LOCAL_DESCRIPTION: ip.SetLocalDescription(value); return;

                case F_COUNTRY: ip.SetCountry(value); return;

                case F_OPOL: ip.SetOPOL(value); return;

                case F_EXCHANGE_DATA: ip.SetExchangeData(value); return;

                case F_EXCHANGES: ip.SetExchanges(value); return;

                case F_CURRENCY: ip.SetCurrency(value); return;

                case F_BASE_CURRENCY: ip.SetBaseCurrency(value); return;

                case F_CFI: ip.SetCFI(value); return;

                case F_ISIN: ip.SetISIN(value); return;

                case F_SEDOL: ip.SetSEDOL(value); return;

                case F_CUSIP: ip.SetCUSIP(value); return;

                case F_ICB: ip.SetICB((int)ParseNumber(value)); return;

                case F_SIC: ip.SetSIC((int)ParseNumber(value)); return;

                case F_MULTIPLIER: ip.SetMultiplier(ParseNumber(value)); return;

                case F_PRODUCT: ip.SetProduct(value); return;

                case F_UNDERLYING: ip.SetUnderlying(value); return;

                case F_SPC: ip.SetSPC(ParseNumber(value)); return;

                case F_ADDITIONAL_UNDERLYINGS: ip.SetAdditionalUnderlyings(value); return;

                case F_MMY: ip.SetMMY(value); return;

                case F_EXPIRATION: ip.SetExpiration(ParseDate(value)); return;

                case F_LAST_TRADE: ip.SetLastTrade(ParseDate(value)); return;

                case F_STRIKE: ip.SetStrike(ParseNumber(value)); return;

                case F_OPTION_TYPE: ip.SetOptionType(value); return;

                case F_EXPIRATION_STYLE: ip.SetExpirationStyle(value); return;

                case F_SETTLEMENT_STYLE: ip.SetSettlementStyle(value); return;

                case F_PRICE_INCREMENTS: ip.SetPriceIncrements(value); return;

                case F_TRADING_HOURS: ip.SetTradingHours(value); return;

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