public AnalysisContentPageModel(IProjectHost projectHost, ILutService lutService, StorageService storageService)
        {
            myProjectHost    = projectHost;
            myCurrenciesLut  = lutService.CurrenciesLut;
            myStorageService = storageService;

            GoCommand = new DelegateCommand(OnGo);
        }
Esempio n. 2
0
        public AnalysisTemplate LoadAnalysisTemplate(ICurrenciesLut lut)
        {
            var reader = new ValidatingXamlReader();

            var text = LoadAnalysisTemplateText();

            // required for currency translation during loading from text to entity
            CurrencyConverter.CurrenciesLut = lut;

            return(reader.Read <AnalysisTemplate>(XElement.Parse(text)));
        }
Esempio n. 3
0
        public ImportPreviewModel(StorageService storageService, ICurrenciesLut currenciesLut)
        {
            Contract.RequiresNotNull(storageService, "storageService");
            Contract.RequiresNotNull(currenciesLut, "currenciesLut");

            myStorageService = storageService;
            CurrenciesLut    = currenciesLut;

            OkCommand     = new DelegateCommand(OnOk);
            CancelCommand = new DelegateCommand(OnCancel);
            ApplyCommand  = new DelegateCommand(OnApply);

            Sources = new ObservableCollection <DataSource>();
            myData  = new List <IFigure>();
        }
Esempio n. 4
0
        internal ReportContext(ICurrenciesLut lut, Stock stock, FlowDocument document)
        {
            myCurrenciesLut = lut;
            Stock           = stock;
            Document        = document;

            var data = new List <IFigureSeries>();

            foreach (var figureType in Dynamics.AllFigures)
            {
                // EnableCurrencyCheck has to be true - otherwise we will not have series.Currency property set
                // except for Price - there we might have different currencies in one collection and currently we anyway
                // just need one price
                data.Add(Dynamics.GetSeries(stock, figureType, figureType != typeof(Price)));
            }
            Data = data;

            myProviders = new List <IFigureProvider>();

            myProviders.Add(new CurrentPrice());

            foreach (var figureType in Dynamics.AllFigures.Where(t => t != typeof(Price)))
            {
                myProviders.Add(new GenericFigureProvider(figureType));
            }

            myProviders.Add(new GenericJoinProvider(ProviderNames.Eps, typeof(NetIncome).Name, typeof(SharesOutstanding).Name,
                                                    (lhs, rhs) => lhs / rhs)
            {
                PreserveCurrency = true
            });
            myProviders.Add(new GenericJoinProvider(ProviderNames.BookValue, typeof(Equity).Name, typeof(SharesOutstanding).Name,
                                                    (lhs, rhs) => lhs / rhs)
            {
                PreserveCurrency = true
            });
            myProviders.Add(new GenericJoinProvider(ProviderNames.DividendPayoutRatio, typeof(Dividend).Name, typeof(NetIncome).Name,
                                                    (lhs, rhs) => lhs / rhs * 100)
            {
                PreserveCurrency = false
            });
            myProviders.Add(new GenericJoinProvider(ProviderNames.ReturnOnEquity, typeof(NetIncome).Name, typeof(Equity).Name,
                                                    (lhs, rhs) => lhs / rhs * 100)
            {
                PreserveCurrency = false
            });
            myProviders.Add(new GenericJoinProvider(ProviderNames.DividendPerShare, typeof(Dividend).Name, typeof(SharesOutstanding).Name,
                                                    (lhs, rhs) => lhs / rhs)
            {
                PreserveCurrency = true
            });
            myProviders.Add(new GenericJoinProvider(ProviderNames.DebtEquityRatio, typeof(TotalLiabilities).Name, typeof(Equity).Name,
                                                    (lhs, rhs) => lhs / rhs)
            {
                PreserveCurrency = false
            });
            myProviders.Add(new GenericJoinProvider(ProviderNames.InterestCoverage, typeof(EBIT).Name, typeof(InterestExpense).Name,
                                                    (lhs, rhs) => lhs / rhs)
            {
                PreserveCurrency = false
            });
            myProviders.Add(new GenericJoinProvider(ProviderNames.CurrentRatio, typeof(CurrentAssets).Name, typeof(CurrentLiabilities).Name,
                                                    (lhs, rhs) => lhs / rhs)
            {
                PreserveCurrency = false
            });

            myProviders.Add(new GenericPriceRatioProvider(ProviderNames.MarketCap, typeof(SharesOutstanding).Name,
                                                          (lhs, rhs) => lhs * rhs)
            {
                PreserveCurrency = true
            });
            myProviders.Add(new GenericPriceRatioProvider(ProviderNames.PriceEarningsRatio, ProviderNames.Eps,
                                                          (lhs, rhs) => lhs / rhs)
            {
                PreserveCurrency = false
            });
            myProviders.Add(new GenericPriceRatioProvider(ProviderNames.PriceToBook, ProviderNames.BookValue,
                                                          (lhs, rhs) => lhs / rhs)
            {
                PreserveCurrency = false
            });
            myProviders.Add(new GenericPriceRatioProvider(ProviderNames.DividendYield, ProviderNames.DividendPerShare,
                                                          (lhs, rhs) => rhs / lhs * 100)
            {
                PreserveCurrency = false
            });

            myProviderFailures = new List <IFigureProviderFailure>();
        }