gateio / gateapi-python

243 stars 91 forks source link

Errors: Your order size 2 is too small. The minimum is 1 USDT #139

Closed akashc-25 closed 1 year ago

akashc-25 commented 1 year ago

I am using the Python SDK for my App to buy and sell Crypto. So, I‘m calling the API to buy the ALEPH USDT crypto.

  1. I then use the get currency pair API to retrieve the ALEPH USDT currency pair. I am obtaining the min quote amount value from the pair.

      pair = spot_api.get_currency_pair("ALEPH USDT")
      pair.min_quote_amount
    
     {
        "id": "ALEPH_USDT",
        "base": "ALEPH",
        "quote": "USDT",
        "fee": "0.2",
        "min_quote_amount": "1",
        "amount_precision": 3,
        "precision": 5,
        "trade_status": "tradable",
        "sell_start": 0,
        "buy_start": 0
    },
    
    I'm taking the 1 as min_quote_amount.
  2. Next, I am calling the list_tickers API to get the last price of the currency.

      tickers = spot_api.list_tickers(currency_pair=bot.currency_pair)
      tickers[0].last
    
      tickers[0].last returning the 0.1149 value.
  3. After that, I am initializing the Order class by passing the necessary values.

      currency = bot.currency_pair.split("_")[1]   => USDT (In this case)
      order_amount = D(min_amount) * 2 => 2
      order = Order(amount=str(order_amount), price=0.1149, side='buy', currency_pair=ALEPH_USDT)       
    
      returning the order object
  4. Then I am calling the create_order.

      spot_api.create_order(order)
    
      It is giving me the error saying that "Your order size 2 is too small. The minimum is 1 USDT".

Can anybody please assist me with this?

I'm assuming that because ALEPH USDT crypto isn't returning the min base amount, some internal conditions aren't satisfied. Is this the cause of the above problem or is there another factor that I am missing?

revilwang commented 1 year ago

When no min_base_amount is returned, it means there is no limit on minimum base currency required. However, to create an order, you have to satisfy both base and quote minimum. In this case. Although no minimum amount is placed on ALEPH, the minimum quote amount is 1 USDT(which is also said in the error message), which means the value of your ALEPH order(amount * your order price) must be larger than 1 USDT.

akashc-25 commented 1 year ago

Okay, I understood

Sorry for this question, What does the amount in this calculation (amount your order price) represent—the minimum quotation amount, or the last price, or the amount=(minimum quote amount total quantity)?

And correct me if I'm wrong, but does "your order price" in the formula equal to this formula (minimum quote amount * total quantity)?

revilwang commented 1 year ago

It means your order amount. That is, your order must meet the following requirements.

  1. Order amount >= min_base_amount
  2. Order amount * Order price >= min_quote_amount

When either min_quote_amount or min_base_amount is missing, just ignore corresponding requirement.

akashc-25 commented 1 year ago

Okay, Thank you