Beispiel #1
0
        public void ReloadHistoryPriceTicker(int shareId)
        {
            SettingBLL sBLL     = new SettingBLL(_unit);
            ShareBLL   shareBLL = new ShareBLL(_unit);

            try
            {
                //remove existing tickers
                this.RemoveHistoryPriceTicker(shareId);

                int historyYear = int.Parse(sBLL.Get(s => s.Key ==
                                                     SettingKey.HistoryDataYears.ToString()).Single().Value);

                DateTime start = DateTime.Now.AddYears(-1 * historyYear);

                Share share = shareBLL.GetByID(shareId);

                this.UploadHistoryPriceTicker(share.Symbol, start, DateTime.Now);
            }
            catch (Exception ex)
            {
                LogHelper.Error(_log, ex.ToString());
                throw;
            }
        }
Beispiel #2
0
        /// <summary>
        /// Gets the share profile.
        /// </summary>
        /// <param name="symbol">The y symbol.</param>
        /// <returns></returns>
        public void UploadShareProfileFromYahoo(string symbol)
        {
            SettingBLL settingBLL = new SettingBLL(_unit);


            Share s = _sBLL.GetShareBySymbol(symbol);

            try
            {
                // Load profile info
                string urlTemplate = settingBLL.GetSetting(Shared.SettingKey.YahooProfileUrl);
                string url         = string.Format(urlTemplate, symbol);

                if (!string.IsNullOrEmpty(url))
                {
                    HtmlWeb      web = new HtmlWeb();
                    HtmlDocument doc = web.Load(url);

                    if (doc != null)
                    {
                        //Process HTML Doc
                        this.ExtractProfileEntityFromHtmlDoc(s, doc);
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(_log, ex.ToString());
                throw;
            }

            //return shareInfo;
        }