Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manually support gate.io minimum cost #3032

Merged
merged 2 commits into from
Jun 5, 2018
Merged

Conversation

miracle2k
Copy link
Contributor

gate.io returns a minimum amount via the API, and ccxt uses that + a minim-based derived from the decimal places to set the minimum cost. However, the gate.io API says:

ccxt.base.errors.ExchangeError: gateio {"result":"false","message":"Your order size is too small. The minimum is 1 USDT","code":20}

It does so when I want to sell 2 XLM on XLM/USDT. 2 XLM is much more than the minimum amount given via the API (0.0001), but clearly not enough. It seems there is a hidden "cost"-based limit from the API that we do not yet know.

I used trial an error here to figure those out.

gate.io returns a minimum amount via the API, and ccxt uses that + a minim-based derived from the decimal places to set the minimum cost. However, the gate.io API says:

```
ccxt.base.errors.ExchangeError: gateio {"result":"false","message":"Your order size is too small. The minimum is 1 USDT","code":20}
```

It does so when I want to sell 2 XLM on XLM/USDT.  2 XLM is much more than the minimum amount given via the API (0.0001), but clearly not enough. It seems there is a hidden "cost"-based limit from the API that we do not yet know.

I used trial an error here to figure those out.
@frosty00
Copy link
Member

frosty00 commented Jun 4, 2018

load these into the .markets attribute, not the code

@miracle2k
Copy link
Contributor Author

Do you mean add them to the structure returned by describe()? (https://github.com/miracle2k/ccxt/blob/eeadbe46f8761be39555461bf8bd66b99bab47c4/js/gateio.js#L11)

Do you have an example of how to define per-currency limits in that structure?

@kroitor
Copy link
Member

kroitor commented Jun 4, 2018

Do you have an example of how to define per-currency limits in that structure?

https://github.com/ccxt/ccxt/wiki/Manual#precision-and-limits
That info is stored in each market of .markets and in each currency of .currencies, under the limits key, where available )

@kroitor kroitor self-assigned this Jun 4, 2018
@miracle2k
Copy link
Contributor Author

Sorry for being thick. Can you link to an example, or to the line in the code where I am supposed to add these changes? It seems to me that we fetch the markets from the server, thus we construct .markets dynamically, and so at that point we are adding in the limits, no?

@frosty00
Copy link
Member

frosty00 commented Jun 4, 2018

Yeah load them in the .limits param - https://github.com/ccxt/ccxt/blob/master/js/base/Exchange.js#L523

@miracle2k
Copy link
Contributor Author

I still don't get it. The code that you linked to:

  • Loops through all the markets we collected from the server response.
  • For each market, provides as a default market.limits and market.precision, by copying the exchange-wide default into the market - if the market has no value of it's own.

In this case, some limits are different for each market. The limit is based on the quote currency of the market. For the markets XRP/USDT and REP/USDT we have to use a cost-limit of 1, but for the market XRP/ETH, we have to use a cost limit of 0.001.

Can I ask you to have a second look at the patch to confirm that I really need to change something? Maybe I was not clear about the kind of change this is.

@kroitor kroitor merged commit eeadbe4 into ccxt:master Jun 5, 2018
kroitor added a commit that referenced this pull request Jun 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants