Esempio n. 1
0
        #pragma warning restore 0414

        internal RequestHistoric()
        {
            this._dtStart = new RequestHistoricElementDate("startDate");
            this._dtEnd = new RequestHistoricElementDate("endDate");
            this._securities = new RequestHistoricElementStringArray("securities");
            this._fields = new RequestHistoricElementStringArray("fields");
        }
Esempio n. 2
0
        #pragma warning restore 0414

        internal RequestHistoric()
        {
            this._dtStart    = new RequestHistoricElementDate("startDate");
            this._dtEnd      = new RequestHistoricElementDate("endDate");
            this._securities = new RequestHistoricElementStringArray("securities");
            this._fields     = new RequestHistoricElementStringArray("fields");
        }
Esempio n. 3
0
        public override void Set(string name, string elementValue)
        {
            DateTime dtTemp;
            switch (name.ToLower())
            {
                case "startdate":
                    if (DateTime.TryParseExact(elementValue, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out dtTemp))
                        this._dtStart = new RequestHistoricElementDate("startDate", dtTemp);
                    else
                        throw new ArgumentException(string.Format("BEmu.Request.Set: Bad startDate format {0}, yyyyMMdd expected", elementValue));
                    break;
                case "enddate":
                    if (DateTime.TryParseExact(elementValue, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out dtTemp))
                        this._dtEnd = new RequestHistoricElementDate("endDate", dtTemp);
                    else
                        throw new ArgumentException(string.Format("BEmu.Request.Set: Bad endDate format {0}, yyyyMMdd expected", elementValue));
                    break;
                case "periodicityadjustment":
                    string pAdjUpper = elementValue.ToUpper();

                    switch (pAdjUpper)
                    {
                        case "CALENDAR":
                            this._periodicityAdjustment = HistDataPeriodicityAdjustment.calendar;
                            break;
                        case "FISCAL":
                            this._periodicityAdjustment = HistDataPeriodicityAdjustment.fiscal;
                            break;
                        case "ACTUAL":
                            this._periodicityAdjustment = HistDataPeriodicityAdjustment.actual;
                            break;
                        default:
                            throw new ArgumentException(string.Format("BEmu.Request.Set: unknown value ({0}) for periodicityadjustment", elementValue));
                    }
                    this._periodicityAdjustmentElement = new RequestHistoricElementString("periodicityAdjustment", pAdjUpper);
                    break;

                case "periodicityselection":
                    string pUpper = elementValue.ToUpper();

                    switch (pUpper)
                    {
                        case "WEEKLY":
                            this._periodicity = HistDataPeriodicity.weekly;
                            break;
                        case "MONTHLY":
                            this._periodicity = HistDataPeriodicity.monthly;
                            break;
                        case "QUARTERLY":
                            this._periodicity = HistDataPeriodicity.quarterly;
                            break;
                        case "SEMI_ANNUALLY":
                            this._periodicity = HistDataPeriodicity.semi_annually;
                            break;
                        case "YEARLY":
                            this._periodicity = HistDataPeriodicity.yearly;
                            break;
                        case "DAILY":
                            this._periodicity = HistDataPeriodicity.daily;
                            break;
                        default:
                            throw new ArgumentException(string.Format("BEmu.Request.Set: unknown value ({0}) for periodicityselection", elementValue));
                    }
                    this._periodicityElement = new RequestHistoricElementString("periodicitySelection", pUpper);
                    break;

                case "pricingoption":
                    string prUpper = elementValue.ToUpper();

                    switch (prUpper)
                    {
                        case "PRICING_OPTION_YIELD":
                            this._pricingOption = PricingOption.yield;
                            break;
                        case "PRICING_OPTION_PRICE":
                            this._pricingOption = PricingOption.price;
                            break;
                        default:
                            throw new ArgumentException(string.Format("BEmu.Request.Set: unknown value ({0}) for pricingOption", elementValue));
                    }
                    this._pricingOptionElement = new RequestHistoricElementString("pricingOption", prUpper);
                    break;

                case "overrideoption":
                    string strOpt = elementValue.ToUpper();

                    switch (strOpt)
                    {
                        case "OVERRIDE_OPTION_GPA":
                            this._overrideOptions = OverrideOptions.averagePrice;
                            break;
                        case "OVERRIDE_OPTION_CLOSE":
                            this._overrideOptions = OverrideOptions.closingPrice;
                            break;
                        default:
                            throw new ArgumentException(string.Format("BEmu.Request.Set: unknown value ({0}) for overrideoption", elementValue));
                    }
                    this._overrideOptionsElement = new RequestHistoricElementString("overrideOption", strOpt);
                    break;

                default:
                    throw new ArgumentException(string.Format("BEmu.Request.Set: Element name {0} not supported", name));
            }
        }
