In the common package added JSONDecode error check. Added verbosity in SendHTTPGetRequest. Updated Nonce package function. Fixed issues in ItBit package and expanded test coverage.

This commit is contained in:
Ryan O'Hara-Reid
2017-09-12 08:37:18 +10:00
parent 939ce3ab21
commit e8c7bf9af4
24 changed files with 601 additions and 241 deletions

View File

@@ -119,7 +119,7 @@ func (b *Bitfinex) GetTicker(symbol string, values url.Values) (Ticker, error) {
response := Ticker{}
path := common.EncodeURLValues(bitfinexAPIURL+bitfinexTicker+symbol, values)
return response, common.SendHTTPGetRequest(path, true, &response)
return response, common.SendHTTPGetRequest(path, true, b.Verbose, &response)
}
// GetStats returns various statistics about the requested pair
@@ -127,7 +127,7 @@ func (b *Bitfinex) GetStats(symbol string) ([]Stat, error) {
response := []Stat{}
path := fmt.Sprint(bitfinexAPIURL + bitfinexStats + symbol)
return response, common.SendHTTPGetRequest(path, true, &response)
return response, common.SendHTTPGetRequest(path, true, b.Verbose, &response)
}
// GetFundingBook the entire margin funding book for both bids and asks sides
@@ -137,7 +137,7 @@ func (b *Bitfinex) GetFundingBook(symbol string) (FundingBook, error) {
response := FundingBook{}
path := fmt.Sprint(bitfinexAPIURL + bitfinexLendbook + symbol)
return response, common.SendHTTPGetRequest(path, true, &response)
return response, common.SendHTTPGetRequest(path, true, b.Verbose, &response)
}
// GetOrderbook retieves the entire orderbook bid and ask price on a currency
@@ -149,7 +149,7 @@ func (b *Bitfinex) GetOrderbook(currencyPair string, values url.Values) (Orderbo
bitfinexAPIURL+bitfinexOrderbook+currencyPair,
values,
)
return response, common.SendHTTPGetRequest(path, true, &response)
return response, common.SendHTTPGetRequest(path, true, b.Verbose, &response)
}
// GetTrades returns a list of the most recent trades for the given curencyPair
@@ -160,7 +160,7 @@ func (b *Bitfinex) GetTrades(currencyPair string, values url.Values) ([]TradeStr
bitfinexAPIURL+bitfinexTrades+currencyPair,
values,
)
return response, common.SendHTTPGetRequest(path, true, &response)
return response, common.SendHTTPGetRequest(path, true, b.Verbose, &response)
}
// GetLendbook returns a list of the most recent funding data for the given
@@ -174,7 +174,7 @@ func (b *Bitfinex) GetLendbook(symbol string, values url.Values) (Lendbook, erro
}
path := common.EncodeURLValues(bitfinexAPIURL+bitfinexLendbook+symbol, values)
return response, common.SendHTTPGetRequest(path, true, &response)
return response, common.SendHTTPGetRequest(path, true, b.Verbose, &response)
}
// GetLends returns a list of the most recent funding data for the given
@@ -185,7 +185,7 @@ func (b *Bitfinex) GetLends(symbol string, values url.Values) ([]Lends, error) {
response := []Lends{}
path := common.EncodeURLValues(bitfinexAPIURL+bitfinexLends+symbol, values)
return response, common.SendHTTPGetRequest(path, true, &response)
return response, common.SendHTTPGetRequest(path, true, b.Verbose, &response)
}
// GetSymbols returns the avaliable currency pairs on the exchange
@@ -193,7 +193,7 @@ func (b *Bitfinex) GetSymbols() ([]string, error) {
products := []string{}
path := fmt.Sprint(bitfinexAPIURL + bitfinexSymbols)
return products, common.SendHTTPGetRequest(path, true, &products)
return products, common.SendHTTPGetRequest(path, true, b.Verbose, &products)
}
// GetSymbolsDetails a list of valid symbol IDs and the pair details
@@ -201,7 +201,7 @@ func (b *Bitfinex) GetSymbolsDetails() ([]SymbolDetails, error) {
response := []SymbolDetails{}
path := fmt.Sprint(bitfinexAPIURL + bitfinexSymbolsDetails)
return response, common.SendHTTPGetRequest(path, true, &response)
return response, common.SendHTTPGetRequest(path, true, b.Verbose, &response)
}
// GetAccountInfo returns information about your account incl. trading fees