bithumb: Add missing functionality (#770)

* bithumb: Add missing functionality

* glorious: nits
This commit is contained in:
Ryan O'Hara-Reid
2021-08-31 09:57:04 +10:00
committed by GitHub
parent 1e79384b25
commit 4d1994afb6
3 changed files with 56 additions and 2 deletions

View File

@@ -31,6 +31,7 @@ const (
publicOrderBook = "/public/orderbook/"
publicTransactionHistory = "/public/transaction_history/"
publicCandleStick = "/public/candlestick/"
publicAssetStatus = "/public/assetsstatus/"
privateAccInfo = "/info/account"
privateAccBalance = "/info/balance"
@@ -48,6 +49,8 @@ const (
privateMarketSell = "/trade/market_sell"
)
var errSymbolIsEmpty = errors.New("symbol cannot be empty")
// Bithumb is the overarching type across the Bithumb package
type Bithumb struct {
exchange.Base
@@ -129,6 +132,24 @@ func (b *Bithumb) GetOrderBook(symbol string) (*Orderbook, error) {
return &response, nil
}
// GetAssetStatus returns the withdrawal and deposit status for the symbol
func (b *Bithumb) GetAssetStatus(symbol string) (*Status, error) {
if symbol == "" {
return nil, errSymbolIsEmpty
}
var response Status
err := b.SendHTTPRequest(exchange.RestSpot, publicAssetStatus+strings.ToUpper(symbol), &response)
if err != nil {
return nil, err
}
if response.Status != noError {
return nil, errors.New(response.Message)
}
return &response, nil
}
// GetTransactionHistory returns recent transactions
//
// symbol e.g. "btc"
@@ -154,7 +175,7 @@ func (b *Bithumb) GetTransactionHistory(symbol string) (TransactionHistory, erro
func (b *Bithumb) GetAccountInformation(orderCurrency, paymentCurrency string) (Account, error) {
var response Account
if orderCurrency == "" {
return response, errors.New("order currency must be set")
return response, errSymbolIsEmpty
}
val := url.Values{}
@@ -270,7 +291,7 @@ func (b *Bithumb) GetOrders(orderID, transactionType, count, after, currency str
params := url.Values{}
if currency == "" {
return response, errors.New("order currency is required")
return response, errSymbolIsEmpty
}
params.Set("order_currency", strings.ToUpper(currency))