Esempio n. 4
0
        public override void Set(string name, string elementValue)
        {
            DateTime dtTemp;

            switch (name.ToLower())
            {
            case "startdate":
                if (DateTime.TryParseExact(elementValue, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out dtTemp))
                {
                    this._dtStart = new RequestHistoricElementDate("startDate", dtTemp);
                }
                else
                {
                    throw new ArgumentException(string.Format("BEmu.Request.Set: Bad startDate format {0}, yyyyMMdd expected", elementValue));
                }
                break;

            case "enddate":
                if (DateTime.TryParseExact(elementValue, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out dtTemp))
                {
                    this._dtEnd = new RequestHistoricElementDate("endDate", dtTemp);
                }
                else
                {
                    throw new ArgumentException(string.Format("BEmu.Request.Set: Bad endDate format {0}, yyyyMMdd expected", elementValue));
                }
                break;

            case "periodicityadjustment":
                string pAdjUpper = elementValue.ToUpper();

                switch (pAdjUpper)
                {
                case "CALENDAR":
                    this._periodicityAdjustment = HistDataPeriodicityAdjustment.calendar;
                    break;

                case "FISCAL":
                    this._periodicityAdjustment = HistDataPeriodicityAdjustment.fiscal;
                    break;

                case "ACTUAL":
                    this._periodicityAdjustment = HistDataPeriodicityAdjustment.actual;
                    break;

                default:
                    throw new ArgumentException(string.Format("BEmu.Request.Set: unknown value ({0}) for periodicityadjustment", elementValue));
                }
                this._periodicityAdjustmentElement = new RequestHistoricElementString("periodicityAdjustment", pAdjUpper);
                break;

            case "periodicityselection":
                string pUpper = elementValue.ToUpper();

                switch (pUpper)
                {
                case "WEEKLY":
                    this._periodicity = HistDataPeriodicity.weekly;
                    break;

                case "MONTHLY":
                    this._periodicity = HistDataPeriodicity.monthly;
                    break;

                case "QUARTERLY":
                    this._periodicity = HistDataPeriodicity.quarterly;
                    break;

                case "SEMI_ANNUALLY":
                    this._periodicity = HistDataPeriodicity.semi_annually;
                    break;

                case "YEARLY":
                    this._periodicity = HistDataPeriodicity.yearly;
                    break;

                case "DAILY":
                    this._periodicity = HistDataPeriodicity.daily;
                    break;

                default:
                    throw new ArgumentException(string.Format("BEmu.Request.Set: unknown value ({0}) for periodicityselection", elementValue));
                }
                this._periodicityElement = new RequestHistoricElementString("periodicitySelection", pUpper);
                break;

            case "pricingoption":
                string prUpper = elementValue.ToUpper();

                switch (prUpper)
                {
                case "PRICING_OPTION_YIELD":
                    this._pricingOption = PricingOption.yield;
                    break;

                case "PRICING_OPTION_PRICE":
                    this._pricingOption = PricingOption.price;
                    break;

                default:
                    throw new ArgumentException(string.Format("BEmu.Request.Set: unknown value ({0}) for pricingOption", elementValue));
                }
                this._pricingOptionElement = new RequestHistoricElementString("pricingOption", prUpper);
                break;

            case "overrideoption":
                string strOpt = elementValue.ToUpper();

                switch (strOpt)
                {
                case "OVERRIDE_OPTION_GPA":
                    this._overrideOptions = OverrideOptions.averagePrice;
                    break;

                case "OVERRIDE_OPTION_CLOSE":
                    this._overrideOptions = OverrideOptions.closingPrice;
                    break;

                default:
                    throw new ArgumentException(string.Format("BEmu.Request.Set: unknown value ({0}) for overrideoption", elementValue));
                }
                this._overrideOptionsElement = new RequestHistoricElementString("overrideOption", strOpt);
                break;

            default:
                throw new ArgumentException(string.Format("BEmu.Request.Set: Element name {0} not supported", name));
            }
        }