Esempio n. 1
0
        public void TestSave()
        {
            var pack = new PackValues()
            {
                FinInstruments = new[]
                {
                    new FinInstrument()
                    {
                        FinId         = 1,
                        FinIdent      = "ISIN",
                        DataSourceId  = 0,
                        FinDataValues = new[]
                        {
                            new FinDataValue {
                                FinAttriubte = "MATURITY_DATE", FromDate = constDate, Value = constDate
                            }
                        },
                        FinNumericValues = new[]
                        {
                            new FinNumericValue {
                                FinAttriubte = "FACEVALUE", FromDate = constDate, Value = 100.0m
                            }
                        },
                        FinStringValues = new[]
                        {
                            new FinStringValue {
                                FinAttriubte = "ISIN", FromDate = constDate, Value = "RU3214123"
                            }
                        },
                        FinTimeSerieses = new[]
                        {
                            new FinTimeSeries {
                                FinAttriubte = "CLOSE", Date = constDate, Value = 132.0m
                            }
                        }
                    }
                }
            };

            _saverMurrData.Save(pack);
        }
Esempio n. 2
0
        public async override Task Run()
        {
            await base.Run();

            try
            {
                IsContinue();
                var path = _paramDescriptors.ConvertStr(File);
                var date = _paramDescriptors.ConvertDate(RunDateTime);

                Log.Info($"Задача {TaskId} : Загрузка данных");
                var currencies = _cbrDownloader.DownloadCurrencies(path);
                var pack       = new PackCurrencies()
                {
                    ValidDate  = date,
                    Currencies = currencies
                };

                Log.Info($"Задача {TaskId} : Конвертация данных");
                var converter    = _converterFactory.GetConverter(typeof(PackCurrencies));
                var importedDate = converter.ConvertToPackValues(pack);
                IsContinue();

                Log.Info($"Задача {TaskId} : Сохранение данных");
                _saver.Save(importedDate);

                Finished();
            }
            catch (OperationCanceledException)
            {
                Log.Info($"Задача отменена {TaskId}");
            }
            catch (Exception ex)
            {
                Log.Error(ex);
            }
            finally
            {
                IsAliveTokenSource.Cancel();
            }
        }