<commit_before>from datetime import datetime, timedelta
from currency import ExchangeRate, Amount


class Trade(object):
    """Represents an exchange of two currency amounts.
    May include the entities between which the trade is made
    """
    def __init__(self, from_amount, to_amount, from_entity=None,
                 to_entity=None, opening_time=None, closing_time=None,
                 market=None):
        assert all([isinstance(x, Amount) for x in (from_amount, to_amount)])
        assert all([x is None or isinstance(x, Participant) for x
                                            in (from_entity, to_entity)])
        assert all([x is None or isinstance(x, datetime) for x
                                            in (opening_time, closing_time)])
        assert isinstance(market, Market)  # must not be null
        self.from_amount = from_amount
        self.to_amount = to_amount
        self.from_entity = from_entity
        self.to_entity = to_entity
        self.opening_time = opening_time
        self.closing_time = closing_time
        self.market = market

    def __str__(self):
        return "{0} -> {1}".format(self.from_amount, self.to_amount)


class Market(object):
    """Represents a market - where Trade's are made
    """

    def __init__(self, market_name, c1, c2):
        """c1 is the "buy" currency"""
        self.name = market_name
        self.c1, self.c2 = c1, c2

    def getTicker(self):
        """returns the most recent ticker"""
        raise NotImplementedError()

    def getOpenTrades(self):<commit_msg>Trade: represented as (from_amount, exchange_rate) instead of (from_amount, to_amount)<commit_after>from datetime import datetime, timedelta
from currency import ExchangeRate, Amount


class Trade(object):
    """Represents an exchange of two currency amounts.
    May include the entities between which the trade is made
    """
    def __init__(self, from_amount, exchange_rate, from_entity=None,
                 to_entity=None, opening_time=None, closing_time=None,
                 market=None):
        assert isinstance(from_amount, Amount)
        assert isinstance(exchange_rate, ExchangeRate)
        assert all([x is None or isinstance(x, Participant) for x
                                            in (from_entity, to_entity)])
        assert all([x is None or isinstance(x, datetime) for x
                                            in (opening_time, closing_time)])
        assert isinstance(market, Market)  # must not be null
        self.from_amount = from_amount
        self.exchange_rate = exchange_rate
        self.from_entity = from_entity
        self.to_entity = to_entity
        self.opening_time = opening_time
        self.closing_time = closing_time
        self.market = market

    def __str__(self):
        return "{0} -> {1}".format(self.from_amount, self.to_amount)


class Market(object):
    """Represents a market - where Trade's are made
    """

    def __init__(self, market_name, c1, c2):
        """c1 is the "buy" currency"""
        self.name = market_name
        self.c1, self.c2 = c1, c2

    def getTicker(self):
        """returns the most recent ticker"""
        raise NotImplementedError()

    def getOpenTrades(self):
{'fraction_non_alphanumeric': 0.08782742681047766, 'fraction_numerical': 0.005546995377503852, 'mean_word_length': 2.4060860440713534, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '333232', 'n_tokens_mistral': 905, 'n_tokens_neox': 877, 'n_words': 271}