'After the subsequent sale, carry out two more sells/shorts
and then close the position out with two additional buys/longs.
The following prices have been tested against those calculated
via Interactive Brokers\' Trader Workstation (TWS).'

def test_calculate_round_trip(self):

    self.position.transact_shares('SLD', 100, PriceParser.parse(77.68), PriceParser.parse(1.0))
    self.position.transact_shares('SLD', 50, PriceParser.parse(77.7), PriceParser.parse(1.0))
    self.position.transact_shares('BOT', 100, PriceParser.parse(77.77), PriceParser.parse(1.0))
    self.position.transact_shares('BOT', 150, PriceParser.parse(77.73), PriceParser.parse(1.0))
    self.position.update_market_value(PriceParser.parse(77.72), PriceParser.parse(77.72))
    self.assertEqual(self.position.action, 'SLD')
    self.assertEqual(self.position.ticker, 'PG')
    self.assertEqual(self.position.quantity, 0)
    self.assertEqual(self.position.buys, 250)
    self.assertEqual(self.position.sells, 250)
    self.assertEqual(self.position.net, 0)
    self.assertEqual(PriceParser.display(self.position.avg_bot, 3), 77.746)
    self.assertEqual(PriceParser.display(self.position.avg_sld, 3), 77.688)
    self.assertEqual(PriceParser.display(self.position.total_bot), 19436.5)
    self.assertEqual(PriceParser.display(self.position.total_sld), 19422.0)
    self.assertEqual(PriceParser.display(self.position.net_total), (-14.5))
    self.assertEqual(PriceParser.display(self.position.total_commission), 5.0)
    self.assertEqual(PriceParser.display(self.position.net_incl_comm), (-19.5))
    self.assertEqual(PriceParser.display(self.position.avg_price, 5), 77.676)
    self.assertEqual(PriceParser.display(self.position.cost_basis), 0.0)
    self.assertEqual(PriceParser.display(self.position.market_value), 0.0)
    self.assertEqual(PriceParser.display(self.position.unrealised_pnl), 0.0)
    self.assertEqual(PriceParser.display(self.position.realised_pnl), (-19.5))
