public FundInvestor(FundModel fund, DateTime startDate) { StartDate = startDate; CurrentDate = startDate; FirstInvestor = new EnterInFundInvestor(fund) { MaximumCash = 10000, NumberOfWeekToInvest = 52 / 2, StartDate = StartDate }; }
public bool LoadFund(string PathFund) { if (string.IsNullOrEmpty(PathFund)) { return(false); } if (!File.Exists(PathFund)) { return(false); } var fund = new FundModel(Path.GetFileNameWithoutExtension(PathFund)); fund.FilePath = PathFund; try { using (var reader = new StreamReader(PathFund)) { var isFirstFile = true; while (!reader.EndOfStream) { var line = reader.ReadLine(); if (isFirstFile) { isFirstFile = !isFirstFile; continue; } var values = line.Split(';'); var tick = new FundTickModel() { Date = DateTime.Parse(values[0]), Value = double.Parse(values[1]) }; fund.Ticks.Add(tick); } } } catch (Exception e) { Console.WriteLine(e.Message); return(false); } Funds.Add(fund); return(true); }
public EnterInFundInvestor(FundModel fund) { Fund = fund; }