コード例 #1
0
ファイル: Program.cs プロジェクト: JacqueMartin/PricerAV
 public FundInvestor(FundModel fund, DateTime startDate)
 {
     StartDate     = startDate;
     CurrentDate   = startDate;
     FirstInvestor = new EnterInFundInvestor(fund)
     {
         MaximumCash          = 10000,
         NumberOfWeekToInvest = 52 / 2,
         StartDate            = StartDate
     };
 }
コード例 #2
0
ファイル: FundHistory.cs プロジェクト: JacqueMartin/PricerAV
        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);
        }
コード例 #3
0
 public EnterInFundInvestor(FundModel fund)
 {
     Fund = fund;
 }