protected override string GetUrl()
 {
     if (this.Query == string.Empty)
     {
         throw new ArgumentNullException("Query", "The passed query text is empty.");
     }
     System.Text.StringBuilder url = new System.Text.StringBuilder();
     //url.Append("http://d.yimg.com/autoc.finance.yahoo.com/autoc?query=")
     //url.Append(Uri.EscapeDataString(search.Trim))
     //url.Append("&callback=YAHOO.Finance.SymbolSuggest.ssCallback")
     url.Append("http://d.yimg.com/aq/autoc?query=");
     url.Append(Uri.EscapeDataString(this.Query.Trim()));
     url.Append(YahooHelper.CultureToParameters(this.Culture));
     url.Append("&callback=YAHOO.util.ScriptNodeDataSource.callbacks");
     return(url.ToString());
 }
Пример #2
0
        protected override string GetUrl()
        {
            if (this.ID == string.Empty)
            {
                throw new ArgumentException("ID is empty.", "ID");
            }
            System.Text.StringBuilder url = new System.Text.StringBuilder();
            url.Append("http://");
            url.Append("chart.finance.yahoo.com/");

            if (this.SimplifiedImage)
            {
                url.Append("t?");
            }
            else if (this.ImageSize == ChartImageSize.Small)
            {
                url.Append("h?");
            }
            else
            {
                url.Append("z?");
            }

            url.Append("s=");
            url.Append(MyHelper.CleanYqlParam(FinanceHelper.CleanIndexID(this.ID)));

            if (this.SimplifiedImage)
            {
                url.Append("&width=" + this.ImageWidth.ToString());
                url.Append("&height=" + this.ImageHeight.ToString());
            }
            else if (this.ImageSize != ChartImageSize.Small)
            {
                url.Append("&t=");
                url.Append(FinanceHelper.GetChartTimeSpan(this.TimeSpan));
                url.Append("&z=");
                url.Append(FinanceHelper.GetChartImageSize(this.ImageSize));
                url.Append("&q=");
                url.Append(FinanceHelper.GetChartType(this.Type));
                url.Append("&l=");
                url.Append(FinanceHelper.GetChartScale(this.Scale));
                if (this.MovingAverages.Count > 0 | this.ExponentialMovingAverages.Count > 0 | this.TechnicalIndicators.Count > 0)
                {
                    url.Append("&p=");
                    foreach (MovingAverageInterval ma in this.MovingAverages)
                    {
                        url.Append('m');
                        url.Append(FinanceHelper.GetMovingAverageInterval(ma));
                        url.Append(',');
                    }
                    foreach (MovingAverageInterval ma in this.ExponentialMovingAverages)
                    {
                        url.Append('e');
                        url.Append(FinanceHelper.GetMovingAverageInterval(ma));
                        url.Append(',');
                    }
                    foreach (TechnicalIndicator ti in this.TechnicalIndicators)
                    {
                        url.Append(FinanceHelper.GetTechnicalIndicatorsI(ti));
                    }
                }
                if (this.TechnicalIndicators.Count > 0)
                {
                    url.Append("&a=");
                    foreach (TechnicalIndicator ti in this.TechnicalIndicators)
                    {
                        url.Append(FinanceHelper.GetTechnicalIndicatorsII(ti));
                    }
                }
                if (this.ComparingIDs.Count > 0)
                {
                    url.Append("&c=");
                    foreach (string csid in this.ComparingIDs)
                    {
                        url.Append(MyHelper.CleanYqlParam(FinanceHelper.CleanIndexID(csid)));
                        url.Append(',');
                    }
                }
                if (this.Culture == null)
                {
                    this.Culture = Culture.DefaultCultures.UnitedStates_English;
                }
            }
            url.Append(YahooHelper.CultureToParameters(this.Culture));
            return(url.ToString());
        }
Пример #3
0
        /// <summary>
        /// Returns the URL of the Yahoo! RSS news feed.
        /// </summary>
        /// <param name="culture">The culture of the feed.</param>
        /// <returns></returns>
        /// <remarks></remarks>
        public string RssNewsURL(Culture culture = null)
        {
            Culture cult = culture;

            if (cult == null)
            {
                cult = Culture.DefaultCultures.UnitedStates_English;
            }
            return("http://feeds.finance.yahoo.com/rss/2.0/headline?s=" + MyHelper.CleanYqlParam(mID) + YahooHelper.CultureToParameters(cult));
        }