def parse_transaction(self, transaction, currency=None):
    type = None
    id = None
    address = None
    withdrawalId = self.safe_string(transaction, 'withdrawal_id')
    addressFrom = self.safe_string(transaction, 'from')
    addressTo = self.safe_string(transaction, 'to')
    tagTo = self.safe_string(transaction, 'tag')
    if (withdrawalId is not None):
        type = 'withdrawal'
        id = withdrawalId
        address = addressTo
    else:
        id = self.safe_string_2(transaction, 'payment_id', 'deposit_id')
        type = 'deposit'
        address = addressTo
    currencyId = self.safe_string(transaction, 'currency')
    code = self.safe_currency_code(currencyId)
    amount = self.safe_float(transaction, 'amount')
    status = self.parse_transaction_status(self.safe_string(transaction, 'status'))
    txid = self.safe_string(transaction, 'txid')
    timestamp = self.parse8601(self.safe_string(transaction, 'timestamp'))
    feeCost = None
    if (type == 'deposit'):
        feeCost = 0
    elif (currencyId is not None):
        feeWithCurrencyId = self.safe_string(transaction, 'fee')
        if (feeWithCurrencyId is not None):
            lowercaseCurrencyId = currencyId.lower()
            feeWithoutCurrencyId = feeWithCurrencyId.replace(lowercaseCurrencyId, '')
            feeCost = float(feeWithoutCurrencyId)
    return {'info': transaction, 'id': id, 'currency': code, 'amount': amount, 'addressFrom': addressFrom, 'addressTo': addressTo, 'address': address, 'tagFrom': None, 'tagTo': tagTo, 'tag': tagTo, 'status': status, 'type': type, 'updated': None, 'txid': txid, 'timestamp': timestamp, 'datetime': self.iso8601(timestamp), 'fee': {'currency': code, 'cost': feeCost}}
def parse_transaction(self, transaction, currency=None):
    type = None
    id = None
    address = None
    withdrawalId = self.safe_string(transaction, 'withdrawal_id')
    addressFrom = self.safe_string(transaction, 'from')
    addressTo = self.safe_string(transaction, 'to')
    tagTo = self.safe_string(transaction, 'tag')
    if (withdrawalId is not None):
        type = 'withdrawal'
        id = withdrawalId
        address = addressTo
    else:
        id = self.safe_string_2(transaction, 'payment_id', 'deposit_id')
        type = 'deposit'
        address = addressTo
    currencyId = self.safe_string(transaction, 'currency')
    code = self.safe_currency_code(currencyId)
    amount = self.safe_float(transaction, 'amount')
    status = self.parse_transaction_status(self.safe_string(transaction, 'status'))
    txid = self.safe_string(transaction, 'txid')
    timestamp = self.parse8601(self.safe_string(transaction, 'timestamp'))
    feeCost = None
    if (type == 'deposit'):
        feeCost = 0
    elif (currencyId is not None):
        feeWithCurrencyId = self.safe_string(transaction, 'fee')
        if (feeWithCurrencyId is not None):
            lowercaseCurrencyId = currencyId.lower()
            feeWithoutCurrencyId = feeWithCurrencyId.replace(lowercaseCurrencyId, )
            feeCost = float(feeWithoutCurrencyId)
    return {'info': transaction, 'id': id, 'currency': code, 'amount': amount, 'addressFrom': addressFrom, 'addressTo': addressTo, 'address': address, 'tagFrom': None, 'tagTo': tagTo, 'tag': tagTo, 'status': status, 'type': type, 'updated': None, 'txid': txid, 'timestamp': timestamp, 'datetime': self.iso8601(timestamp), 'fee': {'currency': code, 'cost': feeCost}}