Ejemplo n.º 1
0
def is_valid_order_amount(value: str) -> bool:
    try:
        trading_pair = cross_exchange_market_making_config_map[
            "maker_market_trading_pair"].value
        return Decimal(value) >= minimum_order_amount(trading_pair)
    except Exception:
        return False
Ejemplo n.º 2
0
def validate_order_amount(value: str) -> Optional[str]:
    try:
        trading_pair = pure_market_making_config_map["market"].value
        min_amount = minimum_order_amount(trading_pair)
        if Decimal(value) < min_amount:
            return f"Order amount must be at least {min_amount}."
    except Exception:
        return f"Invalid order amount."
    def test_minimum_order_amount_no_default_min_quote(self):
        global_config_map["min_quote_order_amount"].value = {
            "USDT": Decimal("10")
        }
        min_amount = self.async_run_with_timeout(
            minimum_order_amount(exchange="binance", trading_pair="BTC-USDC"))

        self.assertEqual(0, min_amount)
Ejemplo n.º 4
0
def order_amount_prompt() -> str:
    maker_exchange = cross_exchange_market_making_config_map[
        "maker_market"].value
    trading_pair = cross_exchange_market_making_config_map[
        "maker_market_trading_pair"].value
    base_asset, quote_asset = trading_pair.split("-")
    min_amount = minimum_order_amount(maker_exchange, trading_pair)
    return f"What is the amount of {base_asset} per order? (minimum {min_amount}) >>> "
def validate_order_amount(value: str) -> Optional[str]:
    try:
        exchange = candle_spike_config_map["exchange"].value
        trading_pair = candle_spike_config_map["market"].value
        min_amount = minimum_order_amount(exchange, trading_pair)
        if Decimal(value) < min_amount:
            return f"Order amount must be at least {min_amount}."
    except Exception:
        return "Invalid order amount."
Ejemplo n.º 6
0
def validate_order_amount(value: str) -> Optional[str]:
    try:
        maker_exchange = triangular_arbitrage_config_map.get("market").value
        trading_pair = triangular_arbitrage_config_map.get("first_market_trading_pair").value
        min_amount = minimum_order_amount(maker_exchange, trading_pair)
        if Decimal(value) < min_amount:
            return f"Order amount must be at least {min_amount}."
    except Exception:
        return "Invalid order amount."
    def test_minimum_order_amount_with_default_min_quote_and_fail_to_get_last_price(
            self, get_last_price_mock: AsyncMock):
        get_last_price_mock.side_effect = self.get_async_sleep_fn(delay=0.02)
        global_config_map["create_command_timeout"].value = 0.01
        global_config_map["min_quote_order_amount"].value = {
            "USDT": Decimal("10")
        }
        min_amount = self.async_run_with_timeout(
            minimum_order_amount(exchange="binance", trading_pair="BTC-USDT"))

        self.assertEqual(0, min_amount)
    def test_minimum_order_amount_with_default_min_quote_and_last_price(
            self, get_last_price_mock: AsyncMock):
        get_last_price_mock.return_value = Decimal("5")
        global_config_map["create_command_timeout"].value = 10
        global_config_map["min_quote_order_amount"].value = {
            "USDT": Decimal("10")
        }
        min_amount = self.async_run_with_timeout(
            minimum_order_amount(exchange="binance", trading_pair="BTC-USDT"))

        self.assertEqual(2, min_amount)
Ejemplo n.º 9
0
def order_start_size_prompt() -> str:
    trading_pair = pure_market_making_config_map["market"].value
    min_amount = minimum_order_amount(trading_pair)
    return f"What is the size of the first bid and ask order? (minimum {min_amount}) >>> "
Ejemplo n.º 10
0
def order_amount_prompt() -> str:
    trading_pair = pure_market_making_config_map["market"].value
    base_asset, quote_asset = trading_pair.split("-")
    min_amount = minimum_order_amount(trading_pair)
    return f"What is the amount of {base_asset} per order? (minimum {min_amount}) >>> "
def order_amount_prompt() -> str:
    exchange = candle_spike_config_map["exchange"].value
    trading_pair = candle_spike_config_map["market"].value
    base_asset, quote_asset = trading_pair.split("-")
    min_amount = minimum_order_amount(exchange, trading_pair)
    return f"What is the amount of {base_asset} per order? (minimum {min_amount}) >>> "
Ejemplo n.º 12
0
def order_amount_prompt() -> str:
    maker_exchange = triangular_arbitrage_config_map["market"].value
    trading_pair = triangular_arbitrage_config_map.get("first_market_trading_pair").value
    base_asset, quote_asset = trading_pair.split("-")
    min_amount = minimum_order_amount(maker_exchange, trading_pair)
    return f"What is the amount of {base_asset} per order? (minimum {min_amount}) >>>: "