Skip to content

Commit

Permalink
add amount & price to orders task as float
Browse files Browse the repository at this point in the history
  • Loading branch information
Sagleft committed Feb 14, 2023
1 parent b8c7f1c commit 4649e40
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions trade.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@ import (
)

func (c *Client) sendTradeTask(orderType string, pairSymbol string, amount, price float64) (int64, error) {
reqFields := url.Values{}
reqFields, err := url.ParseQuery(fmt.Sprintf(
"amount=%v&price=%v",
amount, price,
))
if err != nil {
return 0, fmt.Errorf("parse query: %w", err)
}
reqFields.Add("pair", pairSymbol)
reqFields.Add("amount", strconv.FormatFloat(amount, 'f', 8, 64))
reqFields.Add("price", strconv.FormatFloat(price, 'f', 8, 64))

body, err := c.sendRequest(c.getAPIURL("market/"+orderType), "POST", reqFields)
if err != nil {
Expand Down

0 comments on commit 4649e40

Please sign in to comment.