String concatenation/conversion/formatting improvements (#393)

* Magic strings

* Comment, format and builder fixes
This commit is contained in:
lozdog245
2019-12-09 11:44:01 +11:00
committed by Adrian Gallagher
parent 17a786536d
commit 8c30505d46
32 changed files with 122 additions and 128 deletions

View File

@@ -74,10 +74,9 @@ func (b *Bithumb) GetTradablePairs() ([]string, error) {
// symbol e.g. "btc"
func (b *Bithumb) GetTicker(symbol string) (Ticker, error) {
var response TickerResponse
path := fmt.Sprintf("%s%s%s",
b.API.Endpoints.URL,
publicTicker,
strings.ToUpper(symbol))
path := b.API.Endpoints.URL +
publicTicker +
strings.ToUpper(symbol)
err := b.SendHTTPRequest(path, &response)
if err != nil {
return response.Data, err
@@ -93,7 +92,7 @@ func (b *Bithumb) GetTicker(symbol string) (Ticker, error) {
// GetAllTickers returns all ticker information
func (b *Bithumb) GetAllTickers() (map[string]Ticker, error) {
var response TickersResponse
path := fmt.Sprintf("%s%s%s", b.API.Endpoints.URL, publicTicker, "all")
path := b.API.Endpoints.URL + publicTicker + "all"
err := b.SendHTTPRequest(path, &response)
if err != nil {
return nil, err
@@ -123,7 +122,7 @@ func (b *Bithumb) GetAllTickers() (map[string]Ticker, error) {
// symbol e.g. "btc"
func (b *Bithumb) GetOrderBook(symbol string) (Orderbook, error) {
response := Orderbook{}
path := fmt.Sprintf("%s%s%s", b.API.Endpoints.URL, publicOrderBook, strings.ToUpper(symbol))
path := b.API.Endpoints.URL + publicOrderBook + strings.ToUpper(symbol)
err := b.SendHTTPRequest(path, &response)
if err != nil {
@@ -142,7 +141,9 @@ func (b *Bithumb) GetOrderBook(symbol string) (Orderbook, error) {
// symbol e.g. "btc"
func (b *Bithumb) GetTransactionHistory(symbol string) (TransactionHistory, error) {
response := TransactionHistory{}
path := fmt.Sprintf("%s%s%s", b.API.Endpoints.URL, publicTransactionHistory, strings.ToUpper(symbol))
path := b.API.Endpoints.URL +
publicTransactionHistory +
strings.ToUpper(symbol)
err := b.SendHTTPRequest(path, &response)
if err != nil {

View File

@@ -4,6 +4,7 @@ import (
"errors"
"fmt"
"math"
"strconv"
"sync"
"time"
@@ -423,7 +424,8 @@ func (b *Bithumb) WithdrawFiatFunds(withdrawRequest *exchange.FiatWithdrawReques
if withdrawRequest.Currency != currency.KRW {
return "", errors.New("only KRW is supported")
}
bankDetails := fmt.Sprintf("%v_%v", withdrawRequest.BankCode, withdrawRequest.BankName)
bankDetails := strconv.FormatFloat(withdrawRequest.BankCode, 'f', -1, 64) +
"_" + withdrawRequest.BankName
resp, err := b.RequestKRWWithdraw(bankDetails, withdrawRequest.BankAccountNumber, int64(withdrawRequest.Amount))
if err != nil {
return "", err