mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-05 23:16:53 +00:00
Remove unwanted wrapper name stuttering and standardise common error returns (#213)
This commit is contained in:
committed by
Adrian Gallagher
parent
c41f611d96
commit
92534249bf
@@ -71,7 +71,7 @@ if err != nil {
|
||||
// set and AuthenticatedAPISupport is set to true
|
||||
|
||||
// Fetches current account information
|
||||
accountInfo, err := l.GetExchangeAccountInfo()
|
||||
accountInfo, err := l.GetAccountInfo()
|
||||
if err != nil {
|
||||
// Handle error
|
||||
}
|
||||
|
||||
@@ -183,10 +183,10 @@ func (l *Liqui) GetTrades(currencyPair string) ([]Trades, error) {
|
||||
return response.Data[currencyPair], l.SendHTTPRequest(req, &response.Data)
|
||||
}
|
||||
|
||||
// GetAccountInfo returns information about the user’s current balance, API-key
|
||||
// GetAccountInformation returns information about the user’s current balance, API-key
|
||||
// privileges, the number of open orders and Server Time. To use this method you
|
||||
// need a privilege of the key info.
|
||||
func (l *Liqui) GetAccountInfo() (AccountInfo, error) {
|
||||
func (l *Liqui) GetAccountInformation() (AccountInfo, error) {
|
||||
var result AccountInfo
|
||||
|
||||
return result,
|
||||
@@ -217,8 +217,8 @@ func (l *Liqui) GetActiveOrders(pair string) (map[string]ActiveOrders, error) {
|
||||
return result, l.SendAuthenticatedHTTPRequest(liquiActiveOrders, req, &result)
|
||||
}
|
||||
|
||||
// GetOrderInfo returns the information on particular order.
|
||||
func (l *Liqui) GetOrderInfo(OrderID int64) (map[string]OrderInfo, error) {
|
||||
// GetOrderInfoByID returns the information on particular order.
|
||||
func (l *Liqui) GetOrderInfoByID(OrderID int64) (map[string]OrderInfo, error) {
|
||||
result := make(map[string]OrderInfo)
|
||||
|
||||
req := url.Values{}
|
||||
@@ -227,8 +227,8 @@ func (l *Liqui) GetOrderInfo(OrderID int64) (map[string]OrderInfo, error) {
|
||||
return result, l.SendAuthenticatedHTTPRequest(liquiOrderInfo, req, &result)
|
||||
}
|
||||
|
||||
// CancelOrder method is used for order cancelation.
|
||||
func (l *Liqui) CancelOrder(OrderID int64) (bool, error) {
|
||||
// CancelExistingOrder method is used for order cancelation.
|
||||
func (l *Liqui) CancelExistingOrder(OrderID int64) (bool, error) {
|
||||
req := url.Values{}
|
||||
req.Add("order_id", strconv.FormatInt(OrderID, 10))
|
||||
|
||||
|
||||
@@ -100,9 +100,9 @@ func TestAuthRequests(t *testing.T) {
|
||||
t.Error("Test Failed - liqui GetOrderInfo() error", err)
|
||||
}
|
||||
|
||||
_, err = l.CancelOrder(1337)
|
||||
_, err = l.CancelExistingOrder(1337)
|
||||
if err == nil {
|
||||
t.Error("Test Failed - liqui CancelOrder() error", err)
|
||||
t.Error("Test Failed - liqui CancelExistingOrder() error", err)
|
||||
}
|
||||
|
||||
_, err = l.GetTradeHistory(url.Values{}, "")
|
||||
@@ -251,7 +251,7 @@ func TestSubmitOrder(t *testing.T) {
|
||||
FirstCurrency: symbol.BTC,
|
||||
SecondCurrency: symbol.EUR,
|
||||
}
|
||||
response, err := l.SubmitExchangeOrder(p, exchange.Buy, exchange.Market, 1, 10, "hi")
|
||||
response, err := l.SubmitOrder(p, exchange.Buy, exchange.Market, 1, 10, "hi")
|
||||
if err != nil || !response.IsOrderPlaced {
|
||||
t.Errorf("Order failed to be placed: %v", err)
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package liqui
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"log"
|
||||
"sync"
|
||||
@@ -113,12 +112,12 @@ func (l *Liqui) UpdateOrderbook(p pair.CurrencyPair, assetType string) (orderboo
|
||||
return orderbook.GetOrderbook(l.Name, p, assetType)
|
||||
}
|
||||
|
||||
// GetExchangeAccountInfo retrieves balances for all enabled currencies for the
|
||||
// GetAccountInfo retrieves balances for all enabled currencies for the
|
||||
// Liqui exchange
|
||||
func (l *Liqui) GetExchangeAccountInfo() (exchange.AccountInfo, error) {
|
||||
func (l *Liqui) GetAccountInfo() (exchange.AccountInfo, error) {
|
||||
var response exchange.AccountInfo
|
||||
response.ExchangeName = l.GetName()
|
||||
accountBalance, err := l.GetAccountInfo()
|
||||
accountBalance, err := l.GetAccountInformation()
|
||||
if err != nil {
|
||||
return response, err
|
||||
}
|
||||
@@ -134,22 +133,22 @@ func (l *Liqui) GetExchangeAccountInfo() (exchange.AccountInfo, error) {
|
||||
return response, nil
|
||||
}
|
||||
|
||||
// GetExchangeFundTransferHistory returns funding history, deposits and
|
||||
// GetFundingHistory returns funding history, deposits and
|
||||
// withdrawals
|
||||
func (l *Liqui) GetExchangeFundTransferHistory() ([]exchange.FundHistory, error) {
|
||||
func (l *Liqui) GetFundingHistory() ([]exchange.FundHistory, error) {
|
||||
var fundHistory []exchange.FundHistory
|
||||
return fundHistory, errors.New("not supported on exchange")
|
||||
return fundHistory, common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetExchangeHistory returns historic trade data since exchange opening.
|
||||
func (l *Liqui) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) {
|
||||
var resp []exchange.TradeHistory
|
||||
|
||||
return resp, errors.New("trade history not yet implemented")
|
||||
return resp, common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// SubmitExchangeOrder submits a new order
|
||||
func (l *Liqui) SubmitExchangeOrder(p pair.CurrencyPair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, clientID string) (exchange.SubmitOrderResponse, error) {
|
||||
// SubmitOrder submits a new order
|
||||
func (l *Liqui) SubmitOrder(p pair.CurrencyPair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, clientID string) (exchange.SubmitOrderResponse, error) {
|
||||
var submitOrderResponse exchange.SubmitOrderResponse
|
||||
response, err := l.Trade(p.Pair().String(), fmt.Sprintf("%s", orderType), amount, price)
|
||||
|
||||
@@ -164,54 +163,54 @@ func (l *Liqui) SubmitExchangeOrder(p pair.CurrencyPair, side exchange.OrderSide
|
||||
return submitOrderResponse, err
|
||||
}
|
||||
|
||||
// ModifyExchangeOrder will allow of changing orderbook placement and limit to
|
||||
// ModifyOrder will allow of changing orderbook placement and limit to
|
||||
// market conversion
|
||||
func (l *Liqui) ModifyExchangeOrder(orderID int64, action exchange.ModifyOrder) (int64, error) {
|
||||
return 0, errors.New("not yet implemented")
|
||||
func (l *Liqui) ModifyOrder(orderID int64, action exchange.ModifyOrder) (int64, error) {
|
||||
return 0, common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// CancelExchangeOrder cancels an order by its corresponding ID number
|
||||
func (l *Liqui) CancelExchangeOrder(orderID int64) error {
|
||||
return errors.New("not yet implemented")
|
||||
// CancelOrder cancels an order by its corresponding ID number
|
||||
func (l *Liqui) CancelOrder(orderID int64) error {
|
||||
return common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// CancelAllExchangeOrders cancels all orders associated with a currency pair
|
||||
func (l *Liqui) CancelAllExchangeOrders() error {
|
||||
return errors.New("not yet implemented")
|
||||
// CancelAllOrders cancels all orders associated with a currency pair
|
||||
func (l *Liqui) CancelAllOrders() error {
|
||||
return common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// GetExchangeOrderInfo returns information on a current open order
|
||||
func (l *Liqui) GetExchangeOrderInfo(orderID int64) (exchange.OrderDetail, error) {
|
||||
// GetOrderInfo returns information on a current open order
|
||||
func (l *Liqui) GetOrderInfo(orderID int64) (exchange.OrderDetail, error) {
|
||||
var orderDetail exchange.OrderDetail
|
||||
return orderDetail, errors.New("not yet implemented")
|
||||
return orderDetail, common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// GetExchangeDepositAddress returns a deposit address for a specified currency
|
||||
func (l *Liqui) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (string, error) {
|
||||
return "", errors.New("not yet implemented")
|
||||
// GetDepositAddress returns a deposit address for a specified currency
|
||||
func (l *Liqui) GetDepositAddress(cryptocurrency pair.CurrencyItem) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// WithdrawCryptoExchangeFunds returns a withdrawal ID when a withdrawal is
|
||||
// WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is
|
||||
// submitted
|
||||
func (l *Liqui) WithdrawCryptoExchangeFunds(address string, cryptocurrency pair.CurrencyItem, amount float64) (string, error) {
|
||||
return "", errors.New("not yet implemented")
|
||||
func (l *Liqui) WithdrawCryptocurrencyFunds(address string, cryptocurrency pair.CurrencyItem, amount float64) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// WithdrawFiatExchangeFunds returns a withdrawal ID when a
|
||||
// WithdrawFiatFunds returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
func (l *Liqui) WithdrawFiatExchangeFunds(currency pair.CurrencyItem, amount float64) (string, error) {
|
||||
return "", errors.New("not yet implemented")
|
||||
func (l *Liqui) WithdrawFiatFunds(currency pair.CurrencyItem, amount float64) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// WithdrawFiatExchangeFundsToInternationalBank returns a withdrawal ID when a
|
||||
// WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
func (l *Liqui) WithdrawFiatExchangeFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) {
|
||||
return "", errors.New("not yet implemented")
|
||||
func (l *Liqui) WithdrawFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// GetWebsocket returns a pointer to the exchange websocket
|
||||
func (l *Liqui) GetWebsocket() (*exchange.Websocket, error) {
|
||||
return nil, errors.New("not yet implemented")
|
||||
return nil, common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// GetFeeByType returns an estimate of fee based on type of transaction
|
||||
|
||||
Reference in New Issue
Block a user