Feature: Implement funding rates, futures and coin margin (exchange API coverage) (#530)

* ALMOST THERE

* more api wips

* more api thingz

* testing n more api wipz

* more apiz

* more wips

* what is goin on

* more wips

* whip n testing

* testing

* testing

no keys

* remove log

* kraken is broken

ugh

* still broken

* fixing auth funcs + usdtm api docs

* wip

* api stuffs

* whip

* more wips

* whip

* more wip

* api wip n testing

* wip

* wip

* unsaved

* wip n testing

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* whip

* wrapper authenticated functions

* adding asset type and fixing dependencies

* wip

* binance auth wrapper start

* wrapper functionality

* wip

* wip

* wip

* wrapper cancel functions

* order submission for wrappers

* wip

* more error fixing and nits

* websocket beginning n error fix

* wip

* WOW

* glorious n shazzy nits

* useless nits

* wip

* fixing things

* merge stuffs

* crapveyor

* crapveyor rebuild

* probably broke more things than he fixed

* rm lns n other thangs

* hope

* please

* stop it

* done

* ofcourse

* rm vb

* fix lbank

* appveyor please

* float lev

* DONT ASK RYAN FOR HELP EVER

* wip

* wip

* endpoint upgrades continued

* path upgrade

* NeeeNeeeNeeeNeeeNING

* fix stuffs

* fixing time issue

* fixing broken funcs

* glorious nits

* shaz changes

* fixing errors for fundmon

* more error fixing for fundmon

* test running past 30s

* basic changes

* THX AGAIN SHAZBERT

* path system upgrade

* config upgrade

* unsaved stuffs

* broken wip config upgrade

* path system upgrade contd.

* path system upgrade contd

* path upgrade ready for review

* testing verbose removed

* linter stuffs

* appveyor stuffs

* appveyor stuff

* fixed?

* bugfix

* wip

* broken stuff

* fix test

* wierd hack fix

* appveyor pls stop

* error found

* more useless nits

* bitmex err

* broken wip

* broken wip path upgrade change to uint32

* changed url lookups to uint

* WOW

* ready4review

* config fixed HOPEFULLY

* config fix and glorious changes

* efficient way of getting orders and open orders

* binance wrapper logic fixing

* testing, adding tests and fixing lot of errrrrs

* merge master

* appveyor stuffs

* appveyor stuffs

* fmt

* test

* octalLiteral issue fix?

* octalLiteral fix?

* rm vb

* prnt ln to restart

* adding testz

* test fixzzz

* READY FOR REVIEW

* Actually ready now

* FORMATTING

* addressing shazzy n glorious nits

* crapveyor

* rm vb

* small change

* fixing err

* shazbert nits

* review changes

* requested changes

* more requested changes

* noo

* last nit fixes

* restart appveyor

* improving test cov

* Update .golangci.yml

* shazbert changes

* moving pair formatting

* format pair update wip

* path upgrade complete

* error fix

* appveyor linters

* more linters

* remove testexch

* more formatting changes

* changes

* shazbert changes

* checking older requested changes to ensure completion

* wip

* fixing broken code

* error fix

* all fixed

* additional changes

* more changes

* remove commented code

* ftx margin api

* appveyor fixes

* more appveyor issues + test addition

* more appveyor issues + test addition

* remove unnecessary

* testing

* testing, fixing okex api, error fix

* git merge fix

* go sum

* glorious changes and error fix

* rm vb

* more glorious changes and go mod tidy

* fixed now

* okex testing upgrade

* old config migration and batch fetching fix

* added test

* glorious requested changes WIP

* tested and fixed

* go fmted

* go fmt and test fix

* additional funcs and tests for fundingRates

* OKEX tested and fixed

* appveyor fixes

* ineff assign

* 1 glorious change

* error fix

* typo

* shazbert changes

* glorious code changes and path fixing huobi WIP

* adding assetType to accountinfo functions

* fixing panic

* panic fix and updating account info wrappers WIP

* updateaccountinfo updated

* testing WIP binance USDT n Coin Margined and Kraken Futures

* auth functions tested and fixed

* added test

* config reverted

* shazbert and glorious changes

* shazbert and glorious changes

* latest changes and portfolio update

* go fmt change:

* remove commented codes

* improved error checking

* index out of range fix

* rm ln

* critical nit

* glorious latest changes

* appveyor changes

* shazbert change

* easier readability

* latest glorious changes

* shadow dec

* assetstore updated

* last change

* another last change

* merge changes

* go mod tidy

* thrasher requested changes wip

* improving struct layouts

* appveyor go fmt

* remove unnecessary code

* shazbert changes

* small change

* oopsie

* tidy

* configtest reverted

* error fix

* oopsie

* for what

* test patch fix

* insecurities

* fixing tests

* fix config
This commit is contained in:
Adam
2021-02-12 16:19:18 +11:00
committed by GitHub
parent e9bd2ad4d8
commit 504c2fad6d
169 changed files with 227754 additions and 31776 deletions

View File

@@ -67,15 +67,15 @@ type Gemini struct {
// GetSymbols returns all available symbols for trading
func (g *Gemini) GetSymbols() ([]string, error) {
var symbols []string
path := fmt.Sprintf("%s/v%s/%s", g.API.Endpoints.URL, geminiAPIVersion, geminiSymbols)
return symbols, g.SendHTTPRequest(path, &symbols)
path := fmt.Sprintf("/v%s/%s", geminiAPIVersion, geminiSymbols)
return symbols, g.SendHTTPRequest(exchange.RestSpot, path, &symbols)
}
// GetTicker returns information about recent trading activity for the symbol
func (g *Gemini) GetTicker(currencyPair string) (TickerV2, error) {
ticker := TickerV2{}
path := fmt.Sprintf("%s/v2/ticker/%s", g.API.Endpoints.URL, currencyPair)
err := g.SendHTTPRequest(path, &ticker)
path := fmt.Sprintf("/v2/ticker/%s", currencyPair)
err := g.SendHTTPRequest(exchange.RestSpot, path, &ticker)
if err != nil {
return ticker, err
}
@@ -96,15 +96,14 @@ func (g *Gemini) GetTicker(currencyPair string) (TickerV2, error) {
// Type is an integer ie "params.Set("limit_asks", 30)"
func (g *Gemini) GetOrderbook(currencyPair string, params url.Values) (Orderbook, error) {
path := common.EncodeURLValues(
fmt.Sprintf("%s/v%s/%s/%s",
g.API.Endpoints.URL,
fmt.Sprintf("/v%s/%s/%s",
geminiAPIVersion,
geminiOrderbook,
currencyPair),
params)
var orderbook Orderbook
return orderbook, g.SendHTTPRequest(path, &orderbook)
return orderbook, g.SendHTTPRequest(exchange.RestSpot, path, &orderbook)
}
// GetTrades return the trades that have executed since the specified timestamp.
@@ -127,18 +126,18 @@ func (g *Gemini) GetTrades(currencyPair string, since, limit int64, includeBreak
if includeBreaks {
params.Add("include_breaks", strconv.FormatBool(true))
}
path := common.EncodeURLValues(fmt.Sprintf("%s/v%s/%s/%s", g.API.Endpoints.URL, geminiAPIVersion, geminiTrades, currencyPair), params)
path := common.EncodeURLValues(fmt.Sprintf("/v%s/%s/%s", geminiAPIVersion, geminiTrades, currencyPair), params)
var trades []Trade
return trades, g.SendHTTPRequest(path, &trades)
return trades, g.SendHTTPRequest(exchange.RestSpot, path, &trades)
}
// GetAuction returns auction information
func (g *Gemini) GetAuction(currencyPair string) (Auction, error) {
path := fmt.Sprintf("%s/v%s/%s/%s", g.API.Endpoints.URL, geminiAPIVersion, geminiAuction, currencyPair)
path := fmt.Sprintf("/v%s/%s/%s", geminiAPIVersion, geminiAuction, currencyPair)
auction := Auction{}
return auction, g.SendHTTPRequest(path, &auction)
return auction, g.SendHTTPRequest(exchange.RestSpot, path, &auction)
}
// GetAuctionHistory returns the auction events, optionally including
@@ -153,9 +152,9 @@ func (g *Gemini) GetAuction(currencyPair string) (Auction, error) {
// include_indicative - [bool] Whether to include publication of
// indicative prices and quantities.
func (g *Gemini) GetAuctionHistory(currencyPair string, params url.Values) ([]AuctionHistory, error) {
path := common.EncodeURLValues(fmt.Sprintf("%s/v%s/%s/%s/%s", g.API.Endpoints.URL, geminiAPIVersion, geminiAuction, currencyPair, geminiAuctionHistory), params)
path := common.EncodeURLValues(fmt.Sprintf("/v%s/%s/%s/%s", geminiAPIVersion, geminiAuction, currencyPair, geminiAuctionHistory), params)
var auctionHist []AuctionHistory
return auctionHist, g.SendHTTPRequest(path, &auctionHist)
return auctionHist, g.SendHTTPRequest(exchange.RestSpot, path, &auctionHist)
}
// NewOrder Only limit orders are supported through the API at present.
@@ -169,7 +168,7 @@ func (g *Gemini) NewOrder(symbol string, amount, price float64, side, orderType
req["type"] = orderType
response := Order{}
err := g.SendAuthenticatedHTTPRequest(http.MethodPost, geminiOrderNew, req, &response)
err := g.SendAuthenticatedHTTPRequest(exchange.RestSpot, http.MethodPost, geminiOrderNew, req, &response)
if err != nil {
return 0, err
}
@@ -183,7 +182,7 @@ func (g *Gemini) CancelExistingOrder(orderID int64) (Order, error) {
req["order_id"] = orderID
response := Order{}
err := g.SendAuthenticatedHTTPRequest(http.MethodPost, geminiOrderCancel, req, &response)
err := g.SendAuthenticatedHTTPRequest(exchange.RestSpot, http.MethodPost, geminiOrderCancel, req, &response)
if err != nil {
return Order{}, err
}
@@ -205,7 +204,7 @@ func (g *Gemini) CancelExistingOrders(cancelBySession bool) (OrderResult, error)
}
var response OrderResult
err := g.SendAuthenticatedHTTPRequest(http.MethodPost, path, nil, &response)
err := g.SendAuthenticatedHTTPRequest(exchange.RestSpot, http.MethodPost, path, nil, &response)
if err != nil {
return response, err
}
@@ -222,7 +221,7 @@ func (g *Gemini) GetOrderStatus(orderID int64) (Order, error) {
response := Order{}
err := g.SendAuthenticatedHTTPRequest(http.MethodPost, geminiOrderStatus, req, &response)
err := g.SendAuthenticatedHTTPRequest(exchange.RestSpot, http.MethodPost, geminiOrderStatus, req, &response)
if err != nil {
return response, err
}
@@ -241,7 +240,7 @@ func (g *Gemini) GetOrders() ([]Order, error) {
orders []Order
}
err := g.SendAuthenticatedHTTPRequest(http.MethodPost, geminiOrders, nil, &response)
err := g.SendAuthenticatedHTTPRequest(exchange.RestSpot, http.MethodPost, geminiOrders, nil, &response)
if err != nil {
return nil, err
}
@@ -268,7 +267,7 @@ func (g *Gemini) GetTradeHistory(currencyPair string, timestamp int64) ([]TradeH
}
return response,
g.SendAuthenticatedHTTPRequest(http.MethodPost, geminiMyTrades, req, &response)
g.SendAuthenticatedHTTPRequest(exchange.RestSpot, http.MethodPost, geminiMyTrades, req, &response)
}
// GetNotionalVolume returns the volume in price currency that has been traded across all pairs over a period of 30 days
@@ -276,7 +275,7 @@ func (g *Gemini) GetNotionalVolume() (NotionalVolume, error) {
response := NotionalVolume{}
return response,
g.SendAuthenticatedHTTPRequest(http.MethodPost, geminiVolume, nil, &response)
g.SendAuthenticatedHTTPRequest(exchange.RestSpot, http.MethodPost, geminiVolume, nil, &response)
}
// GetTradeVolume returns a multi-arrayed volume response
@@ -284,7 +283,7 @@ func (g *Gemini) GetTradeVolume() ([][]TradeVolume, error) {
var response [][]TradeVolume
return response,
g.SendAuthenticatedHTTPRequest(http.MethodPost, geminiTradeVolume, nil, &response)
g.SendAuthenticatedHTTPRequest(exchange.RestSpot, http.MethodPost, geminiTradeVolume, nil, &response)
}
// GetBalances returns available balances in the supported currencies
@@ -292,7 +291,7 @@ func (g *Gemini) GetBalances() ([]Balance, error) {
var response []Balance
return response,
g.SendAuthenticatedHTTPRequest(http.MethodPost, geminiBalances, nil, &response)
g.SendAuthenticatedHTTPRequest(exchange.RestSpot, http.MethodPost, geminiBalances, nil, &response)
}
// GetCryptoDepositAddress returns a deposit address
@@ -304,7 +303,7 @@ func (g *Gemini) GetCryptoDepositAddress(depositAddlabel, currency string) (Depo
req["label"] = depositAddlabel
}
err := g.SendAuthenticatedHTTPRequest(http.MethodPost, geminiDeposit+"/"+currency+"/"+geminiNewAddress, req, &response)
err := g.SendAuthenticatedHTTPRequest(exchange.RestSpot, http.MethodPost, geminiDeposit+"/"+currency+"/"+geminiNewAddress, req, &response)
if err != nil {
return response, err
}
@@ -321,7 +320,7 @@ func (g *Gemini) WithdrawCrypto(address, currency string, amount float64) (Withd
req["address"] = address
req["amount"] = strconv.FormatFloat(amount, 'f', -1, 64)
err := g.SendAuthenticatedHTTPRequest(http.MethodPost, geminiWithdraw+strings.ToLower(currency), req, &response)
err := g.SendAuthenticatedHTTPRequest(exchange.RestSpot, http.MethodPost, geminiWithdraw+strings.ToLower(currency), req, &response)
if err != nil {
return response, err
}
@@ -340,7 +339,7 @@ func (g *Gemini) PostHeartbeat() (string, error) {
}
response := Response{}
err := g.SendAuthenticatedHTTPRequest(http.MethodPost, geminiHeartbeat, nil, &response)
err := g.SendAuthenticatedHTTPRequest(exchange.RestSpot, http.MethodPost, geminiHeartbeat, nil, &response)
if err != nil {
return response.Result, err
}
@@ -351,10 +350,14 @@ func (g *Gemini) PostHeartbeat() (string, error) {
}
// SendHTTPRequest sends an unauthenticated request
func (g *Gemini) SendHTTPRequest(path string, result interface{}) error {
func (g *Gemini) SendHTTPRequest(ep exchange.URL, path string, result interface{}) error {
endpoint, err := g.API.Endpoints.GetURL(ep)
if err != nil {
return err
}
return g.SendPayload(context.Background(), &request.Item{
Method: http.MethodGet,
Path: path,
Path: endpoint + path,
Result: result,
Verbose: g.Verbose,
HTTPDebugging: g.HTTPDebugging,
@@ -364,11 +367,16 @@ func (g *Gemini) SendHTTPRequest(path string, result interface{}) error {
// SendAuthenticatedHTTPRequest sends an authenticated HTTP request to the
// exchange and returns an error
func (g *Gemini) SendAuthenticatedHTTPRequest(method, path string, params map[string]interface{}, result interface{}) (err error) {
func (g *Gemini) SendAuthenticatedHTTPRequest(ep exchange.URL, method, path string, params map[string]interface{}, result interface{}) (err error) {
if !g.AllowAuthenticatedRequest() {
return fmt.Errorf(exchange.WarningAuthenticatedRequestWithoutCredentialsSet, g.Name)
}
endpoint, err := g.API.Endpoints.GetURL(ep)
if err != nil {
return err
}
req := make(map[string]interface{})
req["request"] = fmt.Sprintf("/v%s/%s", geminiAPIVersion, path)
req["nonce"] = g.Requester.GetNonce(true).String()
@@ -399,7 +407,7 @@ func (g *Gemini) SendAuthenticatedHTTPRequest(method, path string, params map[st
return g.SendPayload(context.Background(), &request.Item{
Method: method,
Path: g.API.Endpoints.URL + "/v1/" + path,
Path: endpoint + "/v1/" + path,
Headers: headers,
Result: result,
AuthRequest: true,

View File

@@ -10,6 +10,7 @@ import (
"testing"
"github.com/thrasher-corp/gocryptotrader/config"
exchange "github.com/thrasher-corp/gocryptotrader/exchanges"
"github.com/thrasher-corp/gocryptotrader/exchanges/sharedtestvalues"
)
@@ -34,7 +35,10 @@ func TestMain(m *testing.M) {
if err != nil {
log.Fatal("Gemini setup error", err)
}
g.API.Endpoints.URL = geminiSandboxAPIURL
log.Printf(sharedtestvalues.LiveTesting, g.Name, g.API.Endpoints.URL)
err = g.API.Endpoints.SetRunning(exchange.RestSpot.String(), geminiSandboxAPIURL)
if err != nil {
log.Fatalf("endpoint setting failed. key: %s, val: %s", exchange.RestSpot.String(), geminiSandboxAPIURL)
}
log.Printf(sharedtestvalues.LiveTesting, g.Name)
os.Exit(m.Run())
}

View File

@@ -45,7 +45,13 @@ func TestMain(m *testing.M) {
}
g.HTTPClient = newClient
g.API.Endpoints.URL = serverDetails
log.Printf(sharedtestvalues.MockTesting, g.Name, g.API.Endpoints.URL)
endpointMap := g.API.Endpoints.GetURLMap()
for k := range endpointMap {
err = g.API.Endpoints.SetRunning(k, serverDetails)
if err != nil {
log.Fatal(err)
}
}
log.Printf(sharedtestvalues.MockTesting, g.Name)
os.Exit(m.Run())
}

View File

@@ -354,6 +354,7 @@ func TestGetActiveOrders(t *testing.T) {
Pairs: []currency.Pair{
currency.NewPair(currency.LTC, currency.BTC),
},
AssetType: asset.Spot,
}
_, err := g.GetActiveOrders(&getOrdersRequest)
@@ -370,8 +371,9 @@ func TestGetActiveOrders(t *testing.T) {
func TestGetOrderHistory(t *testing.T) {
t.Parallel()
var getOrdersRequest = order.GetOrdersRequest{
Type: order.AnyType,
Pairs: []currency.Pair{currency.NewPair(currency.LTC, currency.BTC)},
Type: order.AnyType,
Pairs: []currency.Pair{currency.NewPair(currency.LTC, currency.BTC)},
AssetType: asset.Spot,
}
_, err := g.GetOrderHistory(&getOrdersRequest)
@@ -550,8 +552,10 @@ func TestGetDepositAddress(t *testing.T) {
// TestWsAuth dials websocket, sends login request.
func TestWsAuth(t *testing.T) {
t.Parallel()
g.API.Endpoints.WebsocketURL = geminiWebsocketSandboxEndpoint
err := g.API.Endpoints.SetRunning(exchange.WebsocketSpot.String(), geminiWebsocketSandboxEndpoint)
if err != nil {
t.Error(err)
}
if !g.Websocket.IsEnabled() &&
!g.API.AuthenticatedWebsocketSupport ||
!areTestAPIKeysSet() {
@@ -559,7 +563,7 @@ func TestWsAuth(t *testing.T) {
}
var dialer websocket.Dialer
go g.wsReadData()
err := g.WsSecureSubscribe(&dialer, geminiWsOrderEvents)
err = g.WsSecureSubscribe(&dialer, geminiWsOrderEvents)
if err != nil {
t.Error(err)
}
@@ -1133,8 +1137,8 @@ func TestGetHistoricTrades(t *testing.T) {
tStart := time.Date(2020, 6, 6, 0, 0, 0, 0, time.UTC)
tEnd := time.Date(2020, 6, 7, 0, 0, 0, 0, time.UTC)
if !mockTests {
tStart = time.Date(2020, time.Now().Month(), 6, 0, 0, 0, 0, time.UTC)
tEnd = time.Date(2020, time.Now().Month(), 7, 0, 0, 0, 0, time.UTC)
tStart = time.Date(time.Now().Year(), time.Now().Month(), 6, 0, 0, 0, 0, time.UTC)
tEnd = time.Date(time.Now().Year(), time.Now().Month(), 7, 0, 0, 0, 0, time.UTC)
}
_, err = g.GetHistoricTrades(currencyPair, asset.Spot, tStart, tEnd)
if err != nil {

View File

@@ -72,8 +72,12 @@ func (g *Gemini) WsSubscribe(dialer *websocket.Dialer) error {
val.Set("bids", "true")
val.Set("offers", "true")
val.Set("trades", "true")
wsEndpoint, err := g.API.Endpoints.GetURL(exchange.WebsocketSpot)
if err != nil {
return err
}
endpoint := fmt.Sprintf("%s%s/%s?%s",
g.API.Endpoints.WebsocketURL,
wsEndpoint,
geminiWsMarketData,
enabledCurrencies[i].String(),
val.Encode())
@@ -85,7 +89,7 @@ func (g *Gemini) WsSubscribe(dialer *websocket.Dialer) error {
Traffic: g.Websocket.TrafficAlert,
Match: g.Websocket.Match,
}
err := connection.Dial(dialer, http.Header{})
err = connection.Dial(dialer, http.Header{})
if err != nil {
return fmt.Errorf("%v Websocket connection %v error. Error %v",
g.Name, endpoint, err)
@@ -109,8 +113,11 @@ func (g *Gemini) WsSecureSubscribe(dialer *websocket.Dialer, url string) error {
if err != nil {
return fmt.Errorf("%v sendAuthenticatedHTTPRequest: Unable to JSON request", g.Name)
}
endpoint := g.API.Endpoints.WebsocketURL + url
wsEndpoint, err := g.API.Endpoints.GetURL(exchange.WebsocketSpot)
if err != nil {
return err
}
endpoint := wsEndpoint + url
PayloadBase64 := crypto.Base64Encode(PayloadJSON)
hmac := crypto.GetHMAC(crypto.HashSHA512_384, []byte(PayloadBase64), []byte(g.API.Credentials.Secret))
headers := http.Header{}

View File

@@ -106,10 +106,14 @@ func (g *Gemini) SetDefaults() {
g.Requester = request.New(g.Name,
common.NewHTTPClientWithTimeout(exchange.DefaultHTTPTimeout),
request.WithLimiter(SetRateLimit()))
g.API.Endpoints.URLDefault = geminiAPIURL
g.API.Endpoints.URL = g.API.Endpoints.URLDefault
g.API.Endpoints.WebsocketURL = geminiWebsocketEndpoint
g.API.Endpoints = g.NewEndpoints()
err = g.API.Endpoints.SetDefaultEndpoints(map[exchange.URL]string{
exchange.RestSpot: geminiAPIURL,
exchange.WebsocketSpot: geminiWebsocketEndpoint,
})
if err != nil {
log.Errorln(log.ExchangeSys, err)
}
g.Websocket = stream.New()
g.WebsocketResponseMaxLimit = exchange.DefaultWebsocketResponseMaxLimit
g.WebsocketResponseCheckTimeout = exchange.DefaultWebsocketResponseCheckTimeout
@@ -129,7 +133,15 @@ func (g *Gemini) Setup(exch *config.ExchangeConfig) error {
}
if exch.UseSandbox {
g.API.Endpoints.URL = geminiSandboxAPIURL
err = g.API.Endpoints.SetRunning(exchange.RestSpot.String(), geminiSandboxAPIURL)
if err != nil {
log.Error(log.ExchangeSys, err)
}
}
wsRunningURL, err := g.API.Endpoints.GetURL(exchange.WebsocketSpot)
if err != nil {
return err
}
return g.Websocket.Setup(&stream.WebsocketSetup{
@@ -139,7 +151,7 @@ func (g *Gemini) Setup(exch *config.ExchangeConfig) error {
WebsocketTimeout: exch.WebsocketTrafficTimeout,
DefaultURL: geminiWebsocketEndpoint,
ExchangeName: exch.Name,
RunningURL: exch.API.Endpoints.WebsocketURL,
RunningURL: wsRunningURL,
Connector: g.WsConnect,
Features: &g.Features.Supports.WebsocketCapabilities,
OrderbookBufferLimit: exch.OrderbookConfig.WebsocketBufferLimit,
@@ -196,7 +208,7 @@ func (g *Gemini) UpdateTradablePairs(forceUpdate bool) error {
// UpdateAccountInfo Retrieves balances for all enabled currencies for the
// Gemini exchange
func (g *Gemini) UpdateAccountInfo() (account.Holdings, error) {
func (g *Gemini) UpdateAccountInfo(assetType asset.Item) (account.Holdings, error) {
var response account.Holdings
response.Exchange = g.Name
accountBalance, err := g.GetBalances()
@@ -226,10 +238,10 @@ func (g *Gemini) UpdateAccountInfo() (account.Holdings, error) {
}
// FetchAccountInfo retrieves balances for all enabled currencies
func (g *Gemini) FetchAccountInfo() (account.Holdings, error) {
acc, err := account.GetHoldings(g.Name)
func (g *Gemini) FetchAccountInfo(assetType asset.Item) (account.Holdings, error) {
acc, err := account.GetHoldings(g.Name, assetType)
if err != nil {
return g.UpdateAccountInfo()
return g.UpdateAccountInfo(assetType)
}
return acc, nil
@@ -655,8 +667,8 @@ func (g *Gemini) GetOrderHistory(req *order.GetOrdersRequest) ([]order.Detail, e
// ValidateCredentials validates current credentials used for wrapper
// functionality
func (g *Gemini) ValidateCredentials() error {
_, err := g.UpdateAccountInfo()
func (g *Gemini) ValidateCredentials(assetType asset.Item) error {
_, err := g.UpdateAccountInfo(assetType)
return g.CheckTransientError(err)
}