コード例 #1
0
        public void Vna2950_Ipca0_5_TotalDias21_17DiasDesejados_DeveRetornar_Vna_2961_93480150027()
        {
            var ntnb   = new NTNB();
            var actual = ntnb.VNA(2950, 0.5, 21, 17);

            Assert.Equal(2961.93480150027M, actual);
        }
コード例 #2
0
        public void Vna1728_461136_Cotacao97_0813_SemTruncar_DeveRetornar_Pu_1678_01254082357()
        {
            var ntnb   = new NTNB();
            var actual = ntnb.PU(1728.461136, 97.0813, false);

            Assert.Equal(1678.01254082357M, actual);
        }
コード例 #3
0
        public void Vna2950_Ipca0_39_TotalDias21_1DiaDesejado_DeveRetornar_Vna_2950_54684226885()
        {
            var ntnb   = new NTNB();
            var actual = ntnb.VNA(2950, 0.39, 21, 1);

            Assert.Equal(2950.54684226885M, actual);
        }
コード例 #4
0
        public void Cupom_DeveRetornar_Cupom_0_029563()
        {
            var ntnb   = new NTNB();
            var actual = ntnb.Cupom();

            Assert.Equal(0.029563M, actual);
        }
コード例 #5
0
        public void Vna1728_461136_Cotacao97_0813_DeveRetornar_Pu_1678_012540()
        {
            var ntnb   = new NTNB();
            var actual = ntnb.PU(1728.461136, 97.0813);

            Assert.Equal(1678.012540M, actual);
        }
コード例 #6
0
        public void Taxa6_5_106Dias_CondicaoResgate_CondicaoResgate_SemTruncar_DeveRetornar_Cotacao_0_97385836702506()
        {
            var ntnb   = new NTNB();
            var actual = ntnb.Cotacao(6.5, 106, true, false);

            Assert.Equal(0.97385836702506M, actual);
        }
コード例 #7
0
        public void Taxa5_32_DiversosDias_COndicaoResgate_DeveRetornar_Cotacao_1_039339623()
        {
            var ntnb   = new NTNB();
            var actual = ntnb.Cotacao(5.32, new[] { 91, 219, 341, 472, 593, 724, 846, 973, 1097, 1224, 1347 }, true);

            Assert.Equal(1.039339623M, actual);
        }
コード例 #8
0
        public void Taxa5_32_91Dias_DeveRetornar_Cotacao_0_0290148()
        {
            var ntnb   = new NTNB();
            var actual = ntnb.Cotacao(5.32, 91);

            Assert.Equal(0.0290148M, actual);
        }
コード例 #9
0
        public void Taxa5_32_1347Dias_DeveRetornar_Cotacao_0_022409008()
        {
            var ntnb   = new NTNB();
            var actual = ntnb.Cotacao(5.32, 1347);

            Assert.Equal(0.022409008M, actual);
        }
コード例 #10
0
        public void CondicaoResgate_Cupom_DeveRetornar_Cupom_0_02956301()
        {
            var ntnb   = new NTNB();
            var actual = ntnb.Cupom(false);

            Assert.Equal(0.02956301M, actual);
        }
コード例 #11
0
        public void ValorPresente2_956301_Taxa6_1475_1800Dias_SemTruncar_DeveRetornar_Vp_1_9305402652764()
        {
            var ntnb   = new NTNB();
            var actual = ntnb.ValorPresente(2.956301, 6.1475, 1800, false);

            Assert.Equal(1.9305402652764M, actual);
        }
コード例 #12
0
        public void ValorPresente2_956301_Taxa6_1475_1800Dias_DeveRetornar_Vp_1_930540()
        {
            var ntnb   = new NTNB();
            var actual = ntnb.ValorPresente(2.956301, 6.1475, 1800);

            Assert.Equal(1.930540M, actual);
        }
コード例 #13
0
        public void ValorPresente102_956301_Taxa6_1475_1927Dias_DeveRetornar_Vp_65_241726()
        {
            var ntnb   = new NTNB();
            var actual = ntnb.ValorPresente(102.956301, 6.1475, 1927);

            Assert.Equal(65.241726M, actual);
        }
コード例 #14
0
        public void TestFloatingRateBond_NPV_NTNB()
        {
            double  faceValue  = 1000;
            double  rate       = 0.1;
            decimal couponRate = (decimal)0.06;


            DateTime currentDay = new DateTime(2014, 9, 23);
            DateTime maturity   = new DateTime(2015, 5, 15);

            decimal expectedValue = (decimal)2455.833738;
            decimal errorRange    = (decimal)0.001;

            NTNB bond = new NTNB(faceValue, rate, couponRate, maturity);

            bond.IPCA = 1.461073427;

            bond.CurrentDate = currentDay;

            decimal diference = Math.Abs(bond.NPV() - expectedValue);

            Assert.IsTrue(diference < errorRange);
        }