def parse_trade(self, trade, market=None):
    symbol = None
    marketId = self.safe_string(trade, 'instrument_id')
    base = None
    quote = None
    if (marketId in self.markets_by_id):
        market = self.markets_by_id[marketId]
        symbol = market['symbol']
        base = market['base']
        quote = market['quote']
    elif (marketId is not None):
        parts = marketId.split('-')
        numParts = len(parts)
        if (numParts == 2):
            (baseId, quoteId) = parts
            base = self.safe_currency_code(baseId)
            quote = self.safe_currency_code(quoteId)
            symbol = ((base + '/') + quote)
        else:
            symbol = marketId
    if ((symbol is None) and (market is not None)):
        symbol = market['symbol']
        base = market['base']
        quote = market['quote']
    timestamp = self.parse8601(self.safe_string_2(trade, 'timestamp', 'created_at'))
    price = self.safe_float(trade, 'price')
    amount = self.safe_float_2(trade, 'size', 'qty')
    amount = self.safe_float(trade, 'order_qty', amount)
    takerOrMaker = self.safe_string_2(trade, 'exec_type', 'liquidity')
    if (takerOrMaker == 'M'):
        takerOrMaker = 'maker'
    elif (takerOrMaker == 'T'):
        takerOrMaker = 'taker'
    side = self.safe_string(trade, 'side')
    cost = None
    if (amount is not None):
        if (price is not None):
            cost = (amount * price)
    feeCost = self.safe_float(trade, 'fee')
    fee = None
    if (feeCost is not None):
        feeCurrency = (base if (side == 'buy') else quote)
        fee = {'cost': (- feeCost), 'currency': feeCurrency}
    orderId = self.safe_string(trade, 'order_id')
    return {'info': trade, 'timestamp': timestamp, 'datetime': self.iso8601(timestamp), 'symbol': symbol, 'id': self.safe_string_2(trade, 'trade_id', 'ledger_id'), 'order': orderId, 'type': None, 'takerOrMaker': takerOrMaker, 'side': side, 'price': price, 'amount': amount, 'cost': cost, 'fee': fee}
def parse_trade(self, trade, market=None):
    symbol = None
    marketId = self.safe_string(trade, 'instrument_id')
    base = None
    quote = None
    if (marketId in self.markets_by_id):
        market = self.markets_by_id[marketId]
        symbol = market['symbol']
        base = market['base']
        quote = market['quote']
    elif (marketId is not None):
        parts = marketId.split('-')
        numParts = len(parts)
        if (numParts == 2):
            (baseId, quoteId) = parts
            base = self.safe_currency_code(baseId)
            quote = self.safe_currency_code(quoteId)
            symbol = ((base + '/') + quote)
        else:
            symbol = marketId
    if ((symbol is None) and (market is not None)):
        symbol = market['symbol']
        base = market['base']
        quote = market['quote']
    timestamp = self.parse8601(self.safe_string_2(trade, 'timestamp', 'created_at'))
    price = self.safe_float(trade, 'price')
    amount = self.safe_float_2(trade, 'size', 'qty')
    amount = self.safe_float(trade, 'order_qty', amount)
    takerOrMaker = self.safe_string_2(trade, 'exec_type', 'liquidity')
    if (takerOrMaker == 'M'):
        takerOrMaker = 'maker'
    elif (takerOrMaker == 'T'):
        takerOrMaker = 'taker'
    side = self.safe_string(trade, 'side')
    cost = None
    if (amount is not None):
        if (price is not None):
            cost = (amount * price)
    feeCost = self.safe_float(trade, 'fee')
    fee = None
    if (feeCost is not None):
        feeCurrency = (base if (side == 'buy') else quote)
        fee = {'cost': (- feeCost), 'currency': feeCurrency}
    orderId = self.safe_string(trade, 'order_id')
    return {'info': trade, 'timestamp': timestamp, 'datetime': self.iso8601(timestamp), 'symbol': symbol, 'id': self.safe_string_2(trade, 'trade_id', 'ledger_id'), 'order': orderId, 'type': None, 'takerOrMaker': takerOrMaker, 'side': side, 'price': price, 'amount': amount, 'cost': cost, 'fee': fee}