Пример #1
0
    def test_fix_market_status_precision_with_price(self):
        emsf = ExchangeMarketStatusFixer({}, 10234.55)
        emsf._fix_market_status_precision_with_price()
        assert emsf.market_status()[
            Ecmsc.PRECISION.value] == self._get_precision(2, 2, 2)

        emsf = ExchangeMarketStatusFixer({}, 10234)
        emsf._fix_market_status_precision_with_price()
        assert emsf.market_status()[
            Ecmsc.PRECISION.value] == self._get_precision(0, 0, 0)

        emsf = ExchangeMarketStatusFixer({}, 10.234140561412567)
        emsf._fix_market_status_precision_with_price()
        assert emsf.market_status()[
            Ecmsc.PRECISION.value] == self._get_precision(15, 15, 15)
Пример #2
0
 def test_fix_market_status_limits_with_specific(self):
     # binance specific
     market_status = {
         Ecmsc.INFO.value: {
             Ecmsic.FILTERS.value: [{
                 Ecmsic.FILTER_TYPE.value:
                 Ecmsic.PRICE_FILTER.value,
                 Ecmsic.MAX_PRICE.value:
                 123456789,
                 Ecmsic.MIN_PRICE.value:
                 0.1234567
             }, {
                 Ecmsic.FILTER_TYPE.value:
                 Ecmsic.LOT_SIZE.value,
                 Ecmsic.MAX_QTY.value:
                 9e11,
                 Ecmsic.MIN_QTY.value:
                 5e-11
             }]
         }
     }
     emsf = ExchangeMarketStatusFixer(market_status)
     emsf._fix_market_status_limits_with_specific()
     assert emsf.market_status()[Ecmsc.LIMITS.value] == self._get_limits(
         5e-11, 9e11, 0.1234567, 123456789, 5e-11 * 0.1234567,
         9e11 * 123456789)
Пример #3
0
    def test_fix_market_status_limits_with_price(self):
        emsf = ExchangeMarketStatusFixer({}, 98765)
        emsf._fix_market_status_limits_with_price()
        assert emsf.market_status()[Ecmsc.LIMITS.value] == self._get_limits(
            0.00010125044297068805, 10.125044297068806, 98.765, 98765000,
            0.010000000000000005, 1000000000.0000006)

        emsf = ExchangeMarketStatusFixer({}, 0.00123456)
        emsf._fix_market_status_limits_with_price()
        assert emsf.market_status()[Ecmsc.LIMITS.value] == self._get_limits(
            0.8100051840331779, 8100.051840331779, 1.23456e-06, 1.23456,
            1.0000000000000002e-06, 10000.000000000002)

        emsf = ExchangeMarketStatusFixer({}, 0.0000012)
        emsf._fix_market_status_limits_with_price()
        assert emsf.market_status()[Ecmsc.LIMITS.value] == self._get_limits(
            833.3333333333311, 8333333.333333311, 1.2e-9, 0.0012,
            9.999999999999974e-07, 9999.999999999973)

        emsf = ExchangeMarketStatusFixer({}, 0.000999)
        emsf._fix_market_status_limits_with_price()
        assert emsf.market_status()[Ecmsc.LIMITS.value] == self._get_limits(
            1.001001001001, 10010.010010009999, 9.99e-07, 0.9990000000000001,
            9.999999999999991e-07, 9999.99999999999)