Пример #1
0
        protected override void Start()
        {
            var datas  = new List <Dictionary <string, string> >();
            var ordNda = new Nda(FileMode.WriteOnly);
            var ordIdn = new Idn(FileMode.WriteOnly);

            try
            {
                SetTemplates();
                datas.AddRange(_configObj.Rics.Select(GetData));

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

                ordNda.LoadFromTemplate(_ordNda, datas);
                ordNda.Save(Path.Combine(_configObj.WorkingDir, String.Format("NdaAdd{0}.csv", _configObj.Market)));
                AddResult("Nda Add file", ordNda.Path, "nda");
            }
            catch (Exception ex)
            {
                LogMessage("Task failed, error: " + ex.Message, Logger.LogType.Error);
                throw new Exception("Task failed, error: " + ex.Message, ex);
            }
            finally
            {
            }
        }
Пример #2
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
            {
            }
        }
Пример #3
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);
            }
        }
Пример #4
0
        protected override void Start()
        {
            try
            {
                int j       = 0;
                var propsCw = new List <Dictionary <string, string> >();
                foreach (Dictionary <string, string> infos in GetPages()
                         .Select(page => CleanInfos(GetInfos(page)))
                         .Where(infos => infos["type"] == "Warrant"))
                {
                    infos.Add("counter", j.ToString());
                    propsCw.Add(infos);
                    j++;
                }
                if (j > 0)
                {
                    var ndaIaCw = new NdaIa(FileMode.WriteOnly);
                    ndaIaCw.LoadFromTemplate(Template.IaAddCw, propsCw);
                    ndaIaCw.Save(String.Format("{0}Nda_Ia_Cw_{1}.csv", configObj.ResultFolderPath, DateTime.Now.ToString("ddMM")));
                    AddResult("Cw Nda bulk file", ndaIaCw.Path, "nda");

                    var ndaQaCw = new NdaQa(FileMode.WriteOnly);
                    ndaQaCw.LoadFromTemplate(Template.QaAddCw, propsCw);
                    ndaQaCw.Save(String.Format("{0}Nda_Qa_Cw_{1}.csv", configObj.ResultFolderPath, DateTime.Now.ToString("ddMM")));
                    AddResult("Cw Nda bulk file", ndaQaCw.Path, "nda");

                    var idnNvdrCw = new Idn(FileMode.WriteOnly);
                    idnNvdrCw.LoadFromTemplate(TemplateIdn.CwNvdr, propsCw);
                    idnNvdrCw.Save(String.Format("{0}IDN_Cw_Nvdr_{1}.txt", configObj.ResultFolderPath, DateTime.Now.ToString("ddMM")));
                    AddResult("Cw Idn bulk file", idnNvdrCw.Path, "idn");

                    var idnMain = new Idn(FileMode.WriteOnly);
                    idnMain.LoadFromTemplate(TemplateIdn.CwMain, propsCw);
                    idnMain.Save(String.Format("{0}IDN_Cw_Main_{1}.txt", configObj.ResultFolderPath, DateTime.Now.ToString("ddMM")));
                    AddResult("Cw Idn bulk file", idnMain.Path, "idn");

                    #region [error in F# dll in this "TemplateFm.ThFmCw"]
                    //var fmCw = new Fm(Format.Horizontal, FileMode.WriteOnly);
                    //fmCw.LoadFromTemplate(TemplateFm.ThFmCw, propsCw);
                    //fmCw.Save(String.Format("{0}Thailand_Fm_Cw_{1}.xls", configObj.ResultFolderPath, DateTime.Now.ToString("ddMM")));
                    //AddResult("Cw Fm bulk file", fmCw.Path, "fm");
                    #endregion

                    string path = String.Format("{0}Thailand_Fm_Cw_{1}.xls", configObj.ResultFolderPath, DateTime.Now.ToString("ddMM"));
                    generateXls(propsCw, path);
                    AddResult("Cw Fm bulk file", path, "fm");

                    var tcCw = new Tc(FileMode.WriteOnly);
                    tcCw.LoadFromTemplate(TemplateTc.WrtAddCw, propsCw);
                    tcCw.Save(String.Format("{0}Wrt_Add_Cw_{1}.csv", configObj.ResultFolderPath, DateTime.Now.ToString("ddMM")));
                    AddResult("Cw t&c bulk file", tcCw.Path, "t&c");
                }
                else
                {
                    LogMessage("No Cw announcement today");
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Task failed, error: " + ex.Message, ex);
            }
        }