protected override void ScheduleTask(VcssTaskInfoModel vcssTaskInfo, params string[] parameters)
        {
            Dictionary <string, int> symbols = StockService.GetStocks().Where(s => s.market_id == 2 && s.active).ToDictionary(s => s.symbol + ".US", s => s.Id);

            using (WebClient web = new WebClient())
            {
                string   quotesData = web.DownloadString(String.Format(vcssTaskInfo.url, symbols.Keys.First(), vcssTaskInfo.auth_token, String.Join(",", symbols.Keys)));
                DateTime marketTime = DateTime.UtcNow.AddHours(vcssTaskInfo.Market.utc_offset);
                VcssTaskManagerService.ScheduleTask(vcssTaskInfo.Id, quotesData, marketTime);
            }
        }
Exemple #2
0
        protected override void ScheduleTask(VcssTaskInfoModel vcssTaskInfo, params string[] parameters)
        {
            int      symbolId = int.Parse(parameters[0]);
            DateTime from     = DateTime.Parse(parameters[1]);
            DateTime to       = DateTime.Parse(parameters[2]);
            string   symbol   = StockService.GetStockSymbol(symbolId).symbol;

            using (WebClient web = new WebClient())
            {
                string data = web.DownloadString(String.Format(vcssTaskInfo.url, symbol, from.ToString("yyyy-MM-dd"), to.ToString("yyyy-MM-dd"), vcssTaskInfo.auth_token));
                data += "#" + symbolId;
                DateTime marketTime = DateTime.UtcNow.AddHours(vcssTaskInfo.Market.utc_offset);
                VcssTaskManagerService.ScheduleTask(vcssTaskInfo.Id, data, marketTime);
            }
        }
        protected override void ScheduleTask(VcssTaskInfoModel vcssTaskInfo, params string[] parameters)
        {
            HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(vcssTaskInfo.url);

            request.Headers["Authorization"] = vcssTaskInfo.auth_token;

            HttpWebResponse response = (HttpWebResponse)request.GetResponse();

            using (Stream stream2 = response.GetResponseStream())
            {
                using (StreamReader reader2 = new StreamReader(stream2))
                {
                    string   data       = reader2.ReadToEnd();
                    DateTime marketTime = DateTime.UtcNow.AddHours(vcssTaskInfo.Market.utc_offset);
                    VcssTaskManagerService.ScheduleTask(vcssTaskInfo.Id, data, marketTime);
                }
            }
        }
Exemple #4
0
        protected override void ScheduleTask(VcssTaskInfoModel vcssTaskInfo, params string[] parameters)
        {
            DateTime marketTime = DateTime.UtcNow.AddHours(vcssTaskInfo.Market.utc_offset);

            VcssTaskManagerService.ScheduleTask(vcssTaskInfo.Id, "", marketTime);
        }