BTCMarkets / API

API
120 stars 30 forks source link

Create order - Invalid amount error #161

Closed stevenmasci closed 4 years ago

stevenmasci commented 5 years ago

Hi,

When creating an order with the following details I receive the error below.

symbol: GNT/AUD, order type: limit, side: buy, volume: 1381.0876, price: 0.1362

{"success":false,"errorCode":3,"errorMessage":"Invalid amount.","id":0,"clientRequestId":"XXXXXXX"}

However, previously I have created orders with these details with no issue

symbol: GNT/AUD, order type: limit, side: buy, volume: 1383.587, price: 0.1365 symbol: GNT/AUD, order type: limit, side: buy, volume: 1386.0876, price: 0.1437

I assume "invalid amount" is referring to the price, is this correct?

I've also read on the trading API that states:

When passing AUD as currency, maximum 2 decimal points are allowed. In above example, $130 and $130.12 are allowed but $130.123 will return "invalid amount".

But that doesn't explain why it worked previously and why submitting price values of $X.XXXX AUD works on the website.

Any idea whats happening or what I'm doing wrong? Thank you.

martin-nginio commented 5 years ago

Hi @stevenmasci

Thanks for your feedback.

Please see below for number formats (e.g. price, volume) when working with APIs. https://github.com/BTCMarkets/API/wiki/Trading-API#number-conversion

Please note that the number format has always stayed the same.

Regards, Martin

stevenmasci commented 5 years ago

Thanks for your reply @martin-nginio

Sorry for being vague, yes the app does multiply it by 1E8 as described in that link. I just represented the prices as AUD values in that post.

So the "invalid" create order is being submitted with a price of 13620000 and volume 138108760000

Where as these create orders worked: price: 13650000, volume: 138358700000 price: 14370000, volume: 138608760000

martin-nginio commented 5 years ago

please note that GNT has a minimum order volume as 0.15 or 15000000 (after multiplied by IE8). when submitting orders with less amounts then you will get invalid amount.

I believe this has been the case since introduction of GNT last year.

stevenmasci commented 5 years ago

The order is greater than the minimum order volume.

Any idea why one of the create order requests failed but the other two were successful?

martin-nginio commented 5 years ago

I can confirm that for GNT/AUD market, placing orders with up to 4 decimal points for price should work on both the website and also API. (sorry if the documentation is not clear and generic. )

For instance calling the API to create an order (order to buy with volume of 1.0 ) with the price of 0.1234 (12340000) should work. There is no restriction on the specific price you mentioned 13620000 compared to other prices.

If you are still getting issues with specific order, please can you add all other detail (with exception of private key and signature) and we should be able to investigate further.

Thanks.

martin-nginio commented 4 years ago

Hi @stevenmasci

I'm closing the issue but if you still have questions please let us know.

By the way, we have developed new generation of API that comes with several improvements and new features (including better error handling). Please feel free to check it below and If you have any questions please let us know.

https://api.btcmarkets.net/doc/v3#section/Introduction

Thanks again.