'Purchase/sell multiple lots of AMZN and GOOG
at various prices/commissions to check the
arithmetic and cost handling.'

def test_calculate_round_trip(self):

    self.portfolio.transact_position('BOT', 'AMZN', 100, PriceParser.parse(566.56), PriceParser.parse(1.0))
    self.portfolio.transact_position('BOT', 'AMZN', 200, PriceParser.parse(566.395), PriceParser.parse(1.0))
    self.portfolio.transact_position('BOT', 'GOOG', 200, PriceParser.parse(707.5), PriceParser.parse(1.0))
    self.portfolio.transact_position('SLD', 'AMZN', 100, PriceParser.parse(565.83), PriceParser.parse(1.0))
    self.portfolio.transact_position('BOT', 'GOOG', 200, PriceParser.parse(705.545), PriceParser.parse(1.0))
    self.portfolio.transact_position('SLD', 'AMZN', 200, PriceParser.parse(565.59), PriceParser.parse(1.0))
    self.portfolio.transact_position('SLD', 'GOOG', 100, PriceParser.parse(704.92), PriceParser.parse(1.0))
    self.portfolio.transact_position('SLD', 'GOOG', 100, PriceParser.parse(704.9), PriceParser.parse(0.0))
    self.portfolio.transact_position('SLD', 'GOOG', 100, PriceParser.parse(704.92), PriceParser.parse(0.5))
    self.portfolio.transact_position('SLD', 'GOOG', 100, PriceParser.parse(704.78), PriceParser.parse(1.0))
    self.assertEqual(len(self.portfolio.positions), 0)
    self.assertEqual(len(self.portfolio.closed_positions), 2)
    self.assertEqual(PriceParser.display(self.portfolio.cur_cash), 499100.5)
    self.assertEqual(PriceParser.display(self.portfolio.equity), 499100.5)
    self.assertEqual(PriceParser.display(self.portfolio.unrealised_pnl), 0.0)
    self.assertEqual(PriceParser.display(self.portfolio.realised_pnl), (-899.5))
