public static async Task <PositionsAnalyzerModel> CreateAsync(string csvPath, AppSettingsModel appData) { PositionsAnalyzerModel model = new PositionsAnalyzerModel(); model.AppData = appData; bool ret = await model.GeneratePositions(csvPath); model.CalcCumulativeRealizedPerformance(); model.LoadPrices(); model.Initialized = true; return(model); }
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); PositionsModel = (PositionsAnalyzerModel)e.Parameter; foreach (AccountValue accVal in PositionsModel.CumulativeRealized) { AccountValues.Add(accVal); } LineSeries series1 = new LineSeries(); series1.XBindingPath = "time"; series1.YBindingPath = "value"; series1.Label = "acctvalues"; series1.ItemsSource = AccountValues; DataContext = this; series1.EnableAnimation = true; AccountPerformanceChart.Series.Add(series1); foreach (Position pos_i in PositionsModel.OpenPositions) { OpenPositions.Add(pos_i); } PortfolioStatus = PositionsModel.PortfolioStatus; /*PortMarketValue = portStatus.MarketValue; * PortCostBasis = portStatus.CostBasis; * PortProfitLoss = portStatus.UnrealizedPL; * PortProfitLossPercent = portStatus.UnrealizedPLPercent;*/ //SummaryPagePage.Background = (AcrylicBrush) Application.Current.Resources["LightAcrylic"]; //SummaryPagePage.Style = (Style)Application.Current.Resources["PageDarkStyle"]; SetColorTheme(PositionsModel.AppData.ColorTheme); }
public async void AppDataPropertyChangedHandler(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == "ColorTheme") { SetColorTheme(AppData.ColorTheme); } if (e.PropertyName == "CsvFilePath") { MainPageFrame.Navigate(typeof(LoadScreenPage), AppData, new DrillInNavigationTransitionInfo()); try { PositionsModel = await PositionsAnalyzerModel.CreateAsync(AppData); EnableNavViewItems(true); SetSettingsColor(); MainPageFrame.Navigate(typeof(SummaryPage), PositionsModel, new DrillInNavigationTransitionInfo()); } catch { MainPageFrame.Navigate(typeof(WaitingForDataFilePage), AppData, new DrillInNavigationTransitionInfo()); } } }
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); PositionsModel = (PositionsAnalyzerModel)e.Parameter; foreach (AccountValue accVal in PositionsModel.CumulativeRealized) { AccountValues.Add(accVal); } LineSeries series1 = new LineSeries(); series1.XBindingPath = "time"; series1.YBindingPath = "value"; series1.Label = "acctvalues"; series1.ItemsSource = AccountValues; DataContext = this; series1.EnableAnimation = true; AccountPerformanceChart.Series.Add(series1); SetColorTheme(PositionsModel.AppData.ColorTheme); }
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); PositionsModel = (PositionsAnalyzerModel)e.Parameter; SetColorTheme(PositionsModel.AppData.ColorTheme); }