Ejemplo n.º 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
            {
            }
        }
Ejemplo n.º 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
            {
            }
        }