mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 23:16:45 +00:00
* Added TimeInForce type and updated related files * Linter issue fix and minor coinbasepro type update * Bitrex consts update * added unit test and minor changes in bittrex * Unit tests update * Fix minor linter issues * Update TestStringToTimeInForce unit test * Exchange test template change * A different approach * fix conflict with gateio timeInForce * minor exchange template update * Minor fix to test_files template * Update order tests * Complete updating the order unit tests * Updating exchange wrapper and test template files * update kucoin and deribit wrapper to match the time in force change * minor comment update * fix time-in-force related test errors * linter issue fix * ADD_NEW_EXCHANGE documentation update * time in force constants, functions and unit tests update * shift tif policies to TimeInForce * Update time-in-force, related functions, and unit tests * fix linter issue and time-in-force processing * added a good till crossing tif value * order type fix and fix related tim-in-force entries * update time-in-force unmarshaling and unit test * consistency guideline added * fix time-in-force error in gateio * linter issue fix * update based on review comments * add unit test and fix missing issues * minor fix and added benchmark unit test * change GTT to GTC for limit * fix linter issue * added time-in-force value to place order param * fix minor issues based on review comment and move tif code to separate files * update on exchanges linked to time-in-force * resolve missing review comments * minor linter issues fix * added time-in-force handler and update timeInForce parametered endpoint * minor fixes based on review * nits fix * update based on review * linter fix * rm getTimeInForce func and minor change to time-in-force * minor change * update based on review comments * wrappers and time-in-force calling approach * minor change * update gateio string to timeInForce conversion and unit test * update exchange template * update wrapper template file * policy comments, and template files update * rename all exchange types name to Exchange * update on template files and template generation * templates and generation code and other updates * linter issue fix * added subscriptions and websocket templates * update ADD_NEW_EXCHANGE.md with recent binance functions and implementations * rename template files and update unit tests * minor template and unit test fix * rename templates and fix on unit tests * update on template files and documentation * removed unnecessary tag fix and update templates * fix Add_NEW_EXCHANGE.md doc file * formatting, comments, and error checks update on template files * rename exchange receivers to e and ex for consistency * rename unit test exchange receiver and minor updates * linter issues fix * fix deribit issue and minor style update * fix test issues caused by receiver change * raname local variables exchange declaration variables * update templates comments * update templates and related comments * renamed ex to e * update template comments * toggle WS to false to improve coverage * template comments update * added test coverage to Ws enabled and minor changes --------- Co-authored-by: Samuel Reid <43227667+cranktakular@users.noreply.github.com>
546 lines
16 KiB
Go
546 lines
16 KiB
Go
package alphapoint
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/thrasher-corp/gocryptotrader/common"
|
|
"github.com/thrasher-corp/gocryptotrader/currency"
|
|
"github.com/thrasher-corp/gocryptotrader/encoding/json"
|
|
exchange "github.com/thrasher-corp/gocryptotrader/exchanges"
|
|
"github.com/thrasher-corp/gocryptotrader/exchanges/asset"
|
|
"github.com/thrasher-corp/gocryptotrader/exchanges/order"
|
|
"github.com/thrasher-corp/gocryptotrader/exchanges/sharedtestvalues"
|
|
"github.com/thrasher-corp/gocryptotrader/portfolio/withdraw"
|
|
)
|
|
|
|
const (
|
|
onlineTest = false
|
|
apiKey = ""
|
|
apiSecret = ""
|
|
canManipulateRealOrders = false
|
|
)
|
|
|
|
var e = &Exchange{}
|
|
|
|
func TestMain(m *testing.M) {
|
|
e = new(Exchange)
|
|
e.SetDefaults()
|
|
|
|
if apiKey != "" && apiSecret != "" {
|
|
e.API.AuthenticatedSupport = true
|
|
e.SetCredentials(apiKey, apiSecret, "", "", "", "")
|
|
}
|
|
|
|
os.Exit(m.Run())
|
|
}
|
|
|
|
func TestGetTicker(t *testing.T) {
|
|
t.Parallel()
|
|
var ticker Ticker
|
|
var err error
|
|
if onlineTest {
|
|
ticker, err = e.GetTicker(t.Context(), "BTCUSD")
|
|
if err != nil {
|
|
t.Fatal("Alphapoint GetTicker init error: ", err)
|
|
}
|
|
|
|
_, err = e.GetTicker(t.Context(), "wigwham")
|
|
if err == nil {
|
|
t.Error("Alphapoint GetTicker Expected error")
|
|
}
|
|
} else {
|
|
mockResp := []byte(
|
|
string(`{"high":253.101,"last":249.76,"bid":248.8901,"volume":5.813354,"low":231.21,"ask":248.9012,"Total24HrQtyTraded":52.654968,"Total24HrProduct2Traded":569.05762,"Total24HrNumTrades":4,"sellOrderCount":7,"buyOrderCount":11,"numOfCreateOrders":0,"isAccepted":true}`),
|
|
)
|
|
|
|
err = json.Unmarshal(mockResp, &ticker)
|
|
if err != nil {
|
|
t.Fatal("Alphapoint GetTicker unmarshalling error: ", err)
|
|
}
|
|
|
|
if ticker.Last != 249.76 {
|
|
t.Error("Alphapoint GetTicker expected last = 249.76")
|
|
}
|
|
}
|
|
|
|
if ticker.Last < 0 {
|
|
t.Error("Alphapoint GetTicker last < 0")
|
|
}
|
|
}
|
|
|
|
func TestGetTrades(t *testing.T) {
|
|
t.Parallel()
|
|
var trades Trades
|
|
var err error
|
|
if onlineTest {
|
|
trades, err = e.GetTrades(t.Context(), "BTCUSD", 0, 10)
|
|
if err != nil {
|
|
t.Fatalf("Init error: %s", err)
|
|
}
|
|
|
|
_, err = e.GetTrades(t.Context(), "wigwham", 0, 10)
|
|
if err == nil {
|
|
t.Fatal("GetTrades Expected error")
|
|
}
|
|
} else {
|
|
mockResp := []byte(
|
|
string(`{"isAccepted":true,"dateTimeUtc":635507981548085938,"ins":"BTCUSD","startIndex":0,"count":10,"trades":[{"tid":0,"px":231.8379,"qty":4.913,"unixtime":1399951989,"utcticks":635355487898355234,"incomingOrderSide":0,"incomingServerOrderId":2598,"bookServerOrderId":2588},{"tid":1,"px":7895.1487,"qty":0.25,"unixtime":1403143708,"utcticks":635387405087297421,"incomingOrderSide":0,"incomingServerOrderId":284241,"bookServerOrderId":284235},{"tid":2,"px":7935.058,"qty":0.25,"unixtime":1403195348,"utcticks":635387921488684140,"incomingOrderSide":0,"incomingServerOrderId":575845,"bookServerOrderId":574078},{"tid":3,"px":7935.0448,"qty":0.25,"unixtime":1403195378,"utcticks":635387921780090390,"incomingOrderSide":0,"incomingServerOrderId":576028,"bookServerOrderId":575946},{"tid":4,"px":7933.9566,"qty":0.1168,"unixtime":1403195510,"utcticks":635387923108371640,"incomingOrderSide":0,"incomingServerOrderId":576974,"bookServerOrderId":576947},{"tid":5,"px":7961.0856,"qty":0.25,"unixtime":1403202307,"utcticks":635387991073850156,"incomingOrderSide":0,"incomingServerOrderId":600547,"bookServerOrderId":600338},{"tid":6,"px":7961.1388,"qty":0.011,"unixtime":1403202307,"utcticks":635387991073850156,"incomingOrderSide":0,"incomingServerOrderId":600547,"bookServerOrderId":600418},{"tid":7,"px":7961.2451,"qty":0.02,"unixtime":1403202307,"utcticks":635387991073850156,"incomingOrderSide":0,"incomingServerOrderId":600547,"bookServerOrderId":600428},{"tid":8,"px":7947.1437,"qty":0.09,"unixtime":1403202749,"utcticks":635387995498225156,"incomingOrderSide":0,"incomingServerOrderId":602183,"bookServerOrderId":601745},{"tid":9,"px":7818.5073,"qty":0.25,"unixtime":1403219720,"utcticks":635388165206506406,"incomingOrderSide":0,"incomingServerOrderId":661909,"bookServerOrderId":661620}]}`),
|
|
)
|
|
|
|
err = json.Unmarshal(mockResp, &trades)
|
|
if err != nil {
|
|
t.Fatal("GetTrades unmarshalling error: ", err)
|
|
}
|
|
}
|
|
|
|
if !trades.IsAccepted {
|
|
t.Error("GetTrades IsAccepted failed")
|
|
}
|
|
|
|
if trades.Count <= 0 {
|
|
t.Error("GetTrades trades count is <= 0")
|
|
}
|
|
|
|
if trades.Instrument != "BTCUSD" {
|
|
t.Error("GetTrades instrument is != BTCUSD")
|
|
}
|
|
}
|
|
|
|
func TestGetOrderbook(t *testing.T) {
|
|
t.Parallel()
|
|
var orderBook Orderbook
|
|
var err error
|
|
if onlineTest {
|
|
orderBook, err = e.GetOrderbook(t.Context(), "BTCUSD")
|
|
if err != nil {
|
|
t.Errorf("Init error: %s", err)
|
|
}
|
|
|
|
_, err = e.GetOrderbook(t.Context(), "wigwham")
|
|
if err == nil {
|
|
t.Error("GetOrderbook() Expected error")
|
|
}
|
|
} else {
|
|
mockResp := []byte(
|
|
string(`{"bids":[{"qty":725,"px":66},{"qty":1289,"px":65},{"qty":1266,"px":64}],"asks":[{"qty":1,"px":67},{"qty":1,"px":69},{"qty":2,"px":70}],"isAccepted":true}`),
|
|
)
|
|
|
|
err = json.Unmarshal(mockResp, &orderBook)
|
|
if err != nil {
|
|
t.Fatal("TestGetOrderbook unmarshalling error: ", err)
|
|
}
|
|
|
|
if orderBook.Bids[0].Quantity != 725 {
|
|
t.Error("TestGetOrderbook Bids[0].Quantity != 725")
|
|
}
|
|
}
|
|
|
|
if !orderBook.IsAccepted {
|
|
t.Error("Alphapoint orderBook.IsAccepted value is negative")
|
|
}
|
|
|
|
if len(orderBook.Asks) == 0 {
|
|
t.Error("Alphapoint orderBook.Asks has len 0")
|
|
}
|
|
|
|
if len(orderBook.Bids) == 0 {
|
|
t.Error("Alphapoint orderBook.Bids has len 0")
|
|
}
|
|
}
|
|
|
|
func TestGetProductPairs(t *testing.T) {
|
|
t.Parallel()
|
|
var products ProductPairs
|
|
var err error
|
|
|
|
if onlineTest {
|
|
products, err = e.GetProductPairs(t.Context())
|
|
if err != nil {
|
|
t.Errorf("Init error: %s", err)
|
|
}
|
|
} else {
|
|
mockResp := []byte(
|
|
string(`{"productPairs":[{"name":"LTCUSD","productPairCode":100,"product1Label":"LTC","product1DecimalPlaces":8,"product2Label":"USD","product2DecimalPlaces":6}, {"name":"BTCUSD","productPairCode":99,"product1Label":"BTC","product1DecimalPlaces":8,"product2Label":"USD","product2DecimalPlaces":6}],"isAccepted":true}`),
|
|
)
|
|
|
|
err = json.Unmarshal(mockResp, &products)
|
|
if err != nil {
|
|
t.Fatal("TestGetProductPairs unmarshalling error: ", err)
|
|
}
|
|
|
|
if products.ProductPairs[0].Name != "LTCUSD" {
|
|
t.Error("Alphapoint ProductPairs 0 != LTCUSD")
|
|
}
|
|
|
|
if products.ProductPairs[1].Product1Label != "BTC" {
|
|
t.Error("Alphapoint ProductPairs 1 != BTC")
|
|
}
|
|
}
|
|
|
|
if !products.IsAccepted {
|
|
t.Error("Alphapoint ProductPairs.IsAccepted value is negative")
|
|
}
|
|
|
|
if len(products.ProductPairs) == 0 {
|
|
t.Error("Alphapoint ProductPairs len is 0")
|
|
}
|
|
}
|
|
|
|
func TestGetProducts(t *testing.T) {
|
|
t.Parallel()
|
|
var products Products
|
|
var err error
|
|
|
|
if onlineTest {
|
|
products, err = e.GetProducts(t.Context())
|
|
if err != nil {
|
|
t.Errorf("Init error: %s", err)
|
|
}
|
|
} else {
|
|
mockResp := []byte(
|
|
string(`{"products": [{"name": "USD","isDigital": false,"productCode": 0,"decimalPlaces": 4,"fullName": "US Dollar"},{"name": "BTC","isDigital": true,"productCode": 1,"decimalPlaces": 6,"fullName": "Bitcoin"}],"isAccepted": true}`),
|
|
)
|
|
|
|
err = json.Unmarshal(mockResp, &products)
|
|
if err != nil {
|
|
t.Fatal("TestGetProducts unmarshalling error: ", err)
|
|
}
|
|
|
|
if products.Products[0].Name != "USD" {
|
|
t.Error("Alphapoint Products 0 != USD")
|
|
}
|
|
|
|
if products.Products[1].ProductCode != 1 {
|
|
t.Error("Alphapoint Products 1 product code != 1")
|
|
}
|
|
}
|
|
|
|
if !products.IsAccepted {
|
|
t.Error("Alphapoint Products.IsAccepted value is negative")
|
|
}
|
|
|
|
if len(products.Products) == 0 {
|
|
t.Error("Alphapoint Products len is 0")
|
|
}
|
|
}
|
|
|
|
func TestCreateAccount(t *testing.T) {
|
|
t.Parallel()
|
|
sharedtestvalues.SkipTestIfCredentialsUnset(t, e)
|
|
|
|
err := e.CreateAccount(t.Context(),
|
|
"test", "account", "something@something.com", "0292383745", "lolcat123")
|
|
if err != nil {
|
|
t.Errorf("Init error: %s", err)
|
|
}
|
|
err = e.CreateAccount(t.Context(),
|
|
"test", "account", "something@something.com", "0292383745", "bla")
|
|
if err == nil {
|
|
t.Errorf("CreateAccount() Expected error")
|
|
}
|
|
err = e.CreateAccount(t.Context(), "", "", "", "", "lolcat123")
|
|
if err == nil {
|
|
t.Errorf("CreateAccount() Expected error")
|
|
}
|
|
}
|
|
|
|
func TestGetUserInfo(t *testing.T) {
|
|
t.Parallel()
|
|
sharedtestvalues.SkipTestIfCredentialsUnset(t, e)
|
|
|
|
_, err := e.GetUserInfo(t.Context())
|
|
if err == nil {
|
|
t.Error("GetUserInfo() Expected error")
|
|
}
|
|
}
|
|
|
|
func TestSetUserInfo(t *testing.T) {
|
|
t.Parallel()
|
|
sharedtestvalues.SkipTestIfCredentialsUnset(t, e)
|
|
|
|
_, err := e.SetUserInfo(t.Context(),
|
|
"bla", "bla", "1", "meh", true, true)
|
|
if err == nil {
|
|
t.Error("GetUserInfo() Expected error")
|
|
}
|
|
}
|
|
|
|
func TestGetAccountInfo(t *testing.T) {
|
|
t.Parallel()
|
|
sharedtestvalues.SkipTestIfCredentialsUnset(t, e)
|
|
|
|
_, err := e.UpdateAccountInfo(t.Context(), asset.Spot)
|
|
if err == nil {
|
|
t.Error("GetUserInfo() Expected error")
|
|
}
|
|
}
|
|
|
|
func TestGetAccountTrades(t *testing.T) {
|
|
t.Parallel()
|
|
sharedtestvalues.SkipTestIfCredentialsUnset(t, e)
|
|
|
|
_, err := e.GetAccountTrades(t.Context(), "", 1, 2)
|
|
if err == nil {
|
|
t.Error("GetUserInfo() Expected error")
|
|
}
|
|
}
|
|
|
|
func TestGetDepositAddresses(t *testing.T) {
|
|
t.Parallel()
|
|
sharedtestvalues.SkipTestIfCredentialsUnset(t, e)
|
|
|
|
_, err := e.GetDepositAddresses(t.Context())
|
|
if err == nil {
|
|
t.Error("GetUserInfo() Expected error")
|
|
}
|
|
}
|
|
|
|
func TestWithdrawCoins(t *testing.T) {
|
|
t.Parallel()
|
|
sharedtestvalues.SkipTestIfCredentialsUnset(t, e)
|
|
|
|
err := e.WithdrawCoins(t.Context(), "", "", "", 0.01)
|
|
if err == nil {
|
|
t.Error("GetUserInfo() Expected error")
|
|
}
|
|
}
|
|
|
|
func TestCreateOrder(t *testing.T) {
|
|
t.Parallel()
|
|
sharedtestvalues.SkipTestIfCredentialsUnset(t, e)
|
|
|
|
_, err := e.CreateOrder(t.Context(),
|
|
"", "", order.Limit.String(), 0.01, 0)
|
|
if err == nil {
|
|
t.Error("GetUserInfo() Expected error")
|
|
}
|
|
}
|
|
|
|
func TestModifyExistingOrder(t *testing.T) {
|
|
t.Parallel()
|
|
sharedtestvalues.SkipTestIfCredentialsUnset(t, e)
|
|
|
|
_, err := e.ModifyExistingOrder(t.Context(), "", 1, 1)
|
|
if err == nil {
|
|
t.Error("GetUserInfo() Expected error")
|
|
}
|
|
}
|
|
|
|
func TestCancelAllExistingOrders(t *testing.T) {
|
|
t.Parallel()
|
|
sharedtestvalues.SkipTestIfCredentialsUnset(t, e)
|
|
|
|
err := e.CancelAllExistingOrders(t.Context(), "")
|
|
if err == nil {
|
|
t.Error("GetUserInfo() Expected error")
|
|
}
|
|
}
|
|
|
|
func TestGetOrders(t *testing.T) {
|
|
t.Parallel()
|
|
sharedtestvalues.SkipTestIfCredentialsUnset(t, e)
|
|
|
|
_, err := e.GetOrders(t.Context())
|
|
if err == nil {
|
|
t.Error("GetUserInfo() Expected error")
|
|
}
|
|
}
|
|
|
|
func TestGetOrderFee(t *testing.T) {
|
|
t.Parallel()
|
|
sharedtestvalues.SkipTestIfCredentialsUnset(t, e)
|
|
|
|
_, err := e.GetOrderFee(t.Context(), "", "", 1, 1)
|
|
if err == nil {
|
|
t.Error("GetUserInfo() Expected error")
|
|
}
|
|
}
|
|
|
|
func TestFormatWithdrawPermissions(t *testing.T) {
|
|
t.Parallel()
|
|
expectedResult := exchange.AutoWithdrawCryptoWithAPIPermissionText + " & " + exchange.WithdrawCryptoWith2FAText + " & " + exchange.NoFiatWithdrawalsText
|
|
withdrawPermissions := e.FormatWithdrawPermissions()
|
|
if withdrawPermissions != expectedResult {
|
|
t.Errorf("Expected: %s, Received: %s", expectedResult, withdrawPermissions)
|
|
}
|
|
}
|
|
|
|
func TestGetActiveOrders(t *testing.T) {
|
|
t.Parallel()
|
|
getOrdersRequest := order.MultiOrderRequest{
|
|
Type: order.AnyType,
|
|
AssetType: asset.Spot,
|
|
Side: order.AnySide,
|
|
}
|
|
|
|
_, err := e.GetActiveOrders(t.Context(), &getOrdersRequest)
|
|
if sharedtestvalues.AreAPICredentialsSet(e) && err != nil {
|
|
t.Errorf("Could not get open orders: %s", err)
|
|
} else if !sharedtestvalues.AreAPICredentialsSet(e) && err == nil {
|
|
t.Error("Expecting an error when no keys are set")
|
|
}
|
|
}
|
|
|
|
func TestGetOrderHistory(t *testing.T) {
|
|
t.Parallel()
|
|
getOrdersRequest := order.MultiOrderRequest{
|
|
Type: order.AnyType,
|
|
AssetType: asset.Spot,
|
|
Side: order.AnySide,
|
|
}
|
|
|
|
_, err := e.GetOrderHistory(t.Context(), &getOrdersRequest)
|
|
if sharedtestvalues.AreAPICredentialsSet(e) && err != nil {
|
|
t.Errorf("Could not get order history: %s", err)
|
|
} else if !sharedtestvalues.AreAPICredentialsSet(e) && err == nil {
|
|
t.Error("Expecting an error when no keys are set")
|
|
}
|
|
}
|
|
|
|
// Any tests below this line have the ability to impact your orders on the exchange. Enable canManipulateRealOrders to run them
|
|
// ----------------------------------------------------------------------------------------------------------------------------
|
|
|
|
func TestSubmitOrder(t *testing.T) {
|
|
t.Parallel()
|
|
sharedtestvalues.SkipTestIfCannotManipulateOrders(t, e, canManipulateRealOrders)
|
|
|
|
orderSubmission := &order.Submit{
|
|
Exchange: e.Name,
|
|
Pair: currency.Pair{
|
|
Delimiter: "_",
|
|
Base: currency.BTC,
|
|
Quote: currency.USD,
|
|
},
|
|
Side: order.Buy,
|
|
Type: order.Limit,
|
|
Price: 1,
|
|
Amount: 1,
|
|
ClientID: "meowOrder",
|
|
AssetType: asset.Spot,
|
|
}
|
|
|
|
response, err := e.SubmitOrder(t.Context(), orderSubmission)
|
|
if !sharedtestvalues.AreAPICredentialsSet(e) && err == nil {
|
|
t.Error("Expecting an error when no keys are set")
|
|
}
|
|
if sharedtestvalues.AreAPICredentialsSet(e) && err != nil {
|
|
t.Errorf("Withdraw failed to be placed: %v", err)
|
|
|
|
if response.Status != order.New {
|
|
t.Errorf("Order failed to be placed: %v", err)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestCancelExchangeOrder(t *testing.T) {
|
|
t.Parallel()
|
|
sharedtestvalues.SkipTestIfCannotManipulateOrders(t, e, canManipulateRealOrders)
|
|
|
|
currencyPair := currency.NewPair(currency.BTC, currency.LTC)
|
|
orderCancellation := &order.Cancel{
|
|
OrderID: "1",
|
|
AccountID: "1",
|
|
Pair: currencyPair,
|
|
AssetType: asset.Spot,
|
|
}
|
|
|
|
err := e.CancelOrder(t.Context(), orderCancellation)
|
|
if !sharedtestvalues.AreAPICredentialsSet(e) && err == nil {
|
|
t.Error("Expecting an error when no keys are set")
|
|
}
|
|
if sharedtestvalues.AreAPICredentialsSet(e) && err != nil {
|
|
t.Errorf("Withdraw failed to be placed: %v", err)
|
|
}
|
|
}
|
|
|
|
func TestCancelAllExchangeOrders(t *testing.T) {
|
|
t.Parallel()
|
|
sharedtestvalues.SkipTestIfCannotManipulateOrders(t, e, canManipulateRealOrders)
|
|
|
|
currencyPair := currency.NewPair(currency.BTC, currency.LTC)
|
|
orderCancellation := &order.Cancel{
|
|
OrderID: "1",
|
|
AccountID: "1",
|
|
Pair: currencyPair,
|
|
AssetType: asset.Spot,
|
|
}
|
|
|
|
resp, err := e.CancelAllOrders(t.Context(), orderCancellation)
|
|
if !sharedtestvalues.AreAPICredentialsSet(e) && err == nil {
|
|
t.Error("Expecting an error when no keys are set")
|
|
}
|
|
if sharedtestvalues.AreAPICredentialsSet(e) && err != nil {
|
|
t.Errorf("Withdraw failed to be placed: %v", err)
|
|
}
|
|
|
|
if len(resp.Status) > 0 {
|
|
t.Errorf("%v orders failed to cancel", len(resp.Status))
|
|
}
|
|
}
|
|
|
|
func TestModifyOrder(t *testing.T) {
|
|
t.Parallel()
|
|
sharedtestvalues.SkipTestIfCredentialsUnset(t, e, canManipulateRealOrders)
|
|
_, err := e.ModifyOrder(t.Context(), &order.Modify{AssetType: asset.Spot})
|
|
if err == nil {
|
|
t.Error("ModifyOrder() Expected error")
|
|
}
|
|
}
|
|
|
|
func TestWithdraw(t *testing.T) {
|
|
t.Parallel()
|
|
_, err := e.WithdrawCryptocurrencyFunds(t.Context(),
|
|
&withdraw.Request{})
|
|
if err != common.ErrNotYetImplemented {
|
|
t.Errorf("Expected 'Not implemented', received %v", err)
|
|
}
|
|
}
|
|
|
|
func TestWithdrawFiat(t *testing.T) {
|
|
t.Parallel()
|
|
sharedtestvalues.SkipTestIfCredentialsUnset(t, e, canManipulateRealOrders)
|
|
|
|
_, err := e.WithdrawFiatFunds(t.Context(),
|
|
&withdraw.Request{})
|
|
if err != common.ErrNotYetImplemented {
|
|
t.Errorf("Expected '%v', received: '%v'", common.ErrNotYetImplemented, err)
|
|
}
|
|
}
|
|
|
|
func TestWithdrawInternationalBank(t *testing.T) {
|
|
t.Parallel()
|
|
sharedtestvalues.SkipTestIfCredentialsUnset(t, e, canManipulateRealOrders)
|
|
|
|
_, err := e.WithdrawFiatFundsToInternationalBank(t.Context(), &withdraw.Request{})
|
|
if err != common.ErrNotYetImplemented {
|
|
t.Errorf("Expected '%v', received: '%v'", common.ErrNotYetImplemented, err)
|
|
}
|
|
}
|
|
|
|
func TestGetRecentTrades(t *testing.T) {
|
|
t.Parallel()
|
|
currencyPair, err := currency.NewPairFromString("btc_usdt")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
_, err = e.GetRecentTrades(t.Context(), currencyPair, asset.Spot)
|
|
if err != nil && err != common.ErrNotYetImplemented {
|
|
t.Error(err)
|
|
}
|
|
}
|
|
|
|
func TestGetHistoricTrades(t *testing.T) {
|
|
t.Parallel()
|
|
currencyPair, err := currency.NewPairFromString("btc_usdt")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
_, err = e.GetHistoricTrades(t.Context(),
|
|
currencyPair, asset.Spot, time.Now().Add(-time.Minute*15), time.Now())
|
|
if err != nil && err != common.ErrNotYetImplemented {
|
|
t.Error(err)
|
|
}
|
|
}
|