mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-22 23:16:48 +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 := b.GetExchangeAccountInfo()
|
||||
accountInfo, err := b.GetAccountInfo()
|
||||
if err != nil {
|
||||
// Handle error
|
||||
}
|
||||
|
||||
@@ -315,8 +315,8 @@ func (b *Bittrex) GetOpenOrders(currencyPair string) (Order, error) {
|
||||
return orders, nil
|
||||
}
|
||||
|
||||
// CancelOrder is used to cancel a buy or sell order.
|
||||
func (b *Bittrex) CancelOrder(uuid string) (Balances, error) {
|
||||
// CancelExistingOrder is used to cancel a buy or sell order.
|
||||
func (b *Bittrex) CancelExistingOrder(uuid string) (Balances, error) {
|
||||
var balances Balances
|
||||
values := url.Values{}
|
||||
values.Set("uuid", uuid)
|
||||
@@ -365,10 +365,10 @@ func (b *Bittrex) GetAccountBalanceByCurrency(currency string) (Balance, error)
|
||||
return balance, nil
|
||||
}
|
||||
|
||||
// GetDepositAddress is used to retrieve or generate an address for a specific
|
||||
// GetCryptoDepositAddress is used to retrieve or generate an address for a specific
|
||||
// currency. If one does not exist, the call will fail and return
|
||||
// ADDRESS_GENERATING until one is available.
|
||||
func (b *Bittrex) GetDepositAddress(currency string) (DepositAddress, error) {
|
||||
func (b *Bittrex) GetCryptoDepositAddress(currency string) (DepositAddress, error) {
|
||||
var address DepositAddress
|
||||
values := url.Values{}
|
||||
values.Set("currency", currency)
|
||||
|
||||
@@ -140,12 +140,12 @@ func TestGetOpenOrders(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestCancelOrder(t *testing.T) {
|
||||
func TestCancelExistingOrder(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
_, err := b.CancelOrder("blaaaaaaa")
|
||||
_, err := b.CancelExistingOrder("blaaaaaaa")
|
||||
if err == nil {
|
||||
t.Error("Test Failed - Bittrex - CancelOrder() error")
|
||||
t.Error("Test Failed - Bittrex - CancelExistingOrder() error")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -349,7 +349,7 @@ func TestSubmitOrder(t *testing.T) {
|
||||
FirstCurrency: symbol.BTC,
|
||||
SecondCurrency: symbol.LTC,
|
||||
}
|
||||
response, err := b.SubmitExchangeOrder(p, exchange.Buy, exchange.Limit, 1, 1, "clientId")
|
||||
response, err := b.SubmitOrder(p, exchange.Buy, exchange.Limit, 1, 1, "clientId")
|
||||
if err != nil || !response.IsOrderPlaced {
|
||||
t.Errorf("Order failed to be placed: %v", err)
|
||||
}
|
||||
|
||||
@@ -60,9 +60,9 @@ func (b *Bittrex) Run() {
|
||||
}
|
||||
}
|
||||
|
||||
// GetExchangeAccountInfo Retrieves balances for all enabled currencies for the
|
||||
// GetAccountInfo Retrieves balances for all enabled currencies for the
|
||||
// Bittrex exchange
|
||||
func (b *Bittrex) GetExchangeAccountInfo() (exchange.AccountInfo, error) {
|
||||
func (b *Bittrex) GetAccountInfo() (exchange.AccountInfo, error) {
|
||||
var response exchange.AccountInfo
|
||||
response.ExchangeName = b.GetName()
|
||||
accountBalance, err := b.GetAccountBalances()
|
||||
@@ -154,22 +154,22 @@ func (b *Bittrex) UpdateOrderbook(p pair.CurrencyPair, assetType string) (orderb
|
||||
return orderbook.GetOrderbook(b.Name, p, assetType)
|
||||
}
|
||||
|
||||
// GetExchangeFundTransferHistory returns funding history, deposits and
|
||||
// GetFundingHistory returns funding history, deposits and
|
||||
// withdrawals
|
||||
func (b *Bittrex) GetExchangeFundTransferHistory() ([]exchange.FundHistory, error) {
|
||||
func (b *Bittrex) 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 (b *Bittrex) 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 (b *Bittrex) SubmitExchangeOrder(p pair.CurrencyPair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, clientID string) (exchange.SubmitOrderResponse, error) {
|
||||
// SubmitOrder submits a new order
|
||||
func (b *Bittrex) SubmitOrder(p pair.CurrencyPair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, clientID string) (exchange.SubmitOrderResponse, error) {
|
||||
var submitOrderResponse exchange.SubmitOrderResponse
|
||||
buy := side == exchange.Buy
|
||||
var response UUID
|
||||
@@ -196,54 +196,54 @@ func (b *Bittrex) SubmitExchangeOrder(p pair.CurrencyPair, side exchange.OrderSi
|
||||
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 (b *Bittrex) ModifyExchangeOrder(orderID int64, action exchange.ModifyOrder) (int64, error) {
|
||||
return 0, errors.New("not yet implemented")
|
||||
func (b *Bittrex) ModifyOrder(orderID int64, action exchange.ModifyOrder) (int64, error) {
|
||||
return 0, common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// CancelExchangeOrder cancels an order by its corresponding ID number
|
||||
func (b *Bittrex) CancelExchangeOrder(orderID int64) error {
|
||||
return errors.New("not yet implemented")
|
||||
// CancelOrder cancels an order by its corresponding ID number
|
||||
func (b *Bittrex) CancelOrder(orderID int64) error {
|
||||
return common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// CancelAllExchangeOrders cancels all orders associated with a currency pair
|
||||
func (b *Bittrex) CancelAllExchangeOrders() error {
|
||||
return errors.New("not yet implemented")
|
||||
// CancelAllOrders cancels all orders associated with a currency pair
|
||||
func (b *Bittrex) CancelAllOrders() error {
|
||||
return common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// GetExchangeOrderInfo returns information on a current open order
|
||||
func (b *Bittrex) GetExchangeOrderInfo(orderID int64) (exchange.OrderDetail, error) {
|
||||
// GetOrderInfo returns information on a current open order
|
||||
func (b *Bittrex) 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 (b *Bittrex) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (string, error) {
|
||||
return "", errors.New("not yet implemented")
|
||||
// GetDepositAddress returns a deposit address for a specified currency
|
||||
func (b *Bittrex) 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 (b *Bittrex) WithdrawCryptoExchangeFunds(address string, cryptocurrency pair.CurrencyItem, amount float64) (string, error) {
|
||||
return "", errors.New("not yet implemented")
|
||||
func (b *Bittrex) 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 (b *Bittrex) WithdrawFiatExchangeFunds(currency pair.CurrencyItem, amount float64) (string, error) {
|
||||
return "", errors.New("not yet implemented")
|
||||
func (b *Bittrex) 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 (b *Bittrex) WithdrawFiatExchangeFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) {
|
||||
return "", errors.New("not yet implemented")
|
||||
func (b *Bittrex) WithdrawFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// GetWebsocket returns a pointer to the exchange websocket
|
||||
func (b *Bittrex) 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