Beispiel #1
0
        protected override void Start()
        {
            var datas          = new Dictionary <string, string>();
            var cleanData      = new List <Dictionary <string, string> >();
            var ordNda         = new Nda(FileMode.WriteOnly);
            var ordQuoteFuture = new Nda(FileMode.WriteOnly);
            var ordIssueFuture = new Nda(FileMode.WriteOnly);
            var ordFm          = new Fm();
            var ordIdn         = new Idn(FileMode.WriteOnly);

            try
            {
                SetTemplates();
                foreach (var ric in _configObj.Rics)
                {
                    datas = GetInfos(ric.Trim());
                    cleanData.Add(CleanData(datas));
                }
                ordIssueFuture.LoadFromTemplate(_ordIssueFuture, cleanData);
                ordIssueFuture.Save(Path.Combine(_configObj.WorkingDir, String.Format("IssueFutureAdd{0}.csv", _configObj.Market)));
                AddResult("Issue Future Add file", ordIssueFuture.Path, "nda");


                ordIdn.LoadFromTemplate(_ordIdn, cleanData);
                ordIdn.Save(Path.Combine(_configObj.WorkingDir, String.Format("IdnAdd{0}.txt", _configObj.Market)));
                AddResult("Idn Add file", ordIdn.Path, "idn");

                ordNda.LoadFromTemplate(_ordNda, cleanData);
                ordNda.Save(Path.Combine(_configObj.WorkingDir, String.Format("NdaAdd{0}.csv", _configObj.Market)));
                AddResult("Nda Add file", ordNda.Path, "nda");

                ordQuoteFuture.LoadFromTemplate(_ordQuoteFuture, cleanData);
                ordQuoteFuture.Save(Path.Combine(_configObj.WorkingDir, String.Format("QuoteFutureAdd{0}.csv", _configObj.Market)));
                AddResult("Quote Future Add file", ordQuoteFuture.Path, "nda");

                ordFm.LoadFromTemplate(_ordFm, cleanData);
                ordFm.Save(Path.Combine(_configObj.WorkingDir, String.Format("Fm{0}.txt", _configObj.Market)));
                AddResult("Fm file", ordFm.Path, "fm");
            }
            catch (Exception ex)
            {
                LogMessage("Task failed, error: " + ex.Message, Logger.LogType.Error);
                throw new Exception("Task failed, error: " + ex.Message, ex);
            }
            finally
            {
            }
        }
Beispiel #2
0
        protected override void Start()
        {
            try
            {
                //Login1();
                //Login2();
                int i       = 1;
                var propsDw = new List <Dictionary <string, string> >();
                foreach (Dictionary <string, string> infos in GetPages().Select(page => CleanInfos(GetInfos(page))).Where(infos => infos["type"] == "Derivative warrant"))
                {
                    infos.Add("counter", i.ToString());
                    propsDw.Add(infos);
                    i++;
                }
                if (i > 1)
                {
                    //GetFSharpTitleValue(propsDw);


                    var ndaDw1 = new Fm(Format.Horizontal, FileMode.WriteOnly);
                    ndaDw1.LoadFromTemplate(TemplateFm.ThFm, propsDw);
                    ndaDw1.Save(String.Format("{0}Thailand_DW_ADD_{1}.xls", configObj.ResultFolderPath,
                                              DateTime.Now.ToString("ddMM")));
                    AddResult("Dw Fm bulk file", ndaDw1.Path, "fm");

                    var ndaDw2 = new NdaQa(FileMode.WriteOnly);
                    ndaDw2.LoadFromTemplate(Template.QaAdd, propsDw);
                    ndaDw2.Save(String.Format("{0}NDA_QA_ADD_{1}.csv", configObj.ResultFolderPath,
                                              DateTime.Now.ToString("ddMM")));
                    AddResult("Dw Nda bulk file", ndaDw2.Path, "nda");

                    var ndaDw3 = new Idn(FileMode.WriteOnly);
                    ndaDw3.LoadFromTemplate(TemplateIdn.DomChain, propsDw);
                    ndaDw3.Save(String.Format("{0}IDN_Domchain_{1}.txt", configObj.ResultFolderPath,
                                              DateTime.Now.ToString("ddMM")));
                    AddResult("Dw Idn bulk file", ndaDw3.Path, "idn");

                    var ndaDw4 = new Idn(FileMode.WriteOnly);
                    ndaDw4.LoadFromTemplate(TemplateIdn.ForIdn, propsDw);
                    ndaDw4.Save(String.Format("{0}IDN_ADD_{1}.txt", configObj.ResultFolderPath,
                                              DateTime.Now.ToString("ddMM")));
                    AddResult("Dw Idn bulk file", ndaDw4.Path, "idn");

                    var ndaDw5 = new NdaIa(FileMode.WriteOnly);
                    ndaDw5.LoadFromTemplate(Template.IaAdd, propsDw);
                    ndaDw5.Save(String.Format("{0}NDA_IA_ADD_{1}.csv", configObj.ResultFolderPath,
                                              DateTime.Now.ToString("ddMM")));
                    AddResult("Dw Nda bulk file", ndaDw5.Path, "nda");

                    var ndaDw6 = new Tc(FileMode.WriteOnly);
                    ndaDw6.LoadFromTemplate(TemplateTc.WrtAdd, propsDw);
                    ndaDw6.Save(String.Format("{0}WRT_ADD_{1}_thailand.csv", configObj.ResultFolderPath,
                                              DateTime.Now.ToString("ddMMMyyyy")));
                    AddResult("Dw t&c bulk file", ndaDw6.Path, "t&c");
                }
                else
                {
                    LogMessage("No Dw announcement today");
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }