Remove unwanted wrapper name stuttering and standardise common error returns (#213)

This commit is contained in:
Ryan O'Hara-Reid
2018-11-23 12:55:00 +11:00
committed by Adrian Gallagher
parent c41f611d96
commit 92534249bf
154 changed files with 1362 additions and 1367 deletions

View File

@@ -57,7 +57,7 @@ if err != nil {
// set and AuthenticatedAPISupport is set to true
// Fetches current account information
accountInfo, err := a.GetExchangeAccountInfo()
accountInfo, err := a.GetAccountInfo()
if err != nil {
// Handle error
}

View File

@@ -54,7 +54,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
}

View File

@@ -54,7 +54,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
}

View File

@@ -53,7 +53,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
}

View File

@@ -53,7 +53,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
}

View File

@@ -53,7 +53,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
}

View File

@@ -54,7 +54,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
}

View File

@@ -53,7 +53,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
}

View File

@@ -54,7 +54,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
}

View File

@@ -53,7 +53,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
}

View File

@@ -54,7 +54,7 @@ if err != nil {
// set and AuthenticatedAPISupport is set to true
// Fetches current account information
accountInfo, err := c.GetExchangeAccountInfo()
accountInfo, err := c.GetAccountInfo()
if err != nil {
// Handle error
}

View File

@@ -54,7 +54,7 @@ if err != nil {
// set and AuthenticatedAPISupport is set to true
// Fetches current account information
accountInfo, err := c.GetExchangeAccountInfo()
accountInfo, err := c.GetAccountInfo()
if err != nil {
// Handle error
}

View File

@@ -53,7 +53,7 @@ if err != nil {
// set and AuthenticatedAPISupport is set to true
// Fetches current account information
accountInfo, err := e.GetExchangeAccountInfo()
accountInfo, err := e.GetAccountInfo()
if err != nil {
// Handle error
}

View File

@@ -53,7 +53,7 @@ if err != nil {
// set and AuthenticatedAPISupport is set to true
// Fetches current account information
accountInfo, err := g.GetExchangeAccountInfo()
accountInfo, err := g.GetAccountInfo()
if err != nil {
// Handle error
}

View File

@@ -53,7 +53,7 @@ if err != nil {
// set and AuthenticatedAPISupport is set to true
// Fetches current account information
accountInfo, err := g.GetExchangeAccountInfo()
accountInfo, err := g.GetAccountInfo()
if err != nil {
// Handle error
}

View File

@@ -54,7 +54,7 @@ if err != nil {
// set and AuthenticatedAPISupport is set to true
// Fetches current account information
accountInfo, err := h.GetExchangeAccountInfo()
accountInfo, err := h.GetAccountInfo()
if err != nil {
// Handle error
}

View File

@@ -53,7 +53,7 @@ if err != nil {
// set and AuthenticatedAPISupport is set to true
// Fetches current account information
accountInfo, err := h.GetExchangeAccountInfo()
accountInfo, err := h.GetAccountInfo()
if err != nil {
// Handle error
}

View File

@@ -53,7 +53,7 @@ if err != nil {
// set and AuthenticatedAPISupport is set to true
// Fetches current account information
accountInfo, err := h.GetExchangeAccountInfo()
accountInfo, err := h.GetAccountInfo()
if err != nil {
// Handle error
}

View File

@@ -53,7 +53,7 @@ if err != nil {
// set and AuthenticatedAPISupport is set to true
// Fetches current account information
accountInfo, err := i.GetExchangeAccountInfo()
accountInfo, err := i.GetAccountInfo()
if err != nil {
// Handle error
}

View File

@@ -53,7 +53,7 @@ if err != nil {
// set and AuthenticatedAPISupport is set to true
// Fetches current account information
accountInfo, err := k.GetExchangeAccountInfo()
accountInfo, err := k.GetAccountInfo()
if err != nil {
// Handle error
}

View File

@@ -53,7 +53,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
}

View File

@@ -53,7 +53,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
}

View File

@@ -53,7 +53,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
}

View File

@@ -54,7 +54,7 @@ if err != nil {
// set and AuthenticatedAPISupport is set to true
// Fetches current account information
accountInfo, err := o.GetExchangeAccountInfo()
accountInfo, err := o.GetAccountInfo()
if err != nil {
// Handle error
}

View File

@@ -53,7 +53,7 @@ if err != nil {
// set and AuthenticatedAPISupport is set to true
// Fetches current account information
accountInfo, err := o.GetExchangeAccountInfo()
accountInfo, err := o.GetAccountInfo()
if err != nil {
// Handle error
}

View File

@@ -54,7 +54,7 @@ if err != nil {
// set and AuthenticatedAPISupport is set to true
// Fetches current account information
accountInfo, err := p.GetExchangeAccountInfo()
accountInfo, err := p.GetAccountInfo()
if err != nil {
// Handle error
}

View File

@@ -53,7 +53,7 @@ if err != nil {
// set and AuthenticatedAPISupport is set to true
// Fetches current account information
accountInfo, err := w.GetExchangeAccountInfo()
accountInfo, err := w.GetAccountInfo()
if err != nil {
// Handle error
}

View File

@@ -53,7 +53,7 @@ if err != nil {
// set and AuthenticatedAPISupport is set to true
// Fetches current account information
accountInfo, err := y.GetExchangeAccountInfo()
accountInfo, err := y.GetAccountInfo()
if err != nil {
// Handle error
}

View File

@@ -53,7 +53,7 @@ if err != nil {
// set and AuthenticatedAPISupport is set to true
// Fetches current account information
accountInfo, err := z.GetExchangeAccountInfo()
accountInfo, err := z.GetAccountInfo()
if err != nil {
// Handle error
}

View File

@@ -99,80 +99,80 @@ func ({{.Variable}} *{{.CapitalName}}) UpdateOrderbook(p pair.CurrencyPair, asse
return orderBook, nil // NOTE DO NOT USE AS RETURN
}
// GetExchangeAccountInfo retrieves balances for all enabled currencies for the
// GetAccountInfo retrieves balances for all enabled currencies for the
// {{.CapitalName}} exchange
func ({{.Variable}} *{{.CapitalName}}) GetExchangeAccountInfo() (exchange.AccountInfo, error) {
func ({{.Variable}} *{{.CapitalName}}) GetAccountInfo() (exchange.AccountInfo, error) {
var response exchange.AccountInfo
return response, errors.New("not implemented")
}
// GetExchangeFundTransferHistory returns funding history, deposits and
// GetFundingHistory returns funding history, deposits and
// withdrawals
func ({{.Variable}} *{{.CapitalName}}) GetExchangeFundTransferHistory() ([]exchange.FundHistory, error) {
func ({{.Variable}} *{{.CapitalName}}) 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 ({{.Variable}} *{{.CapitalName}}) 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 ({{.Variable}} *{{.CapitalName}}) SubmitExchangeOrder(p pair.CurrencyPair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, clientID string) (exchange.SubmitOrderResponse, error) {
return "", errors.New("not yet implemented")
// SubmitOrder submits a new order
func ({{.Variable}} *{{.CapitalName}}) SubmitOrder(p pair.CurrencyPair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, clientID string) (exchange.SubmitOrderResponse, error) {
return "", common.ErrNotYetImplemented
}
// ModifyExchangeOrder will allow of changing orderbook placement and limit to
// ModifyOrder will allow of changing orderbook placement and limit to
// market conversion
func ({{.Variable}} *{{.CapitalName}}) ModifyExchangeOrder(orderID int64, action exchange.ModifyOrder) (int64, error) {
return 0, errors.New("not yet implemented")
func ({{.Variable}} *{{.CapitalName}}) ModifyOrder(orderID int64, action exchange.ModifyOrder) (int64, error) {
return 0, common.ErrNotYetImplemented
}
// CancelExchangeOrder cancels an order by its corresponding ID number
func ({{.Variable}} *{{.CapitalName}}) CancelExchangeOrder(orderID int64) error {
return errors.New("not yet implemented")
// CancelOrder cancels an order by its corresponding ID number
func ({{.Variable}} *{{.CapitalName}}) CancelOrder(orderID int64) error {
return common.ErrNotYetImplemented
}
// CancelAllExchangeOrders cancels all orders associated with a currency pair
func ({{.Variable}} *{{.CapitalName}}) CancelAllExchangeOrders() error {
return errors.New("not yet implemented")
// CancelAllOrders cancels all orders associated with a currency pair
func ({{.Variable}} *{{.CapitalName}}) CancelAllOrders() error {
return common.ErrNotYetImplemented
}
// GetExchangeOrderInfo returns information on a current open order
func ({{.Variable}} *{{.CapitalName}}) GetExchangeOrderInfo(orderID int64) (exchange.OrderDetail, error) {
// GetOrderInfo returns information on a current open order
func ({{.Variable}} *{{.CapitalName}}) 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 ({{.Variable}} *{{.CapitalName}}) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (string, error) {
return "", errors.New("not yet implemented")
// GetDepositAddress returns a deposit address for a specified currency
func ({{.Variable}} *{{.CapitalName}}) 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 ({{.Variable}} *{{.CapitalName}}) WithdrawCryptoExchangeFunds(address string, cryptocurrency pair.CurrencyItem, amount float64) (string, error) {
return "", errors.New("not yet implemented")
func ({{.Variable}} *{{.CapitalName}}) WithdrawCryptocurrencyFunds(address string, cryptocurrency pair.CurrencyItem, amount float64) (string, error) {
return "", common.ErrNotYetImplemented
}
// WithdrawFiatExchangeFunds returns a withdrawal ID when a withdrawal is
// WithdrawFiatFunds returns a withdrawal ID when a withdrawal is
// submitted
func ({{.Variable}} *{{.CapitalName}}) WithdrawFiatExchangeFunds(currency pair.CurrencyItem, amount float64) (string, error) {
return "", errors.New("not yet implemented")
func ({{.Variable}} *{{.CapitalName}}) WithdrawFiatFunds(currency pair.CurrencyItem, amount float64) (string, error) {
return "", common.ErrNotYetImplemented
}
// WithdrawFiatExchangeFundsToInternationalBank returns a withdrawal ID when a withdrawal is
// WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a withdrawal is
// submitted
func ({{.Variable}} *{{.CapitalName}}) WithdrawFiatExchangeFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) {
return "", errors.New("not yet implemented")
func ({{.Variable}} *{{.CapitalName}}) WithdrawFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) {
return "", common.ErrNotYetImplemented
}
// GetWebsocket returns a pointer to the exchange websocket
func ({{.Variable}} *{{.CapitalName}}) GetWebsocket() (*exchange.Websocket, error) {
return nil, errors.New("not yet implemented")
return nil, common.ErrNotYetImplemented
}
{{end}}