コード例 #1
0
        public void EquilibriumFallsBetweenPoints()
        {
            var pcm = new PriceCurvesModel()
            {
                DemandCurve = new List <MarketPoint>()
                {
                    new MarketPoint()
                    {
                        Volume = 1, Price = 100
                    },
                    new MarketPoint()
                    {
                        Volume = 2, Price = 70
                    },
                    new MarketPoint()
                    {
                        Volume = 3, Price = 50
                    },
                    new MarketPoint()
                    {
                        Volume = 4, Price = 30
                    },
                },
                SupplyCurve = new List <MarketPoint>()
                {
                    new MarketPoint()
                    {
                        Volume = 1.5m, Price = -2
                    },
                    new MarketPoint()
                    {
                        Volume = 2.3m, Price = 20
                    },
                    new MarketPoint()
                    {
                        Volume = 3.2m, Price = 30
                    },
                    new MarketPoint()
                    {
                        Volume = 4.5m, Price = 50
                    },
                }
            };

            Assert.AreEqual((double)pcm.Equilibrium.Volume, 3.5, 1);
            Assert.AreEqual((double)pcm.Equilibrium.Price, 45, 10);
        }
コード例 #2
0
        public void EquilibriumFallsOnCommonPoint()
        {
            var pcm = new PriceCurvesModel()
            {
                DemandCurve = new List <MarketPoint>()
                {
                    new MarketPoint()
                    {
                        Volume = 1, Price = 100
                    },
                    new MarketPoint()
                    {
                        Volume = 2, Price = 70
                    },
                    new MarketPoint()
                    {
                        Volume = 3, Price = 50
                    },
                    new MarketPoint()
                    {
                        Volume = 4, Price = 30
                    },
                },
                SupplyCurve = new List <MarketPoint>()
                {
                    new MarketPoint()
                    {
                        Volume = 1.5m, Price = -2
                    },
                    new MarketPoint()
                    {
                        Volume = 2.3m, Price = 30
                    },
                    new MarketPoint()
                    {
                        Volume = 3, Price = 50
                    },
                    new MarketPoint()
                    {
                        Volume = 4.5m, Price = 80
                    },
                }
            };

            Assert.AreEqual((double)pcm.Equilibrium.Volume, 3, 1e-5);
            Assert.AreEqual((double)pcm.Equilibrium.Price, 50, 1e-5);
        }
コード例 #3
0
        public void EquilibriumFallsOnCommonPoint()
        {
            var pcm = new PriceCurvesModel()
            {
                DemandCurve = new List<MarketPoint>()
                {
                    new MarketPoint() {Volume = 1, Price = 100},
                    new MarketPoint() {Volume = 2, Price = 70},
                    new MarketPoint() {Volume = 3, Price = 50},
                    new MarketPoint() {Volume = 4, Price = 30},
                },
                SupplyCurve = new List<MarketPoint>()
                {
                    new MarketPoint() {Volume = 1.5m, Price = -2},
                    new MarketPoint() {Volume = 2.3m, Price = 30},
                    new MarketPoint() {Volume = 3, Price = 50},
                    new MarketPoint() {Volume = 4.5m, Price = 80},
                }
            };

            Assert.AreEqual((double) pcm.Equilibrium.Volume, 3, 1e-5);
            Assert.AreEqual((double) pcm.Equilibrium.Price, 50, 1e-5);
        }
コード例 #4
0
        public void EquilibriumFallsBetweenPoints()
        {
            var pcm = new PriceCurvesModel()
            {
                DemandCurve = new List<MarketPoint>()
                {
                    new MarketPoint() {Volume = 1, Price = 100},
                    new MarketPoint() {Volume = 2, Price = 70},
                    new MarketPoint() {Volume = 3, Price = 50},
                    new MarketPoint() {Volume = 4, Price = 30},
                },
                SupplyCurve = new List<MarketPoint>()
                {
                    new MarketPoint() {Volume = 1.5m, Price = -2},
                    new MarketPoint() {Volume = 2.3m, Price = 20},
                    new MarketPoint() {Volume = 3.2m, Price = 30},
                    new MarketPoint() {Volume = 4.5m, Price = 50},
                }
            };

            Assert.AreEqual((double)pcm.Equilibrium.Volume, 3.5, 1);
            Assert.AreEqual((double)pcm.Equilibrium.Price, 45, 10);
        }