def trade(self, pair, trade_type, rate, amount, connection=None): common.validateOrder(pair, trade_type, rate, amount) params = {"method": "Trade", "pair": pair, "type": trade_type, "rate": common.formatCurrency(rate, pair), "amount": common.formatCurrency(amount, pair)} return TradeResult(self._post(params, connection))
def test_formatCurrencyByPair(self): for p, d in max_digits.items(): self.assertEqual(formatCurrency(1.12, p), formatCurrencyDigits(1.12, d)) self.assertEqual(formatCurrency(44.0, p), formatCurrencyDigits(44.0, d)) self.assertEqual(truncateAmount(1.12, p), truncateAmountDigits(1.12, d)) self.assertEqual(truncateAmount(44.0, p), truncateAmountDigits(44.0, d))