예제 #1
0
        public void PnLIsDeferredForROACCalculationsIfNoCapitalIsUsed()
        {
            var pos = new Position(_instrument);
            var c   = new CashTransaction
            {
                Amount       = 10,
                Instrument   = _instrument,
                FXRateToBase = 1
            };

            pos.AddCashTransaction(c);

            pos.GetPnL(10, 1);

            var o = new Order
            {
                Quantity     = 100,
                Price        = 10,
                Instrument   = _instrument,
                FXRateToBase = 1
            };

            pos.AddOrder(o);

            pos.GetPnL(10, 1);

            Assert.AreEqual(1 + (10d / (10 * 100)), pos.ROAC);
        }
예제 #2
0
        public void ROACValueIsCorrectWithCashTransactions()
        {
            var pos = new Position(_instrument);
            var o   = new Order
            {
                Quantity     = 100,
                Price        = 10,
                Instrument   = _instrument,
                FXRateToBase = 1
            };

            pos.AddOrder(o);

            var c = new CashTransaction
            {
                Amount       = 10,
                Instrument   = _instrument,
                FXRateToBase = 1
            };

            pos.AddCashTransaction(c);

            pos.GetPnL(10, 1);

            Assert.AreEqual(1.01, pos.ROAC);
        }