mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-05 15:10:59 +00:00
@@ -3,6 +3,7 @@ package yobit
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -329,7 +330,7 @@ func (y *Yobit) RedeemCoupon(coupon string) (RedeemCoupon, error) {
|
||||
|
||||
// SendHTTPRequest sends an unauthenticated HTTP request
|
||||
func (y *Yobit) SendHTTPRequest(path string, result interface{}) error {
|
||||
return y.SendPayload("GET", path, nil, nil, result, false, y.Verbose)
|
||||
return y.SendPayload(http.MethodGet, path, nil, nil, result, false, y.Verbose)
|
||||
}
|
||||
|
||||
// SendAuthenticatedHTTPRequest sends an authenticated HTTP request to Yobit
|
||||
@@ -362,7 +363,7 @@ func (y *Yobit) SendAuthenticatedHTTPRequest(path string, params url.Values, res
|
||||
headers["Sign"] = common.HexEncodeToString(hmac)
|
||||
headers["Content-Type"] = "application/x-www-form-urlencoded"
|
||||
|
||||
return y.SendPayload("POST", apiPrivateURL, headers, strings.NewReader(encoded), result, true, y.Verbose)
|
||||
return y.SendPayload(http.MethodPost, apiPrivateURL, headers, strings.NewReader(encoded), result, true, y.Verbose)
|
||||
}
|
||||
|
||||
// GetFee returns an estimate of fee based on type of transaction
|
||||
|
||||
@@ -150,10 +150,15 @@ func (y *Yobit) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exc
|
||||
}
|
||||
|
||||
// SubmitOrder submits a new order
|
||||
func (y *Yobit) SubmitOrder(p pair.CurrencyPair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, clientID string) (exchange.SubmitOrderResponse, error) {
|
||||
// Yobit only supports limit orders
|
||||
func (y *Yobit) SubmitOrder(p pair.CurrencyPair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, _ string) (exchange.SubmitOrderResponse, error) {
|
||||
var submitOrderResponse exchange.SubmitOrderResponse
|
||||
response, err := y.Trade(p.Pair().String(), orderType.ToString(), amount, price)
|
||||
|
||||
if orderType != exchange.LimitOrderType {
|
||||
return submitOrderResponse, errors.New("only limit orders are allowed")
|
||||
}
|
||||
|
||||
response, err := y.Trade(p.Pair().String(), side.ToString(), amount, price)
|
||||
if response > 0 {
|
||||
submitOrderResponse.OrderID = fmt.Sprintf("%v", response)
|
||||
}
|
||||
@@ -183,7 +188,7 @@ func (y *Yobit) CancelOrder(order exchange.OrderCancellation) error {
|
||||
}
|
||||
|
||||
// CancelAllOrders cancels all orders associated with a currency pair
|
||||
func (y *Yobit) CancelAllOrders(orderCancellation exchange.OrderCancellation) (exchange.CancelAllOrdersResponse, error) {
|
||||
func (y *Yobit) CancelAllOrders(_ exchange.OrderCancellation) (exchange.CancelAllOrdersResponse, error) {
|
||||
cancelAllOrdersResponse := exchange.CancelAllOrdersResponse{
|
||||
OrderStatus: make(map[string]string),
|
||||
}
|
||||
@@ -222,7 +227,7 @@ func (y *Yobit) GetOrderInfo(orderID int64) (exchange.OrderDetail, error) {
|
||||
}
|
||||
|
||||
// GetDepositAddress returns a deposit address for a specified currency
|
||||
func (y *Yobit) GetDepositAddress(cryptocurrency pair.CurrencyItem, accountID string) (string, error) {
|
||||
func (y *Yobit) GetDepositAddress(cryptocurrency pair.CurrencyItem, _ string) (string, error) {
|
||||
a, err := y.GetCryptoDepositAddress(cryptocurrency.String())
|
||||
if err != nil {
|
||||
return "", err
|
||||
@@ -241,7 +246,7 @@ func (y *Yobit) WithdrawCryptocurrencyFunds(withdrawRequest exchange.WithdrawReq
|
||||
if len(resp.Error) > 0 {
|
||||
return "", errors.New(resp.Error)
|
||||
}
|
||||
return "", nil
|
||||
return "success", nil
|
||||
}
|
||||
|
||||
// WithdrawFiatFunds returns a withdrawal ID when a
|
||||
|
||||
Reference in New Issue
Block a user