From 329e039470fc3a6e9cbad02a8bebb9a817d1ad59 Mon Sep 17 00:00:00 2001 From: Samuel Reid <43227667+cranktakular@users.noreply.github.com> Date: Tue, 17 Sep 2024 11:49:24 +1000 Subject: [PATCH] Glorious fixes --- .../exchange_wrapper_standards_test.go | 19 +- config/config.go | 5 +- config/config_test.go | 4 +- config_example.json | 203 +++++++++++------- exchanges/coinbasepro/coinbasepro.go | 82 ++++--- exchanges/coinbasepro/coinbasepro_test.go | 9 +- 6 files changed, 174 insertions(+), 148 deletions(-) diff --git a/cmd/exchange_wrapper_standards/exchange_wrapper_standards_test.go b/cmd/exchange_wrapper_standards/exchange_wrapper_standards_test.go index 21fb3a2ca44..db596098a13 100644 --- a/cmd/exchange_wrapper_standards/exchange_wrapper_standards_test.go +++ b/cmd/exchange_wrapper_standards/exchange_wrapper_standards_test.go @@ -23,7 +23,6 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/fundingrate" "github.com/thrasher-corp/gocryptotrader/exchanges/futures" "github.com/thrasher-corp/gocryptotrader/exchanges/kline" - "github.com/thrasher-corp/gocryptotrader/exchanges/lbank" "github.com/thrasher-corp/gocryptotrader/exchanges/margin" "github.com/thrasher-corp/gocryptotrader/exchanges/order" "github.com/thrasher-corp/gocryptotrader/exchanges/request" @@ -86,6 +85,8 @@ func setupExchange(ctx context.Context, t *testing.T, name string, cfg *config.C t.Fatalf("Cannot setup %v GetExchangeConfig %v", name, err) } exch.SetDefaults() + exchCfg.API.AuthenticatedSupport = true + exchCfg.API.Credentials = getExchangeCredentials(name) err = exch.Setup(exchCfg) if err != nil { t.Fatalf("Cannot setup %v exchange Setup %v", name, err) @@ -95,22 +96,6 @@ func setupExchange(ctx context.Context, t *testing.T, name string, cfg *config.C t.Fatalf("Cannot setup %v UpdateTradablePairs %v", name, err) } b := exch.GetBase() - // Idiosyncratic execution flow since Setup must be run before UpdateTradablePairs, but Coinbase will fail if - // invalid credentials have been set, so we must set them after UpdateTradablePairs - creds := getExchangeCredentials(name) - b.SetCredentials(creds.Key, creds.Secret, creds.ClientID, creds.Subaccount, creds.Subaccount, - creds.OTPSecret) - b.API.AuthenticatedSupport = true - // Lbank usually runs this during setup, but if keys aren't set then, it will fail, so we have to manually - // recreate that here - lbankExch, ok := exch.(*lbank.Lbank) - if ok { - err = lbankExch.LoadPrivKey(ctx) - if err != nil { - t.Fatalf("Cannot setup %v LoadPrivKey %v", name, err) - } - b.API.AuthenticatedSupport = true - } assets := b.CurrencyPairs.GetAssetTypes(false) if len(assets) == 0 { t.Fatalf("Cannot setup %v, exchange has no assets", name) diff --git a/config/config.go b/config/config.go index a0710b58f24..cd142264e1a 100644 --- a/config/config.go +++ b/config/config.go @@ -30,8 +30,7 @@ import ( ) var ( - // ErrExchangeConfigIsNil defines an error when the config is nil - ErrExchangeConfigIsNil = errors.New("exchange config is nil") + errExchangeConfigIsNil = errors.New("exchange config is nil") errPairsManagerIsNil = errors.New("currency pairs manager is nil") ) @@ -1891,7 +1890,7 @@ func (c *Config) GetDataPath(elem ...string) string { // Validate checks if exchange config is valid func (c *Exchange) Validate() error { if c == nil { - return ErrExchangeConfigIsNil + return errExchangeConfigIsNil } if c.ConnectionMonitorDelay <= 0 { diff --git a/config/config_test.go b/config/config_test.go index 96eefd0c2dd..76c63c5da56 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -2235,8 +2235,8 @@ func TestMigrateConfig(t *testing.T) { func TestExchangeConfigValidate(t *testing.T) { err := (*Exchange)(nil).Validate() - if !errors.Is(err, ErrExchangeConfigIsNil) { - t.Fatalf("received: '%v' but expected: '%v'", err, ErrExchangeConfigIsNil) + if !errors.Is(err, errExchangeConfigIsNil) { + t.Fatalf("received: '%v' but expected: '%v'", err, errExchangeConfigIsNil) } err = (&Exchange{}).Validate() diff --git a/config_example.json b/config_example.json index 67be13645e7..7d25a39ab17 100644 --- a/config_example.json +++ b/config_example.json @@ -1209,85 +1209,142 @@ ] }, { - "name": "CoinbasePro", - "enabled": true, - "verbose": false, - "httpTimeout": 15000000000, - "websocketResponseCheckTimeout": 30000000, - "websocketResponseMaxLimit": 7000000000, - "websocketTrafficTimeout": 30000000000, - "websocketOrderbookBufferLimit": 5, - "baseCurrencies": "USD,GBP,EUR", - "currencyPairs": { - "requestFormat": { - "uppercase": true, - "delimiter": "-" - }, - "configFormat": { - "uppercase": true, - "delimiter": "-" - }, - "useGlobalFormat": true, - "assetTypes": [ - "spot" - ], - "pairs": { - "spot": { - "enabled": "BTC-USD", - "available": "ETC-GBP,CVC-USDC,LINK-ETH,KNC-BTC,GNT-USDC,EOS-BTC,ETC-BTC,LTC-BTC,ZRX-USD,XRP-EUR,ZRX-EUR,ATOM-USD,BTC-USD,LTC-EUR,XRP-USD,MANA-USDC,XRP-BTC,LTC-GBP,DAI-USD,COMP-BTC,ETH-DAI,XTZ-USD,DASH-BTC,OMG-BTC,BTC-USDC,BCH-USD,DNT-USDC,COMP-USD,LOOM-USDC,OMG-GBP,BCH-GBP,ZRX-BTC,ATOM-BTC,EOS-EUR,ETH-USD,XLM-EUR,KNC-USD,OXT-USD,ETC-EUR,OMG-USD,BTC-GBP,OMG-EUR,DASH-USD,MKR-BTC,XTZ-BTC,BAT-ETH,REP-USD,XLM-BTC,ETH-USDC,REP-BTC,LTC-USD,ZEC-BTC,ZEC-USDC,EOS-USD,MKR-USD,ALGO-USD,LINK-USD,BCH-EUR,XLM-USD,ETH-GBP,ETC-USD,ETH-EUR,BCH-BTC,BTC-EUR,ETH-BTC,DAI-USDC,BAT-USDC" + "name": "CoinbasePro", + "enabled": false, + "verbose": false, + "httpTimeout": 15000000000, + "websocketResponseCheckTimeout": 30000000, + "websocketResponseMaxLimit": 7000000000, + "websocketTrafficTimeout": 30000000000, + "connectionMonitorDelay": 2000000000, + "baseCurrencies": "USD,GBP,EUR", + "currencyPairs": { + "bypassConfigFormatUpgrades": false, + "requestFormat": { + "uppercase": true, + "delimiter": "-" + }, + "configFormat": { + "uppercase": true, + "delimiter": "-" + }, + "useGlobalFormat": true, + "pairs": { + "futures": { + "assetEnabled": true, + "enabled": "GOL-28JAN25-CDE", + "available": "BIT-27SEP24-CDE,ET-27SEP24-CDE,GOL-27NOV24-CDE,BIT-25OCT24-CDE,NOL-19SEP24-CDE,BCH-27SEP24-CDE,LC-27SEP24-CDE,AVA-27SEP24-CDE,LNK-27SEP24-CDE,LC-25OCT24-CDE,DOT-27SEP24-CDE,DOG-27SEP24-CDE,SHB-27SEP24-CDE,BIT-29NOV24-CDE,AVA-25OCT24-CDE,ET-25OCT24-CDE,DOT-25OCT24-CDE,ET-29NOV24-CDE,DOG-29NOV24-CDE,GOL-28JAN25-CDE,GOL-31MAR25-CDE,DOG-25OCT24-CDE,DOT-29NOV24-CDE,LC-29NOV24-CDE,LNK-25OCT24-CDE,BCH-29NOV24-CDE,LNK-29NOV24-CDE,NOL-19NOV24-CDE,BCH-25OCT24-CDE,NOL-21OCT24-CDE,SHB-25OCT24-CDE,AVA-29NOV24-CDE,SHB-29NOV24-CDE" + }, + "spot": { + "assetEnabled": true, + "enabled": "BTC-USD,BTC-USDC,USDT-USD,ETH-USD,ETH-USDC,SOL-USD", + "available": "BTC-USD,BTC-USDC,ETH-USDC,ETH-USD,USDT-USD,SOL-USDC,SOL-USD,USDT-USDC,FET-USDC,FET-USD,BTC-USDT,XRP-USD,XRP-USDC,DOGE-USDC,DOGE-USD,BONK-USDC,BONK-USD,USDT-EUR,ETH-USDT,BTC-EUR,USDC-EUR,AAVE-USDC,AAVE-USD,SUI-USDC,SUI-USD,LINK-USD,LINK-USDC,LTC-USD,LTC-USDC,SHIB-USDC,SHIB-USD,BTC-GBP,JASMY-USD,JASMY-USDC,ETH-EUR,AVAX-USDC,AVAX-USD,NEAR-USD,NEAR-USDC,ONDO-USD,ONDO-USDC,ADA-USD,ADA-USDC,SUPER-USDC,SUPER-USD,UNI-USD,UNI-USDC,RARE-USD,RARE-USDC,RNDR-USD,RNDR-USDC,INJ-USDC,INJ-USD,SEI-USDC,SEI-USD,HBAR-USDC,HBAR-USD,XLM-USDC,XLM-USD,SOL-EUR,HNT-USD,HNT-USDC,BCH-USD,BCH-USDC,STX-USDC,STX-USD,TRB-USDC,TRB-USD,PNG-USD,PNG-USDC,MATIC-USDC,MATIC-USD,MKR-USD,MKR-USDC,SOL-USDT,APT-USDC,APT-USD,EURC-USDC,ICP-USD,ICP-USDC,IDEX-USDC,IDEX-USD,AERO-USDC,AERO-USD,ETH-GBP,DAI-USD,DAI-USDC,00-USD,00-USDC,USDC-GBP,MASK-USD,MASK-USDC,USDT-GBP,RENDER-USD,RENDER-USDC,ZRO-USDC,ZRO-USD,CRV-USDC,CRV-USD,DOT-USDC,DOT-USD,TIA-USDC,TIA-USD,GRT-USD,GRT-USDC,FIL-USDC,FIL-USD,IMX-USDC,IMX-USD,OP-USD,OP-USDC,JTO-USD,JTO-USDC,FET-USDT,LDO-USD,LDO-USDC,SOL-GBP,ARB-USD,ARB-USDC,MSOL-USDC,MSOL-USD,GFI-USD,GFI-USDC,MINA-USD,MINA-USDC,ATOM-USD,ATOM-USDC,QNT-USDC,QNT-USD,NEAR-USDT,PRO-USD,PRO-USDC,FORT-USDC,FORT-USD,PRIME-USD,PRIME-USDC,ZEC-USDC,ZEC-USD,TVK-USD,TVK-USDC,XRP-USDT,DOGE-USDT,1INCH-USDC,1INCH-USD,AIOZ-USD,AIOZ-USDC,ABT-USD,ABT-USDC,ROSE-USDC,ROSE-USD,SKL-USDC,SKL-USD,COMP-USDC,COMP-USD,ZETA-USD,ZETA-USDC,TRU-USD,TRU-USDC,AXL-USDC,AXL-USD,AKT-USDC,AKT-USD,XRP-EUR,KARRAT-USD,KARRAT-USDC,CBETH-USD,CBETH-USDC,BICO-USDT,VARA-USD,VARA-USDC,AAVE-EUR,SUSHI-USD,SUSHI-USDC,ALGO-USDC,ALGO-USD,BICO-USDC,BICO-USD,VELO-USDC,VELO-USD,UMA-USD,UMA-USDC,ETC-USDC,ETC-USD,LRDS-USDC,LRDS-USD,ENS-USD,ENS-USDC,LTC-EUR,VET-USDC,VET-USD,SYN-USD,SYN-USDC,LPT-USDC,LPT-USD,OCEAN-USDC,OCEAN-USD,LQTY-USDC,LQTY-USD,AMP-USDC,AMP-USD,BIGTIME-USD,BIGTIME-USDC,LRC-USD,LRC-USDC,ACH-USD,ACH-USDC,VOXEL-USDC,VOXEL-USD,SAND-USDC,SAND-USD,MPL-USD,MPL-USDC,SHIB-EUR,GTC-USDC,GTC-USD,ARKM-USD,ARKM-USDC,COTI-USD,COTI-USDC,ILV-USD,ILV-USDC,FLR-USD,FLR-USDC,ICP-USDT,LCX-USD,LCX-USDC,MOBILE-USD,MOBILE-USDC,DRIFT-USDC,DRIFT-USD,DOGE-EUR,SHIB-USDT,APE-USD,APE-USDC,GODS-USDC,GODS-USD,EOS-USD,EOS-USDC,XTZ-USDC,XTZ-USD,BLUR-USD,BLUR-USDC,ZRX-USDC,ZRX-USD,AUDIO-USD,AUDIO-USDC,ANKR-USD,ANKR-USDC,UNI-EUR,GST-USD,GST-USDC,ORCA-USD,ORCA-USDC,PRQ-USDC,PRQ-USD,AVAX-EUR,SHPING-USDC,SHPING-USD,LOKA-USDC,LOKA-USD,NEON-USD,NEON-USDC,API3-USDC,API3-USD,STRK-USD,STRK-USDC,XCN-USD,XCN-USDC,AVAX-USDT,ADA-EUR,LTC-GBP,WBTC-USD,WBTC-USDC,METIS-USDC,METIS-USD,HIGH-USDC,HIGH-USD,EGLD-USD,EGLD-USDC,ETH-DAI,DESO-USDC,DESO-USD,BIT-USD,BIT-USDC,YFI-USDC,YFI-USD,MASK-EUR,CRO-USDC,CRO-USD,HOPR-USD,HOPR-USDC,CHZ-USD,CHZ-USDC,MATIC-EUR,JASMY-USDT,RBN-USDC,RBN-USD,ADA-USDT,RARI-USDC,RARI-USD,OP-USDT,POLS-USD,POLS-USDC,DIMO-USD,DIMO-USDC,OGN-USD,OGN-USDC,BAL-USD,BAL-USDC,SNX-USD,SNX-USDC,TRAC-USD,TRAC-USDC,QI-USD,QI-USDC,IOTX-USDC,IOTX-USD,MNDE-USD,MNDE-USDC,ACX-USDC,ACX-USD,LINK-EUR,MAGIC-USDC,MAGIC-USD,ALEPH-USDC,ALEPH-USD,T-USDC,T-USD,RONIN-USD,RONIN-USDC,RPL-USD,RPL-USDC,AAVE-GBP,CLV-USDC,CLV-USD,MANA-USDC,MANA-USD,BLZ-USDC,BLZ-USD,AVT-USD,AVT-USDC,PYR-USDC,PYR-USD,DYP-USDC,DYP-USD,OXT-USDC,OXT-USD,A8-USD,A8-USDC,SWFTC-USDC,SWFTC-USD,MATIC-USDT,KAVA-USD,KAVA-USDC,HONEY-USD,HONEY-USDC,ICP-EUR,NCT-USD,NCT-USDC,BLAST-USDC,BLAST-USD,NMR-USD,NMR-USDC,DASH-USDC,DASH-USD,DAR-USD,DAR-USDC,BTRST-USD,BTRST-USDC,CGLD-USDC,CGLD-USD,SPA-USDC,SPA-USD,RAD-USDC,RAD-USD,DNT-USD,DNT-USDC,PIRATE-USDC,PIRATE-USD,MDT-USD,MDT-USDC,CVX-USD,CVX-USDC,APE-EUR,BCH-EUR,AUCTION-USD,AUCTION-USDC,RNDR-USDT,WCFG-USDC,WCFG-USD,APT-USDT,MASK-USDT,CTSI-USD,CTSI-USDC,POND-USDC,POND-USD,DOT-EUR,ADA-GBP,INDEX-USD,INDEX-USDC,SPELL-USDC,SPELL-USD,BAT-USD,BAT-USDC,SUKU-USDC,SUKU-USD,ALGO-EUR,SEAM-USD,SEAM-USDC,BOBA-USDC,BOBA-USD,ALGO-GBP,ACS-USDC,ACS-USD,MANA-EUR,MLN-USD,MLN-USDC,TNSR-USDC,TNSR-USD,FIL-EUR,FLOW-USDC,FLOW-USD,XYO-USDC,XYO-USD,GUSD-USD,GUSD-USDC,VTHO-USD,VTHO-USDC,RLC-USDC,RLC-USD,1INCH-EUR,ALCX-USDC,ALCX-USD,CORECHAIN-USD,CORECHAIN-USDC,SD-USD,SD-USDC,STX-USDT,FX-USDC,FX-USD,XLM-EUR,SHDW-USDC,SHDW-USD,HFT-USD,HFT-USDC,STORJ-USDC,STORJ-USD,SAFE-USDC,SAFE-USD,FIDA-USD,FIDA-USDC,MATH-USD,MATH-USDC,NKN-USDC,NKN-USD,PYUSD-USDC,PYUSD-USD,CELR-USDC,CELR-USD,AXS-USD,AXS-USDC,ALICE-USDC,ALICE-USD,ICP-GBP,GLM-USDC,GLM-USD,FOX-USDC,FOX-USD,AURORA-USDC,AURORA-USD,FARM-USD,FARM-USDC,EOS-EUR,DOT-USDT,HBAR-USDT,GMT-USDC,GMT-USD,GRT-EUR,CTX-USDC,CTX-USD,CHZ-EUR,ETC-EUR,ORN-USDC,ORN-USD,MEDIA-USD,MEDIA-USDC,ATOM-EUR,ASM-USD,ASM-USDC,AGLD-USDC,AGLD-USD,LINK-USDT,KNC-USD,KNC-USDC,DOGE-GBP,SAND-USDT,INV-USDC,INV-USD,GAL-USD,GAL-USDC,PERP-USD,PERP-USDC,POWR-USDC,POWR-USD,KSM-USD,KSM-USDC,BAND-USD,BAND-USDC,ELA-USDC,ELA-USD,G-USD,G-USDC,PLU-USDC,PLU-USD,ROSE-USDT,QNT-USDT,APE-USDT,1INCH-GBP,REQ-USD,REQ-USDC,AXS-USDT,WAXL-USD,WAXL-USDC,ZEN-USD,ZEN-USDC,BCH-GBP,BADGER-USDC,BADGER-USD,FORTH-USD,FORTH-USDC,FIL-GBP,CVC-USDC,CVC-USD,DOT-GBP,LIT-USDC,LIT-USD,CRV-EUR,LINK-GBP,AST-USDC,AST-USD,FIS-USDC,FIS-USD,ENS-EUR,ATOM-USDT,IMX-USDT,SHIB-GBP,MATIC-GBP,DIA-USD,DIA-USDC,ERN-USDC,ERN-USD,OSMO-USD,OSMO-USDC,CHZ-USDT,ARPA-USD,ARPA-USDC,RNDR-EUR,TIME-USD,TIME-USDC,ENS-USDT,OMNI-USD,OMNI-USDC,ATOM-GBP,C98-USD,C98-USDC,PUNDIX-USD,PUNDIX-USDC,MUSE-USD,MUSE-USDC,LRC-USDT,MINA-EUR,GHST-USD,GHST-USDC,ETC-GBP,AXS-EUR,LSETH-USDC,LSETH-USD,GNO-USD,GNO-USDC,BNT-USDC,BNT-USD,AERGO-USD,AERGO-USDC,SNX-EUR,CHZ-GBP,UNI-GBP,FLOW-USDT,BAT-EUR,MINA-USDT,DEXT-USDC,DEXT-USD,XLM-USDT,GYEN-USDC,GYEN-USD,BICO-EUR,CRV-GBP,ANKR-EUR,CGLD-EUR,XTZ-GBP,MASK-GBP,KRL-USDC,KRL-USD,CRO-EUR,ANKR-GBP,XTZ-EUR,GRT-GBP,GMT-USDT,SNX-GBP,STG-USD,STG-USDC,CRO-USDT,PAX-USD,PAX-USDC,CGLD-GBP,SOL-ETH,ETH-BTC,ADA-ETH,SOL-BTC,AAVE-BTC,WBTC-BTC,ZEC-BTC,CBETH-ETH,LINK-ETH,LTC-BTC,UNI-BTC,BCH-BTC,DOGE-BTC,AVAX-BTC,ADA-BTC,LSETH-ETH,MKR-BTC,GRT-BTC,MATIC-BTC,COMP-BTC,LRC-BTC,DOT-BTC,XLM-BTC,FIL-BTC,ICP-BTC,EOS-BTC,BAT-ETH,LINK-BTC,CRV-BTC,ATOM-BTC,BAL-BTC,ALGO-BTC,1INCH-BTC,BAT-BTC,MANA-ETH,ETC-BTC,DASH-BTC,SNX-BTC,YFI-BTC,XTZ-BTC,AXS-BTC,ANKR-BTC,MANA-BTC,CGLD-BTC" + } } - } - }, - "api": { - "authenticatedSupport": false, - "authenticatedWebsocketApiSupport": false, - "endpoints": { - "url": "NON_DEFAULT_HTTP_LINK_TO_EXCHANGE_API", - "urlSecondary": "NON_DEFAULT_HTTP_LINK_TO_EXCHANGE_API", - "websocketURL": "NON_DEFAULT_HTTP_LINK_TO_WEBSOCKET_EXCHANGE_API" }, - "credentials": { - "key": "Key", - "secret": "Secret", - "clientID": "ClientID" - }, - "credentialsValidator": { - "requiresKey": true, - "requiresSecret": true, - "requiresClientID": true, - "requiresBase64DecodeSecret": true - } - }, - "features": { - "supports": { - "restAPI": true, - "restCapabilities": { - "autoPairUpdates": true + "api": { + "authenticatedSupport": false, + "authenticatedWebsocketApiSupport": false, + "credentials": { + "key": "", + "secret": "", + "clientID": "" }, - "websocketAPI": true, - "websocketCapabilities": {} + "credentialsValidator": { + "requiresKey": true, + "requiresSecret": true, + "requiresClientID": true, + "requiresBase64DecodeSecret": true + }, + "urlEndpoints": { + "RestSandboxURL": "https://api-public.sandbox.exchange.coinbase.com/", + "RestSpotURL": "https://api.coinbase.com", + "WebsocketSpotURL": "wss://advanced-trade-ws.coinbase.com" + } }, - "enabled": { - "autoPairUpdates": true, - "websocketAPI": false + "features": { + "supports": { + "restAPI": true, + "restCapabilities": { + "autoPairUpdates": true, + "fundingRateFetching": false + }, + "websocketAPI": true, + "websocketCapabilities": { + "fundingRateFetching": false + } + }, + "enabled": { + "autoPairUpdates": true, + "websocketAPI": true, + "saveTradeData": false, + "tradeFeed": false, + "fillsFeed": false + }, + "subscriptions": [ + { + "enabled": true, + "channel": "heartbeat" + }, + { + "enabled": false, + "channel": "status", + "authenticated": true + }, + { + "enabled": true, + "channel": "ticker", + "asset": "spot" + }, + { + "enabled": true, + "channel": "candles", + "asset": "spot" + }, + { + "enabled": true, + "channel": "allTrades", + "asset": "spot" + }, + { + "enabled": true, + "channel": "orderbook", + "asset": "spot" + }, + { + "enabled": true, + "channel": "account", + "authenticated": true + }, + { + "enabled": false, + "channel": "ticker_batch", + "asset": "spot" + } + ] + }, + "bankAccounts": [ + { + "enabled": false, + "bankName": "", + "bankAddress": "", + "bankPostalCode": "", + "bankPostalCity": "", + "bankCountry": "", + "accountName": "", + "accountNumber": "", + "swiftCode": "", + "iban": "", + "supportedCurrencies": "" + } + ], + "orderbook": { + "verificationBypass": false, + "websocketBufferLimit": 5, + "websocketBufferEnabled": false, + "publishPeriod": 10000000000 } }, - "bankAccounts": [ - { - "enabled": false, - "bankName": "", - "bankAddress": "", - "bankPostalCode": "", - "bankPostalCity": "", - "bankCountry": "", - "accountName": "", - "accountNumber": "", - "swiftCode": "", - "iban": "", - "supportedCurrencies": "" - } - ] - }, { "name": "Deribit", "enabled": true, diff --git a/exchanges/coinbasepro/coinbasepro.go b/exchanges/coinbasepro/coinbasepro.go index 52405501d08..10dca858f79 100644 --- a/exchanges/coinbasepro/coinbasepro.go +++ b/exchanges/coinbasepro/coinbasepro.go @@ -62,8 +62,6 @@ const ( coinbaseV2 = "/v2/" coinbaseNotifications = "notifications" coinbaseUser = "user" - coinbaseUsers = "users" - coinbaseAuth = "auth" coinbaseAddresses = "addresses" coinbaseTransactions = "transactions" coinbaseDeposits = "deposits" @@ -82,10 +80,6 @@ const ( coinbaseConversionRate = "conversion-rate" coinbaseMarket = "market" - pageNone = "" - pageBefore = "before" - pageAfter = "after" - unknownContract = "UNKNOWN_CONTRACT_EXPIRY_TYPE" granUnknown = "UNKNOWN_GRANULARITY" granOneMin = "ONE_MINUTE" granFiveMin = "FIVE_MINUTE" @@ -120,48 +114,46 @@ const ( BestCaseMakerFee = 0 StablePairMakerFee = 0 WorstCaseStablePairTakerFee = 0.000045 - BestCaseStablePairTakerFee = 0.00001 ) var ( - errAccountIDEmpty = errors.New("account id cannot be empty") - errClientOrderIDEmpty = errors.New("client order id cannot be empty") - errProductIDEmpty = errors.New("product id cannot be empty") - errOrderIDEmpty = errors.New("order ids cannot be empty") - errOpenPairWithOtherTypes = errors.New("cannot pair open orders with other order types") - errSizeAndPriceZero = errors.New("size and price cannot both be 0") - errCurrencyEmpty = errors.New("currency cannot be empty") - errCurrWalletConflict = errors.New("exactly one of walletID and currency must be specified") - errWalletIDEmpty = errors.New("wallet id cannot be empty") - errAddressIDEmpty = errors.New("address id cannot be empty") - errTransactionTypeEmpty = errors.New("transaction type cannot be empty") - errToEmpty = errors.New("to cannot be empty") - errAmountEmpty = errors.New("amount cannot be empty") - errTransactionIDEmpty = errors.New("transaction id cannot be empty") - errPaymentMethodEmpty = errors.New("payment method cannot be empty") - errDepositIDEmpty = errors.New("deposit id cannot be empty") - errInvalidPriceType = errors.New("price type must be spot, buy, or sell") - errInvalidOrderType = errors.New("order type must be market, limit, or stop") - errNoMatchingWallets = errors.New("no matching wallets returned") - errOrderModFailNoRet = errors.New("order modification failed but no error returned") - errNameEmpty = errors.New("name cannot be empty") - errPortfolioIDEmpty = errors.New("portfolio id cannot be empty") - errFeeTypeNotSupported = errors.New("fee type not supported") - errCantDecodePrivKey = errors.New("cannot decode private key") - errNoWalletForCurrency = errors.New("no wallet found for currency, address creation impossible") - errChannelNameUnknown = errors.New("unknown channel name") - errNoWalletsReturned = errors.New("no wallets returned") - errPayMethodNotFound = errors.New("payment method not found") - errUnknownL2DataType = errors.New("unknown l2update data type") - errUnknownSide = errors.New("unknown side") - errInvalidGranularity = errors.New("invalid granularity") - errOrderFailedToCancel = errors.New("failed to cancel order") - errUnrecognisedStatusType = errors.New("unrecognised status type") - errPairEmpty = errors.New("pair cannot be empty") - errStringConvert = errors.New("unable to convert into string value") - errFloatConvert = errors.New("unable to convert into float64 value") - errWrappedAssetEmpty = errors.New("wrapped asset cannot be empty") - errExpectedOneTickerReturned = errors.New("expected one ticker to be returned") + errAccountIDEmpty = errors.New("account id cannot be empty") + errClientOrderIDEmpty = errors.New("client order id cannot be empty") + errProductIDEmpty = errors.New("product id cannot be empty") + errOrderIDEmpty = errors.New("order ids cannot be empty") + errOpenPairWithOtherTypes = errors.New("cannot pair open orders with other order types") + errSizeAndPriceZero = errors.New("size and price cannot both be 0") + errCurrencyEmpty = errors.New("currency cannot be empty") + errCurrWalletConflict = errors.New("exactly one of walletID and currency must be specified") + errWalletIDEmpty = errors.New("wallet id cannot be empty") + errAddressIDEmpty = errors.New("address id cannot be empty") + errTransactionTypeEmpty = errors.New("transaction type cannot be empty") + errToEmpty = errors.New("to cannot be empty") + errAmountEmpty = errors.New("amount cannot be empty") + errTransactionIDEmpty = errors.New("transaction id cannot be empty") + errPaymentMethodEmpty = errors.New("payment method cannot be empty") + errDepositIDEmpty = errors.New("deposit id cannot be empty") + errInvalidPriceType = errors.New("price type must be spot, buy, or sell") + errInvalidOrderType = errors.New("order type must be market, limit, or stop") + errNoMatchingWallets = errors.New("no matching wallets returned") + errOrderModFailNoRet = errors.New("order modification failed but no error returned") + errNameEmpty = errors.New("name cannot be empty") + errPortfolioIDEmpty = errors.New("portfolio id cannot be empty") + errFeeTypeNotSupported = errors.New("fee type not supported") + errCantDecodePrivKey = errors.New("cannot decode private key") + errNoWalletForCurrency = errors.New("no wallet found for currency, address creation impossible") + errChannelNameUnknown = errors.New("unknown channel name") + errNoWalletsReturned = errors.New("no wallets returned") + errPayMethodNotFound = errors.New("payment method not found") + errUnknownL2DataType = errors.New("unknown l2update data type") + errUnknownSide = errors.New("unknown side") + errInvalidGranularity = errors.New("invalid granularity") + errOrderFailedToCancel = errors.New("failed to cancel order") + errUnrecognisedStatusType = errors.New("unrecognised status type") + errPairEmpty = errors.New("pair cannot be empty") + errStringConvert = errors.New("unable to convert into string value") + errFloatConvert = errors.New("unable to convert into float64 value") + errWrappedAssetEmpty = errors.New("wrapped asset cannot be empty") ) // GetAllAccounts returns information on all trading accounts associated with the API key diff --git a/exchanges/coinbasepro/coinbasepro_test.go b/exchanges/coinbasepro/coinbasepro_test.go index 8f6c4fcb3a7..f281ff817f9 100644 --- a/exchanges/coinbasepro/coinbasepro_test.go +++ b/exchanges/coinbasepro/coinbasepro_test.go @@ -7,7 +7,6 @@ import ( "net/http" "os" "strconv" - "strings" "testing" "time" @@ -1744,14 +1743,8 @@ func TestCheckSubscriptions(t *testing.T) { func TestGetJWT(t *testing.T) { t.Parallel() sharedtestvalues.SkipTestIfCredentialsUnset(t, c) - creds, err := c.GetCredentials(context.Background()) + _, err := c.GetJWT(context.Background(), "") assert.NoError(t, err) - _, err = c.GetJWT(context.Background(), "") - if strings.HasPrefix(creds.Secret, "-----BEGIN EC PRIVATE KEY-----\n") { - assert.NoError(t, err) - } else { - assert.ErrorIs(t, err, errCantDecodePrivKey) - } } func exchangeBaseHelper(c *CoinbasePro) error {