mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-21 07:26:48 +00:00
FIAT withdrawal wrapper support (#230)
* Adds tests for withdrawFiat and withdrawFiat to international bank to all exchanges * Sets unsupported where FIAT withdrawal not allowed * Updates test signatures. Adds support for bitfinex FIAT withdrawals. Adds withdrawal type of NoFiatWithdrawals. Updates exchange wrapper implementations to return errnotsupported when... not supported. Updates withdraw permissions tests to reflect nofiatwithdrawals. Adds intermediary bank support in withdrawRequest type struct * Adds bithumb and bistamp fiat withdrawl wrapper support * Adds BTCMarkets withdrawal support * Adds kraken withdraw support (uses existing methods) * Fixes line issue from rebase * Updates notsupported for localbitcoins and okex. Updates withdraw permissions for liqui * Adds coinbasePro withdraw support. Fixes withdraw permissions tests for liqui and localbitcoins * Removes unnecessary data from test structs for fiat withdrawal tests * Readds intermediary bank flag * Removes reference * Improves bitfinex testing, improves withdraw fiat error handling * Reverts Kraken hardcoded testing value
This commit is contained in:
@@ -54,7 +54,7 @@ func (a *Alphapoint) SetDefaults() {
|
||||
a.AssetTypes = []string{ticker.Spot}
|
||||
a.SupportsAutoPairUpdating = false
|
||||
a.SupportsRESTTickerBatching = false
|
||||
a.APIWithdrawPermissions = exchange.WithdrawCryptoWith2FA | exchange.AutoWithdrawCryptoWithAPIPermission
|
||||
a.APIWithdrawPermissions = exchange.WithdrawCryptoWith2FA | exchange.AutoWithdrawCryptoWithAPIPermission | exchange.NoFiatWithdrawals
|
||||
a.Requester = request.New(a.Name,
|
||||
request.NewRateLimit(time.Minute*10, alphapointAuthRate),
|
||||
request.NewRateLimit(time.Minute*10, alphapointUnauthRate),
|
||||
|
||||
@@ -483,7 +483,7 @@ func TestFormatWithdrawPermissions(t *testing.T) {
|
||||
// Arrange
|
||||
a := &Alphapoint{}
|
||||
a.SetDefaults()
|
||||
expectedResult := exchange.AutoWithdrawCryptoWithAPIPermissionText + " & " + exchange.WithdrawCryptoWith2FAText
|
||||
expectedResult := exchange.AutoWithdrawCryptoWithAPIPermissionText + " & " + exchange.WithdrawCryptoWith2FAText + " & " + exchange.NoFiatWithdrawalsText
|
||||
// Act
|
||||
withdrawPermissions := a.FormatWithdrawPermissions()
|
||||
// Assert
|
||||
@@ -616,3 +616,35 @@ func TestWithdraw(t *testing.T) {
|
||||
t.Errorf("Expected 'Not implemented', recieved %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawFiat(t *testing.T) {
|
||||
a := &Alphapoint{}
|
||||
a.SetDefaults()
|
||||
|
||||
if areTestAPIKeysSet(a) && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := a.WithdrawFiatFunds(withdrawFiatRequest)
|
||||
if err != common.ErrNotYetImplemented {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrNotYetImplemented, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawInternationalBank(t *testing.T) {
|
||||
a := &Alphapoint{}
|
||||
a.SetDefaults()
|
||||
|
||||
if areTestAPIKeysSet(a) && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := a.WithdrawFiatFundsToInternationalBank(withdrawFiatRequest)
|
||||
if err != common.ErrNotYetImplemented {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrNotYetImplemented, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package anx
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/config"
|
||||
"github.com/thrasher-/gocryptotrader/currency/pair"
|
||||
"github.com/thrasher-/gocryptotrader/currency/symbol"
|
||||
@@ -362,3 +363,35 @@ func TestWithdraw(t *testing.T) {
|
||||
t.Error("Expecting an error when no keys are set")
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawFiat(t *testing.T) {
|
||||
a.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := a.WithdrawFiatFunds(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawInternationalBank(t *testing.T) {
|
||||
a.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := a.WithdrawFiatFundsToInternationalBank(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -319,14 +319,14 @@ func (a *ANX) WithdrawCryptocurrencyFunds(withdrawRequest exchange.WithdrawReque
|
||||
// submitted
|
||||
func (a *ANX) WithdrawFiatFunds(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
// Fiat withdrawals available via website
|
||||
return "", common.ErrNotYetImplemented
|
||||
return "", common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a withdrawal is
|
||||
// submitted
|
||||
func (a *ANX) WithdrawFiatFundsToInternationalBank(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
// Fiat withdrawals available via website
|
||||
return "", common.ErrNotYetImplemented
|
||||
return "", common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetWebsocket returns a pointer to the exchange websocket
|
||||
|
||||
@@ -81,7 +81,7 @@ func (b *Binance) SetDefaults() {
|
||||
b.AssetTypes = []string{ticker.Spot}
|
||||
b.SupportsAutoPairUpdating = true
|
||||
b.SupportsRESTTickerBatching = true
|
||||
b.APIWithdrawPermissions = exchange.AutoWithdrawCrypto
|
||||
b.APIWithdrawPermissions = exchange.AutoWithdrawCrypto | exchange.NoFiatWithdrawals
|
||||
b.SetValues()
|
||||
b.Requester = request.New(b.Name,
|
||||
request.NewRateLimit(time.Second, binanceAuthRate),
|
||||
|
||||
@@ -3,6 +3,7 @@ package binance
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/currency/pair"
|
||||
"github.com/thrasher-/gocryptotrader/currency/symbol"
|
||||
|
||||
@@ -322,7 +323,7 @@ func TestGetFee(t *testing.T) {
|
||||
func TestFormatWithdrawPermissions(t *testing.T) {
|
||||
// Arrange
|
||||
b.SetDefaults()
|
||||
expectedResult := exchange.AutoWithdrawCryptoText
|
||||
expectedResult := exchange.AutoWithdrawCryptoText + " & " + exchange.NoFiatWithdrawalsText
|
||||
// Act
|
||||
withdrawPermissions := b.FormatWithdrawPermissions()
|
||||
// Assert
|
||||
@@ -458,3 +459,35 @@ func TestWithdraw(t *testing.T) {
|
||||
t.Errorf("Withdraw failed to be placed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawFiat(t *testing.T) {
|
||||
b.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := b.WithdrawFiatFunds(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawInternationalBank(t *testing.T) {
|
||||
b.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := b.WithdrawFiatFundsToInternationalBank(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -280,13 +280,13 @@ func (b *Binance) WithdrawCryptocurrencyFunds(withdrawRequest exchange.WithdrawR
|
||||
// WithdrawFiatFunds returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
func (b *Binance) WithdrawFiatFunds(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
return "", common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
func (b *Binance) WithdrawFiatFundsToInternationalBank(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
return "", common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetWebsocket returns a pointer to the exchange websocket
|
||||
|
||||
@@ -600,6 +600,42 @@ func (b *Bitfinex) WithdrawCryptocurrency(withdrawType, wallet, address, currenc
|
||||
b.SendAuthenticatedHTTPRequest("POST", bitfinexWithdrawal, request, &response)
|
||||
}
|
||||
|
||||
// WithdrawFIAT requests a withdrawal from one of your wallets.
|
||||
// For Cryptocurrency, use WithdrawCryptocurrency
|
||||
func (b *Bitfinex) WithdrawFIAT(withdrawType, wallet, wireCurrency,
|
||||
accountName, bankName, bankAddress, bankCity, bankCountry, swift, transactionMessage,
|
||||
intermediaryBankName, intermediaryBankAddress, intermediaryBankCity, intermediaryBankCountry, intermediaryBankSwift string,
|
||||
amount, accountNumber, intermediaryBankAccountNumber float64, isExpressWire, requiresIntermediaryBank bool) ([]Withdrawal, error) {
|
||||
response := []Withdrawal{}
|
||||
request := make(map[string]interface{})
|
||||
request["withdraw_type"] = withdrawType
|
||||
request["walletselected"] = wallet
|
||||
request["amount"] = strconv.FormatFloat(amount, 'f', -1, 64)
|
||||
request["account_name"] = accountName
|
||||
request["account_number"] = strconv.FormatFloat(accountNumber, 'f', -1, 64)
|
||||
request["bank_name"] = bankName
|
||||
request["bank_address"] = bankAddress
|
||||
request["bank_city"] = bankCity
|
||||
request["bank_country"] = bankCountry
|
||||
request["expressWire"] = isExpressWire
|
||||
request["swift"] = swift
|
||||
request["detail_payment"] = transactionMessage
|
||||
request["currency"] = wireCurrency
|
||||
request["account_address"] = bankAddress
|
||||
|
||||
if requiresIntermediaryBank {
|
||||
request["intermediary_bank_name"] = intermediaryBankName
|
||||
request["intermediary_bank_address"] = intermediaryBankAddress
|
||||
request["intermediary_bank_city"] = intermediaryBankCity
|
||||
request["intermediary_bank_country"] = intermediaryBankCountry
|
||||
request["intermediary_bank_account"] = strconv.FormatFloat(intermediaryBankAccountNumber, 'f', -1, 64)
|
||||
request["intermediary_bank_swift"] = intermediaryBankSwift
|
||||
}
|
||||
|
||||
return response,
|
||||
b.SendAuthenticatedHTTPRequest("POST", bitfinexWithdrawal, request, &response)
|
||||
}
|
||||
|
||||
// NewOrder submits a new order and returns a order information
|
||||
// Major Upgrade needed on this function to include all query params
|
||||
func (b *Bitfinex) NewOrder(currencyPair string, amount float64, price float64, buy bool, Type string, hidden bool) (Order, error) {
|
||||
|
||||
@@ -831,3 +831,75 @@ func TestWithdraw(t *testing.T) {
|
||||
t.Errorf("Withdraw failed to be placed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawFiat(t *testing.T) {
|
||||
b.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{
|
||||
Amount: 100,
|
||||
Currency: symbol.BTC,
|
||||
Description: "WITHDRAW IT ALL",
|
||||
BankAccountName: "Satoshi Nakamoto",
|
||||
BankAccountNumber: 12345,
|
||||
BankAddress: "123 Fake St",
|
||||
BankCity: "Tarry Town",
|
||||
BankCountry: "Hyrule",
|
||||
BankName: "Federal Reserve Bank",
|
||||
WireCurrency: symbol.USD,
|
||||
SwiftCode: "Taylor",
|
||||
RequiresIntermediaryBank: false,
|
||||
IsExpressWire: false,
|
||||
}
|
||||
|
||||
_, err := b.WithdrawFiatFunds(withdrawFiatRequest)
|
||||
if !areTestAPIKeysSet() && err == nil {
|
||||
t.Errorf("Expecting an error when no keys are set: %v", err)
|
||||
}
|
||||
if areTestAPIKeysSet() && err != nil {
|
||||
t.Errorf("Withdraw failed to be placed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawInternationalBank(t *testing.T) {
|
||||
b.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{
|
||||
Amount: 100,
|
||||
Currency: symbol.BTC,
|
||||
Description: "WITHDRAW IT ALL",
|
||||
BankAccountName: "Satoshi Nakamoto",
|
||||
BankAccountNumber: 12345,
|
||||
BankAddress: "123 Fake St",
|
||||
BankCity: "Tarry Town",
|
||||
BankCountry: "Hyrule",
|
||||
BankName: "Federal Reserve Bank",
|
||||
WireCurrency: symbol.USD,
|
||||
SwiftCode: "Taylor",
|
||||
RequiresIntermediaryBank: true,
|
||||
IsExpressWire: false,
|
||||
IntermediaryBankAccountNumber: 12345,
|
||||
IntermediaryBankAddress: "123 Fake St",
|
||||
IntermediaryBankCity: "Tarry Town",
|
||||
IntermediaryBankCountry: "Hyrule",
|
||||
IntermediaryBankName: "Federal Reserve Bank",
|
||||
IntermediarySwiftCode: "Taylor",
|
||||
}
|
||||
|
||||
_, err := b.WithdrawFiatFundsToInternationalBank(withdrawFiatRequest)
|
||||
if !areTestAPIKeysSet() && err == nil {
|
||||
t.Errorf("Expecting an error when no keys are set: %v", err)
|
||||
}
|
||||
if areTestAPIKeysSet() && err != nil {
|
||||
t.Errorf("Withdraw failed to be placed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,7 +236,8 @@ type WalletTransfer struct {
|
||||
type Withdrawal struct {
|
||||
Status string `json:"status"`
|
||||
Message string `json:"message"`
|
||||
WithdrawalID int64 `json:"withdrawal_id,string"`
|
||||
WithdrawalID int64 `json:"withdrawal_id,omitempty"`
|
||||
Fees string `json:"fees,omitempty"`
|
||||
}
|
||||
|
||||
// Order holds order information when an order is in the market
|
||||
|
||||
@@ -251,16 +251,49 @@ func (b *Bitfinex) WithdrawCryptocurrencyFunds(withdrawRequest exchange.Withdraw
|
||||
return fmt.Sprintf("%v", resp[0].WithdrawalID), err
|
||||
}
|
||||
|
||||
// WithdrawFiatFunds returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
// WithdrawFiatFunds returns a withdrawal ID when a withdrawal is submitted
|
||||
// Returns comma delimited withdrawal IDs
|
||||
func (b *Bitfinex) WithdrawFiatFunds(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
withdrawalType := "wire"
|
||||
// Bitfinex has support for three types, exchange, margin and deposit
|
||||
// As this is for trading, I've made the wrapper default 'exchange'
|
||||
// TODO: Discover an automated way to make the decision for wallet type to withdraw from
|
||||
walletType := "exchange"
|
||||
resp, err := b.WithdrawFIAT(withdrawalType, walletType, withdrawRequest.WireCurrency,
|
||||
withdrawRequest.BankAccountName, withdrawRequest.BankName, withdrawRequest.BankAddress,
|
||||
withdrawRequest.BankCity, withdrawRequest.BankCountry, withdrawRequest.SwiftCode,
|
||||
withdrawRequest.Description, withdrawRequest.IntermediaryBankName, withdrawRequest.IntermediaryBankAddress,
|
||||
withdrawRequest.IntermediaryBankCity, withdrawRequest.IntermediaryBankCountry, withdrawRequest.IntermediarySwiftCode,
|
||||
withdrawRequest.Amount, withdrawRequest.BankAccountNumber, withdrawRequest.IntermediaryBankAccountNumber,
|
||||
withdrawRequest.IsExpressWire, withdrawRequest.RequiresIntermediaryBank)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if len(resp) == 0 {
|
||||
return "", errors.New("No withdrawID returned. Check order status")
|
||||
}
|
||||
|
||||
var withdrawalSuccesses string
|
||||
var withdrawalErrors string
|
||||
for _, withdrawl := range resp {
|
||||
if withdrawl.Status == "error" {
|
||||
withdrawalErrors += fmt.Sprintf("%v ", withdrawl.Message)
|
||||
}
|
||||
if withdrawl.Status == "success" {
|
||||
withdrawalSuccesses += fmt.Sprintf("%v,", withdrawl.WithdrawalID)
|
||||
}
|
||||
}
|
||||
if len(withdrawalErrors) > 0 {
|
||||
return withdrawalSuccesses, errors.New(withdrawalErrors)
|
||||
}
|
||||
|
||||
return withdrawalSuccesses, nil
|
||||
}
|
||||
|
||||
// WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
// WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a withdrawal is submitted
|
||||
// Returns comma delimited withdrawal IDs
|
||||
func (b *Bitfinex) WithdrawFiatFundsToInternationalBank(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
return b.WithdrawFiatFunds(withdrawRequest)
|
||||
}
|
||||
|
||||
// GetWebsocket returns a pointer to the exchange websocket
|
||||
|
||||
@@ -354,3 +354,35 @@ func TestModifyOrder(t *testing.T) {
|
||||
t.Error("Test failed - ModifyOrder() error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawFiat(t *testing.T) {
|
||||
b.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := b.WithdrawFiatFunds(withdrawFiatRequest)
|
||||
if err != common.ErrNotYetImplemented {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrNotYetImplemented, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawInternationalBank(t *testing.T) {
|
||||
b.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := b.WithdrawFiatFundsToInternationalBank(withdrawFiatRequest)
|
||||
if err != common.ErrNotYetImplemented {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrNotYetImplemented, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package bithumb
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/config"
|
||||
"github.com/thrasher-/gocryptotrader/currency/pair"
|
||||
"github.com/thrasher-/gocryptotrader/currency/symbol"
|
||||
@@ -431,3 +432,53 @@ func TestWithdraw(t *testing.T) {
|
||||
t.Errorf("Withdraw failed to be placed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawFiat(t *testing.T) {
|
||||
b.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{
|
||||
Amount: 100,
|
||||
Currency: symbol.KRW,
|
||||
Description: "WITHDRAW IT ALL",
|
||||
BankAccountName: "Satoshi Nakamoto",
|
||||
BankAccountNumber: 12345,
|
||||
BankCode: 123,
|
||||
BankAddress: "123 Fake St",
|
||||
BankCity: "Tarry Town",
|
||||
BankCountry: "Hyrule",
|
||||
BankName: "Federal Reserve Bank",
|
||||
WireCurrency: symbol.KRW,
|
||||
SwiftCode: "Taylor",
|
||||
RequiresIntermediaryBank: false,
|
||||
IsExpressWire: false,
|
||||
}
|
||||
|
||||
_, err := b.WithdrawFiatFunds(withdrawFiatRequest)
|
||||
if !areTestAPIKeysSet() && err == nil {
|
||||
t.Errorf("Expecting an error when no keys are set: %v", err)
|
||||
}
|
||||
if areTestAPIKeysSet() && err != nil {
|
||||
t.Errorf("Withdraw failed to be placed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawInternationalBank(t *testing.T) {
|
||||
b.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := b.WithdrawFiatFundsToInternationalBank(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
package bithumb
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"math"
|
||||
"strconv"
|
||||
"sync"
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/currency/pair"
|
||||
"github.com/thrasher-/gocryptotrader/currency/symbol"
|
||||
exchange "github.com/thrasher-/gocryptotrader/exchanges"
|
||||
"github.com/thrasher-/gocryptotrader/exchanges/orderbook"
|
||||
"github.com/thrasher-/gocryptotrader/exchanges/ticker"
|
||||
@@ -258,13 +262,29 @@ func (b *Bithumb) WithdrawCryptocurrencyFunds(withdrawRequest exchange.WithdrawR
|
||||
// WithdrawFiatFunds returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
func (b *Bithumb) WithdrawFiatFunds(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
if math.Mod(withdrawRequest.Amount, 1) != 0 {
|
||||
return "", errors.New("KRW withdrawals do not support decimal places")
|
||||
}
|
||||
if withdrawRequest.Currency.String() != symbol.KRW {
|
||||
return "", errors.New("Only KRW supported")
|
||||
}
|
||||
bankDetails := fmt.Sprintf("%v_%v", withdrawRequest.BankCode, withdrawRequest.BankName)
|
||||
bankAccountNumber := strconv.FormatFloat(withdrawRequest.BankAccountNumber, 'f', -1, 64)
|
||||
withdrawAmountInt := int64(withdrawRequest.Amount)
|
||||
resp, err := b.RequestKRWWithdraw(bankDetails, bankAccountNumber, withdrawAmountInt)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if resp.Status != "0000" {
|
||||
return "", errors.New(resp.Message)
|
||||
}
|
||||
|
||||
return resp.Message, nil
|
||||
}
|
||||
|
||||
// WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
// WithdrawFiatFundsToInternationalBank is not supported as Bithumb only withdraws KRW to South Korean banks
|
||||
func (b *Bithumb) WithdrawFiatFundsToInternationalBank(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
return "", common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetWebsocket returns a pointer to the exchange websocket
|
||||
|
||||
@@ -114,7 +114,7 @@ func (b *Bitmex) SetDefaults() {
|
||||
b.Enabled = false
|
||||
b.Verbose = false
|
||||
b.RESTPollingDelay = 10
|
||||
b.APIWithdrawPermissions = exchange.AutoWithdrawCryptoWithAPIPermission | exchange.WithdrawCryptoWithEmail | exchange.WithdrawCryptoWith2FA
|
||||
b.APIWithdrawPermissions = exchange.AutoWithdrawCryptoWithAPIPermission | exchange.WithdrawCryptoWithEmail | exchange.WithdrawCryptoWith2FA | exchange.NoFiatWithdrawals
|
||||
b.RequestCurrencyPairFormat.Delimiter = ""
|
||||
b.RequestCurrencyPairFormat.Uppercase = true
|
||||
b.ConfigCurrencyPairFormat.Delimiter = ""
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/currency/pair"
|
||||
"github.com/thrasher-/gocryptotrader/currency/symbol"
|
||||
"github.com/thrasher-/gocryptotrader/exchanges"
|
||||
@@ -456,7 +457,8 @@ func TestGetFee(t *testing.T) {
|
||||
func TestFormatWithdrawPermissions(t *testing.T) {
|
||||
// Arrange
|
||||
b.SetDefaults()
|
||||
expectedResult := exchange.AutoWithdrawCryptoWithAPIPermissionText + " & " + exchange.WithdrawCryptoWith2FAText + " & " + exchange.WithdrawCryptoWithEmailText
|
||||
expectedResult := exchange.AutoWithdrawCryptoWithAPIPermissionText + " & " + exchange.WithdrawCryptoWith2FAText +
|
||||
" & " + exchange.WithdrawCryptoWithEmailText + " & " + exchange.NoFiatWithdrawalsText
|
||||
// Act
|
||||
withdrawPermissions := b.FormatWithdrawPermissions()
|
||||
// Assert
|
||||
@@ -604,3 +606,35 @@ func TestWithdraw(t *testing.T) {
|
||||
t.Errorf("Withdraw failed to be placed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawFiat(t *testing.T) {
|
||||
b.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := b.WithdrawFiatFunds(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawInternationalBank(t *testing.T) {
|
||||
b.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := b.WithdrawFiatFundsToInternationalBank(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -278,13 +278,13 @@ func (b *Bitmex) WithdrawCryptocurrencyFunds(withdrawRequest exchange.WithdrawRe
|
||||
// WithdrawFiatFunds returns a withdrawal ID when a withdrawal is
|
||||
// submitted
|
||||
func (b *Bitmex) WithdrawFiatFunds(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
return "", common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a withdrawal is
|
||||
// submitted
|
||||
func (b *Bitmex) WithdrawFiatFundsToInternationalBank(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
return "", common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetWebsocket returns a pointer to the exchange websocket
|
||||
|
||||
@@ -36,6 +36,7 @@ const (
|
||||
bitstampAPISell = "sell"
|
||||
bitstampAPIMarket = "market"
|
||||
bitstampAPIWithdrawalRequests = "withdrawal_requests"
|
||||
bitstampAPIOpenWithdrawal = "withdrawal/open"
|
||||
bitstampAPIBitcoinWithdrawal = "bitcoin_withdrawal"
|
||||
bitstampAPILTCWithdrawal = "ltc_withdrawal"
|
||||
bitstampAPIETHWithdrawal = "eth_withdrawal"
|
||||
@@ -514,6 +515,55 @@ func (b *Bitstamp) CryptoWithdrawal(amount float64, address, symbol, destTag str
|
||||
return resp, b.SendAuthenticatedHTTPRequest(endpoint, false, req, &resp)
|
||||
}
|
||||
|
||||
// OpenBankWithdrawal Opens a bank withdrawal request (SEPA or international)
|
||||
func (b *Bitstamp) OpenBankWithdrawal(amount float64, currency,
|
||||
name, iban, bic, address, postalCode, city, country,
|
||||
comment, withdrawalType string) (FIATWithdrawalResponse, error) {
|
||||
var req = url.Values{}
|
||||
req.Add("amount", strconv.FormatFloat(amount, 'f', -1, 64))
|
||||
req.Add("account_currency", currency)
|
||||
req.Add("name", name)
|
||||
req.Add("iban", iban)
|
||||
req.Add("bic", bic)
|
||||
req.Add("address", address)
|
||||
req.Add("postal_code", postalCode)
|
||||
req.Add("city", city)
|
||||
req.Add("country", country)
|
||||
req.Add("type", withdrawalType)
|
||||
req.Add("comment", comment)
|
||||
|
||||
resp := FIATWithdrawalResponse{}
|
||||
return resp, b.SendAuthenticatedHTTPRequest(bitstampAPIOpenWithdrawal, true, req, &resp)
|
||||
}
|
||||
|
||||
// OpenInternationalBankWithdrawal Opens a bank withdrawal request (international)
|
||||
func (b *Bitstamp) OpenInternationalBankWithdrawal(amount float64, currency,
|
||||
name, iban, bic, address, postalCode, city, country,
|
||||
bankName, bankAddress, bankPostCode, bankCity, bankCountry, internationalCurrency,
|
||||
comment, withdrawalType string) (FIATWithdrawalResponse, error) {
|
||||
var req = url.Values{}
|
||||
req.Add("amount", strconv.FormatFloat(amount, 'f', -1, 64))
|
||||
req.Add("account_currency", currency)
|
||||
req.Add("name", name)
|
||||
req.Add("iban", iban)
|
||||
req.Add("bic", bic)
|
||||
req.Add("address", address)
|
||||
req.Add("postal_code", postalCode)
|
||||
req.Add("city", city)
|
||||
req.Add("country", country)
|
||||
req.Add("type", withdrawalType)
|
||||
req.Add("comment", comment)
|
||||
req.Add("currency", internationalCurrency)
|
||||
req.Add("bank_name", bankName)
|
||||
req.Add("bank_address", bankAddress)
|
||||
req.Add("bank_postal_code", bankPostCode)
|
||||
req.Add("bank_city", bankCity)
|
||||
req.Add("bank_country", bankCountry)
|
||||
|
||||
resp := FIATWithdrawalResponse{}
|
||||
return resp, b.SendAuthenticatedHTTPRequest(bitstampAPIOpenWithdrawal, true, req, &resp)
|
||||
}
|
||||
|
||||
// GetCryptoDepositAddress returns a depositing address by crypto
|
||||
// crypto - example "btc", "ltc", "eth", or "xrp"
|
||||
func (b *Bitstamp) GetCryptoDepositAddress(crypto string) (string, error) {
|
||||
|
||||
@@ -16,7 +16,7 @@ import (
|
||||
const (
|
||||
apiKey = ""
|
||||
apiSecret = ""
|
||||
customerID = ""
|
||||
customerID = "" // This is the customer id you use to log in
|
||||
canManipulateRealOrders = false
|
||||
)
|
||||
|
||||
@@ -381,7 +381,6 @@ func areTestAPIKeysSet() bool {
|
||||
func TestSubmitOrder(t *testing.T) {
|
||||
b.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
@@ -492,3 +491,79 @@ func TestWithdraw(t *testing.T) {
|
||||
t.Errorf("Withdraw failed to be placed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawFiat(t *testing.T) {
|
||||
b.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{
|
||||
Amount: 100,
|
||||
Currency: symbol.USD,
|
||||
Description: "WITHDRAW IT ALL",
|
||||
BankAccountName: "Satoshi Nakamoto",
|
||||
BankAccountNumber: 12345,
|
||||
BankAddress: "123 Fake St",
|
||||
BankCity: "Tarry Town",
|
||||
BankCountry: "AU",
|
||||
BankName: "Federal Reserve Bank",
|
||||
WireCurrency: symbol.USD,
|
||||
SwiftCode: "CTBAAU2S",
|
||||
RequiresIntermediaryBank: false,
|
||||
IsExpressWire: false,
|
||||
BankPostalCode: "2088",
|
||||
IBAN: "IT60X0542811101000000123456",
|
||||
}
|
||||
|
||||
_, err := b.WithdrawFiatFunds(withdrawFiatRequest)
|
||||
if !areTestAPIKeysSet() && err == nil {
|
||||
t.Errorf("Expecting an error when no keys are set: %v", err)
|
||||
}
|
||||
if areTestAPIKeysSet() && err != nil {
|
||||
t.Errorf("Withdraw failed to be placed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawInternationalBank(t *testing.T) {
|
||||
b.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{
|
||||
Amount: 100,
|
||||
Currency: symbol.USD,
|
||||
Description: "WITHDRAW IT ALL",
|
||||
BankAccountName: "Satoshi Nakamoto",
|
||||
BankAccountNumber: 12345,
|
||||
BankAddress: "123 Fake St",
|
||||
BankCity: "Tarry Town",
|
||||
BankCountry: "AU",
|
||||
BankName: "Federal Reserve Bank",
|
||||
WireCurrency: symbol.USD,
|
||||
SwiftCode: "CTBAAU2S",
|
||||
RequiresIntermediaryBank: false,
|
||||
IsExpressWire: false,
|
||||
BankPostalCode: "2088",
|
||||
IBAN: "IT60X0542811101000000123456",
|
||||
IntermediaryBankAccountNumber: 12345,
|
||||
IntermediaryBankAddress: "123 Fake St",
|
||||
IntermediaryBankCity: "Tarry Town",
|
||||
IntermediaryBankCountry: "AU",
|
||||
IntermediaryBankName: "Federal Reserve Bank",
|
||||
IntermediaryBankPostalCode: "2088",
|
||||
}
|
||||
|
||||
_, err := b.WithdrawFiatFundsToInternationalBank(withdrawFiatRequest)
|
||||
if !areTestAPIKeysSet() && err == nil {
|
||||
t.Errorf("Expecting an error when no keys are set: %v", err)
|
||||
}
|
||||
if areTestAPIKeysSet() && err != nil {
|
||||
t.Errorf("Withdraw failed to be placed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,11 +122,19 @@ type WithdrawalRequests struct {
|
||||
TransactionID string `json:"transaction_id"` // Bitcoin withdrawals only
|
||||
}
|
||||
|
||||
// CryptoWithdrawalResponse response from a crypto withdrawal request
|
||||
type CryptoWithdrawalResponse struct {
|
||||
ID string `json:"id"`
|
||||
Error string `json:"error"`
|
||||
}
|
||||
|
||||
// FIATWithdrawalResponse response from a fiat withdrawal request
|
||||
type FIATWithdrawalResponse struct {
|
||||
ID string `json:"id"`
|
||||
Status string `json:"status"`
|
||||
Reason string `json:"reason"`
|
||||
}
|
||||
|
||||
// UnconfirmedBTCTransactions holds address information about unconfirmed
|
||||
// transactions
|
||||
type UnconfirmedBTCTransactions struct {
|
||||
@@ -142,3 +150,9 @@ type CaptureError struct {
|
||||
Code interface{} `json:"code"`
|
||||
Error interface{} `json:"error"`
|
||||
}
|
||||
|
||||
const (
|
||||
sepaWithdrawal string = "sepa"
|
||||
internationalWithdrawal string = "international"
|
||||
errStr string = "error"
|
||||
)
|
||||
|
||||
@@ -240,13 +240,37 @@ func (b *Bitstamp) WithdrawCryptocurrencyFunds(withdrawRequest exchange.Withdraw
|
||||
// WithdrawFiatFunds returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
func (b *Bitstamp) WithdrawFiatFunds(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
resp, err := b.OpenBankWithdrawal(withdrawRequest.Amount, withdrawRequest.Currency.String(),
|
||||
withdrawRequest.BankAccountName, withdrawRequest.IBAN, withdrawRequest.SwiftCode, withdrawRequest.BankAddress,
|
||||
withdrawRequest.BankPostalCode, withdrawRequest.BankCity, withdrawRequest.BankCountry,
|
||||
withdrawRequest.Description, sepaWithdrawal)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if resp.Status == errStr {
|
||||
return "", errors.New(resp.Reason)
|
||||
}
|
||||
|
||||
return resp.ID, nil
|
||||
}
|
||||
|
||||
// WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
func (b *Bitstamp) WithdrawFiatFundsToInternationalBank(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
resp, err := b.OpenInternationalBankWithdrawal(withdrawRequest.Amount, withdrawRequest.Currency.String(),
|
||||
withdrawRequest.BankAccountName, withdrawRequest.IBAN, withdrawRequest.SwiftCode, withdrawRequest.BankAddress,
|
||||
withdrawRequest.BankPostalCode, withdrawRequest.BankCity, withdrawRequest.BankCountry,
|
||||
withdrawRequest.IntermediaryBankName, withdrawRequest.IntermediaryBankAddress, withdrawRequest.IntermediaryBankPostalCode,
|
||||
withdrawRequest.IntermediaryBankCity, withdrawRequest.IntermediaryBankCountry, withdrawRequest.WireCurrency,
|
||||
withdrawRequest.Description, internationalWithdrawal)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if resp.Status == errStr {
|
||||
return "", errors.New(resp.Reason)
|
||||
}
|
||||
|
||||
return resp.ID, nil
|
||||
}
|
||||
|
||||
// GetWebsocket returns a pointer to the exchange websocket
|
||||
|
||||
@@ -68,7 +68,7 @@ func (b *Bittrex) SetDefaults() {
|
||||
b.Enabled = false
|
||||
b.Verbose = false
|
||||
b.RESTPollingDelay = 10
|
||||
b.APIWithdrawPermissions = exchange.AutoWithdrawCryptoWithAPIPermission
|
||||
b.APIWithdrawPermissions = exchange.AutoWithdrawCryptoWithAPIPermission | exchange.NoFiatWithdrawals
|
||||
b.RequestCurrencyPairFormat.Delimiter = "-"
|
||||
b.RequestCurrencyPairFormat.Uppercase = true
|
||||
b.ConfigCurrencyPairFormat.Delimiter = "-"
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/config"
|
||||
"github.com/thrasher-/gocryptotrader/currency/pair"
|
||||
"github.com/thrasher-/gocryptotrader/currency/symbol"
|
||||
@@ -315,7 +316,7 @@ func TestGetFee(t *testing.T) {
|
||||
func TestFormatWithdrawPermissions(t *testing.T) {
|
||||
// Arrange
|
||||
b.SetDefaults()
|
||||
expectedResult := exchange.AutoWithdrawCryptoWithAPIPermissionText
|
||||
expectedResult := exchange.AutoWithdrawCryptoWithAPIPermissionText + " & " + exchange.NoFiatWithdrawalsText
|
||||
// Act
|
||||
withdrawPermissions := b.FormatWithdrawPermissions()
|
||||
// Assert
|
||||
@@ -448,3 +449,35 @@ func TestWithdraw(t *testing.T) {
|
||||
t.Errorf("Withdraw failed to be placed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawFiat(t *testing.T) {
|
||||
b.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := b.WithdrawFiatFunds(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawInternationalBank(t *testing.T) {
|
||||
b.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := b.WithdrawFiatFundsToInternationalBank(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -251,13 +251,13 @@ func (b *Bittrex) WithdrawCryptocurrencyFunds(withdrawRequest exchange.WithdrawR
|
||||
// WithdrawFiatFunds returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
func (b *Bittrex) WithdrawFiatFunds(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
return "", common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
func (b *Bittrex) WithdrawFiatFundsToInternationalBank(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
return "", common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetWebsocket returns a pointer to the exchange websocket
|
||||
|
||||
@@ -270,8 +270,8 @@ func TestWithdraw(t *testing.T) {
|
||||
}
|
||||
|
||||
_, err := b.WithdrawCryptocurrencyFunds(withdrawCryptoRequest)
|
||||
if err != common.ErrNotYetImplemented {
|
||||
t.Errorf("Expected 'Not Yet Implemented', recieved %v", err)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -281,3 +281,35 @@ func TestModifyOrder(t *testing.T) {
|
||||
t.Error("Test failed - ModifyOrder() error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawFiat(t *testing.T) {
|
||||
b.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := b.WithdrawFiatFunds(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawInternationalBank(t *testing.T) {
|
||||
b.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := b.WithdrawFiatFundsToInternationalBank(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,19 +187,19 @@ func (b *BTCC) GetDepositAddress(cryptocurrency pair.CurrencyItem) (string, erro
|
||||
// WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is
|
||||
// submitted
|
||||
func (b *BTCC) WithdrawCryptocurrencyFunds(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
return "", common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// WithdrawFiatFunds returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
func (b *BTCC) WithdrawFiatFunds(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
return "", common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
func (b *BTCC) WithdrawFiatFundsToInternationalBank(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
return "", common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetWebsocket returns a pointer to the exchange websocket
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"net/url"
|
||||
"testing"
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/config"
|
||||
"github.com/thrasher-/gocryptotrader/currency/pair"
|
||||
"github.com/thrasher-/gocryptotrader/currency/symbol"
|
||||
@@ -400,3 +401,52 @@ func TestWithdraw(t *testing.T) {
|
||||
t.Errorf("Withdraw failed to be placed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawFiat(t *testing.T) {
|
||||
b.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{
|
||||
Amount: 100,
|
||||
Currency: symbol.AUD,
|
||||
Description: "WITHDRAW IT ALL",
|
||||
BankAccountName: "Satoshi Nakamoto",
|
||||
BankAccountNumber: 12345,
|
||||
BankAddress: "123 Fake St",
|
||||
BankCity: "Tarry Town",
|
||||
BankCountry: "Hyrule",
|
||||
BankName: "Commonwealth Bank of Australia",
|
||||
WireCurrency: symbol.AUD,
|
||||
SwiftCode: "Taylor",
|
||||
RequiresIntermediaryBank: false,
|
||||
IsExpressWire: false,
|
||||
}
|
||||
|
||||
_, err := b.WithdrawFiatFunds(withdrawFiatRequest)
|
||||
if !areTestAPIKeysSet() && err == nil {
|
||||
t.Errorf("Expecting an error when no keys are set: %v", err)
|
||||
}
|
||||
if areTestAPIKeysSet() && err != nil {
|
||||
t.Errorf("Withdraw failed to be placed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawInternationalBank(t *testing.T) {
|
||||
b.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := b.WithdrawFiatFundsToInternationalBank(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/currency/pair"
|
||||
"github.com/thrasher-/gocryptotrader/currency/symbol"
|
||||
exchange "github.com/thrasher-/gocryptotrader/exchanges"
|
||||
"github.com/thrasher-/gocryptotrader/exchanges/orderbook"
|
||||
"github.com/thrasher-/gocryptotrader/exchanges/ticker"
|
||||
@@ -267,17 +268,16 @@ func (b *BTCMarkets) WithdrawCryptocurrencyFunds(withdrawRequest exchange.Withdr
|
||||
// WithdrawFiatFunds returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
func (b *BTCMarkets) WithdrawFiatFunds(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
bd, err := b.GetClientBankAccounts(b.Name, withdrawRequest.Currency.Upper().String())
|
||||
if err != nil {
|
||||
return "", err
|
||||
if withdrawRequest.Currency != symbol.AUD {
|
||||
return "", errors.New("Only AUD supported for withdrawals")
|
||||
}
|
||||
return b.WithdrawAUD(bd.AccountName, bd.AccountNumber, bd.BankName, bd.BSBNumber, withdrawRequest.Amount)
|
||||
return b.WithdrawAUD(withdrawRequest.BankAccountName, fmt.Sprintf("%v", withdrawRequest.BankAccountNumber), withdrawRequest.BankName, fmt.Sprintf("%v", withdrawRequest.BankCode), withdrawRequest.Amount)
|
||||
}
|
||||
|
||||
// WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
func (b *BTCMarkets) WithdrawFiatFundsToInternationalBank(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
return "", common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetWebsocket returns a pointer to the exchange websocket
|
||||
|
||||
@@ -531,3 +531,49 @@ func TestWithdraw(t *testing.T) {
|
||||
t.Errorf("Withdraw failed to be placed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawFiat(t *testing.T) {
|
||||
c.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{
|
||||
Amount: 100,
|
||||
Currency: symbol.USD,
|
||||
BankName: "Federal Reserve Bank",
|
||||
}
|
||||
|
||||
_, err := c.WithdrawFiatFunds(withdrawFiatRequest)
|
||||
if !areTestAPIKeysSet() && err == nil {
|
||||
t.Errorf("Expecting an error when no keys are set: %v", err)
|
||||
}
|
||||
if areTestAPIKeysSet() && err != nil {
|
||||
t.Errorf("Withdraw failed to be placed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawInternationalBank(t *testing.T) {
|
||||
c.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{
|
||||
Amount: 100,
|
||||
Currency: symbol.USD,
|
||||
BankName: "Federal Reserve Bank",
|
||||
}
|
||||
|
||||
_, err := c.WithdrawFiatFundsToInternationalBank(withdrawFiatRequest)
|
||||
if !areTestAPIKeysSet() && err == nil {
|
||||
t.Errorf("Expecting an error when no keys are set: %v", err)
|
||||
}
|
||||
if areTestAPIKeysSet() && err != nil {
|
||||
t.Errorf("Withdraw failed to be placed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package coinbasepro
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
@@ -207,13 +208,34 @@ func (c *CoinbasePro) WithdrawCryptocurrencyFunds(withdrawRequest exchange.Withd
|
||||
// WithdrawFiatFunds returns a withdrawal ID when a withdrawal is
|
||||
// submitted
|
||||
func (c *CoinbasePro) WithdrawFiatFunds(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
paymentMethods, err := c.GetPayMethods()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
selectedWithdrawalMethod := PaymentMethod{}
|
||||
for _, paymentMethod := range paymentMethods {
|
||||
if withdrawRequest.BankName == paymentMethod.Name {
|
||||
selectedWithdrawalMethod = paymentMethod
|
||||
break
|
||||
}
|
||||
}
|
||||
if len(selectedWithdrawalMethod.ID) <= 0 {
|
||||
return "", fmt.Errorf("Could not find payment method '%v'. Check the name via the website and try again", withdrawRequest.BankName)
|
||||
}
|
||||
|
||||
resp, err := c.WithdrawViaPaymentMethod(withdrawRequest.Amount, withdrawRequest.Currency.String(), selectedWithdrawalMethod.ID)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return resp.ID, nil
|
||||
}
|
||||
|
||||
// WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
func (c *CoinbasePro) WithdrawFiatFundsToInternationalBank(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
return c.WithdrawFiatFunds(withdrawRequest)
|
||||
}
|
||||
|
||||
// GetWebsocket returns a pointer to the exchange websocket
|
||||
|
||||
@@ -328,3 +328,35 @@ func TestWithdraw(t *testing.T) {
|
||||
t.Errorf("Expected 'Not supported', recieved %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawFiat(t *testing.T) {
|
||||
c.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := c.WithdrawFiatFunds(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawInternationalBank(t *testing.T) {
|
||||
c.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := c.WithdrawFiatFundsToInternationalBank(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,25 +100,42 @@ type OrderCancellation struct {
|
||||
|
||||
// WithdrawRequest used for wrapper crypto and FIAT withdraw methods
|
||||
type WithdrawRequest struct {
|
||||
// Exchange related information
|
||||
// General withdraw information
|
||||
Description string
|
||||
OneTimePassword int64
|
||||
AccountID string
|
||||
PIN int64
|
||||
TradePassword string
|
||||
Amount float64
|
||||
Currency pair.CurrencyItem
|
||||
// Crypto related information
|
||||
Currency pair.CurrencyItem
|
||||
Address string
|
||||
AddressTag string
|
||||
Amount float64
|
||||
FeeAmount float64
|
||||
// FIAT related information
|
||||
BankName string
|
||||
BankAddress string
|
||||
BankCity string
|
||||
BankCountry string
|
||||
SwiftCode string
|
||||
WireCurrency string
|
||||
BankAccountName string
|
||||
BankAccountNumber float64
|
||||
BankName string
|
||||
BankAddress string
|
||||
BankCity string
|
||||
BankCountry string
|
||||
BankPostalCode 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
|
||||
}
|
||||
|
||||
// Definitions for each type of withdrawal method for a given exchange
|
||||
@@ -162,6 +179,8 @@ const (
|
||||
WithdrawFiatViaWebsiteOnly uint32 = (1 << 17)
|
||||
WithdrawCryptoViaWebsiteOnlyText string = "WITHDRAW CRYPTO VIA WEBSITE ONLY"
|
||||
WithdrawFiatViaWebsiteOnlyText string = "WITHDRAW FIAT VIA WEBSITE ONLY"
|
||||
NoFiatWithdrawals uint32 = (1 << 18)
|
||||
NoFiatWithdrawalsText string = "NO FIAT WITHDRAWAL"
|
||||
|
||||
UnknownWithdrawalTypeText string = "UNKNOWN"
|
||||
)
|
||||
@@ -907,6 +926,8 @@ func (e *Base) FormatWithdrawPermissions() string {
|
||||
services = append(services, WithdrawCryptoViaWebsiteOnlyText)
|
||||
case WithdrawFiatViaWebsiteOnly:
|
||||
services = append(services, WithdrawFiatViaWebsiteOnlyText)
|
||||
case NoFiatWithdrawals:
|
||||
services = append(services, NoFiatWithdrawalsText)
|
||||
default:
|
||||
services = append(services, fmt.Sprintf("%s[1<<%v]", UnknownWithdrawalTypeText, i))
|
||||
}
|
||||
|
||||
@@ -901,9 +901,10 @@ func TestFormatWithdrawPermissions(t *testing.T) {
|
||||
WithdrawFiatWithAPIPermission |
|
||||
WithdrawCryptoViaWebsiteOnly |
|
||||
WithdrawFiatViaWebsiteOnly |
|
||||
1<<18
|
||||
NoFiatWithdrawals |
|
||||
1<<19
|
||||
withdrawPermissions := UAC.FormatWithdrawPermissions()
|
||||
if withdrawPermissions != "AUTO WITHDRAW CRYPTO & AUTO WITHDRAW CRYPTO WITH API PERMISSION & AUTO WITHDRAW CRYPTO WITH SETUP & WITHDRAW CRYPTO WITH 2FA & WITHDRAW CRYPTO WITH SMS & WITHDRAW CRYPTO WITH EMAIL & WITHDRAW CRYPTO WITH WEBSITE APPROVAL & WITHDRAW CRYPTO WITH API PERMISSION & AUTO WITHDRAW FIAT & AUTO WITHDRAW FIAT WITH API PERMISSION & AUTO WITHDRAW FIAT WITH SETUP & WITHDRAW FIAT WITH 2FA & WITHDRAW FIAT WITH SMS & WITHDRAW FIAT WITH EMAIL & WITHDRAW FIAT WITH WEBSITE APPROVAL & WITHDRAW FIAT WITH API PERMISSION & WITHDRAW CRYPTO VIA WEBSITE ONLY & WITHDRAW FIAT VIA WEBSITE ONLY & UNKNOWN[1<<18]" {
|
||||
if withdrawPermissions != "AUTO WITHDRAW CRYPTO & AUTO WITHDRAW CRYPTO WITH API PERMISSION & AUTO WITHDRAW CRYPTO WITH SETUP & WITHDRAW CRYPTO WITH 2FA & WITHDRAW CRYPTO WITH SMS & WITHDRAW CRYPTO WITH EMAIL & WITHDRAW CRYPTO WITH WEBSITE APPROVAL & WITHDRAW CRYPTO WITH API PERMISSION & AUTO WITHDRAW FIAT & AUTO WITHDRAW FIAT WITH API PERMISSION & AUTO WITHDRAW FIAT WITH SETUP & WITHDRAW FIAT WITH 2FA & WITHDRAW FIAT WITH SMS & WITHDRAW FIAT WITH EMAIL & WITHDRAW FIAT WITH WEBSITE APPROVAL & WITHDRAW FIAT WITH API PERMISSION & WITHDRAW CRYPTO VIA WEBSITE ONLY & WITHDRAW FIAT VIA WEBSITE ONLY & NO FIAT WITHDRAWAL & UNKNOWN[1<<19]" {
|
||||
t.Errorf("Expected: %s, Received: %s", AutoWithdrawCryptoText+" & "+AutoWithdrawCryptoWithAPIPermissionText, withdrawPermissions)
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ func (e *EXMO) SetDefaults() {
|
||||
e.Enabled = false
|
||||
e.Verbose = false
|
||||
e.RESTPollingDelay = 10
|
||||
e.APIWithdrawPermissions = exchange.AutoWithdrawCryptoWithSetup
|
||||
e.APIWithdrawPermissions = exchange.AutoWithdrawCryptoWithSetup | exchange.NoFiatWithdrawals
|
||||
e.RequestCurrencyPairFormat.Delimiter = "_"
|
||||
e.RequestCurrencyPairFormat.Uppercase = true
|
||||
e.RequestCurrencyPairFormat.Separator = ","
|
||||
|
||||
@@ -3,6 +3,7 @@ package exmo
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/currency/pair"
|
||||
"github.com/thrasher-/gocryptotrader/currency/symbol"
|
||||
exchange "github.com/thrasher-/gocryptotrader/exchanges"
|
||||
@@ -239,7 +240,7 @@ func TestGetFee(t *testing.T) {
|
||||
func TestFormatWithdrawPermissions(t *testing.T) {
|
||||
// Arrange
|
||||
e.SetDefaults()
|
||||
expectedResult := exchange.AutoWithdrawCryptoWithSetupText
|
||||
expectedResult := exchange.AutoWithdrawCryptoWithSetupText + " & " + exchange.NoFiatWithdrawalsText
|
||||
// Act
|
||||
withdrawPermissions := e.FormatWithdrawPermissions()
|
||||
// Assert
|
||||
@@ -367,3 +368,35 @@ func TestWithdraw(t *testing.T) {
|
||||
t.Errorf("Withdraw failed to be placed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawFiat(t *testing.T) {
|
||||
e.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := e.WithdrawFiatFunds(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawInternationalBank(t *testing.T) {
|
||||
e.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := e.WithdrawFiatFundsToInternationalBank(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -264,13 +264,13 @@ func (e *EXMO) WithdrawCryptocurrencyFunds(withdrawRequest exchange.WithdrawRequ
|
||||
// WithdrawFiatFunds returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
func (e *EXMO) WithdrawFiatFunds(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
return "", common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
func (e *EXMO) WithdrawFiatFundsToInternationalBank(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
return "", common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetWebsocket returns a pointer to the exchange websocket
|
||||
|
||||
@@ -49,7 +49,7 @@ func (g *Gateio) SetDefaults() {
|
||||
g.Enabled = false
|
||||
g.Verbose = false
|
||||
g.RESTPollingDelay = 10
|
||||
g.APIWithdrawPermissions = exchange.AutoWithdrawCrypto
|
||||
g.APIWithdrawPermissions = exchange.AutoWithdrawCrypto | exchange.NoFiatWithdrawals
|
||||
g.RequestCurrencyPairFormat.Delimiter = "_"
|
||||
g.RequestCurrencyPairFormat.Uppercase = false
|
||||
g.ConfigCurrencyPairFormat.Delimiter = "_"
|
||||
|
||||
@@ -3,6 +3,7 @@ package gateio
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/config"
|
||||
"github.com/thrasher-/gocryptotrader/currency/pair"
|
||||
"github.com/thrasher-/gocryptotrader/currency/symbol"
|
||||
@@ -241,7 +242,7 @@ func TestGetFee(t *testing.T) {
|
||||
func TestFormatWithdrawPermissions(t *testing.T) {
|
||||
// Arrange
|
||||
g.SetDefaults()
|
||||
expectedResult := exchange.AutoWithdrawCryptoText
|
||||
expectedResult := exchange.AutoWithdrawCryptoText + " & " + exchange.NoFiatWithdrawalsText
|
||||
// Act
|
||||
withdrawPermissions := g.FormatWithdrawPermissions()
|
||||
// Assert
|
||||
@@ -388,3 +389,35 @@ func TestWithdraw(t *testing.T) {
|
||||
t.Errorf("Withdraw failed to be placed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawFiat(t *testing.T) {
|
||||
g.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := g.WithdrawFiatFunds(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawInternationalBank(t *testing.T) {
|
||||
g.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := g.WithdrawFiatFundsToInternationalBank(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -275,13 +275,13 @@ func (g *Gateio) WithdrawCryptocurrencyFunds(withdrawRequest exchange.WithdrawRe
|
||||
// WithdrawFiatFunds returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
func (g *Gateio) WithdrawFiatFunds(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
return "", common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
func (g *Gateio) WithdrawFiatFundsToInternationalBank(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
return "", common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetWebsocket returns a pointer to the exchange websocket
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"net/url"
|
||||
"testing"
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/config"
|
||||
"github.com/thrasher-/gocryptotrader/currency/pair"
|
||||
"github.com/thrasher-/gocryptotrader/currency/symbol"
|
||||
@@ -326,6 +327,9 @@ func TestGetFee(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestFormatWithdrawPermissions(t *testing.T) {
|
||||
TestAddSession(t)
|
||||
TestSetDefaults(t)
|
||||
TestSetup(t)
|
||||
// Arrange
|
||||
expectedResult := exchange.AutoWithdrawCryptoWithAPIPermissionText + " & " + exchange.AutoWithdrawCryptoWithSetupText + " & " + exchange.WithdrawFiatViaWebsiteOnlyText
|
||||
// Act
|
||||
@@ -464,3 +468,37 @@ func TestWithdraw(t *testing.T) {
|
||||
t.Errorf("Withdraw failed to be placed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawFiat(t *testing.T) {
|
||||
TestAddSession(t)
|
||||
TestSetDefaults(t)
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := Session[1].WithdrawFiatFunds(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawInternationalBank(t *testing.T) {
|
||||
TestAddSession(t)
|
||||
TestSetDefaults(t)
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := Session[1].WithdrawFiatFundsToInternationalBank(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,13 +207,13 @@ func (g *Gemini) WithdrawCryptocurrencyFunds(withdrawRequest exchange.WithdrawRe
|
||||
// WithdrawFiatFunds returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
func (g *Gemini) WithdrawFiatFunds(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
return "", common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
func (g *Gemini) WithdrawFiatFundsToInternationalBank(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
return "", common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetWebsocket returns a pointer to the exchange websocket
|
||||
|
||||
@@ -60,7 +60,7 @@ func (h *HitBTC) SetDefaults() {
|
||||
h.Fee = 0
|
||||
h.Verbose = false
|
||||
h.RESTPollingDelay = 10
|
||||
h.APIWithdrawPermissions = exchange.AutoWithdrawCrypto
|
||||
h.APIWithdrawPermissions = exchange.AutoWithdrawCrypto | exchange.NoFiatWithdrawals
|
||||
h.RequestCurrencyPairFormat.Delimiter = ""
|
||||
h.RequestCurrencyPairFormat.Uppercase = true
|
||||
h.ConfigCurrencyPairFormat.Delimiter = "-"
|
||||
|
||||
@@ -3,6 +3,7 @@ package hitbtc
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/config"
|
||||
"github.com/thrasher-/gocryptotrader/currency/pair"
|
||||
"github.com/thrasher-/gocryptotrader/currency/symbol"
|
||||
@@ -166,7 +167,7 @@ func TestGetFee(t *testing.T) {
|
||||
func TestFormatWithdrawPermissions(t *testing.T) {
|
||||
// Arrange
|
||||
h.SetDefaults()
|
||||
expectedResult := exchange.AutoWithdrawCryptoText
|
||||
expectedResult := exchange.AutoWithdrawCryptoText + " & " + exchange.NoFiatWithdrawalsText
|
||||
// Act
|
||||
withdrawPermissions := h.FormatWithdrawPermissions()
|
||||
// Assert
|
||||
@@ -299,3 +300,35 @@ func TestWithdraw(t *testing.T) {
|
||||
t.Errorf("Withdraw failed to be placed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawFiat(t *testing.T) {
|
||||
h.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := h.WithdrawFiatFunds(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawInternationalBank(t *testing.T) {
|
||||
h.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := h.WithdrawFiatFundsToInternationalBank(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,13 +230,13 @@ func (h *HitBTC) WithdrawCryptocurrencyFunds(withdrawRequest exchange.WithdrawRe
|
||||
// WithdrawFiatFunds returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
func (h *HitBTC) WithdrawFiatFunds(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
return "", common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
func (h *HitBTC) WithdrawFiatFundsToInternationalBank(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
return "", common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetWebsocket returns a pointer to the exchange websocket
|
||||
|
||||
@@ -77,7 +77,7 @@ func (h *HUOBI) SetDefaults() {
|
||||
h.Fee = 0
|
||||
h.Verbose = false
|
||||
h.RESTPollingDelay = 10
|
||||
h.APIWithdrawPermissions = exchange.AutoWithdrawCryptoWithSetup
|
||||
h.APIWithdrawPermissions = exchange.AutoWithdrawCryptoWithSetup | exchange.NoFiatWithdrawals
|
||||
h.RequestCurrencyPairFormat.Delimiter = ""
|
||||
h.RequestCurrencyPairFormat.Uppercase = false
|
||||
h.ConfigCurrencyPairFormat.Delimiter = "-"
|
||||
|
||||
@@ -387,7 +387,7 @@ func TestGetFee(t *testing.T) {
|
||||
func TestFormatWithdrawPermissions(t *testing.T) {
|
||||
// Arrange
|
||||
h.SetDefaults()
|
||||
expectedResult := exchange.AutoWithdrawCryptoWithSetupText
|
||||
expectedResult := exchange.AutoWithdrawCryptoWithSetupText + " & " + exchange.NoFiatWithdrawalsText
|
||||
// Act
|
||||
withdrawPermissions := h.FormatWithdrawPermissions()
|
||||
// Assert
|
||||
@@ -542,3 +542,35 @@ func TestWithdraw(t *testing.T) {
|
||||
t.Errorf("Withdraw failed to be placed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawFiat(t *testing.T) {
|
||||
h.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := h.WithdrawFiatFunds(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawInternationalBank(t *testing.T) {
|
||||
h.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := h.WithdrawFiatFundsToInternationalBank(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -344,13 +344,13 @@ func (h *HUOBI) WithdrawCryptocurrencyFunds(withdrawRequest exchange.WithdrawReq
|
||||
// WithdrawFiatFunds returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
func (h *HUOBI) WithdrawFiatFunds(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
return "", common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
func (h *HUOBI) WithdrawFiatFundsToInternationalBank(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
return "", common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetWebsocket returns a pointer to the exchange websocket
|
||||
|
||||
@@ -69,7 +69,7 @@ func (h *HUOBIHADAX) SetDefaults() {
|
||||
h.Fee = 0
|
||||
h.Verbose = false
|
||||
h.RESTPollingDelay = 10
|
||||
h.APIWithdrawPermissions = exchange.AutoWithdrawCryptoWithSetup
|
||||
h.APIWithdrawPermissions = exchange.AutoWithdrawCryptoWithSetup | exchange.NoFiatWithdrawals
|
||||
h.RequestCurrencyPairFormat.Delimiter = ""
|
||||
h.RequestCurrencyPairFormat.Uppercase = false
|
||||
h.ConfigCurrencyPairFormat.Delimiter = "-"
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"strconv"
|
||||
"testing"
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/config"
|
||||
"github.com/thrasher-/gocryptotrader/currency/pair"
|
||||
"github.com/thrasher-/gocryptotrader/currency/symbol"
|
||||
@@ -366,7 +367,7 @@ func TestGetFee(t *testing.T) {
|
||||
func TestFormatWithdrawPermissions(t *testing.T) {
|
||||
// Arrange
|
||||
h.SetDefaults()
|
||||
expectedResult := exchange.AutoWithdrawCryptoWithSetupText
|
||||
expectedResult := exchange.AutoWithdrawCryptoWithSetupText + " & " + exchange.NoFiatWithdrawalsText
|
||||
// Act
|
||||
withdrawPermissions := h.FormatWithdrawPermissions()
|
||||
// Assert
|
||||
@@ -525,3 +526,35 @@ func TestWithdraw(t *testing.T) {
|
||||
t.Errorf("Withdraw failed to be placed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawFiat(t *testing.T) {
|
||||
h.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := h.WithdrawFiatFunds(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawInternationalBank(t *testing.T) {
|
||||
h.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := h.WithdrawFiatFundsToInternationalBank(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -309,13 +309,13 @@ func (h *HUOBIHADAX) WithdrawCryptocurrencyFunds(withdrawRequest exchange.Withdr
|
||||
// WithdrawFiatFunds returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
func (h *HUOBIHADAX) WithdrawFiatFunds(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
return "", common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
func (h *HUOBIHADAX) WithdrawFiatFundsToInternationalBank(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
return "", common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetWebsocket returns a pointer to the exchange websocket
|
||||
|
||||
@@ -374,3 +374,35 @@ func TestWithdraw(t *testing.T) {
|
||||
t.Errorf("Expected 'Not supported', recieved %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawFiat(t *testing.T) {
|
||||
i.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := i.WithdrawFiatFunds(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawInternationalBank(t *testing.T) {
|
||||
i.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := i.WithdrawFiatFundsToInternationalBank(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -469,3 +469,53 @@ func TestWithdraw(t *testing.T) {
|
||||
t.Errorf("Withdraw failed to be placed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawFiat(t *testing.T) {
|
||||
k.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{
|
||||
Amount: 100,
|
||||
Currency: symbol.EUR,
|
||||
Address: "",
|
||||
Description: "donation",
|
||||
TradePassword: "someBank",
|
||||
}
|
||||
|
||||
_, err := k.WithdrawFiatFunds(withdrawFiatRequest)
|
||||
if !areTestAPIKeysSet() && err == nil {
|
||||
t.Errorf("Expecting an error when no keys are set: %v", err)
|
||||
}
|
||||
if areTestAPIKeysSet() && err != nil {
|
||||
t.Errorf("Withdraw failed to be placed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawInternationalBank(t *testing.T) {
|
||||
k.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{
|
||||
Amount: 100,
|
||||
Currency: symbol.EUR,
|
||||
Address: "",
|
||||
Description: "donation",
|
||||
TradePassword: "someBank",
|
||||
}
|
||||
|
||||
_, err := k.WithdrawFiatFundsToInternationalBank(withdrawFiatRequest)
|
||||
if !areTestAPIKeysSet() && err == nil {
|
||||
t.Errorf("Expecting an error when no keys are set: %v", err)
|
||||
}
|
||||
if areTestAPIKeysSet() && err != nil {
|
||||
t.Errorf("Withdraw failed to be placed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,13 +249,13 @@ func (k *Kraken) WithdrawCryptocurrencyFunds(withdrawRequest exchange.WithdrawRe
|
||||
// WithdrawFiatFunds returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
func (k *Kraken) WithdrawFiatFunds(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
return k.WithdrawCryptocurrencyFunds(withdrawRequest)
|
||||
}
|
||||
|
||||
// WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
func (k *Kraken) WithdrawFiatFundsToInternationalBank(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
return k.WithdrawCryptocurrencyFunds(withdrawRequest)
|
||||
}
|
||||
|
||||
// GetWebsocket returns a pointer to the exchange websocket
|
||||
|
||||
@@ -3,6 +3,7 @@ package lakebtc
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/config"
|
||||
"github.com/thrasher-/gocryptotrader/currency/pair"
|
||||
"github.com/thrasher-/gocryptotrader/currency/symbol"
|
||||
@@ -361,3 +362,35 @@ func TestWithdraw(t *testing.T) {
|
||||
t.Errorf("Withdraw failed to be placed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawFiat(t *testing.T) {
|
||||
l.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := l.WithdrawFiatFunds(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawInternationalBank(t *testing.T) {
|
||||
l.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := l.WithdrawFiatFundsToInternationalBank(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,13 +223,13 @@ func (l *LakeBTC) WithdrawCryptocurrencyFunds(withdrawRequest exchange.WithdrawR
|
||||
// WithdrawFiatFunds returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
func (l *LakeBTC) WithdrawFiatFunds(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
return "", common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
func (l *LakeBTC) WithdrawFiatFundsToInternationalBank(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
return "", common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetWebsocket returns a pointer to the exchange websocket
|
||||
|
||||
@@ -52,7 +52,7 @@ func (l *Liqui) SetDefaults() {
|
||||
l.Verbose = false
|
||||
l.RESTPollingDelay = 10
|
||||
l.Ticker = make(map[string]Ticker)
|
||||
l.APIWithdrawPermissions = exchange.NoAPIWithdrawalMethods
|
||||
l.APIWithdrawPermissions = exchange.WithdrawCryptoWithAPIPermission | exchange.NoFiatWithdrawals
|
||||
l.RequestCurrencyPairFormat.Delimiter = "_"
|
||||
l.RequestCurrencyPairFormat.Uppercase = false
|
||||
l.RequestCurrencyPairFormat.Separator = "-"
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"net/url"
|
||||
"testing"
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/config"
|
||||
"github.com/thrasher-/gocryptotrader/currency/pair"
|
||||
"github.com/thrasher-/gocryptotrader/currency/symbol"
|
||||
@@ -224,7 +225,7 @@ func TestGetFee(t *testing.T) {
|
||||
func TestFormatWithdrawPermissions(t *testing.T) {
|
||||
// Arrange
|
||||
l.SetDefaults()
|
||||
expectedResult := exchange.NoAPIWithdrawalMethodsText
|
||||
expectedResult := exchange.WithdrawCryptoWithAPIPermissionText + " & " + exchange.NoFiatWithdrawalsText
|
||||
// Act
|
||||
withdrawPermissions := l.FormatWithdrawPermissions()
|
||||
// Assert
|
||||
@@ -352,3 +353,35 @@ func TestWithdraw(t *testing.T) {
|
||||
t.Errorf("Withdraw failed to be placed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawFiat(t *testing.T) {
|
||||
l.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := l.WithdrawFiatFunds(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawInternationalBank(t *testing.T) {
|
||||
l.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := l.WithdrawFiatFundsToInternationalBank(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ func (l *LocalBitcoins) SetDefaults() {
|
||||
l.Verbose = false
|
||||
l.Verbose = false
|
||||
l.RESTPollingDelay = 10
|
||||
l.APIWithdrawPermissions = exchange.WithdrawCryptoViaWebsiteOnly
|
||||
l.APIWithdrawPermissions = exchange.AutoWithdrawCrypto | exchange.WithdrawFiatViaWebsiteOnly
|
||||
l.RequestCurrencyPairFormat.Delimiter = ""
|
||||
l.RequestCurrencyPairFormat.Uppercase = true
|
||||
l.ConfigCurrencyPairFormat.Delimiter = ""
|
||||
|
||||
@@ -3,6 +3,7 @@ package localbitcoins
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/config"
|
||||
"github.com/thrasher-/gocryptotrader/currency/pair"
|
||||
"github.com/thrasher-/gocryptotrader/currency/symbol"
|
||||
@@ -189,7 +190,7 @@ func TestGetFee(t *testing.T) {
|
||||
func TestFormatWithdrawPermissions(t *testing.T) {
|
||||
// Arrange
|
||||
l.SetDefaults()
|
||||
expectedResult := exchange.WithdrawCryptoViaWebsiteOnlyText
|
||||
expectedResult := exchange.AutoWithdrawCryptoText + " & " + exchange.WithdrawFiatViaWebsiteOnlyText
|
||||
// Act
|
||||
withdrawPermissions := l.FormatWithdrawPermissions()
|
||||
// Assert
|
||||
@@ -322,3 +323,35 @@ func TestWithdraw(t *testing.T) {
|
||||
t.Errorf("Withdraw failed to be placed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawFiat(t *testing.T) {
|
||||
l.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := l.WithdrawFiatFunds(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawInternationalBank(t *testing.T) {
|
||||
l.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := l.WithdrawFiatFundsToInternationalBank(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,13 +260,13 @@ func (l *LocalBitcoins) WithdrawCryptocurrencyFunds(withdrawRequest exchange.Wit
|
||||
// WithdrawFiatFunds returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
func (l *LocalBitcoins) WithdrawFiatFunds(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
return "", common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
func (l *LocalBitcoins) WithdrawFiatFundsToInternationalBank(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
return "", common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetWebsocket returns a pointer to the exchange websocket
|
||||
|
||||
@@ -3,6 +3,7 @@ package okcoin
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/config"
|
||||
"github.com/thrasher-/gocryptotrader/currency/pair"
|
||||
"github.com/thrasher-/gocryptotrader/currency/symbol"
|
||||
@@ -272,3 +273,35 @@ func TestWithdraw(t *testing.T) {
|
||||
t.Errorf("Withdraw failed to be placed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawFiat(t *testing.T) {
|
||||
o.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := o.WithdrawFiatFunds(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawInternationalBank(t *testing.T) {
|
||||
o.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := o.WithdrawFiatFundsToInternationalBank(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -299,13 +299,13 @@ func (o *OKCoin) WithdrawCryptocurrencyFunds(withdrawRequest exchange.WithdrawRe
|
||||
// WithdrawFiatFunds returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
func (o *OKCoin) WithdrawFiatFunds(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
return "", common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
func (o *OKCoin) WithdrawFiatFundsToInternationalBank(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
return "", common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetWebsocket returns a pointer to the exchange websocket
|
||||
|
||||
@@ -106,7 +106,7 @@ func (o *OKEX) SetDefaults() {
|
||||
o.Enabled = false
|
||||
o.Verbose = false
|
||||
o.RESTPollingDelay = 10
|
||||
o.APIWithdrawPermissions = exchange.AutoWithdrawCrypto
|
||||
o.APIWithdrawPermissions = exchange.AutoWithdrawCrypto | exchange.NoFiatWithdrawals
|
||||
o.RequestCurrencyPairFormat.Delimiter = "_"
|
||||
o.RequestCurrencyPairFormat.Uppercase = false
|
||||
o.ConfigCurrencyPairFormat.Delimiter = "_"
|
||||
|
||||
@@ -3,6 +3,7 @@ package okex
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/config"
|
||||
"github.com/thrasher-/gocryptotrader/currency/pair"
|
||||
"github.com/thrasher-/gocryptotrader/currency/symbol"
|
||||
@@ -388,7 +389,7 @@ func TestGetFee(t *testing.T) {
|
||||
func TestFormatWithdrawPermissions(t *testing.T) {
|
||||
// Arrange
|
||||
o.SetDefaults()
|
||||
expectedResult := exchange.AutoWithdrawCryptoText
|
||||
expectedResult := exchange.AutoWithdrawCryptoText + " & " + exchange.NoFiatWithdrawalsText
|
||||
// Act
|
||||
withdrawPermissions := o.FormatWithdrawPermissions()
|
||||
// Assert
|
||||
@@ -537,3 +538,35 @@ func TestWithdraw(t *testing.T) {
|
||||
t.Errorf("Withdraw failed to be placed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawFiat(t *testing.T) {
|
||||
o.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := o.WithdrawFiatFunds(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawInternationalBank(t *testing.T) {
|
||||
o.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := o.WithdrawFiatFundsToInternationalBank(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -297,13 +297,13 @@ func (o *OKEX) WithdrawCryptocurrencyFunds(withdrawRequest exchange.WithdrawRequ
|
||||
// WithdrawFiatFunds returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
func (o *OKEX) WithdrawFiatFunds(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
return "", common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
func (o *OKEX) WithdrawFiatFundsToInternationalBank(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
return "", common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetWebsocket returns a pointer to the exchange websocket
|
||||
|
||||
@@ -66,7 +66,7 @@ func (p *Poloniex) SetDefaults() {
|
||||
p.Fee = 0
|
||||
p.Verbose = false
|
||||
p.RESTPollingDelay = 10
|
||||
p.APIWithdrawPermissions = exchange.AutoWithdrawCryptoWithAPIPermission
|
||||
p.APIWithdrawPermissions = exchange.AutoWithdrawCryptoWithAPIPermission | exchange.NoFiatWithdrawals
|
||||
p.RequestCurrencyPairFormat.Delimiter = "_"
|
||||
p.RequestCurrencyPairFormat.Uppercase = true
|
||||
p.ConfigCurrencyPairFormat.Delimiter = "_"
|
||||
|
||||
@@ -3,6 +3,7 @@ package poloniex
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/config"
|
||||
"github.com/thrasher-/gocryptotrader/currency/pair"
|
||||
"github.com/thrasher-/gocryptotrader/currency/symbol"
|
||||
@@ -184,7 +185,7 @@ func TestGetFee(t *testing.T) {
|
||||
func TestFormatWithdrawPermissions(t *testing.T) {
|
||||
// Arrange
|
||||
p.SetDefaults()
|
||||
expectedResult := exchange.AutoWithdrawCryptoWithAPIPermissionText
|
||||
expectedResult := exchange.AutoWithdrawCryptoWithAPIPermissionText + " & " + exchange.NoFiatWithdrawalsText
|
||||
// Act
|
||||
withdrawPermissions := p.FormatWithdrawPermissions()
|
||||
// Assert
|
||||
@@ -317,3 +318,35 @@ func TestWithdraw(t *testing.T) {
|
||||
t.Errorf("Withdraw failed to be placed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawFiat(t *testing.T) {
|
||||
p.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := p.WithdrawFiatFunds(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawInternationalBank(t *testing.T) {
|
||||
p.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := p.WithdrawFiatFundsToInternationalBank(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,13 +249,13 @@ func (p *Poloniex) WithdrawCryptocurrencyFunds(withdrawRequest exchange.Withdraw
|
||||
// WithdrawFiatFunds returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
func (p *Poloniex) WithdrawFiatFunds(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
return "", common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
func (p *Poloniex) WithdrawFiatFundsToInternationalBank(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
return "", common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetWebsocket returns a pointer to the exchange websocket
|
||||
|
||||
@@ -56,7 +56,7 @@ func (w *WEX) SetDefaults() {
|
||||
w.Verbose = false
|
||||
w.RESTPollingDelay = 10
|
||||
w.Ticker = make(map[string]Ticker)
|
||||
w.APIWithdrawPermissions = exchange.AutoWithdrawCryptoWithAPIPermission
|
||||
w.APIWithdrawPermissions = exchange.AutoWithdrawCryptoWithAPIPermission | exchange.NoFiatWithdrawals
|
||||
w.RequestCurrencyPairFormat.Delimiter = "_"
|
||||
w.RequestCurrencyPairFormat.Uppercase = false
|
||||
w.RequestCurrencyPairFormat.Separator = "-"
|
||||
|
||||
@@ -3,6 +3,7 @@ package wex
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/config"
|
||||
"github.com/thrasher-/gocryptotrader/currency/pair"
|
||||
"github.com/thrasher-/gocryptotrader/currency/symbol"
|
||||
@@ -314,7 +315,7 @@ func TestFormatWithdrawPermissions(t *testing.T) {
|
||||
}
|
||||
// Arrange
|
||||
w.SetDefaults()
|
||||
expectedResult := exchange.AutoWithdrawCryptoWithAPIPermissionText
|
||||
expectedResult := exchange.AutoWithdrawCryptoWithAPIPermissionText + " & " + exchange.NoFiatWithdrawalsText
|
||||
// Act
|
||||
withdrawPermissions := w.FormatWithdrawPermissions()
|
||||
// Assert
|
||||
@@ -456,3 +457,35 @@ func TestWithdraw(t *testing.T) {
|
||||
t.Errorf("Withdraw failed to be placed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawFiat(t *testing.T) {
|
||||
w.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := w.WithdrawFiatFunds(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawInternationalBank(t *testing.T) {
|
||||
w.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := w.WithdrawFiatFundsToInternationalBank(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,13 +246,13 @@ func (w *WEX) WithdrawCryptocurrencyFunds(withdrawRequest exchange.WithdrawReque
|
||||
// WithdrawFiatFunds returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
func (w *WEX) WithdrawFiatFunds(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
return "", common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
func (w *WEX) WithdrawFiatFundsToInternationalBank(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
return "", common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetWebsocket returns a pointer to the exchange websocket
|
||||
|
||||
@@ -3,6 +3,7 @@ package yobit
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/config"
|
||||
"github.com/thrasher-/gocryptotrader/currency/pair"
|
||||
"github.com/thrasher-/gocryptotrader/currency/symbol"
|
||||
@@ -436,3 +437,35 @@ func TestWithdraw(t *testing.T) {
|
||||
t.Errorf("Withdraw failed to be placed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawFiat(t *testing.T) {
|
||||
y.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := y.WithdrawFiatFunds(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawInternationalBank(t *testing.T) {
|
||||
y.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := y.WithdrawFiatFundsToInternationalBank(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,13 +234,13 @@ func (y *Yobit) WithdrawCryptocurrencyFunds(withdrawRequest exchange.WithdrawReq
|
||||
// WithdrawFiatFunds returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
func (y *Yobit) WithdrawFiatFunds(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
return "", common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
func (y *Yobit) WithdrawFiatFundsToInternationalBank(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
return "", common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetWebsocket returns a pointer to the exchange websocket
|
||||
|
||||
@@ -51,7 +51,7 @@ func (z *ZB) SetDefaults() {
|
||||
z.Fee = 0
|
||||
z.Verbose = false
|
||||
z.RESTPollingDelay = 10
|
||||
z.APIWithdrawPermissions = exchange.AutoWithdrawCrypto
|
||||
z.APIWithdrawPermissions = exchange.AutoWithdrawCrypto | exchange.NoFiatWithdrawals
|
||||
z.RequestCurrencyPairFormat.Delimiter = "_"
|
||||
z.RequestCurrencyPairFormat.Uppercase = false
|
||||
z.ConfigCurrencyPairFormat.Delimiter = "_"
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/config"
|
||||
"github.com/thrasher-/gocryptotrader/currency/pair"
|
||||
"github.com/thrasher-/gocryptotrader/currency/symbol"
|
||||
@@ -221,7 +222,7 @@ func TestGetFee(t *testing.T) {
|
||||
func TestFormatWithdrawPermissions(t *testing.T) {
|
||||
// Arrange
|
||||
z.SetDefaults()
|
||||
expectedResult := exchange.AutoWithdrawCryptoText
|
||||
expectedResult := exchange.AutoWithdrawCryptoText + " & " + exchange.NoFiatWithdrawalsText
|
||||
// Act
|
||||
withdrawPermissions := z.FormatWithdrawPermissions()
|
||||
// Assert
|
||||
@@ -368,3 +369,35 @@ func TestWithdraw(t *testing.T) {
|
||||
t.Errorf("Withdraw failed to be placed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawFiat(t *testing.T) {
|
||||
z.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := z.WithdrawFiatFunds(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithdrawInternationalBank(t *testing.T) {
|
||||
z.SetDefaults()
|
||||
TestSetup(t)
|
||||
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
var withdrawFiatRequest = exchange.WithdrawRequest{}
|
||||
|
||||
_, err := z.WithdrawFiatFundsToInternationalBank(withdrawFiatRequest)
|
||||
if err != common.ErrFunctionNotSupported {
|
||||
t.Errorf("Expected '%v', recieved: '%v'", common.ErrFunctionNotSupported, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -256,13 +256,13 @@ func (z *ZB) WithdrawCryptocurrencyFunds(withdrawRequest exchange.WithdrawReques
|
||||
// WithdrawFiatFunds returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
func (z *ZB) WithdrawFiatFunds(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
return "", common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a
|
||||
// withdrawal is submitted
|
||||
func (z *ZB) WithdrawFiatFundsToInternationalBank(withdrawRequest exchange.WithdrawRequest) (string, error) {
|
||||
return "", common.ErrNotYetImplemented
|
||||
return "", common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetWebsocket returns a pointer to the exchange websocket
|
||||
|
||||
Reference in New Issue
Block a user