コード例 #1
0
    def test_xem_jpy(self):
        tick = Tick(self._xem_jpy)
        case1 = tick.truncate_price(0.1)
        case2 = tick.truncate_price(1)
        case3 = tick.truncate_price(1.0)
        case4 = tick.truncate_price(0.000001)
        case5 = tick.truncate_price(0.12345)

        cases = (case1, case2, case3, case4, case5)
        expected_values = (0.1, 1.0, 1.0, 0.0, 0.1234)
        self.assertEqual(cases, expected_values)
コード例 #2
0
    def test_zaif_btc(self):
        tick = Tick(self._zaif_btc)
        case1 = tick.truncate_price(0.00000001)
        case2 = tick.truncate_price(0.00000001234)
        case3 = tick.truncate_price(0.00000341)
        case4 = tick.truncate_price(1)

        cases = (case1, case2, case3, case4)
        expected_values = (0.00000001, 0.00000001, 0.00000341, 1.0)
        self.assertEqual(cases, expected_values)
コード例 #3
0
    def test_btc_jpy(self):
        tick = Tick(self._btc_jpy)
        case1 = tick.truncate_price(100)
        case2 = tick.truncate_price(3)
        case3 = tick.truncate_price(5)
        case4 = tick.truncate_price(5.0)
        case5 = tick.truncate_price(123.45678)

        cases = (case1, case2, case3, case4, case5)
        expected_values = (100, 0, 5, 5, 120)
        self.assertEqual(cases, expected_values)