コード例 #1
0
        public void TestToData()
        {
            var dt          = DateTime.Today;
            var testSubject = new NamedTradeline("Test Name");

            testSubject.AddName(KindsOfNames.Group, "Company");
            var cusip = new Cusip().Value;

            testSubject.AddPositiveValue(dt.AddDays(-360), new Security(cusip, 5000));
            testSubject.AddPositiveValue(dt.AddDays(-360), new Pecuniam(500000.0M));
            testSubject.Inception = dt.AddDays(-365);
            testSubject.AddPositiveValue(dt.AddDays(-365), new Pecuniam(800000M));


            var testResult = testSubject.ToData(KindsOfTextCase.Kabab);

            var asJson = JsonConvert.SerializeObject(testResult, Formatting.Indented);

            Console.WriteLine(asJson);
        }
コード例 #2
0
ファイル: WealthBase.cs プロジェクト: nofuture-git/31g
        public virtual void AddItem(string name, string groupName, Pecuniam expectedValue, DateTime?atTime = null,
                                    TimeSpan?dueFrequency = null)
        {
            var amt = expectedValue ?? Pecuniam.Zero;
            var dt  = atTime.GetValueOrDefault(DateTime.UtcNow);
            var tss = dueFrequency ?? Constants.TropicalYear;
            var p   = new NamedTradeline(new VocaBase(name, DivisionName))
            {
                DueFrequency = tss
            };

            if (amt.Amount < 0M)
            {
                p.AddNegativeValue(dt, amt);
            }
            else
            {
                p.AddPositiveValue(dt, amt);
            }
            AddItem(p);
        }