Use -1 and 'f' for formatting floats.

This commit is contained in:
Adrian Gallagher
2015-06-20 17:01:14 +10:00
parent 1f6f160c23
commit 8761189400
12 changed files with 54 additions and 54 deletions

View File

@@ -157,8 +157,8 @@ func (h *HUOBI) Trade(orderType string, coinType int, price, amount float64) {
orderType = "sell"
}
values.Set("coin_type", strconv.Itoa(coinType))
values.Set("amount", strconv.FormatFloat(amount, 'f', 8, 64))
values.Set("price", strconv.FormatFloat(price, 'f', 8, 64))
values.Set("amount", strconv.FormatFloat(amount, 'f', -1, 64))
values.Set("price", strconv.FormatFloat(price, 'f', -1, 64))
err := h.SendAuthenticatedRequest(orderType, values)
if err != nil {
@@ -172,8 +172,8 @@ func (h *HUOBI) MarketTrade(orderType string, coinType int, price, amount float6
orderType = "sell_market"
}
values.Set("coin_type", strconv.Itoa(coinType))
values.Set("amount", strconv.FormatFloat(amount, 'f', 8, 64))
values.Set("price", strconv.FormatFloat(price, 'f', 8, 64))
values.Set("amount", strconv.FormatFloat(amount, 'f', -1, 64))
values.Set("price", strconv.FormatFloat(price, 'f', -1, 64))
err := h.SendAuthenticatedRequest(orderType, values)
if err != nil {
@@ -196,8 +196,8 @@ func (h *HUOBI) ModifyOrder(orderType string, coinType, orderID int, price, amou
values := url.Values{}
values.Set("coin_type", strconv.Itoa(coinType))
values.Set("id", strconv.Itoa(orderID))
values.Set("amount", strconv.FormatFloat(amount, 'f', 8, 64))
values.Set("price", strconv.FormatFloat(price, 'f', 8, 64))
values.Set("amount", strconv.FormatFloat(amount, 'f', -1, 64))
values.Set("price", strconv.FormatFloat(price, 'f', -1, 64))
err := h.SendAuthenticatedRequest("modify_order", values)
if err != nil {