def test_market_profit_loss(self):
        mock_response = create_mock_json('tests/resources/list_market_profit_and_loss.json')
        market_profits = mock_response.json().get('result')

        for market_profit in market_profits:
            resource = resources.MarketProfitLoss(date_time_sent=self.DATE_TIME_SENT,
                                                  **market_profit)

            assert resource._datetime_sent == self.DATE_TIME_SENT
            assert resource.market_id == market_profit['marketId']
            assert resource.commission_applied == market_profit.get('commissionApplied')

            assert len(resource.profit_and_losses) == len(market_profit['profitAndLosses'])
    def test_market_profit_loss(self):
        mock_response = create_mock_json('tests/resources/list_market_profit_and_loss.json')
        market_profits = mock_response.json().get('result')

        for market_profit in market_profits:
            resource = resources.MarketProfitLoss(elapsed_time=self.ELAPSED_TIME,
                                                  **market_profit)

            assert resource.elapsed_time == self.ELAPSED_TIME
            assert resource.market_id == market_profit['marketId']
            assert resource.commission_applied == market_profit.get('commissionApplied')

            assert len(resource.profit_and_losses) == len(market_profit['profitAndLosses'])