diff --git a/cmd/exchange_template/wrapper_file.tmpl b/cmd/exchange_template/wrapper_file.tmpl index 0ed4873fe24..8dc2f88f4af 100644 --- a/cmd/exchange_template/wrapper_file.tmpl +++ b/cmd/exchange_template/wrapper_file.tmpl @@ -333,19 +333,19 @@ func ({{.Variable}} *{{.CapitalName}}) GetDepositAddress(cryptocurrency currency // WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is // submitted -func ({{.Variable}} *{{.CapitalName}}) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.CryptoWithdrawRequest) (string, error) { +func ({{.Variable}} *{{.CapitalName}}) WithdrawCryptocurrencyFunds(withdrawRequest *withdraw.CryptoWithdrawRequest) (string, error) { return "", common.ErrNotYetImplemented } // WithdrawFiatFunds returns a withdrawal ID when a withdrawal is // submitted -func ({{.Variable}} *{{.CapitalName}}) WithdrawFiatFunds(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func ({{.Variable}} *{{.CapitalName}}) WithdrawFiatFunds(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return "", common.ErrNotYetImplemented } // WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a withdrawal is // submitted -func ({{.Variable}} *{{.CapitalName}}) WithdrawFiatFundsToInternationalBank(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func ({{.Variable}} *{{.CapitalName}}) WithdrawFiatFundsToInternationalBank(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return "", common.ErrNotYetImplemented } diff --git a/cmd/exchange_wrapper_coverage/main.go b/cmd/exchange_wrapper_coverage/main.go index 40dba073d36..e352c028766 100644 --- a/cmd/exchange_wrapper_coverage/main.go +++ b/cmd/exchange_wrapper_coverage/main.go @@ -12,6 +12,7 @@ import ( exchange "github.com/thrasher-corp/gocryptotrader/exchanges" "github.com/thrasher-corp/gocryptotrader/exchanges/asset" "github.com/thrasher-corp/gocryptotrader/exchanges/order" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" ) const ( @@ -173,16 +174,16 @@ func testWrappers(e exchange.IBotExchange) []string { funcs = append(funcs, "GetDepositAddress") } - _, err = e.WithdrawCryptocurrencyFunds(&exchange.CryptoWithdrawRequest{}) + _, err = e.WithdrawCryptocurrencyFunds(&withdraw.CryptoWithdrawRequest{}) if err == common.ErrNotYetImplemented { funcs = append(funcs, "WithdrawCryptocurrencyFunds") } - _, err = e.WithdrawFiatFunds(&exchange.FiatWithdrawRequest{}) + _, err = e.WithdrawFiatFunds(&withdraw.FiatWithdrawRequest{}) if err == common.ErrNotYetImplemented { funcs = append(funcs, "WithdrawFiatFunds") } - _, err = e.WithdrawFiatFundsToInternationalBank(&exchange.FiatWithdrawRequest{}) + _, err = e.WithdrawFiatFundsToInternationalBank(&withdraw.FiatWithdrawRequest{}) if err == common.ErrNotYetImplemented { funcs = append(funcs, "WithdrawFiatFundsToInternationalBank") } diff --git a/cmd/exchange_wrapper_issues/main.go b/cmd/exchange_wrapper_issues/main.go index e4d2b6e4451..704fc220380 100644 --- a/cmd/exchange_wrapper_issues/main.go +++ b/cmd/exchange_wrapper_issues/main.go @@ -22,6 +22,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/order" "github.com/thrasher-corp/gocryptotrader/exchanges/orderbook" "github.com/thrasher-corp/gocryptotrader/exchanges/ticker" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" ) func main() { @@ -619,11 +620,11 @@ func testWrappers(e exchange.IBotExchange, base *exchange.Base, config *Config) Response: jsonifyInterface([]interface{}{r19}), }) - genericWithdrawRequest := exchange.GenericWithdrawRequestInfo{ + genericWithdrawRequest := withdraw.GenericWithdrawRequestInfo{ Amount: config.OrderSubmission.Amount, Currency: p.Quote, } - withdrawRequest := exchange.CryptoWithdrawRequest{ + withdrawRequest := withdraw.CryptoWithdrawRequest{ GenericWithdrawRequestInfo: genericWithdrawRequest, Address: withdrawAddressOverride, } @@ -663,7 +664,7 @@ func testWrappers(e exchange.IBotExchange, base *exchange.Base, config *Config) Response: jsonifyInterface([]interface{}{r21}), }) - fiatWithdrawRequest := exchange.FiatWithdrawRequest{ + fiatWithdrawRequest := withdraw.FiatWithdrawRequest{ GenericWithdrawRequestInfo: genericWithdrawRequest, BankAccountName: config.BankDetails.BankAccountName, BankAccountNumber: config.BankDetails.BankAccountNumber, diff --git a/engine/helpers.go b/engine/helpers.go index 0db45287d11..570989bbfed 100644 --- a/engine/helpers.go +++ b/engine/helpers.go @@ -26,6 +26,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/orderbook" "github.com/thrasher-corp/gocryptotrader/exchanges/stats" "github.com/thrasher-corp/gocryptotrader/exchanges/ticker" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" log "github.com/thrasher-corp/gocryptotrader/logger" "github.com/thrasher-corp/gocryptotrader/portfolio" "github.com/thrasher-corp/gocryptotrader/utils" @@ -699,7 +700,7 @@ func GetExchangeCryptocurrencyDepositAddresses() map[string]map[string]string { } // WithdrawCryptocurrencyFundsByExchange withdraws the desired cryptocurrency and amount to a desired cryptocurrency address -func WithdrawCryptocurrencyFundsByExchange(exchName string, req *exchange.CryptoWithdrawRequest) (string, error) { +func WithdrawCryptocurrencyFundsByExchange(exchName string, req *withdraw.CryptoWithdrawRequest) (string, error) { if req == nil { return "", errors.New("crypto withdraw request param is nil") } diff --git a/exchanges/alphapoint/alphapoint_test.go b/exchanges/alphapoint/alphapoint_test.go index 910e988039e..6ed0c2c8165 100644 --- a/exchanges/alphapoint/alphapoint_test.go +++ b/exchanges/alphapoint/alphapoint_test.go @@ -10,6 +10,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/currency" exchange "github.com/thrasher-corp/gocryptotrader/exchanges" "github.com/thrasher-corp/gocryptotrader/exchanges/order" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" ) const ( @@ -560,7 +561,7 @@ func TestModifyOrder(t *testing.T) { func TestWithdraw(t *testing.T) { t.Parallel() - var withdrawCryptoRequest = exchange.CryptoWithdrawRequest{} + var withdrawCryptoRequest = withdraw.CryptoWithdrawRequest{} _, err := a.WithdrawCryptocurrencyFunds(&withdrawCryptoRequest) if err != common.ErrNotYetImplemented { t.Errorf("Expected 'Not implemented', received %v", err) @@ -573,7 +574,7 @@ func TestWithdrawFiat(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - var withdrawFiatRequest = exchange.FiatWithdrawRequest{} + var withdrawFiatRequest = withdraw.FiatWithdrawRequest{} _, err := a.WithdrawFiatFunds(&withdrawFiatRequest) if err != common.ErrNotYetImplemented { t.Errorf("Expected '%v', received: '%v'", common.ErrNotYetImplemented, err) @@ -586,7 +587,7 @@ func TestWithdrawInternationalBank(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - var withdrawFiatRequest = exchange.FiatWithdrawRequest{} + var withdrawFiatRequest = withdraw.FiatWithdrawRequest{} _, err := a.WithdrawFiatFundsToInternationalBank(&withdrawFiatRequest) if err != common.ErrNotYetImplemented { t.Errorf("Expected '%v', received: '%v'", common.ErrNotYetImplemented, err) diff --git a/exchanges/alphapoint/alphapoint_wrapper.go b/exchanges/alphapoint/alphapoint_wrapper.go index 4df2c5d5fbc..f7fd940e316 100644 --- a/exchanges/alphapoint/alphapoint_wrapper.go +++ b/exchanges/alphapoint/alphapoint_wrapper.go @@ -16,6 +16,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/request" "github.com/thrasher-corp/gocryptotrader/exchanges/ticker" "github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wshandler" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" ) // GetDefaultConfig returns a default exchange config for Alphapoint @@ -282,18 +283,18 @@ func (a *Alphapoint) GetDepositAddress(cryptocurrency currency.Code, _ string) ( // WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is // submitted -func (a *Alphapoint) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.CryptoWithdrawRequest) (string, error) { +func (a *Alphapoint) WithdrawCryptocurrencyFunds(withdrawRequest *withdraw.CryptoWithdrawRequest) (string, error) { return "", common.ErrNotYetImplemented } // WithdrawFiatFunds returns a withdrawal ID when a withdrawal is submitted -func (a *Alphapoint) WithdrawFiatFunds(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (a *Alphapoint) WithdrawFiatFunds(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return "", common.ErrNotYetImplemented } // WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a withdrawal is // submitted -func (a *Alphapoint) WithdrawFiatFundsToInternationalBank(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (a *Alphapoint) WithdrawFiatFundsToInternationalBank(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return "", common.ErrNotYetImplemented } diff --git a/exchanges/anx/anx_test.go b/exchanges/anx/anx_test.go index c817c725bd3..4242a104c61 100644 --- a/exchanges/anx/anx_test.go +++ b/exchanges/anx/anx_test.go @@ -8,6 +8,7 @@ import ( exchange "github.com/thrasher-corp/gocryptotrader/exchanges" "github.com/thrasher-corp/gocryptotrader/exchanges/asset" "github.com/thrasher-corp/gocryptotrader/exchanges/order" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" ) // Please supply your own keys here for due diligence testing @@ -326,8 +327,8 @@ func TestWithdraw(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - withdrawCryptoRequest := exchange.CryptoWithdrawRequest{ - GenericWithdrawRequestInfo: exchange.GenericWithdrawRequestInfo{ + withdrawCryptoRequest := withdraw.CryptoWithdrawRequest{ + GenericWithdrawRequestInfo: withdraw.GenericWithdrawRequestInfo{ Amount: -1, Currency: currency.BTC, Description: "WITHDRAW IT ALL", @@ -346,7 +347,7 @@ func TestWithdraw(t *testing.T) { func TestWithdrawFiat(t *testing.T) { t.Parallel() - var withdrawFiatRequest = exchange.FiatWithdrawRequest{} + var withdrawFiatRequest = withdraw.FiatWithdrawRequest{} _, err := a.WithdrawFiatFunds(&withdrawFiatRequest) if err != common.ErrFunctionNotSupported { t.Errorf("Expected '%v', received: '%v'", @@ -357,7 +358,7 @@ func TestWithdrawFiat(t *testing.T) { func TestWithdrawInternationalBank(t *testing.T) { t.Parallel() - var withdrawFiatRequest = exchange.FiatWithdrawRequest{} + var withdrawFiatRequest = withdraw.FiatWithdrawRequest{} _, err := a.WithdrawFiatFundsToInternationalBank(&withdrawFiatRequest) if err != common.ErrFunctionNotSupported { t.Errorf("Expected '%v', received: '%v'", diff --git a/exchanges/anx/anx_wrapper.go b/exchanges/anx/anx_wrapper.go index 5c1184bf938..a709243224b 100644 --- a/exchanges/anx/anx_wrapper.go +++ b/exchanges/anx/anx_wrapper.go @@ -18,6 +18,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/request" "github.com/thrasher-corp/gocryptotrader/exchanges/ticker" "github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wshandler" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" log "github.com/thrasher-corp/gocryptotrader/logger" ) @@ -417,20 +418,20 @@ func (a *ANX) GetDepositAddress(cryptocurrency currency.Code, _ string) (string, // WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is // submitted -func (a *ANX) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.CryptoWithdrawRequest) (string, error) { +func (a *ANX) WithdrawCryptocurrencyFunds(withdrawRequest *withdraw.CryptoWithdrawRequest) (string, error) { return a.Send(withdrawRequest.Currency.String(), withdrawRequest.Address, "", strconv.FormatFloat(withdrawRequest.Amount, 'f', -1, 64)) } // WithdrawFiatFunds returns a withdrawal ID when a withdrawal is // submitted -func (a *ANX) WithdrawFiatFunds(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (a *ANX) WithdrawFiatFunds(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { // Fiat withdrawals available via website return "", common.ErrFunctionNotSupported } // WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a withdrawal is // submitted -func (a *ANX) WithdrawFiatFundsToInternationalBank(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (a *ANX) WithdrawFiatFundsToInternationalBank(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { // Fiat withdrawals available via website return "", common.ErrFunctionNotSupported } diff --git a/exchanges/binance/binance.go b/exchanges/binance/binance.go index fb0f8a16cb8..c324dc5f4c9 100644 --- a/exchanges/binance/binance.go +++ b/exchanges/binance/binance.go @@ -46,7 +46,7 @@ const ( allOrders = "/api/v3/allOrders" // Withdraw API endpoints - withdraw = "/wapi/v3/withdraw.html" + withdrawEndpoint = "/wapi/v3/withdraw.html" depositHistory = "/wapi/v3/depositHistory.html" withdrawalHistory = "/wapi/v3/withdrawHistory.html" depositAddress = "/wapi/v3/depositAddress.html" @@ -643,7 +643,7 @@ func getCryptocurrencyWithdrawalFee(c currency.Code) float64 { // WithdrawCrypto sends cryptocurrency to the address of your choosing func (b *Binance) WithdrawCrypto(asset, address, addressTag, name, amount string) (string, error) { var resp WithdrawResponse - path := b.API.Endpoints.URL + withdraw + path := b.API.Endpoints.URL + withdrawEndpoint params := url.Values{} params.Set("asset", asset) diff --git a/exchanges/binance/binance_test.go b/exchanges/binance/binance_test.go index 0934d278987..4019a849418 100644 --- a/exchanges/binance/binance_test.go +++ b/exchanges/binance/binance_test.go @@ -8,6 +8,7 @@ import ( exchange "github.com/thrasher-corp/gocryptotrader/exchanges" "github.com/thrasher-corp/gocryptotrader/exchanges/asset" "github.com/thrasher-corp/gocryptotrader/exchanges/order" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" ) // Please supply your own keys here for due diligence testing @@ -453,8 +454,8 @@ func TestWithdraw(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - withdrawCryptoRequest := exchange.CryptoWithdrawRequest{ - GenericWithdrawRequestInfo: exchange.GenericWithdrawRequestInfo{ + withdrawCryptoRequest := withdraw.CryptoWithdrawRequest{ + GenericWithdrawRequestInfo: withdraw.GenericWithdrawRequestInfo{ Amount: 0, Currency: currency.BTC, Description: "WITHDRAW IT ALL", @@ -476,7 +477,7 @@ func TestWithdraw(t *testing.T) { func TestWithdrawFiat(t *testing.T) { t.Parallel() - var withdrawFiatRequest exchange.FiatWithdrawRequest + var withdrawFiatRequest withdraw.FiatWithdrawRequest _, err := b.WithdrawFiatFunds(&withdrawFiatRequest) if err != common.ErrFunctionNotSupported { t.Errorf("Expected '%v', received: '%v'", common.ErrFunctionNotSupported, err) @@ -486,7 +487,7 @@ func TestWithdrawFiat(t *testing.T) { func TestWithdrawInternationalBank(t *testing.T) { t.Parallel() - var withdrawFiatRequest exchange.FiatWithdrawRequest + var withdrawFiatRequest withdraw.FiatWithdrawRequest _, err := b.WithdrawFiatFundsToInternationalBank(&withdrawFiatRequest) if err != common.ErrFunctionNotSupported { t.Errorf("Expected '%v', received: '%v'", common.ErrFunctionNotSupported, err) diff --git a/exchanges/binance/binance_wrapper.go b/exchanges/binance/binance_wrapper.go index 4f79f15c1b9..288649d5d0f 100644 --- a/exchanges/binance/binance_wrapper.go +++ b/exchanges/binance/binance_wrapper.go @@ -19,6 +19,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/request" "github.com/thrasher-corp/gocryptotrader/exchanges/ticker" "github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wshandler" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" log "github.com/thrasher-corp/gocryptotrader/logger" ) @@ -494,7 +495,7 @@ func (b *Binance) GetDepositAddress(cryptocurrency currency.Code, _ string) (str // WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is // submitted -func (b *Binance) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.CryptoWithdrawRequest) (string, error) { +func (b *Binance) WithdrawCryptocurrencyFunds(withdrawRequest *withdraw.CryptoWithdrawRequest) (string, error) { amountStr := strconv.FormatFloat(withdrawRequest.Amount, 'f', -1, 64) return b.WithdrawCrypto(withdrawRequest.Currency.String(), withdrawRequest.Address, @@ -504,13 +505,13 @@ func (b *Binance) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.CryptoWi // WithdrawFiatFunds returns a withdrawal ID when a // withdrawal is submitted -func (b *Binance) WithdrawFiatFunds(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (b *Binance) WithdrawFiatFunds(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return "", common.ErrFunctionNotSupported } // WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a // withdrawal is submitted -func (b *Binance) WithdrawFiatFundsToInternationalBank(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (b *Binance) WithdrawFiatFundsToInternationalBank(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return "", common.ErrFunctionNotSupported } diff --git a/exchanges/bitfinex/bitfinex.go b/exchanges/bitfinex/bitfinex.go index a79811f3c14..ba239f4845d 100644 --- a/exchanges/bitfinex/bitfinex.go +++ b/exchanges/bitfinex/bitfinex.go @@ -15,6 +15,7 @@ import ( exchange "github.com/thrasher-corp/gocryptotrader/exchanges" "github.com/thrasher-corp/gocryptotrader/exchanges/order" "github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wshandler" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" log "github.com/thrasher-corp/gocryptotrader/logger" ) @@ -541,7 +542,7 @@ func (b *Bitfinex) WithdrawCryptocurrency(withdrawType, wallet, address, payment } // WithdrawFIAT Sends an authenticated request to withdraw FIAT currency -func (b *Bitfinex) WithdrawFIAT(withdrawalType, walletType string, withdrawRequest *exchange.FiatWithdrawRequest) ([]Withdrawal, error) { +func (b *Bitfinex) WithdrawFIAT(withdrawalType, walletType string, withdrawRequest *withdraw.FiatWithdrawRequest) ([]Withdrawal, error) { var response []Withdrawal req := make(map[string]interface{}) diff --git a/exchanges/bitfinex/bitfinex_test.go b/exchanges/bitfinex/bitfinex_test.go index ce29001dd06..3599613424a 100644 --- a/exchanges/bitfinex/bitfinex_test.go +++ b/exchanges/bitfinex/bitfinex_test.go @@ -17,6 +17,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/order" "github.com/thrasher-corp/gocryptotrader/exchanges/sharedtestvalues" "github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wshandler" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" ) // Please supply your own keys here to do better tests @@ -884,8 +885,8 @@ func TestWithdraw(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - withdrawCryptoRequest := exchange.CryptoWithdrawRequest{ - GenericWithdrawRequestInfo: exchange.GenericWithdrawRequestInfo{ + withdrawCryptoRequest := withdraw.CryptoWithdrawRequest{ + GenericWithdrawRequestInfo: withdraw.GenericWithdrawRequestInfo{ Amount: -1, Currency: currency.BTC, Description: "WITHDRAW IT ALL", @@ -908,8 +909,8 @@ func TestWithdrawFiat(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - var withdrawFiatRequest = exchange.FiatWithdrawRequest{ - GenericWithdrawRequestInfo: exchange.GenericWithdrawRequestInfo{ + var withdrawFiatRequest = withdraw.FiatWithdrawRequest{ + GenericWithdrawRequestInfo: withdraw.GenericWithdrawRequestInfo{ Amount: -1, Currency: currency.USD, Description: "WITHDRAW IT ALL", @@ -941,8 +942,8 @@ func TestWithdrawInternationalBank(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - var withdrawFiatRequest = exchange.FiatWithdrawRequest{ - GenericWithdrawRequestInfo: exchange.GenericWithdrawRequestInfo{ + var withdrawFiatRequest = withdraw.FiatWithdrawRequest{ + GenericWithdrawRequestInfo: withdraw.GenericWithdrawRequestInfo{ Amount: -1, Currency: currency.BTC, Description: "WITHDRAW IT ALL", diff --git a/exchanges/bitfinex/bitfinex_wrapper.go b/exchanges/bitfinex/bitfinex_wrapper.go index 555dedf4cde..a2431e229dd 100644 --- a/exchanges/bitfinex/bitfinex_wrapper.go +++ b/exchanges/bitfinex/bitfinex_wrapper.go @@ -19,6 +19,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/request" "github.com/thrasher-corp/gocryptotrader/exchanges/ticker" "github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wshandler" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" log "github.com/thrasher-corp/gocryptotrader/logger" ) @@ -485,7 +486,7 @@ func (b *Bitfinex) GetDepositAddress(cryptocurrency currency.Code, accountID str } // WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is submitted -func (b *Bitfinex) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.CryptoWithdrawRequest) (string, error) { +func (b *Bitfinex) WithdrawCryptocurrencyFunds(withdrawRequest *withdraw.CryptoWithdrawRequest) (string, error) { withdrawalType := b.ConvertSymbolToWithdrawalType(withdrawRequest.Currency) // Bitfinex has support for three types, exchange, margin and deposit // As this is for trading, I've made the wrapper default 'exchange' @@ -509,7 +510,7 @@ func (b *Bitfinex) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.CryptoW // WithdrawFiatFunds returns a withdrawal ID when a withdrawal is submitted // Returns comma delimited withdrawal IDs -func (b *Bitfinex) WithdrawFiatFunds(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (b *Bitfinex) WithdrawFiatFunds(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { withdrawalType := "wire" // Bitfinex has support for three types, exchange, margin and deposit // As this is for trading, I've made the wrapper default 'exchange' @@ -541,7 +542,7 @@ func (b *Bitfinex) WithdrawFiatFunds(withdrawRequest *exchange.FiatWithdrawReque // WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a withdrawal is submitted // Returns comma delimited withdrawal IDs -func (b *Bitfinex) WithdrawFiatFundsToInternationalBank(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (b *Bitfinex) WithdrawFiatFundsToInternationalBank(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return b.WithdrawFiatFunds(withdrawRequest) } diff --git a/exchanges/bitflyer/bitflyer_test.go b/exchanges/bitflyer/bitflyer_test.go index 31a87a5c75b..41c5cf20580 100644 --- a/exchanges/bitflyer/bitflyer_test.go +++ b/exchanges/bitflyer/bitflyer_test.go @@ -11,6 +11,7 @@ import ( exchange "github.com/thrasher-corp/gocryptotrader/exchanges" "github.com/thrasher-corp/gocryptotrader/exchanges/asset" "github.com/thrasher-corp/gocryptotrader/exchanges/order" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" ) // Please supply your own keys here for due diligence testing @@ -366,8 +367,8 @@ func TestWithdraw(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - withdrawCryptoRequest := exchange.CryptoWithdrawRequest{ - GenericWithdrawRequestInfo: exchange.GenericWithdrawRequestInfo{ + withdrawCryptoRequest := withdraw.CryptoWithdrawRequest{ + GenericWithdrawRequestInfo: withdraw.GenericWithdrawRequestInfo{ Amount: -1, Currency: currency.BTC, Description: "WITHDRAW IT ALL", @@ -398,7 +399,7 @@ func TestWithdrawFiat(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - var withdrawFiatRequest = exchange.FiatWithdrawRequest{} + var withdrawFiatRequest = withdraw.FiatWithdrawRequest{} _, err := b.WithdrawFiatFunds(&withdrawFiatRequest) if err != common.ErrNotYetImplemented { @@ -412,7 +413,7 @@ func TestWithdrawInternationalBank(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - var withdrawFiatRequest = exchange.FiatWithdrawRequest{} + var withdrawFiatRequest = withdraw.FiatWithdrawRequest{} _, err := b.WithdrawFiatFundsToInternationalBank(&withdrawFiatRequest) if err != common.ErrNotYetImplemented { diff --git a/exchanges/bitflyer/bitflyer_wrapper.go b/exchanges/bitflyer/bitflyer_wrapper.go index 7bbce079a5f..3f3304e8e71 100644 --- a/exchanges/bitflyer/bitflyer_wrapper.go +++ b/exchanges/bitflyer/bitflyer_wrapper.go @@ -16,6 +16,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/request" "github.com/thrasher-corp/gocryptotrader/exchanges/ticker" "github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wshandler" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" log "github.com/thrasher-corp/gocryptotrader/logger" ) @@ -309,19 +310,19 @@ func (b *Bitflyer) GetDepositAddress(cryptocurrency currency.Code, accountID str // WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is // submitted -func (b *Bitflyer) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.CryptoWithdrawRequest) (string, error) { +func (b *Bitflyer) WithdrawCryptocurrencyFunds(withdrawRequest *withdraw.CryptoWithdrawRequest) (string, error) { return "", common.ErrNotYetImplemented } // WithdrawFiatFunds returns a withdrawal ID when a // withdrawal is submitted -func (b *Bitflyer) WithdrawFiatFunds(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (b *Bitflyer) WithdrawFiatFunds(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return "", common.ErrNotYetImplemented } // WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a // withdrawal is submitted -func (b *Bitflyer) WithdrawFiatFundsToInternationalBank(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (b *Bitflyer) WithdrawFiatFundsToInternationalBank(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return "", common.ErrNotYetImplemented } diff --git a/exchanges/bithumb/bithumb_test.go b/exchanges/bithumb/bithumb_test.go index b2331ba2960..0dea6ecc196 100644 --- a/exchanges/bithumb/bithumb_test.go +++ b/exchanges/bithumb/bithumb_test.go @@ -10,6 +10,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/currency" exchange "github.com/thrasher-corp/gocryptotrader/exchanges" "github.com/thrasher-corp/gocryptotrader/exchanges/order" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" ) // Please supply your own keys here for due diligence testing @@ -448,8 +449,8 @@ func TestWithdraw(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - withdrawCryptoRequest := exchange.CryptoWithdrawRequest{ - GenericWithdrawRequestInfo: exchange.GenericWithdrawRequestInfo{ + withdrawCryptoRequest := withdraw.CryptoWithdrawRequest{ + GenericWithdrawRequestInfo: withdraw.GenericWithdrawRequestInfo{ Amount: -1, Currency: currency.BTC, Description: "WITHDRAW IT ALL", @@ -472,8 +473,8 @@ func TestWithdrawFiat(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - var withdrawFiatRequest = exchange.FiatWithdrawRequest{ - GenericWithdrawRequestInfo: exchange.GenericWithdrawRequestInfo{ + var withdrawFiatRequest = withdraw.FiatWithdrawRequest{ + GenericWithdrawRequestInfo: withdraw.GenericWithdrawRequestInfo{ Amount: -1, Currency: currency.USD, Description: "WITHDRAW IT ALL", @@ -506,7 +507,7 @@ func TestWithdrawInternationalBank(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - var withdrawFiatRequest = exchange.FiatWithdrawRequest{} + var withdrawFiatRequest = withdraw.FiatWithdrawRequest{} _, err := b.WithdrawFiatFundsToInternationalBank(&withdrawFiatRequest) if err != common.ErrFunctionNotSupported { t.Errorf("Expected '%v', received: '%v'", common.ErrFunctionNotSupported, err) diff --git a/exchanges/bithumb/bithumb_wrapper.go b/exchanges/bithumb/bithumb_wrapper.go index 73dc3c3f868..03f16bbdcba 100644 --- a/exchanges/bithumb/bithumb_wrapper.go +++ b/exchanges/bithumb/bithumb_wrapper.go @@ -19,6 +19,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/request" "github.com/thrasher-corp/gocryptotrader/exchanges/ticker" "github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wshandler" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" log "github.com/thrasher-corp/gocryptotrader/logger" ) @@ -407,7 +408,7 @@ func (b *Bithumb) GetDepositAddress(cryptocurrency currency.Code, _ string) (str // WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is // submitted -func (b *Bithumb) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.CryptoWithdrawRequest) (string, error) { +func (b *Bithumb) WithdrawCryptocurrencyFunds(withdrawRequest *withdraw.CryptoWithdrawRequest) (string, error) { _, err := b.WithdrawCrypto(withdrawRequest.Address, withdrawRequest.AddressTag, withdrawRequest.Currency.String(), @@ -417,7 +418,7 @@ func (b *Bithumb) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.CryptoWi // WithdrawFiatFunds returns a withdrawal ID when a // withdrawal is submitted -func (b *Bithumb) WithdrawFiatFunds(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (b *Bithumb) WithdrawFiatFunds(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { if math.Mod(withdrawRequest.Amount, 1) != 0 { return "", errors.New("currency KRW does not support decimal places") } @@ -438,7 +439,7 @@ func (b *Bithumb) WithdrawFiatFunds(withdrawRequest *exchange.FiatWithdrawReques } // WithdrawFiatFundsToInternationalBank is not supported as Bithumb only withdraws KRW to South Korean banks -func (b *Bithumb) WithdrawFiatFundsToInternationalBank(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (b *Bithumb) WithdrawFiatFundsToInternationalBank(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return "", common.ErrFunctionNotSupported } diff --git a/exchanges/bitmex/bitmex_test.go b/exchanges/bitmex/bitmex_test.go index f92fdee0f59..8a693f1de66 100644 --- a/exchanges/bitmex/bitmex_test.go +++ b/exchanges/bitmex/bitmex_test.go @@ -16,6 +16,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/order" "github.com/thrasher-corp/gocryptotrader/exchanges/sharedtestvalues" "github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wshandler" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" ) // Please supply your own keys here for due diligence testing @@ -606,8 +607,8 @@ func TestModifyOrder(t *testing.T) { } func TestWithdraw(t *testing.T) { - withdrawCryptoRequest := exchange.CryptoWithdrawRequest{ - GenericWithdrawRequestInfo: exchange.GenericWithdrawRequestInfo{ + withdrawCryptoRequest := withdraw.CryptoWithdrawRequest{ + GenericWithdrawRequestInfo: withdraw.GenericWithdrawRequestInfo{ Amount: -1, Currency: currency.BTC, Description: "WITHDRAW IT ALL", @@ -634,7 +635,7 @@ func TestWithdrawFiat(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - var withdrawFiatRequest = exchange.FiatWithdrawRequest{} + var withdrawFiatRequest = withdraw.FiatWithdrawRequest{} _, err := b.WithdrawFiatFunds(&withdrawFiatRequest) if err != common.ErrFunctionNotSupported { t.Errorf("Expected '%v', received: '%v'", common.ErrFunctionNotSupported, err) @@ -646,7 +647,7 @@ func TestWithdrawInternationalBank(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - var withdrawFiatRequest = exchange.FiatWithdrawRequest{} + var withdrawFiatRequest = withdraw.FiatWithdrawRequest{} _, err := b.WithdrawFiatFundsToInternationalBank(&withdrawFiatRequest) if err != common.ErrFunctionNotSupported { t.Errorf("Expected '%v', received: '%v'", common.ErrFunctionNotSupported, err) diff --git a/exchanges/bitmex/bitmex_wrapper.go b/exchanges/bitmex/bitmex_wrapper.go index 4f65011d59b..a5908ea95ee 100644 --- a/exchanges/bitmex/bitmex_wrapper.go +++ b/exchanges/bitmex/bitmex_wrapper.go @@ -18,6 +18,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/request" "github.com/thrasher-corp/gocryptotrader/exchanges/ticker" "github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wshandler" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" log "github.com/thrasher-corp/gocryptotrader/logger" ) @@ -509,7 +510,7 @@ func (b *Bitmex) GetDepositAddress(cryptocurrency currency.Code, _ string) (stri // WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is // submitted -func (b *Bitmex) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.CryptoWithdrawRequest) (string, error) { +func (b *Bitmex) WithdrawCryptocurrencyFunds(withdrawRequest *withdraw.CryptoWithdrawRequest) (string, error) { var request = UserRequestWithdrawalParams{ Address: withdrawRequest.Address, Amount: withdrawRequest.Amount, @@ -530,13 +531,13 @@ func (b *Bitmex) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.CryptoWit // WithdrawFiatFunds returns a withdrawal ID when a withdrawal is // submitted -func (b *Bitmex) WithdrawFiatFunds(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (b *Bitmex) WithdrawFiatFunds(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return "", common.ErrFunctionNotSupported } // WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a withdrawal is // submitted -func (b *Bitmex) WithdrawFiatFundsToInternationalBank(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (b *Bitmex) WithdrawFiatFundsToInternationalBank(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return "", common.ErrFunctionNotSupported } diff --git a/exchanges/bitstamp/bitstamp_test.go b/exchanges/bitstamp/bitstamp_test.go index 39d7dfd471a..b385a891d93 100644 --- a/exchanges/bitstamp/bitstamp_test.go +++ b/exchanges/bitstamp/bitstamp_test.go @@ -7,6 +7,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/currency" exchange "github.com/thrasher-corp/gocryptotrader/exchanges" "github.com/thrasher-corp/gocryptotrader/exchanges/order" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" ) // Please add your private keys and customerID for better tests @@ -454,8 +455,8 @@ func TestWithdraw(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - withdrawCryptoRequest := exchange.CryptoWithdrawRequest{ - GenericWithdrawRequestInfo: exchange.GenericWithdrawRequestInfo{ + withdrawCryptoRequest := withdraw.CryptoWithdrawRequest{ + GenericWithdrawRequestInfo: withdraw.GenericWithdrawRequestInfo{ Amount: -1, Currency: currency.BTC, Description: "WITHDRAW IT ALL", @@ -481,8 +482,8 @@ func TestWithdrawFiat(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - var withdrawFiatRequest = exchange.FiatWithdrawRequest{ - GenericWithdrawRequestInfo: exchange.GenericWithdrawRequestInfo{ + var withdrawFiatRequest = withdraw.FiatWithdrawRequest{ + GenericWithdrawRequestInfo: withdraw.GenericWithdrawRequestInfo{ Amount: -1, Currency: currency.USD, Description: "WITHDRAW IT ALL", @@ -519,8 +520,8 @@ func TestWithdrawInternationalBank(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - var withdrawFiatRequest = exchange.FiatWithdrawRequest{ - GenericWithdrawRequestInfo: exchange.GenericWithdrawRequestInfo{ + var withdrawFiatRequest = withdraw.FiatWithdrawRequest{ + GenericWithdrawRequestInfo: withdraw.GenericWithdrawRequestInfo{ Amount: -1, Currency: currency.USD, Description: "WITHDRAW IT ALL", diff --git a/exchanges/bitstamp/bitstamp_wrapper.go b/exchanges/bitstamp/bitstamp_wrapper.go index fc6fa247c1f..d228e4720a6 100644 --- a/exchanges/bitstamp/bitstamp_wrapper.go +++ b/exchanges/bitstamp/bitstamp_wrapper.go @@ -18,6 +18,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/request" "github.com/thrasher-corp/gocryptotrader/exchanges/ticker" "github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wshandler" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" log "github.com/thrasher-corp/gocryptotrader/logger" ) @@ -420,7 +421,7 @@ func (b *Bitstamp) GetDepositAddress(cryptocurrency currency.Code, _ string) (st // WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is // submitted -func (b *Bitstamp) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.CryptoWithdrawRequest) (string, error) { +func (b *Bitstamp) WithdrawCryptocurrencyFunds(withdrawRequest *withdraw.CryptoWithdrawRequest) (string, error) { resp, err := b.CryptoWithdrawal(withdrawRequest.Amount, withdrawRequest.Address, withdrawRequest.Currency.String(), @@ -442,7 +443,7 @@ func (b *Bitstamp) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.CryptoW // WithdrawFiatFunds returns a withdrawal ID when a // withdrawal is submitted -func (b *Bitstamp) WithdrawFiatFunds(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (b *Bitstamp) WithdrawFiatFunds(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { resp, err := b.OpenBankWithdrawal(withdrawRequest.Amount, withdrawRequest.Currency.String(), withdrawRequest.BankAccountName, @@ -470,7 +471,7 @@ func (b *Bitstamp) WithdrawFiatFunds(withdrawRequest *exchange.FiatWithdrawReque // WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a // withdrawal is submitted -func (b *Bitstamp) WithdrawFiatFundsToInternationalBank(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (b *Bitstamp) WithdrawFiatFundsToInternationalBank(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { resp, err := b.OpenInternationalBankWithdrawal(withdrawRequest.Amount, withdrawRequest.Currency.String(), withdrawRequest.BankAccountName, diff --git a/exchanges/bittrex/bittrex_test.go b/exchanges/bittrex/bittrex_test.go index 5cc15712e8a..e83c5bf0481 100644 --- a/exchanges/bittrex/bittrex_test.go +++ b/exchanges/bittrex/bittrex_test.go @@ -10,6 +10,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/currency" exchange "github.com/thrasher-corp/gocryptotrader/exchanges" "github.com/thrasher-corp/gocryptotrader/exchanges/order" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" ) // Please supply you own test keys here to run better tests. @@ -442,8 +443,8 @@ func TestModifyOrder(t *testing.T) { } func TestWithdraw(t *testing.T) { - withdrawCryptoRequest := exchange.CryptoWithdrawRequest{ - GenericWithdrawRequestInfo: exchange.GenericWithdrawRequestInfo{ + withdrawCryptoRequest := withdraw.CryptoWithdrawRequest{ + GenericWithdrawRequestInfo: withdraw.GenericWithdrawRequestInfo{ Amount: -1, Currency: currency.BTC, Description: "WITHDRAW IT ALL", @@ -469,7 +470,7 @@ func TestWithdrawFiat(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - var withdrawFiatRequest = exchange.FiatWithdrawRequest{} + var withdrawFiatRequest = withdraw.FiatWithdrawRequest{} _, err := b.WithdrawFiatFunds(&withdrawFiatRequest) if err != common.ErrFunctionNotSupported { @@ -482,7 +483,7 @@ func TestWithdrawInternationalBank(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - var withdrawFiatRequest = exchange.FiatWithdrawRequest{} + var withdrawFiatRequest = withdraw.FiatWithdrawRequest{} _, err := b.WithdrawFiatFundsToInternationalBank(&withdrawFiatRequest) if err != common.ErrFunctionNotSupported { diff --git a/exchanges/bittrex/bittrex_wrapper.go b/exchanges/bittrex/bittrex_wrapper.go index 0af7bb877ac..162f6048a8b 100644 --- a/exchanges/bittrex/bittrex_wrapper.go +++ b/exchanges/bittrex/bittrex_wrapper.go @@ -17,6 +17,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/request" "github.com/thrasher-corp/gocryptotrader/exchanges/ticker" "github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wshandler" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" log "github.com/thrasher-corp/gocryptotrader/logger" ) @@ -408,20 +409,20 @@ func (b *Bittrex) GetDepositAddress(cryptocurrency currency.Code, _ string) (str // WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is // submitted -func (b *Bittrex) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.CryptoWithdrawRequest) (string, error) { +func (b *Bittrex) WithdrawCryptocurrencyFunds(withdrawRequest *withdraw.CryptoWithdrawRequest) (string, error) { uuid, err := b.Withdraw(withdrawRequest.Currency.String(), withdrawRequest.AddressTag, withdrawRequest.Address, withdrawRequest.Amount) return uuid.Result.ID, err } // WithdrawFiatFunds returns a withdrawal ID when a // withdrawal is submitted -func (b *Bittrex) WithdrawFiatFunds(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (b *Bittrex) WithdrawFiatFunds(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return "", common.ErrFunctionNotSupported } // WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a // withdrawal is submitted -func (b *Bittrex) WithdrawFiatFundsToInternationalBank(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (b *Bittrex) WithdrawFiatFundsToInternationalBank(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return "", common.ErrFunctionNotSupported } diff --git a/exchanges/btcmarkets/btcmarkets_wrapper.go b/exchanges/btcmarkets/btcmarkets_wrapper.go index 7c59d882c2c..a4804030cd0 100644 --- a/exchanges/btcmarkets/btcmarkets_wrapper.go +++ b/exchanges/btcmarkets/btcmarkets_wrapper.go @@ -18,6 +18,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/request" "github.com/thrasher-corp/gocryptotrader/exchanges/ticker" "github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wshandler" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" log "github.com/thrasher-corp/gocryptotrader/logger" ) @@ -477,7 +478,7 @@ func (b *BTCMarkets) GetDepositAddress(cryptocurrency currency.Code, accountID s } // WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is submitted -func (b *BTCMarkets) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.CryptoWithdrawRequest) (string, error) { +func (b *BTCMarkets) WithdrawCryptocurrencyFunds(withdrawRequest *withdraw.CryptoWithdrawRequest) (string, error) { a, err := b.RequestWithdraw(withdrawRequest.Currency.String(), withdrawRequest.Amount, withdrawRequest.Address, @@ -493,7 +494,7 @@ func (b *BTCMarkets) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.Crypt // WithdrawFiatFunds returns a withdrawal ID when a // withdrawal is submitted -func (b *BTCMarkets) WithdrawFiatFunds(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (b *BTCMarkets) WithdrawFiatFunds(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { if withdrawRequest.Currency != currency.AUD { return "", errors.New("only aud is supported for withdrawals") } @@ -512,7 +513,7 @@ func (b *BTCMarkets) WithdrawFiatFunds(withdrawRequest *exchange.FiatWithdrawReq // WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a // withdrawal is submitted -func (b *BTCMarkets) WithdrawFiatFundsToInternationalBank(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (b *BTCMarkets) WithdrawFiatFundsToInternationalBank(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return "", common.ErrFunctionNotSupported } diff --git a/exchanges/btse/btse_wrapper.go b/exchanges/btse/btse_wrapper.go index 02444533b36..57060b1bdbd 100644 --- a/exchanges/btse/btse_wrapper.go +++ b/exchanges/btse/btse_wrapper.go @@ -19,6 +19,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/request" "github.com/thrasher-corp/gocryptotrader/exchanges/ticker" "github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wshandler" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" log "github.com/thrasher-corp/gocryptotrader/logger" ) @@ -497,19 +498,19 @@ func (b *BTSE) GetDepositAddress(cryptocurrency currency.Code, accountID string) // WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is // submitted -func (b *BTSE) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.CryptoWithdrawRequest) (string, error) { +func (b *BTSE) WithdrawCryptocurrencyFunds(withdrawRequest *withdraw.CryptoWithdrawRequest) (string, error) { return "", common.ErrFunctionNotSupported } // WithdrawFiatFunds returns a withdrawal ID when a withdrawal is // submitted -func (b *BTSE) WithdrawFiatFunds(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (b *BTSE) WithdrawFiatFunds(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return "", common.ErrFunctionNotSupported } // WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a withdrawal is // submitted -func (b *BTSE) WithdrawFiatFundsToInternationalBank(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (b *BTSE) WithdrawFiatFundsToInternationalBank(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return "", common.ErrFunctionNotSupported } diff --git a/exchanges/coinbasepro/coinbasepro_test.go b/exchanges/coinbasepro/coinbasepro_test.go index b594603c8a3..05484ed4f22 100644 --- a/exchanges/coinbasepro/coinbasepro_test.go +++ b/exchanges/coinbasepro/coinbasepro_test.go @@ -14,6 +14,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/order" "github.com/thrasher-corp/gocryptotrader/exchanges/sharedtestvalues" "github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wshandler" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" ) var c CoinbasePro @@ -498,8 +499,8 @@ func TestModifyOrder(t *testing.T) { } func TestWithdraw(t *testing.T) { - withdrawCryptoRequest := exchange.CryptoWithdrawRequest{ - GenericWithdrawRequestInfo: exchange.GenericWithdrawRequestInfo{ + withdrawCryptoRequest := withdraw.CryptoWithdrawRequest{ + GenericWithdrawRequestInfo: withdraw.GenericWithdrawRequestInfo{ Amount: -1, Currency: currency.BTC, Description: "WITHDRAW IT ALL", @@ -525,8 +526,8 @@ func TestWithdrawFiat(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - var withdrawFiatRequest = exchange.FiatWithdrawRequest{ - GenericWithdrawRequestInfo: exchange.GenericWithdrawRequestInfo{ + var withdrawFiatRequest = withdraw.FiatWithdrawRequest{ + GenericWithdrawRequestInfo: withdraw.GenericWithdrawRequestInfo{ Amount: 100, Currency: currency.USD, }, @@ -547,8 +548,8 @@ func TestWithdrawInternationalBank(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - var withdrawFiatRequest = exchange.FiatWithdrawRequest{ - GenericWithdrawRequestInfo: exchange.GenericWithdrawRequestInfo{ + var withdrawFiatRequest = withdraw.FiatWithdrawRequest{ + GenericWithdrawRequestInfo: withdraw.GenericWithdrawRequestInfo{ Amount: 100, Currency: currency.USD, }, diff --git a/exchanges/coinbasepro/coinbasepro_wrapper.go b/exchanges/coinbasepro/coinbasepro_wrapper.go index db4848e8f11..376718d719c 100644 --- a/exchanges/coinbasepro/coinbasepro_wrapper.go +++ b/exchanges/coinbasepro/coinbasepro_wrapper.go @@ -18,6 +18,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/request" "github.com/thrasher-corp/gocryptotrader/exchanges/ticker" "github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wshandler" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" log "github.com/thrasher-corp/gocryptotrader/logger" ) @@ -447,14 +448,14 @@ func (c *CoinbasePro) GetDepositAddress(cryptocurrency currency.Code, accountID // WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is // submitted -func (c *CoinbasePro) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.CryptoWithdrawRequest) (string, error) { +func (c *CoinbasePro) WithdrawCryptocurrencyFunds(withdrawRequest *withdraw.CryptoWithdrawRequest) (string, error) { resp, err := c.WithdrawCrypto(withdrawRequest.Amount, withdrawRequest.Currency.String(), withdrawRequest.Address) return resp.ID, err } // WithdrawFiatFunds returns a withdrawal ID when a withdrawal is // submitted -func (c *CoinbasePro) WithdrawFiatFunds(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (c *CoinbasePro) WithdrawFiatFunds(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { paymentMethods, err := c.GetPayMethods() if err != nil { return "", err @@ -481,7 +482,7 @@ func (c *CoinbasePro) WithdrawFiatFunds(withdrawRequest *exchange.FiatWithdrawRe // WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a // withdrawal is submitted -func (c *CoinbasePro) WithdrawFiatFundsToInternationalBank(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (c *CoinbasePro) WithdrawFiatFundsToInternationalBank(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return c.WithdrawFiatFunds(withdrawRequest) } diff --git a/exchanges/coinbene/coinbene_wrapper.go b/exchanges/coinbene/coinbene_wrapper.go index 373222f10c3..65a5743d2d8 100644 --- a/exchanges/coinbene/coinbene_wrapper.go +++ b/exchanges/coinbene/coinbene_wrapper.go @@ -18,6 +18,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/request" "github.com/thrasher-corp/gocryptotrader/exchanges/ticker" "github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wshandler" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" log "github.com/thrasher-corp/gocryptotrader/logger" ) @@ -456,19 +457,19 @@ func (c *Coinbene) GetDepositAddress(cryptocurrency currency.Code, accountID str // WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is // submitted -func (c *Coinbene) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.CryptoWithdrawRequest) (string, error) { +func (c *Coinbene) WithdrawCryptocurrencyFunds(withdrawRequest *withdraw.CryptoWithdrawRequest) (string, error) { return "", common.ErrFunctionNotSupported } // WithdrawFiatFunds returns a withdrawal ID when a withdrawal is // submitted -func (c *Coinbene) WithdrawFiatFunds(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (c *Coinbene) WithdrawFiatFunds(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return "", common.ErrFunctionNotSupported } // WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a withdrawal is // submitted -func (c *Coinbene) WithdrawFiatFundsToInternationalBank(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (c *Coinbene) WithdrawFiatFundsToInternationalBank(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return "", common.ErrFunctionNotSupported } diff --git a/exchanges/coinut/coinut_test.go b/exchanges/coinut/coinut_test.go index c361670874a..bf1bf3a19eb 100644 --- a/exchanges/coinut/coinut_test.go +++ b/exchanges/coinut/coinut_test.go @@ -14,6 +14,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/order" "github.com/thrasher-corp/gocryptotrader/exchanges/sharedtestvalues" "github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wshandler" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" ) var c COINUT @@ -382,8 +383,8 @@ func TestModifyOrder(t *testing.T) { } func TestWithdraw(t *testing.T) { - withdrawCryptoRequest := exchange.CryptoWithdrawRequest{ - GenericWithdrawRequestInfo: exchange.GenericWithdrawRequestInfo{ + withdrawCryptoRequest := withdraw.CryptoWithdrawRequest{ + GenericWithdrawRequestInfo: withdraw.GenericWithdrawRequestInfo{ Amount: -1, Currency: currency.BTC, Description: "WITHDRAW IT ALL", @@ -406,7 +407,7 @@ func TestWithdrawFiat(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - var withdrawFiatRequest = exchange.FiatWithdrawRequest{} + var withdrawFiatRequest = withdraw.FiatWithdrawRequest{} _, err := c.WithdrawFiatFunds(&withdrawFiatRequest) if err != common.ErrFunctionNotSupported { t.Errorf("Expected '%v', received: '%v'", common.ErrFunctionNotSupported, err) @@ -418,7 +419,7 @@ func TestWithdrawInternationalBank(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - var withdrawFiatRequest = exchange.FiatWithdrawRequest{} + var withdrawFiatRequest = withdraw.FiatWithdrawRequest{} _, err := c.WithdrawFiatFundsToInternationalBank(&withdrawFiatRequest) if err != common.ErrFunctionNotSupported { t.Errorf("Expected '%v', received: '%v'", common.ErrFunctionNotSupported, err) diff --git a/exchanges/coinut/coinut_wrapper.go b/exchanges/coinut/coinut_wrapper.go index aaa0b0e3c13..5882e0d29c0 100644 --- a/exchanges/coinut/coinut_wrapper.go +++ b/exchanges/coinut/coinut_wrapper.go @@ -19,6 +19,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/request" "github.com/thrasher-corp/gocryptotrader/exchanges/ticker" "github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wshandler" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" log "github.com/thrasher-corp/gocryptotrader/logger" ) @@ -648,19 +649,19 @@ func (c *COINUT) GetDepositAddress(cryptocurrency currency.Code, accountID strin // WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is // submitted -func (c *COINUT) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.CryptoWithdrawRequest) (string, error) { +func (c *COINUT) WithdrawCryptocurrencyFunds(withdrawRequest *withdraw.CryptoWithdrawRequest) (string, error) { return "", common.ErrFunctionNotSupported } // WithdrawFiatFunds returns a withdrawal ID when a // withdrawal is submitted -func (c *COINUT) WithdrawFiatFunds(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (c *COINUT) WithdrawFiatFunds(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return "", common.ErrFunctionNotSupported } // WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a // withdrawal is submitted -func (c *COINUT) WithdrawFiatFundsToInternationalBank(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (c *COINUT) WithdrawFiatFundsToInternationalBank(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return "", common.ErrFunctionNotSupported } diff --git a/exchanges/exchange_types.go b/exchanges/exchange_types.go index 804f7921458..ab39cace432 100644 --- a/exchanges/exchange_types.go +++ b/exchanges/exchange_types.go @@ -156,57 +156,6 @@ type FundHistory struct { BankFrom string } -// GenericWithdrawRequestInfo stores genric withdraw request info -type GenericWithdrawRequestInfo struct { - // General withdraw information - Currency currency.Code - Description string - OneTimePassword int64 - AccountID string - PIN int64 - TradePassword string - Amount float64 -} - -// CryptoWithdrawRequest stores the info required for a crypto withdrawal request -type CryptoWithdrawRequest struct { - GenericWithdrawRequestInfo - // Crypto related information - Address string - AddressTag string - FeeAmount float64 -} - -// FiatWithdrawRequest used for fiat withdrawal requests -type FiatWithdrawRequest struct { - GenericWithdrawRequestInfo - // FIAT related information - BankAccountName string - BankAccountNumber string - BankName string - BankAddress string - BankCity string - BankCountry string - BankPostalCode string - BSB string - SwiftCode string - IBAN string - BankCode float64 - IsExpressWire bool - // Intermediary bank information - RequiresIntermediaryBank bool - IntermediaryBankAccountNumber float64 - IntermediaryBankName string - IntermediaryBankAddress string - IntermediaryBankCity string - IntermediaryBankCountry string - IntermediaryBankPostalCode string - IntermediarySwiftCode string - IntermediaryBankCode float64 - IntermediaryIBAN string - WireCurrency string -} - // Features stores the supported and enabled features // for the exchange type Features struct { diff --git a/exchanges/exmo/exmo_test.go b/exchanges/exmo/exmo_test.go index 2a5fa1d9547..d8c82b3d2df 100644 --- a/exchanges/exmo/exmo_test.go +++ b/exchanges/exmo/exmo_test.go @@ -10,6 +10,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/currency" exchange "github.com/thrasher-corp/gocryptotrader/exchanges" "github.com/thrasher-corp/gocryptotrader/exchanges/order" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" ) const ( @@ -382,8 +383,8 @@ func TestWithdraw(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - withdrawCryptoRequest := exchange.CryptoWithdrawRequest{ - GenericWithdrawRequestInfo: exchange.GenericWithdrawRequestInfo{ + withdrawCryptoRequest := withdraw.CryptoWithdrawRequest{ + GenericWithdrawRequestInfo: withdraw.GenericWithdrawRequestInfo{ Amount: -1, Currency: currency.BTC, Description: "WITHDRAW IT ALL", @@ -405,7 +406,7 @@ func TestWithdrawFiat(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - var withdrawFiatRequest = exchange.FiatWithdrawRequest{} + var withdrawFiatRequest = withdraw.FiatWithdrawRequest{} _, err := e.WithdrawFiatFunds(&withdrawFiatRequest) if err != common.ErrFunctionNotSupported { t.Errorf("Expected '%v', received: '%v'", common.ErrFunctionNotSupported, err) @@ -417,7 +418,7 @@ func TestWithdrawInternationalBank(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - var withdrawFiatRequest = exchange.FiatWithdrawRequest{} + var withdrawFiatRequest = withdraw.FiatWithdrawRequest{} _, err := e.WithdrawFiatFundsToInternationalBank(&withdrawFiatRequest) if err != common.ErrFunctionNotSupported { t.Errorf("Expected '%v', received: '%v'", common.ErrFunctionNotSupported, err) diff --git a/exchanges/exmo/exmo_wrapper.go b/exchanges/exmo/exmo_wrapper.go index 374cbf81cd7..050e9a00667 100644 --- a/exchanges/exmo/exmo_wrapper.go +++ b/exchanges/exmo/exmo_wrapper.go @@ -19,6 +19,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/request" "github.com/thrasher-corp/gocryptotrader/exchanges/ticker" "github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wshandler" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" log "github.com/thrasher-corp/gocryptotrader/logger" ) @@ -418,7 +419,7 @@ func (e *EXMO) GetDepositAddress(cryptocurrency currency.Code, _ string) (string // WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is // submitted -func (e *EXMO) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.CryptoWithdrawRequest) (string, error) { +func (e *EXMO) WithdrawCryptocurrencyFunds(withdrawRequest *withdraw.CryptoWithdrawRequest) (string, error) { resp, err := e.WithdrawCryptocurrency(withdrawRequest.Currency.String(), withdrawRequest.Address, withdrawRequest.AddressTag, @@ -429,13 +430,13 @@ func (e *EXMO) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.CryptoWithd // WithdrawFiatFunds returns a withdrawal ID when a // withdrawal is submitted -func (e *EXMO) WithdrawFiatFunds(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (e *EXMO) WithdrawFiatFunds(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return "", common.ErrFunctionNotSupported } // WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a // withdrawal is submitted -func (e *EXMO) WithdrawFiatFundsToInternationalBank(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (e *EXMO) WithdrawFiatFundsToInternationalBank(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return "", common.ErrFunctionNotSupported } diff --git a/exchanges/gateio/gateio_test.go b/exchanges/gateio/gateio_test.go index cfa6cf2fa5a..222731c7fc2 100644 --- a/exchanges/gateio/gateio_test.go +++ b/exchanges/gateio/gateio_test.go @@ -14,6 +14,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/order" "github.com/thrasher-corp/gocryptotrader/exchanges/sharedtestvalues" "github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wshandler" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" ) // Please supply your own APIKEYS here for due diligence testing @@ -405,8 +406,8 @@ func TestModifyOrder(t *testing.T) { } func TestWithdraw(t *testing.T) { - withdrawCryptoRequest := exchange.CryptoWithdrawRequest{ - GenericWithdrawRequestInfo: exchange.GenericWithdrawRequestInfo{ + withdrawCryptoRequest := withdraw.CryptoWithdrawRequest{ + GenericWithdrawRequestInfo: withdraw.GenericWithdrawRequestInfo{ Amount: -1, Currency: currency.BTC, Description: "WITHDRAW IT ALL", @@ -432,7 +433,7 @@ func TestWithdrawFiat(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - var withdrawFiatRequest = exchange.FiatWithdrawRequest{} + var withdrawFiatRequest = withdraw.FiatWithdrawRequest{} _, err := g.WithdrawFiatFunds(&withdrawFiatRequest) if err != common.ErrFunctionNotSupported { t.Errorf("Expected '%v', received: '%v'", common.ErrFunctionNotSupported, err) @@ -444,7 +445,7 @@ func TestWithdrawInternationalBank(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - var withdrawFiatRequest = exchange.FiatWithdrawRequest{} + var withdrawFiatRequest = withdraw.FiatWithdrawRequest{} _, err := g.WithdrawFiatFundsToInternationalBank(&withdrawFiatRequest) if err != common.ErrFunctionNotSupported { t.Errorf("Expected '%v', received: '%v'", common.ErrFunctionNotSupported, err) diff --git a/exchanges/gateio/gateio_wrapper.go b/exchanges/gateio/gateio_wrapper.go index 5d0d838495a..7bd18678e83 100644 --- a/exchanges/gateio/gateio_wrapper.go +++ b/exchanges/gateio/gateio_wrapper.go @@ -20,6 +20,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/request" "github.com/thrasher-corp/gocryptotrader/exchanges/ticker" "github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wshandler" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" log "github.com/thrasher-corp/gocryptotrader/logger" ) @@ -524,19 +525,19 @@ func (g *Gateio) GetDepositAddress(cryptocurrency currency.Code, _ string) (stri // WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is // submitted -func (g *Gateio) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.CryptoWithdrawRequest) (string, error) { +func (g *Gateio) WithdrawCryptocurrencyFunds(withdrawRequest *withdraw.CryptoWithdrawRequest) (string, error) { return g.WithdrawCrypto(withdrawRequest.Currency.String(), withdrawRequest.Address, withdrawRequest.Amount) } // WithdrawFiatFunds returns a withdrawal ID when a // withdrawal is submitted -func (g *Gateio) WithdrawFiatFunds(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (g *Gateio) WithdrawFiatFunds(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return "", common.ErrFunctionNotSupported } // WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a // withdrawal is submitted -func (g *Gateio) WithdrawFiatFundsToInternationalBank(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (g *Gateio) WithdrawFiatFundsToInternationalBank(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return "", common.ErrFunctionNotSupported } diff --git a/exchanges/gemini/gemini_test.go b/exchanges/gemini/gemini_test.go index 02704567c9f..5273da8d24f 100644 --- a/exchanges/gemini/gemini_test.go +++ b/exchanges/gemini/gemini_test.go @@ -12,6 +12,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/order" "github.com/thrasher-corp/gocryptotrader/exchanges/sharedtestvalues" "github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wshandler" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" ) // Please enter sandbox API keys & assigned roles for better testing procedures @@ -477,8 +478,8 @@ func TestModifyOrder(t *testing.T) { func TestWithdraw(t *testing.T) { t.Parallel() - withdrawCryptoRequest := exchange.CryptoWithdrawRequest{ - GenericWithdrawRequestInfo: exchange.GenericWithdrawRequestInfo{ + withdrawCryptoRequest := withdraw.CryptoWithdrawRequest{ + GenericWithdrawRequestInfo: withdraw.GenericWithdrawRequestInfo{ Amount: -1, Currency: currency.BTC, Description: "WITHDRAW IT ALL", @@ -508,7 +509,7 @@ func TestWithdrawFiat(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - var withdrawFiatRequest = exchange.FiatWithdrawRequest{} + var withdrawFiatRequest = withdraw.FiatWithdrawRequest{} _, err := g.WithdrawFiatFunds(&withdrawFiatRequest) if err != common.ErrFunctionNotSupported { t.Errorf("Expected '%v', received: '%v'", @@ -523,7 +524,7 @@ func TestWithdrawInternationalBank(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - var withdrawFiatRequest = exchange.FiatWithdrawRequest{} + var withdrawFiatRequest = withdraw.FiatWithdrawRequest{} _, err := g.WithdrawFiatFundsToInternationalBank(&withdrawFiatRequest) if err != common.ErrFunctionNotSupported { t.Errorf("Expected '%v', received: '%v'", diff --git a/exchanges/gemini/gemini_wrapper.go b/exchanges/gemini/gemini_wrapper.go index d730b463397..3f50ccab2bb 100644 --- a/exchanges/gemini/gemini_wrapper.go +++ b/exchanges/gemini/gemini_wrapper.go @@ -19,6 +19,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/request" "github.com/thrasher-corp/gocryptotrader/exchanges/ticker" "github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wshandler" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" log "github.com/thrasher-corp/gocryptotrader/logger" ) @@ -396,7 +397,7 @@ func (g *Gemini) GetDepositAddress(cryptocurrency currency.Code, _ string) (stri // WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is // submitted -func (g *Gemini) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.CryptoWithdrawRequest) (string, error) { +func (g *Gemini) WithdrawCryptocurrencyFunds(withdrawRequest *withdraw.CryptoWithdrawRequest) (string, error) { resp, err := g.WithdrawCrypto(withdrawRequest.Address, withdrawRequest.Currency.String(), withdrawRequest.Amount) if err != nil { return "", err @@ -410,13 +411,13 @@ func (g *Gemini) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.CryptoWit // WithdrawFiatFunds returns a withdrawal ID when a // withdrawal is submitted -func (g *Gemini) WithdrawFiatFunds(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (g *Gemini) WithdrawFiatFunds(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return "", common.ErrFunctionNotSupported } // WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a // withdrawal is submitted -func (g *Gemini) WithdrawFiatFundsToInternationalBank(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (g *Gemini) WithdrawFiatFundsToInternationalBank(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return "", common.ErrFunctionNotSupported } diff --git a/exchanges/hitbtc/hitbtc_test.go b/exchanges/hitbtc/hitbtc_test.go index 208d5fdcfe6..b8f168bbd1c 100644 --- a/exchanges/hitbtc/hitbtc_test.go +++ b/exchanges/hitbtc/hitbtc_test.go @@ -16,6 +16,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/order" "github.com/thrasher-corp/gocryptotrader/exchanges/sharedtestvalues" "github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wshandler" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" ) var h HitBTC @@ -339,8 +340,8 @@ func TestModifyOrder(t *testing.T) { } func TestWithdraw(t *testing.T) { - withdrawCryptoRequest := exchange.CryptoWithdrawRequest{ - GenericWithdrawRequestInfo: exchange.GenericWithdrawRequestInfo{ + withdrawCryptoRequest := withdraw.CryptoWithdrawRequest{ + GenericWithdrawRequestInfo: withdraw.GenericWithdrawRequestInfo{ Amount: -1, Currency: currency.BTC, Description: "WITHDRAW IT ALL", @@ -366,7 +367,7 @@ func TestWithdrawFiat(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - var withdrawFiatRequest = exchange.FiatWithdrawRequest{} + var withdrawFiatRequest = withdraw.FiatWithdrawRequest{} _, err := h.WithdrawFiatFunds(&withdrawFiatRequest) if err != common.ErrFunctionNotSupported { t.Errorf("Expected '%v', received: '%v'", common.ErrFunctionNotSupported, err) @@ -378,7 +379,7 @@ func TestWithdrawInternationalBank(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - var withdrawFiatRequest = exchange.FiatWithdrawRequest{} + var withdrawFiatRequest = withdraw.FiatWithdrawRequest{} _, err := h.WithdrawFiatFundsToInternationalBank(&withdrawFiatRequest) if err != common.ErrFunctionNotSupported { t.Errorf("Expected '%v', received: '%v'", common.ErrFunctionNotSupported, err) diff --git a/exchanges/hitbtc/hitbtc_wrapper.go b/exchanges/hitbtc/hitbtc_wrapper.go index 3acdf45d5b9..dec6b9da5a1 100644 --- a/exchanges/hitbtc/hitbtc_wrapper.go +++ b/exchanges/hitbtc/hitbtc_wrapper.go @@ -19,6 +19,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/request" "github.com/thrasher-corp/gocryptotrader/exchanges/ticker" "github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wshandler" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" log "github.com/thrasher-corp/gocryptotrader/logger" ) @@ -469,20 +470,20 @@ func (h *HitBTC) GetDepositAddress(currency currency.Code, _ string) (string, er // WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is // submitted -func (h *HitBTC) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.CryptoWithdrawRequest) (string, error) { +func (h *HitBTC) WithdrawCryptocurrencyFunds(withdrawRequest *withdraw.CryptoWithdrawRequest) (string, error) { _, err := h.Withdraw(withdrawRequest.Currency.String(), withdrawRequest.Address, withdrawRequest.Amount) return "", err } // WithdrawFiatFunds returns a withdrawal ID when a // withdrawal is submitted -func (h *HitBTC) WithdrawFiatFunds(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (h *HitBTC) WithdrawFiatFunds(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return "", common.ErrFunctionNotSupported } // WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a // withdrawal is submitted -func (h *HitBTC) WithdrawFiatFundsToInternationalBank(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (h *HitBTC) WithdrawFiatFundsToInternationalBank(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return "", common.ErrFunctionNotSupported } diff --git a/exchanges/huobi/huobi_test.go b/exchanges/huobi/huobi_test.go index 714af623abd..1d721524a71 100644 --- a/exchanges/huobi/huobi_test.go +++ b/exchanges/huobi/huobi_test.go @@ -21,6 +21,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/order" "github.com/thrasher-corp/gocryptotrader/exchanges/sharedtestvalues" "github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wshandler" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" ) // Please supply you own test keys here for due diligence testing. @@ -587,8 +588,8 @@ func TestModifyOrder(t *testing.T) { } func TestWithdraw(t *testing.T) { - withdrawCryptoRequest := exchange.CryptoWithdrawRequest{ - GenericWithdrawRequestInfo: exchange.GenericWithdrawRequestInfo{ + withdrawCryptoRequest := withdraw.CryptoWithdrawRequest{ + GenericWithdrawRequestInfo: withdraw.GenericWithdrawRequestInfo{ Amount: -1, Currency: currency.BTC, Description: "WITHDRAW IT ALL", @@ -614,7 +615,7 @@ func TestWithdrawFiat(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - var withdrawFiatRequest = exchange.FiatWithdrawRequest{} + var withdrawFiatRequest = withdraw.FiatWithdrawRequest{} _, err := h.WithdrawFiatFunds(&withdrawFiatRequest) if err != common.ErrFunctionNotSupported { t.Errorf("Expected '%v', received: '%v'", common.ErrFunctionNotSupported, err) @@ -626,7 +627,7 @@ func TestWithdrawInternationalBank(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - var withdrawFiatRequest = exchange.FiatWithdrawRequest{} + var withdrawFiatRequest = withdraw.FiatWithdrawRequest{} _, err := h.WithdrawFiatFundsToInternationalBank(&withdrawFiatRequest) if err != common.ErrFunctionNotSupported { t.Errorf("Expected '%v', received: '%v'", common.ErrFunctionNotSupported, err) diff --git a/exchanges/huobi/huobi_wrapper.go b/exchanges/huobi/huobi_wrapper.go index b224c629ca5..fa1ad5bc05a 100644 --- a/exchanges/huobi/huobi_wrapper.go +++ b/exchanges/huobi/huobi_wrapper.go @@ -19,6 +19,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/request" "github.com/thrasher-corp/gocryptotrader/exchanges/ticker" "github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wshandler" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" log "github.com/thrasher-corp/gocryptotrader/logger" ) @@ -639,20 +640,20 @@ func (h *HUOBI) GetDepositAddress(cryptocurrency currency.Code, accountID string // WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is // submitted -func (h *HUOBI) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.CryptoWithdrawRequest) (string, error) { +func (h *HUOBI) WithdrawCryptocurrencyFunds(withdrawRequest *withdraw.CryptoWithdrawRequest) (string, error) { resp, err := h.Withdraw(withdrawRequest.Currency, withdrawRequest.Address, withdrawRequest.AddressTag, withdrawRequest.Amount, withdrawRequest.FeeAmount) return strconv.FormatInt(resp, 10), err } // WithdrawFiatFunds returns a withdrawal ID when a // withdrawal is submitted -func (h *HUOBI) WithdrawFiatFunds(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (h *HUOBI) WithdrawFiatFunds(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return "", common.ErrFunctionNotSupported } // WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a // withdrawal is submitted -func (h *HUOBI) WithdrawFiatFundsToInternationalBank(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (h *HUOBI) WithdrawFiatFundsToInternationalBank(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return "", common.ErrFunctionNotSupported } diff --git a/exchanges/interfaces.go b/exchanges/interfaces.go index 3f5723e30fc..627ae507b20 100644 --- a/exchanges/interfaces.go +++ b/exchanges/interfaces.go @@ -10,6 +10,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/orderbook" "github.com/thrasher-corp/gocryptotrader/exchanges/ticker" "github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wshandler" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" ) // IBotExchange enforces standard functions for all exchanges supported in @@ -50,9 +51,9 @@ type IBotExchange interface { GetDepositAddress(cryptocurrency currency.Code, accountID string) (string, error) GetOrderHistory(getOrdersRequest *order.GetOrdersRequest) ([]order.Detail, error) GetActiveOrders(getOrdersRequest *order.GetOrdersRequest) ([]order.Detail, error) - WithdrawCryptocurrencyFunds(withdrawRequest *CryptoWithdrawRequest) (string, error) - WithdrawFiatFunds(withdrawRequest *FiatWithdrawRequest) (string, error) - WithdrawFiatFundsToInternationalBank(withdrawRequest *FiatWithdrawRequest) (string, error) + WithdrawCryptocurrencyFunds(withdrawRequest *withdraw.CryptoWithdrawRequest) (string, error) + WithdrawFiatFunds(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) + WithdrawFiatFundsToInternationalBank(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) SetHTTPClientUserAgent(ua string) GetHTTPClientUserAgent() string SetClientProxyAddress(addr string) error diff --git a/exchanges/itbit/itbit_test.go b/exchanges/itbit/itbit_test.go index 85cfd4d65ea..b42859e5777 100644 --- a/exchanges/itbit/itbit_test.go +++ b/exchanges/itbit/itbit_test.go @@ -11,6 +11,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/currency" exchange "github.com/thrasher-corp/gocryptotrader/exchanges" "github.com/thrasher-corp/gocryptotrader/exchanges/order" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" ) var i ItBit @@ -389,8 +390,8 @@ func TestModifyOrder(t *testing.T) { } func TestWithdraw(t *testing.T) { - withdrawCryptoRequest := exchange.CryptoWithdrawRequest{ - GenericWithdrawRequestInfo: exchange.GenericWithdrawRequestInfo{ + withdrawCryptoRequest := withdraw.CryptoWithdrawRequest{ + GenericWithdrawRequestInfo: withdraw.GenericWithdrawRequestInfo{ Amount: -1, Currency: currency.BTC, Description: "WITHDRAW IT ALL", @@ -413,7 +414,7 @@ func TestWithdrawFiat(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - var withdrawFiatRequest = exchange.FiatWithdrawRequest{} + var withdrawFiatRequest = withdraw.FiatWithdrawRequest{} _, err := i.WithdrawFiatFunds(&withdrawFiatRequest) if err != common.ErrFunctionNotSupported { t.Errorf("Expected '%v', received: '%v'", common.ErrFunctionNotSupported, err) @@ -425,7 +426,7 @@ func TestWithdrawInternationalBank(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - var withdrawFiatRequest = exchange.FiatWithdrawRequest{} + var withdrawFiatRequest = withdraw.FiatWithdrawRequest{} _, err := i.WithdrawFiatFundsToInternationalBank(&withdrawFiatRequest) if err != common.ErrFunctionNotSupported { t.Errorf("Expected '%v', received: '%v'", common.ErrFunctionNotSupported, err) diff --git a/exchanges/itbit/itbit_wrapper.go b/exchanges/itbit/itbit_wrapper.go index 918b877d110..05932dfee38 100644 --- a/exchanges/itbit/itbit_wrapper.go +++ b/exchanges/itbit/itbit_wrapper.go @@ -19,6 +19,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/request" "github.com/thrasher-corp/gocryptotrader/exchanges/ticker" "github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wshandler" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" log "github.com/thrasher-corp/gocryptotrader/logger" ) @@ -392,19 +393,19 @@ func (i *ItBit) GetDepositAddress(cryptocurrency currency.Code, accountID string // WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is // submitted -func (i *ItBit) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.CryptoWithdrawRequest) (string, error) { +func (i *ItBit) WithdrawCryptocurrencyFunds(withdrawRequest *withdraw.CryptoWithdrawRequest) (string, error) { return "", common.ErrFunctionNotSupported } // WithdrawFiatFunds returns a withdrawal ID when a // withdrawal is submitted -func (i *ItBit) WithdrawFiatFunds(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (i *ItBit) WithdrawFiatFunds(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return "", common.ErrFunctionNotSupported } // WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a // withdrawal is submitted -func (i *ItBit) WithdrawFiatFundsToInternationalBank(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (i *ItBit) WithdrawFiatFundsToInternationalBank(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return "", common.ErrFunctionNotSupported } diff --git a/exchanges/kraken/kraken_test.go b/exchanges/kraken/kraken_test.go index 227bde0b160..7b446e73dd1 100644 --- a/exchanges/kraken/kraken_test.go +++ b/exchanges/kraken/kraken_test.go @@ -14,6 +14,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/order" "github.com/thrasher-corp/gocryptotrader/exchanges/sharedtestvalues" "github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wshandler" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" ) var k Kraken @@ -529,8 +530,8 @@ func TestModifyOrder(t *testing.T) { // TestWithdraw wrapper test func TestWithdraw(t *testing.T) { - withdrawCryptoRequest := exchange.CryptoWithdrawRequest{ - GenericWithdrawRequestInfo: exchange.GenericWithdrawRequestInfo{ + withdrawCryptoRequest := withdraw.CryptoWithdrawRequest{ + GenericWithdrawRequestInfo: withdraw.GenericWithdrawRequestInfo{ Amount: -1, Currency: currency.XXBT, Description: "WITHDRAW IT ALL", @@ -558,8 +559,8 @@ func TestWithdrawFiat(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - var withdrawFiatRequest = exchange.FiatWithdrawRequest{ - GenericWithdrawRequestInfo: exchange.GenericWithdrawRequestInfo{ + var withdrawFiatRequest = withdraw.FiatWithdrawRequest{ + GenericWithdrawRequestInfo: withdraw.GenericWithdrawRequestInfo{ Amount: -1, Currency: currency.EUR, Description: "WITHDRAW IT ALL", @@ -582,8 +583,8 @@ func TestWithdrawInternationalBank(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - var withdrawFiatRequest = exchange.FiatWithdrawRequest{ - GenericWithdrawRequestInfo: exchange.GenericWithdrawRequestInfo{ + var withdrawFiatRequest = withdraw.FiatWithdrawRequest{ + GenericWithdrawRequestInfo: withdraw.GenericWithdrawRequestInfo{ Amount: -1, Currency: currency.EUR, Description: "WITHDRAW IT ALL", diff --git a/exchanges/kraken/kraken_wrapper.go b/exchanges/kraken/kraken_wrapper.go index 71c23b31d22..7356db2bf64 100644 --- a/exchanges/kraken/kraken_wrapper.go +++ b/exchanges/kraken/kraken_wrapper.go @@ -20,6 +20,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/request" "github.com/thrasher-corp/gocryptotrader/exchanges/ticker" "github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wshandler" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" log "github.com/thrasher-corp/gocryptotrader/logger" ) @@ -569,19 +570,19 @@ func (k *Kraken) GetDepositAddress(cryptocurrency currency.Code, _ string) (stri // WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal // Populate exchange.WithdrawRequest.TradePassword with withdrawal key name, as set up on your account -func (k *Kraken) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.CryptoWithdrawRequest) (string, error) { +func (k *Kraken) WithdrawCryptocurrencyFunds(withdrawRequest *withdraw.CryptoWithdrawRequest) (string, error) { return k.Withdraw(withdrawRequest.Currency.String(), withdrawRequest.TradePassword, withdrawRequest.Amount) } // WithdrawFiatFunds returns a withdrawal ID when a // withdrawal is submitted -func (k *Kraken) WithdrawFiatFunds(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (k *Kraken) WithdrawFiatFunds(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return k.Withdraw(withdrawRequest.Currency.String(), withdrawRequest.TradePassword, withdrawRequest.Amount) } // WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a // withdrawal is submitted -func (k *Kraken) WithdrawFiatFundsToInternationalBank(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (k *Kraken) WithdrawFiatFundsToInternationalBank(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return k.Withdraw(withdrawRequest.Currency.String(), withdrawRequest.TradePassword, withdrawRequest.Amount) } diff --git a/exchanges/lakebtc/lakebtc_test.go b/exchanges/lakebtc/lakebtc_test.go index afb75558a57..43bb7987df6 100644 --- a/exchanges/lakebtc/lakebtc_test.go +++ b/exchanges/lakebtc/lakebtc_test.go @@ -13,6 +13,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/order" "github.com/thrasher-corp/gocryptotrader/exchanges/sharedtestvalues" "github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wshandler" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" ) var l LakeBTC @@ -375,8 +376,8 @@ func TestModifyOrder(t *testing.T) { } func TestWithdraw(t *testing.T) { - withdrawCryptoRequest := exchange.CryptoWithdrawRequest{ - GenericWithdrawRequestInfo: exchange.GenericWithdrawRequestInfo{ + withdrawCryptoRequest := withdraw.CryptoWithdrawRequest{ + GenericWithdrawRequestInfo: withdraw.GenericWithdrawRequestInfo{ Amount: -1, Currency: currency.BTC, Description: "WITHDRAW IT ALL", @@ -402,7 +403,7 @@ func TestWithdrawFiat(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - var withdrawFiatRequest = exchange.FiatWithdrawRequest{} + var withdrawFiatRequest = withdraw.FiatWithdrawRequest{} _, err := l.WithdrawFiatFunds(&withdrawFiatRequest) if err != common.ErrFunctionNotSupported { t.Errorf("Expected '%v', received: '%v'", common.ErrFunctionNotSupported, err) @@ -414,7 +415,7 @@ func TestWithdrawInternationalBank(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - var withdrawFiatRequest = exchange.FiatWithdrawRequest{} + var withdrawFiatRequest = withdraw.FiatWithdrawRequest{} _, err := l.WithdrawFiatFundsToInternationalBank(&withdrawFiatRequest) if err != common.ErrFunctionNotSupported { t.Errorf("Expected '%v', received: '%v'", common.ErrFunctionNotSupported, err) diff --git a/exchanges/lakebtc/lakebtc_wrapper.go b/exchanges/lakebtc/lakebtc_wrapper.go index 0e15e0438ba..b16ef5929c0 100644 --- a/exchanges/lakebtc/lakebtc_wrapper.go +++ b/exchanges/lakebtc/lakebtc_wrapper.go @@ -19,6 +19,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/request" "github.com/thrasher-corp/gocryptotrader/exchanges/ticker" "github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wshandler" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" log "github.com/thrasher-corp/gocryptotrader/logger" ) @@ -404,7 +405,7 @@ func (l *LakeBTC) GetDepositAddress(cryptocurrency currency.Code, _ string) (str // WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is // submitted -func (l *LakeBTC) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.CryptoWithdrawRequest) (string, error) { +func (l *LakeBTC) WithdrawCryptocurrencyFunds(withdrawRequest *withdraw.CryptoWithdrawRequest) (string, error) { if withdrawRequest.Currency != currency.BTC { return "", errors.New("only BTC supported for withdrawals") } @@ -419,13 +420,13 @@ func (l *LakeBTC) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.CryptoWi // WithdrawFiatFunds returns a withdrawal ID when a // withdrawal is submitted -func (l *LakeBTC) WithdrawFiatFunds(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (l *LakeBTC) WithdrawFiatFunds(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return "", common.ErrFunctionNotSupported } // WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a // withdrawal is submitted -func (l *LakeBTC) WithdrawFiatFundsToInternationalBank(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (l *LakeBTC) WithdrawFiatFundsToInternationalBank(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return "", common.ErrFunctionNotSupported } diff --git a/exchanges/lbank/lbank_wrapper.go b/exchanges/lbank/lbank_wrapper.go index d5eab666b38..1b4d4525532 100644 --- a/exchanges/lbank/lbank_wrapper.go +++ b/exchanges/lbank/lbank_wrapper.go @@ -18,6 +18,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/request" "github.com/thrasher-corp/gocryptotrader/exchanges/ticker" "github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wshandler" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" log "github.com/thrasher-corp/gocryptotrader/logger" ) @@ -453,7 +454,7 @@ func (l *Lbank) GetDepositAddress(cryptocurrency currency.Code, accountID string // WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is // submitted -func (l *Lbank) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.CryptoWithdrawRequest) (string, error) { +func (l *Lbank) WithdrawCryptocurrencyFunds(withdrawRequest *withdraw.CryptoWithdrawRequest) (string, error) { resp, err := l.Withdraw(withdrawRequest.Address, withdrawRequest.Currency.String(), strconv.FormatFloat(withdrawRequest.Amount, 'f', -1, 64), "", withdrawRequest.Description, "") @@ -462,13 +463,13 @@ func (l *Lbank) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.CryptoWith // WithdrawFiatFunds returns a withdrawal ID when a withdrawal is // submitted -func (l *Lbank) WithdrawFiatFunds(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (l *Lbank) WithdrawFiatFunds(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return "", common.ErrFunctionNotSupported } // WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a withdrawal is // submitted -func (l *Lbank) WithdrawFiatFundsToInternationalBank(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (l *Lbank) WithdrawFiatFundsToInternationalBank(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return "", common.ErrFunctionNotSupported } diff --git a/exchanges/localbitcoins/localbitcoins_test.go b/exchanges/localbitcoins/localbitcoins_test.go index d1c6bc0edc1..d525e8c43b2 100644 --- a/exchanges/localbitcoins/localbitcoins_test.go +++ b/exchanges/localbitcoins/localbitcoins_test.go @@ -7,6 +7,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/currency" exchange "github.com/thrasher-corp/gocryptotrader/exchanges" "github.com/thrasher-corp/gocryptotrader/exchanges/order" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" ) // Please supply your own APIKEYS here for due diligence testing @@ -332,8 +333,8 @@ func TestModifyOrder(t *testing.T) { func TestWithdraw(t *testing.T) { t.Parallel() - withdrawCryptoRequest := exchange.CryptoWithdrawRequest{ - GenericWithdrawRequestInfo: exchange.GenericWithdrawRequestInfo{ + withdrawCryptoRequest := withdraw.CryptoWithdrawRequest{ + GenericWithdrawRequestInfo: withdraw.GenericWithdrawRequestInfo{ Amount: -1, Currency: currency.BTC, Description: "WITHDRAW IT ALL", @@ -359,7 +360,7 @@ func TestWithdraw(t *testing.T) { func TestWithdrawFiat(t *testing.T) { t.Parallel() - var withdrawFiatRequest = exchange.FiatWithdrawRequest{} + var withdrawFiatRequest = withdraw.FiatWithdrawRequest{} _, err := l.WithdrawFiatFunds(&withdrawFiatRequest) if err != common.ErrFunctionNotSupported { t.Errorf("Expected '%v', received: '%v'", @@ -371,7 +372,7 @@ func TestWithdrawFiat(t *testing.T) { func TestWithdrawInternationalBank(t *testing.T) { t.Parallel() - var withdrawFiatRequest = exchange.FiatWithdrawRequest{} + var withdrawFiatRequest = withdraw.FiatWithdrawRequest{} _, err := l.WithdrawFiatFundsToInternationalBank(&withdrawFiatRequest) if err != common.ErrFunctionNotSupported { t.Errorf("Expected '%v', received: '%v'", diff --git a/exchanges/localbitcoins/localbitcoins_wrapper.go b/exchanges/localbitcoins/localbitcoins_wrapper.go index 1e1bf0a2778..a6c8073ad7e 100644 --- a/exchanges/localbitcoins/localbitcoins_wrapper.go +++ b/exchanges/localbitcoins/localbitcoins_wrapper.go @@ -20,6 +20,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/request" "github.com/thrasher-corp/gocryptotrader/exchanges/ticker" "github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wshandler" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" log "github.com/thrasher-corp/gocryptotrader/logger" ) @@ -393,7 +394,7 @@ func (l *LocalBitcoins) GetDepositAddress(cryptocurrency currency.Code, _ string // WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is // submitted -func (l *LocalBitcoins) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.CryptoWithdrawRequest) (string, error) { +func (l *LocalBitcoins) WithdrawCryptocurrencyFunds(withdrawRequest *withdraw.CryptoWithdrawRequest) (string, error) { return "", l.WalletSend(withdrawRequest.Address, withdrawRequest.Amount, @@ -402,13 +403,13 @@ func (l *LocalBitcoins) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.Cr // WithdrawFiatFunds returns a withdrawal ID when a // withdrawal is submitted -func (l *LocalBitcoins) WithdrawFiatFunds(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (l *LocalBitcoins) WithdrawFiatFunds(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return "", common.ErrFunctionNotSupported } // WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a // withdrawal is submitted -func (l *LocalBitcoins) WithdrawFiatFundsToInternationalBank(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (l *LocalBitcoins) WithdrawFiatFundsToInternationalBank(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return "", common.ErrFunctionNotSupported } diff --git a/exchanges/okcoin/okcoin_test.go b/exchanges/okcoin/okcoin_test.go index 2d212f0e3bf..8555c9bcc9f 100644 --- a/exchanges/okcoin/okcoin_test.go +++ b/exchanges/okcoin/okcoin_test.go @@ -20,6 +20,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/order" "github.com/thrasher-corp/gocryptotrader/exchanges/sharedtestvalues" "github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wshandler" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" ) // Please supply you own test keys here for due diligence testing. @@ -1058,8 +1059,8 @@ func TestModifyOrder(t *testing.T) { func TestWithdraw(t *testing.T) { TestSetRealOrderDefaults(t) - withdrawCryptoRequest := exchange.CryptoWithdrawRequest{ - GenericWithdrawRequestInfo: exchange.GenericWithdrawRequestInfo{ + withdrawCryptoRequest := withdraw.CryptoWithdrawRequest{ + GenericWithdrawRequestInfo: withdraw.GenericWithdrawRequestInfo{ Amount: -1, Currency: currency.BTC, Description: "WITHDRAW IT ALL", @@ -1076,7 +1077,7 @@ func TestWithdraw(t *testing.T) { // TestWithdrawFiat Wrapper test func TestWithdrawFiat(t *testing.T) { TestSetRealOrderDefaults(t) - var withdrawFiatRequest = exchange.FiatWithdrawRequest{} + var withdrawFiatRequest = withdraw.FiatWithdrawRequest{} _, err := o.WithdrawFiatFunds(&withdrawFiatRequest) if err != common.ErrFunctionNotSupported { t.Errorf("Expected '%v', received: '%v'", common.ErrFunctionNotSupported, err) @@ -1086,7 +1087,7 @@ func TestWithdrawFiat(t *testing.T) { // TestSubmitOrder Wrapper test func TestWithdrawInternationalBank(t *testing.T) { TestSetRealOrderDefaults(t) - var withdrawFiatRequest = exchange.FiatWithdrawRequest{} + var withdrawFiatRequest = withdraw.FiatWithdrawRequest{} _, err := o.WithdrawFiatFundsToInternationalBank(&withdrawFiatRequest) if err != common.ErrFunctionNotSupported { t.Errorf("Expected '%v', received: '%v'", common.ErrFunctionNotSupported, err) diff --git a/exchanges/okex/okex_test.go b/exchanges/okex/okex_test.go index 70ae624677c..d59bd3e1087 100644 --- a/exchanges/okex/okex_test.go +++ b/exchanges/okex/okex_test.go @@ -22,6 +22,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/order" "github.com/thrasher-corp/gocryptotrader/exchanges/sharedtestvalues" "github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wshandler" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" ) // Please supply you own test keys here for due diligence testing. @@ -1751,8 +1752,8 @@ func TestModifyOrder(t *testing.T) { func TestWithdraw(t *testing.T) { TestSetRealOrderDefaults(t) t.Parallel() - withdrawCryptoRequest := exchange.CryptoWithdrawRequest{ - GenericWithdrawRequestInfo: exchange.GenericWithdrawRequestInfo{ + withdrawCryptoRequest := withdraw.CryptoWithdrawRequest{ + GenericWithdrawRequestInfo: withdraw.GenericWithdrawRequestInfo{ Amount: -1, Currency: currency.BTC, Description: "WITHDRAW IT ALL", @@ -1769,7 +1770,7 @@ func TestWithdraw(t *testing.T) { func TestWithdrawFiat(t *testing.T) { TestSetRealOrderDefaults(t) t.Parallel() - var withdrawFiatRequest = exchange.FiatWithdrawRequest{} + var withdrawFiatRequest = withdraw.FiatWithdrawRequest{} _, err := o.WithdrawFiatFunds(&withdrawFiatRequest) if err != common.ErrFunctionNotSupported { t.Errorf("Expected '%v', received: '%v'", @@ -1782,7 +1783,7 @@ func TestWithdrawFiat(t *testing.T) { func TestWithdrawInternationalBank(t *testing.T) { TestSetRealOrderDefaults(t) t.Parallel() - var withdrawFiatRequest = exchange.FiatWithdrawRequest{} + var withdrawFiatRequest = withdraw.FiatWithdrawRequest{} _, err := o.WithdrawFiatFundsToInternationalBank(&withdrawFiatRequest) if err != common.ErrFunctionNotSupported { t.Errorf("Expected '%v', received: '%v'", diff --git a/exchanges/okgroup/okgroup_wrapper.go b/exchanges/okgroup/okgroup_wrapper.go index c3dcca42e45..ef0804cf74a 100644 --- a/exchanges/okgroup/okgroup_wrapper.go +++ b/exchanges/okgroup/okgroup_wrapper.go @@ -14,6 +14,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/order" "github.com/thrasher-corp/gocryptotrader/exchanges/orderbook" "github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wshandler" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" log "github.com/thrasher-corp/gocryptotrader/logger" ) @@ -366,7 +367,7 @@ func (o *OKGroup) GetDepositAddress(p currency.Code, accountID string) (string, // WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is // submitted -func (o *OKGroup) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.CryptoWithdrawRequest) (string, error) { +func (o *OKGroup) WithdrawCryptocurrencyFunds(withdrawRequest *withdraw.CryptoWithdrawRequest) (string, error) { withdrawal, err := o.AccountWithdraw(AccountWithdrawRequest{ Amount: withdrawRequest.Amount, Currency: withdrawRequest.Currency.Lower().String(), @@ -390,13 +391,13 @@ func (o *OKGroup) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.CryptoWi // WithdrawFiatFunds returns a withdrawal ID when a // withdrawal is submitted -func (o *OKGroup) WithdrawFiatFunds(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (o *OKGroup) WithdrawFiatFunds(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return "", common.ErrFunctionNotSupported } // WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a // withdrawal is submitted -func (o *OKGroup) WithdrawFiatFundsToInternationalBank(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (o *OKGroup) WithdrawFiatFundsToInternationalBank(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return "", common.ErrFunctionNotSupported } diff --git a/exchanges/poloniex/poloniex_test.go b/exchanges/poloniex/poloniex_test.go index cc939aca118..480c96b8203 100644 --- a/exchanges/poloniex/poloniex_test.go +++ b/exchanges/poloniex/poloniex_test.go @@ -13,6 +13,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/order" "github.com/thrasher-corp/gocryptotrader/exchanges/sharedtestvalues" "github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wshandler" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" ) // Please supply your own APIKEYS here for due diligence testing @@ -347,8 +348,8 @@ func TestModifyOrder(t *testing.T) { func TestWithdraw(t *testing.T) { t.Parallel() - withdrawCryptoRequest := exchange.CryptoWithdrawRequest{ - GenericWithdrawRequestInfo: exchange.GenericWithdrawRequestInfo{ + withdrawCryptoRequest := withdraw.CryptoWithdrawRequest{ + GenericWithdrawRequestInfo: withdraw.GenericWithdrawRequestInfo{ Amount: 0, Currency: currency.LTC, Description: "WITHDRAW IT ALL", @@ -377,7 +378,7 @@ func TestWithdrawFiat(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - var withdrawFiatRequest exchange.FiatWithdrawRequest + var withdrawFiatRequest withdraw.FiatWithdrawRequest _, err := p.WithdrawFiatFunds(&withdrawFiatRequest) if err != common.ErrFunctionNotSupported { t.Errorf("Expected '%v', received: '%v'", @@ -391,7 +392,7 @@ func TestWithdrawInternationalBank(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - var withdrawFiatRequest exchange.FiatWithdrawRequest + var withdrawFiatRequest withdraw.FiatWithdrawRequest _, err := p.WithdrawFiatFundsToInternationalBank(&withdrawFiatRequest) if err != common.ErrFunctionNotSupported { t.Errorf("Expected '%v', received: '%v'", diff --git a/exchanges/poloniex/poloniex_wrapper.go b/exchanges/poloniex/poloniex_wrapper.go index 496e1e63d7d..2c178495735 100644 --- a/exchanges/poloniex/poloniex_wrapper.go +++ b/exchanges/poloniex/poloniex_wrapper.go @@ -18,6 +18,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/request" "github.com/thrasher-corp/gocryptotrader/exchanges/ticker" "github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wshandler" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" log "github.com/thrasher-corp/gocryptotrader/logger" ) @@ -462,20 +463,20 @@ func (p *Poloniex) GetDepositAddress(cryptocurrency currency.Code, _ string) (st // WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is // submitted -func (p *Poloniex) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.CryptoWithdrawRequest) (string, error) { +func (p *Poloniex) WithdrawCryptocurrencyFunds(withdrawRequest *withdraw.CryptoWithdrawRequest) (string, error) { _, err := p.Withdraw(withdrawRequest.Currency.String(), withdrawRequest.Address, withdrawRequest.Amount) return "", err } // WithdrawFiatFunds returns a withdrawal ID when a // withdrawal is submitted -func (p *Poloniex) WithdrawFiatFunds(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (p *Poloniex) WithdrawFiatFunds(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return "", common.ErrFunctionNotSupported } // WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a // withdrawal is submitted -func (p *Poloniex) WithdrawFiatFundsToInternationalBank(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (p *Poloniex) WithdrawFiatFundsToInternationalBank(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return "", common.ErrFunctionNotSupported } diff --git a/exchanges/withdraw/withdraw.go b/exchanges/withdraw/withdraw.go new file mode 100644 index 00000000000..96d5bcff57b --- /dev/null +++ b/exchanges/withdraw/withdraw.go @@ -0,0 +1 @@ +package withdraw diff --git a/exchanges/withdraw/withdraw_types.go b/exchanges/withdraw/withdraw_types.go new file mode 100644 index 00000000000..dd089d03dbd --- /dev/null +++ b/exchanges/withdraw/withdraw_types.go @@ -0,0 +1,54 @@ +package withdraw + +import "github.com/thrasher-corp/gocryptotrader/currency" + +// GenericWithdrawRequestInfo stores genric withdraw request info +type GenericWithdrawRequestInfo struct { + // General withdraw information + Currency currency.Code + Description string + OneTimePassword int64 + AccountID string + PIN int64 + TradePassword string + Amount float64 +} + +// CryptoWithdrawRequest stores the info required for a crypto withdrawal request +type CryptoWithdrawRequest struct { + GenericWithdrawRequestInfo + // Crypto related information + Address string + AddressTag string + FeeAmount float64 +} + +// FiatWithdrawRequest used for fiat withdrawal requests +type FiatWithdrawRequest struct { + GenericWithdrawRequestInfo + // FIAT related information + BankAccountName string + BankAccountNumber string + BankName string + BankAddress string + BankCity string + BankCountry string + BankPostalCode string + BSB string + SwiftCode string + IBAN string + BankCode float64 + IsExpressWire bool + // Intermediary bank information + RequiresIntermediaryBank bool + IntermediaryBankAccountNumber float64 + IntermediaryBankName string + IntermediaryBankAddress string + IntermediaryBankCity string + IntermediaryBankCountry string + IntermediaryBankPostalCode string + IntermediarySwiftCode string + IntermediaryBankCode float64 + IntermediaryIBAN string + WireCurrency string +} diff --git a/exchanges/yobit/yobit_test.go b/exchanges/yobit/yobit_test.go index 4a2dafab8fa..5eb1ebcbdaf 100644 --- a/exchanges/yobit/yobit_test.go +++ b/exchanges/yobit/yobit_test.go @@ -13,6 +13,7 @@ import ( exchange "github.com/thrasher-corp/gocryptotrader/exchanges" "github.com/thrasher-corp/gocryptotrader/exchanges/asset" "github.com/thrasher-corp/gocryptotrader/exchanges/order" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" ) var y Yobit @@ -445,8 +446,8 @@ func TestModifyOrder(t *testing.T) { } func TestWithdraw(t *testing.T) { - withdrawCryptoRequest := exchange.CryptoWithdrawRequest{ - GenericWithdrawRequestInfo: exchange.GenericWithdrawRequestInfo{ + withdrawCryptoRequest := withdraw.CryptoWithdrawRequest{ + GenericWithdrawRequestInfo: withdraw.GenericWithdrawRequestInfo{ Amount: -1, Currency: currency.BTC, Description: "WITHDRAW IT ALL", @@ -472,7 +473,7 @@ func TestWithdrawFiat(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - var withdrawFiatRequest = exchange.FiatWithdrawRequest{} + var withdrawFiatRequest = withdraw.FiatWithdrawRequest{} _, err := y.WithdrawFiatFunds(&withdrawFiatRequest) if err != common.ErrFunctionNotSupported { t.Errorf("Expected '%v', received: '%v'", @@ -486,7 +487,7 @@ func TestWithdrawInternationalBank(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - var withdrawFiatRequest = exchange.FiatWithdrawRequest{} + var withdrawFiatRequest = withdraw.FiatWithdrawRequest{} _, err := y.WithdrawFiatFundsToInternationalBank(&withdrawFiatRequest) if err != common.ErrFunctionNotSupported { t.Errorf("Expected '%v', received: '%v'", diff --git a/exchanges/yobit/yobit_wrapper.go b/exchanges/yobit/yobit_wrapper.go index 363f82087f5..eeb3d8b3340 100644 --- a/exchanges/yobit/yobit_wrapper.go +++ b/exchanges/yobit/yobit_wrapper.go @@ -19,6 +19,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/request" "github.com/thrasher-corp/gocryptotrader/exchanges/ticker" "github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wshandler" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" log "github.com/thrasher-corp/gocryptotrader/logger" ) @@ -406,7 +407,7 @@ func (y *Yobit) GetDepositAddress(cryptocurrency currency.Code, _ string) (strin // WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is // submitted -func (y *Yobit) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.CryptoWithdrawRequest) (string, error) { +func (y *Yobit) WithdrawCryptocurrencyFunds(withdrawRequest *withdraw.CryptoWithdrawRequest) (string, error) { resp, err := y.WithdrawCoinsToAddress(withdrawRequest.Currency.String(), withdrawRequest.Amount, withdrawRequest.Address) if err != nil { return "", err @@ -419,13 +420,13 @@ func (y *Yobit) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.CryptoWith // WithdrawFiatFunds returns a withdrawal ID when a // withdrawal is submitted -func (y *Yobit) WithdrawFiatFunds(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (y *Yobit) WithdrawFiatFunds(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return "", common.ErrFunctionNotSupported } // WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a // withdrawal is submitted -func (y *Yobit) WithdrawFiatFundsToInternationalBank(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (y *Yobit) WithdrawFiatFundsToInternationalBank(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return "", common.ErrFunctionNotSupported } diff --git a/exchanges/zb/zb_test.go b/exchanges/zb/zb_test.go index 3182e16e31b..72c54e59b71 100644 --- a/exchanges/zb/zb_test.go +++ b/exchanges/zb/zb_test.go @@ -16,6 +16,7 @@ import ( exchange "github.com/thrasher-corp/gocryptotrader/exchanges" "github.com/thrasher-corp/gocryptotrader/exchanges/order" "github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wshandler" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" ) // Please supply you own test keys here for due diligence testing. @@ -413,8 +414,8 @@ func TestModifyOrder(t *testing.T) { } func TestWithdraw(t *testing.T) { - withdrawCryptoRequest := exchange.CryptoWithdrawRequest{ - GenericWithdrawRequestInfo: exchange.GenericWithdrawRequestInfo{ + withdrawCryptoRequest := withdraw.CryptoWithdrawRequest{ + GenericWithdrawRequestInfo: withdraw.GenericWithdrawRequestInfo{ Amount: -1, Currency: currency.BTC, Description: "WITHDRAW IT ALL", @@ -441,7 +442,7 @@ func TestWithdrawFiat(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - var withdrawFiatRequest = exchange.FiatWithdrawRequest{} + var withdrawFiatRequest = withdraw.FiatWithdrawRequest{} _, err := z.WithdrawFiatFunds(&withdrawFiatRequest) if err != common.ErrFunctionNotSupported { t.Errorf("Expected '%v', received: '%v'", common.ErrFunctionNotSupported, err) @@ -453,7 +454,7 @@ func TestWithdrawInternationalBank(t *testing.T) { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } - var withdrawFiatRequest = exchange.FiatWithdrawRequest{} + var withdrawFiatRequest = withdraw.FiatWithdrawRequest{} _, err := z.WithdrawFiatFundsToInternationalBank(&withdrawFiatRequest) if err != common.ErrFunctionNotSupported { t.Errorf("Expected '%v', received: '%v'", common.ErrFunctionNotSupported, err) diff --git a/exchanges/zb/zb_wrapper.go b/exchanges/zb/zb_wrapper.go index eac00ae5ef8..8664d2845c5 100644 --- a/exchanges/zb/zb_wrapper.go +++ b/exchanges/zb/zb_wrapper.go @@ -19,6 +19,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/exchanges/request" "github.com/thrasher-corp/gocryptotrader/exchanges/ticker" "github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wshandler" + "github.com/thrasher-corp/gocryptotrader/exchanges/withdraw" log "github.com/thrasher-corp/gocryptotrader/logger" ) @@ -498,19 +499,19 @@ func (z *ZB) GetDepositAddress(cryptocurrency currency.Code, _ string) (string, // WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is // submitted -func (z *ZB) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.CryptoWithdrawRequest) (string, error) { +func (z *ZB) WithdrawCryptocurrencyFunds(withdrawRequest *withdraw.CryptoWithdrawRequest) (string, error) { return z.Withdraw(withdrawRequest.Currency.Lower().String(), withdrawRequest.Address, withdrawRequest.TradePassword, withdrawRequest.Amount, withdrawRequest.FeeAmount, false) } // WithdrawFiatFunds returns a withdrawal ID when a // withdrawal is submitted -func (z *ZB) WithdrawFiatFunds(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (z *ZB) WithdrawFiatFunds(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return "", common.ErrFunctionNotSupported } // WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a // withdrawal is submitted -func (z *ZB) WithdrawFiatFundsToInternationalBank(withdrawRequest *exchange.FiatWithdrawRequest) (string, error) { +func (z *ZB) WithdrawFiatFundsToInternationalBank(withdrawRequest *withdraw.FiatWithdrawRequest) (string, error) { return "", common.ErrFunctionNotSupported } diff --git a/gctrpc/rpc.pb.go b/gctrpc/rpc.pb.go index a5796e2b3d1..8098fdf09f8 100644 --- a/gctrpc/rpc.pb.go +++ b/gctrpc/rpc.pb.go @@ -6,12 +6,13 @@ package gctrpc import ( context "context" fmt "fmt" + math "math" + proto "github.com/golang/protobuf/proto" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - math "math" ) // Reference imports to suppress errors if they are not otherwise used.