sending an order through BTC-e API incorrect field error

1

I get the following message when trying to send a buy/sell order through btc-e api using a variable: "you incorrectly entered one of the fields".

This is the line of code I use for sending an order:

APIMain.Trade(BtcePair.BtcUsd, TradeType.Sell, Math.Round(myAskP, 4), Math.Round(myAskQ, 4));

Sending an order via api does work when I enter it like this:

APIMain.Trade(BtcePair.BtcUsd, TradeType.Sell, 800m, 0.5m);

How do I force a decimal variable to be formatted like the line above? Anybody experienced similar problems?

user10776

Posted 2013-12-13T18:54:34.277

Reputation: 21

might be helpful if you could mention the particular programming language you are using I'm guessing maybe Java?Mark S. 2013-12-14T04:03:58.057

Answers

2

The exact problem you're facing regards the number of acceptable decimal digits in the rate field.

You're trying to submit an order on the BTC/USD pair, which happens to have a max decimal allotment of 3. Meaning, you can submit an order for example 800.123, but NOT 800.1234 Not all pairs are the same. LTC/USD can have 6 digits, most BTC based pairs can accept 5 digits.

To get a list of exact information regarding the individual pairs, use this public endpoint for a JSON object that gives you all the values: https://btc-e.com/api/3/info

As far as I know, all pairs' amount fields can have a max of 8 decimals. You are rounding both the amount and rate to 4 digits. Fix the rate field and it should work.

Please keep in mind when I say "decimal places" I mean actual number of digits after the period in a number. Not the numerical type decimal that you are using. Using a double or float will work as well, provided they are rounded properly.

ACVentures

Posted 2013-12-13T18:54:34.277

Reputation: 81

1

The problem seems to be in the Price. This worked:

APIMain.Trade(BtcePair.BtcUsd, TradeType.Buy, decimal.Floor(myBidP),decimal.Round(myBidQ,4));

Can somebody confirm that the price must be rounded to the nearest integer?

Bonne chance trading everybody......

user10776

Posted 2013-12-13T18:54:34.277

Reputation: 21

Price and quantity are automatically rounded by BTC-e. I believe they round to the nearest number (e.g. 0.5 up 0.4999 down), still I would strongly recommend rounding down yourself to avoid missing trades due to insufficient funds.Mark 2014-01-31T17:08:53.773