user10776: 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: 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......

user12900: 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.

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

<p>This is the line of code I use for sending an order:</p>

<pre><code>APIMain.Trade(BtcePair.BtcUsd, TradeType.Sell, Math.Round(myAskP, 4), Math.Round(myAskQ, 4));
</code></pre>

<p>Sending an order via api does work when I enter it like this:</p>

<pre><code>APIMain.Trade(BtcePair.BtcUsd, TradeType.Sell, 800m, 0.5m);
</code></pre>

<p>How do I force a decimal variable to be formatted like the line above?
Anybody experienced similar problems?</p>
 10776: <p>The problem seems to be in the Price. This worked:</p>

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

<p>Can somebody confirm that the price must be rounded to the nearest integer?</p>

<p>Bonne chance trading everybody......</p>
 12900: <p>The exact problem you're facing regards the number of acceptable decimal digits in the <code>rate</code> field.</p>

<p>You're trying to submit an order on the <code>BTC/USD</code> 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. <code>LTC/USD</code> can have 6 digits, most BTC based pairs can accept 5 digits.</p>

<p>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:  <a href="https://btc-e.com/api/3/info" rel="nofollow">https://btc-e.com/api/3/info</a></p>

<p>As far as I know, all pairs' <code>amount</code> 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.</p>

<p>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 <code>decimal</code> that you are using. Using a <code>double</code> or <code>float</code> will work as well, provided they are rounded properly.</p>
