mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-02 07:26:53 +00:00
exchanges/qa: Add exchange wrapper testing suite (#1159)
* initial concept of a nice validation tester for exchanges * adds some datahandler design * expand testing * more tests and fixes * minor end of day fix for bithumb * fixes implementation issues * more test coverage and improvements, but not sure if i should continue * fix more wrapper implementations * adds error type, more fixes * changes signature, fixes implementations * fixes more wrapper implementations * one more bit * more cleanup * WOW things work? * lintle 1/1337 * mini bump * fixes all linting * neaten * GetOrderInfo+ asset pair fixes+improvements * adds new websocket test * expand ws testing * fix bug, expand tests, improve implementation * code coverage of a lot of new codes * fixes everything * reverts accidental changes * minor fixes from reviewing code * removes Bitfinex cancelBatchOrder implementation * fixes dumb baby typo for babies * mini nit fixes * so many nits to address * addresses all the nits * Titlecase * switcheroo * removes websocket testing for now * fix appveyor, minor test fix * fixes typo, re-kindles killed kode * skip binance wrapper tests when running CI * expired context, huobi okx fixes * kodespull * fix ordering * time fix because why not * fix exmo, others * hopefully this fixes all of my life's problems * last thing today * huobi, more like hypotrophy * golangci-lint, more like mypooroldknee-splint * fix huobi times by removing them * should fix okx currency issues * blocks the application * adds last little contingency for pairs * addresses most nits and new problems * lovely fixed before seeing why okx sucks * fixes issues with okx websocket * the classic receieieivaier * lintle * adds test and fixes existing tests * expands error handling messages during setup * fixes dumb okx bugs introduced * quick fix for lint and exmo * fixes nixes * fix exmo deposit issue * lint * fixes issue with extra asset runs missing * fix surprise race * all the lint and merge fixes * fixes surprise bugs in OKx * fixes issues with times and chains * fixing all the merge stuff * merge fix * rm logs and a panic potential * lovely lint lament * an easy demonstration of scenario, but not of initial purpose * put it in the bin * Revert "put it in the bin" This reverts commit 15c6490f713233d43f10957367fcbf18e3818bdd. * re-add after immediate error popup * fix mini poor test design * okx okay * merge fixes * fixes issues discovered in lovely test * I FORGOT TO COMMIT THIS * nit fixaroonaboo * forgoetten test fix * revert old okx asset intrument work * fixes * revert problems I didnt understand. update bybit * fix merge bugs * test cleanup * further improvements * reshuffle and lint * rm redundant CI_TEST by rm the CI_TEST field that is redundant * path fix * move to its own section, dont run on 32 bit + appveyor * lint * fix lbank * address nits * let it rip * fix failing test time range * niteroo boogaloo * mod tidy, use common.SimpleTimeFormat
This commit is contained in:
@@ -2,7 +2,6 @@ package exmo
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
@@ -96,8 +95,7 @@ func (e *EXMO) GetCurrency(ctx context.Context) ([]string, error) {
|
||||
// GetUserInfo returns the user info
|
||||
func (e *EXMO) GetUserInfo(ctx context.Context) (UserInfo, error) {
|
||||
var result UserInfo
|
||||
err := e.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpot, http.MethodPost, exmoUserInfo, url.Values{}, &result)
|
||||
return result, err
|
||||
return result, e.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpot, http.MethodPost, exmoUserInfo, url.Values{}, &result)
|
||||
}
|
||||
|
||||
// CreateOrder creates an order
|
||||
@@ -117,11 +115,7 @@ func (e *EXMO) CreateOrder(ctx context.Context, pair, orderType string, price, a
|
||||
v.Set("quantity", strconv.FormatFloat(amount, 'f', -1, 64))
|
||||
|
||||
var resp response
|
||||
err := e.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpot, http.MethodPost, exmoOrderCreate, v, &resp)
|
||||
if !resp.Result {
|
||||
return -1, errors.New(resp.Error)
|
||||
}
|
||||
return resp.OrderID, err
|
||||
return resp.OrderID, e.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpot, http.MethodPost, exmoOrderCreate, v, &resp)
|
||||
}
|
||||
|
||||
// CancelExistingOrder cancels an order by the orderID
|
||||
@@ -133,18 +127,13 @@ func (e *EXMO) CancelExistingOrder(ctx context.Context, orderID int64) error {
|
||||
Error string `json:"error"`
|
||||
}
|
||||
var resp response
|
||||
err := e.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpot, http.MethodPost, exmoOrderCancel, v, &resp)
|
||||
if !resp.Result {
|
||||
return errors.New(resp.Error)
|
||||
}
|
||||
return err
|
||||
return e.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpot, http.MethodPost, exmoOrderCancel, v, &resp)
|
||||
}
|
||||
|
||||
// GetOpenOrders returns the users open orders
|
||||
func (e *EXMO) GetOpenOrders(ctx context.Context) (map[string]OpenOrders, error) {
|
||||
result := make(map[string]OpenOrders)
|
||||
err := e.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpot, http.MethodPost, exmoOpenOrders, url.Values{}, &result)
|
||||
return result, err
|
||||
return result, e.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpot, http.MethodPost, exmoOpenOrders, url.Values{}, &result)
|
||||
}
|
||||
|
||||
// GetUserTrades returns the user trades
|
||||
@@ -161,8 +150,7 @@ func (e *EXMO) GetUserTrades(ctx context.Context, pair, offset, limit string) (m
|
||||
v.Set("limit", limit)
|
||||
}
|
||||
|
||||
err := e.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpot, http.MethodPost, exmoUserTrades, v, &result)
|
||||
return result, err
|
||||
return result, e.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpot, http.MethodPost, exmoUserTrades, v, &result)
|
||||
}
|
||||
|
||||
// GetCancelledOrders returns a list of cancelled orders
|
||||
@@ -178,8 +166,7 @@ func (e *EXMO) GetCancelledOrders(ctx context.Context, offset, limit string) ([]
|
||||
v.Set("limit", limit)
|
||||
}
|
||||
|
||||
err := e.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpot, http.MethodPost, exmoCancelledOrders, v, &result)
|
||||
return result, err
|
||||
return result, e.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpot, http.MethodPost, exmoCancelledOrders, v, &result)
|
||||
}
|
||||
|
||||
// GetOrderTrades returns a history of order trade details for the specific orderID
|
||||
@@ -188,8 +175,7 @@ func (e *EXMO) GetOrderTrades(ctx context.Context, orderID int64) (OrderTrades,
|
||||
v := url.Values{}
|
||||
v.Set("order_id", strconv.FormatInt(orderID, 10))
|
||||
|
||||
err := e.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpot, http.MethodPost, exmoOrderTrades, v, &result)
|
||||
return result, err
|
||||
return result, e.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpot, http.MethodPost, exmoOrderTrades, v, &result)
|
||||
}
|
||||
|
||||
// GetRequiredAmount calculates the sum of buying a certain amount of currency
|
||||
@@ -199,8 +185,7 @@ func (e *EXMO) GetRequiredAmount(ctx context.Context, pair string, amount float6
|
||||
v.Set("pair", pair)
|
||||
v.Set("quantity", strconv.FormatFloat(amount, 'f', -1, 64))
|
||||
var result RequiredAmount
|
||||
err := e.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpot, http.MethodPost, exmoRequiredAmount, v, &result)
|
||||
return result, err
|
||||
return result, e.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpot, http.MethodPost, exmoRequiredAmount, v, &result)
|
||||
}
|
||||
|
||||
// GetCryptoDepositAddress returns a list of addresses for cryptocurrency deposits
|
||||
@@ -215,15 +200,16 @@ func (e *EXMO) GetCryptoDepositAddress(ctx context.Context) (map[string]string,
|
||||
case map[string]interface{}:
|
||||
mapString := make(map[string]string)
|
||||
for key, value := range r {
|
||||
v, ok := value.(string)
|
||||
if !ok {
|
||||
return nil, errors.New("unable to type assert value data")
|
||||
if key == "error" {
|
||||
if strVal, ok := value.(string); ok && strVal != "" {
|
||||
return nil, fmt.Errorf("%w %s", request.ErrAuthRequestFailed, strVal)
|
||||
}
|
||||
}
|
||||
mapString[key] = v
|
||||
mapString[key] = fmt.Sprintf("%v", value)
|
||||
}
|
||||
return mapString, nil
|
||||
default:
|
||||
return nil, errors.New("no addresses found, generate required addresses via site")
|
||||
return nil, fmt.Errorf("%w no addresses found, generate via website", request.ErrAuthRequestFailed)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -251,14 +237,7 @@ func (e *EXMO) WithdrawCryptocurrency(ctx context.Context, currency, address, in
|
||||
|
||||
v.Set("amount", strconv.FormatFloat(amount, 'f', -1, 64))
|
||||
var resp response
|
||||
err := e.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpot, http.MethodPost, exmoWithdrawCrypt, v, &resp)
|
||||
if err != nil {
|
||||
return -1, err
|
||||
}
|
||||
if resp.Success == 0 || !resp.Result {
|
||||
return -1, errors.New(resp.Error)
|
||||
}
|
||||
return resp.TaskID, err
|
||||
return resp.TaskID, e.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpot, http.MethodPost, exmoWithdrawCrypt, v, &resp)
|
||||
}
|
||||
|
||||
// GetWithdrawTXID gets the result of a withdrawal request
|
||||
@@ -272,8 +251,7 @@ func (e *EXMO) GetWithdrawTXID(ctx context.Context, taskID int64) (string, error
|
||||
v.Set("task_id", strconv.FormatInt(taskID, 10))
|
||||
|
||||
var result response
|
||||
err := e.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpot, http.MethodPost, exmoGetWithdrawTXID, v, &result)
|
||||
return result.TXID, err
|
||||
return result.TXID, e.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpot, http.MethodPost, exmoGetWithdrawTXID, v, &result)
|
||||
}
|
||||
|
||||
// ExcodeCreate creates an EXMO coupon
|
||||
@@ -283,8 +261,7 @@ func (e *EXMO) ExcodeCreate(ctx context.Context, currency string, amount float64
|
||||
v.Set("amount", strconv.FormatFloat(amount, 'f', -1, 64))
|
||||
|
||||
var result ExcodeCreate
|
||||
err := e.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpot, http.MethodPost, exmoExcodeCreate, v, &result)
|
||||
return result, err
|
||||
return result, e.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpot, http.MethodPost, exmoExcodeCreate, v, &result)
|
||||
}
|
||||
|
||||
// ExcodeLoad loads an EXMO coupon
|
||||
@@ -293,8 +270,7 @@ func (e *EXMO) ExcodeLoad(ctx context.Context, excode string) (ExcodeLoad, error
|
||||
v.Set("code", excode)
|
||||
|
||||
var result ExcodeLoad
|
||||
err := e.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpot, http.MethodPost, exmoExcodeLoad, v, &result)
|
||||
return result, err
|
||||
return result, e.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpot, http.MethodPost, exmoExcodeLoad, v, &result)
|
||||
}
|
||||
|
||||
// GetWalletHistory returns the users deposit/withdrawal history
|
||||
@@ -303,8 +279,7 @@ func (e *EXMO) GetWalletHistory(ctx context.Context, date int64) (WalletHistory,
|
||||
v.Set("date", strconv.FormatInt(date, 10))
|
||||
|
||||
var result WalletHistory
|
||||
err := e.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpot, http.MethodPost, exmoWalletHistory, v, &result)
|
||||
return result, err
|
||||
return result, e.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpot, http.MethodPost, exmoWalletHistory, v, &result)
|
||||
}
|
||||
|
||||
// SendHTTPRequest sends an unauthenticated HTTP request
|
||||
@@ -324,7 +299,7 @@ func (e *EXMO) SendHTTPRequest(ctx context.Context, endpoint exchange.URL, path
|
||||
}
|
||||
return e.SendPayload(ctx, request.Unset, func() (*request.Item, error) {
|
||||
return item, nil
|
||||
})
|
||||
}, request.UnauthenticatedRequest)
|
||||
}
|
||||
|
||||
// SendAuthenticatedHTTPRequest sends an authenticated HTTP request
|
||||
@@ -364,13 +339,12 @@ func (e *EXMO) SendAuthenticatedHTTPRequest(ctx context.Context, epath exchange.
|
||||
Headers: headers,
|
||||
Body: strings.NewReader(payload),
|
||||
Result: result,
|
||||
AuthRequest: true,
|
||||
NonceEnabled: true,
|
||||
Verbose: e.Verbose,
|
||||
HTTPDebugging: e.HTTPDebugging,
|
||||
HTTPRecording: e.HTTPRecording,
|
||||
}, nil
|
||||
})
|
||||
}, request.AuthenticatedRequest)
|
||||
}
|
||||
|
||||
// GetFee returns an estimate of fee based on type of transaction
|
||||
|
||||
@@ -283,7 +283,7 @@ func TestFormatWithdrawPermissions(t *testing.T) {
|
||||
|
||||
func TestGetActiveOrders(t *testing.T) {
|
||||
t.Parallel()
|
||||
var getOrdersRequest = order.GetOrdersRequest{
|
||||
var getOrdersRequest = order.MultiOrderRequest{
|
||||
Type: order.AnyType,
|
||||
AssetType: asset.Spot,
|
||||
Side: order.AnySide,
|
||||
@@ -299,7 +299,7 @@ func TestGetActiveOrders(t *testing.T) {
|
||||
|
||||
func TestGetOrderHistory(t *testing.T) {
|
||||
t.Parallel()
|
||||
var getOrdersRequest = order.GetOrdersRequest{
|
||||
var getOrdersRequest = order.MultiOrderRequest{
|
||||
Type: order.AnyType,
|
||||
AssetType: asset.Spot,
|
||||
Side: order.AnySide,
|
||||
@@ -465,6 +465,15 @@ func TestGetDepositAddress(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetCryptoDepositAddress(t *testing.T) {
|
||||
t.Parallel()
|
||||
sharedtestvalues.SkipTestIfCredentialsUnset(t, e)
|
||||
_, err := e.GetCryptoDepositAddress(context.Background())
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetRecentTrades(t *testing.T) {
|
||||
t.Parallel()
|
||||
currencyPair, err := currency.NewPairFromString("BTC_USD")
|
||||
@@ -531,8 +540,28 @@ func TestGetCryptoPaymentProvidersList(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetAvailableTransferChains(t *testing.T) {
|
||||
t.Parallel()
|
||||
_, err := e.GetAvailableTransferChains(context.Background(), currency.USDT)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetAccountFundingHistory(t *testing.T) {
|
||||
t.Parallel()
|
||||
sharedtestvalues.SkipTestIfCredentialsUnset(t, e)
|
||||
_, err := e.GetAccountFundingHistory(context.Background())
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetWithdrawalsHistory(t *testing.T) {
|
||||
t.Parallel()
|
||||
sharedtestvalues.SkipTestIfCredentialsUnset(t, e)
|
||||
|
||||
_, err := e.GetWithdrawalsHistory(context.Background(), currency.BTC, asset.Spot)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package exmo
|
||||
|
||||
import "github.com/thrasher-corp/gocryptotrader/currency"
|
||||
import (
|
||||
"github.com/thrasher-corp/gocryptotrader/currency"
|
||||
)
|
||||
|
||||
// Trades holds trade data
|
||||
type Trades struct {
|
||||
@@ -137,12 +139,13 @@ type WalletHistory struct {
|
||||
End int64 `json:"end,string"`
|
||||
History []struct {
|
||||
Timestamp int64 `json:"dt"`
|
||||
Type string `json:"string"`
|
||||
Type string `json:"type"`
|
||||
Currency string `json:"curr"`
|
||||
Status string `json:"status"`
|
||||
Provider string `json:"provider"`
|
||||
Amount float64 `json:"amount,string"`
|
||||
Account string `json:"account,string"`
|
||||
Account string `json:"account"`
|
||||
TXID string `json:"txid"`
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -196,7 +196,11 @@ func (e *EXMO) UpdateTradablePairs(ctx context.Context, forceUpdate bool) error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return e.UpdatePairs(pairs, asset.Spot, false, forceUpdate)
|
||||
err = e.UpdatePairs(pairs, asset.Spot, false, forceUpdate)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return e.EnsureOnePairEnabled()
|
||||
}
|
||||
|
||||
// UpdateTickers updates the ticker for all currency pairs of a given asset type
|
||||
@@ -272,6 +276,12 @@ func (e *EXMO) FetchOrderbook(ctx context.Context, p currency.Pair, assetType as
|
||||
|
||||
// UpdateOrderbook updates and returns the orderbook for a currency pair
|
||||
func (e *EXMO) UpdateOrderbook(ctx context.Context, p currency.Pair, assetType asset.Item) (*orderbook.Base, error) {
|
||||
if p.IsEmpty() {
|
||||
return nil, currency.ErrCurrencyPairEmpty
|
||||
}
|
||||
if err := e.CurrencyPairs.IsAssetEnabled(assetType); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
callingBook := &orderbook.Base{
|
||||
Exchange: e.Name,
|
||||
Pair: p,
|
||||
@@ -421,15 +431,51 @@ func (e *EXMO) FetchAccountInfo(ctx context.Context, assetType asset.Item) (acco
|
||||
return acc, nil
|
||||
}
|
||||
|
||||
// GetFundingHistory returns funding history, deposits and
|
||||
// GetAccountFundingHistory returns funding history, deposits and
|
||||
// withdrawals
|
||||
func (e *EXMO) GetFundingHistory(_ context.Context) ([]exchange.FundHistory, error) {
|
||||
return nil, common.ErrFunctionNotSupported
|
||||
func (e *EXMO) GetAccountFundingHistory(ctx context.Context) ([]exchange.FundingHistory, error) {
|
||||
hist, err := e.GetWalletHistory(ctx, 0)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp := make([]exchange.FundingHistory, 0, len(hist.History))
|
||||
for i := range hist.History {
|
||||
if hist.History[i].Type != "deposit" {
|
||||
continue
|
||||
}
|
||||
resp = append(resp, exchange.FundingHistory{
|
||||
Status: hist.History[i].Status,
|
||||
TransferID: hist.History[i].TXID,
|
||||
Timestamp: time.Unix(hist.History[i].Timestamp, 0),
|
||||
Currency: hist.History[i].Currency,
|
||||
Amount: hist.History[i].Amount,
|
||||
BankFrom: hist.History[i].Provider,
|
||||
})
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// GetWithdrawalsHistory returns previous withdrawals data
|
||||
func (e *EXMO) GetWithdrawalsHistory(_ context.Context, _ currency.Code, _ asset.Item) (resp []exchange.WithdrawalHistory, err error) {
|
||||
return nil, common.ErrNotYetImplemented
|
||||
func (e *EXMO) GetWithdrawalsHistory(ctx context.Context, _ currency.Code, _ asset.Item) ([]exchange.WithdrawalHistory, error) {
|
||||
hist, err := e.GetWalletHistory(ctx, 0)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp := make([]exchange.WithdrawalHistory, 0, len(hist.History))
|
||||
for i := range hist.History {
|
||||
if hist.History[i].Type != "withdrawal" {
|
||||
continue
|
||||
}
|
||||
resp = append(resp, exchange.WithdrawalHistory{
|
||||
Status: hist.History[i].Status,
|
||||
TransferID: hist.History[i].TXID,
|
||||
Timestamp: time.Unix(hist.History[i].Timestamp, 0),
|
||||
Currency: hist.History[i].Currency,
|
||||
Amount: hist.History[i].Amount,
|
||||
CryptoTxID: hist.History[i].TXID,
|
||||
})
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// GetRecentTrades returns the most recent trades for a currency and asset
|
||||
@@ -488,7 +534,7 @@ func (e *EXMO) SubmitOrder(ctx context.Context, s *order.Submit) (*order.SubmitR
|
||||
var orderType string
|
||||
switch s.Type {
|
||||
case order.Limit:
|
||||
return nil, errors.New("unsupported order type")
|
||||
return nil, fmt.Errorf("%w %v", order.ErrUnsupportedOrderType, s.Type)
|
||||
case order.Market:
|
||||
if s.Side == order.Sell {
|
||||
orderType = "market_sell"
|
||||
@@ -531,8 +577,13 @@ func (e *EXMO) CancelOrder(ctx context.Context, o *order.Cancel) error {
|
||||
}
|
||||
|
||||
// CancelBatchOrders cancels an orders by their corresponding ID numbers
|
||||
func (e *EXMO) CancelBatchOrders(_ context.Context, _ []order.Cancel) (order.CancelBatchResponse, error) {
|
||||
return order.CancelBatchResponse{}, common.ErrNotYetImplemented
|
||||
func (e *EXMO) CancelBatchOrders(_ context.Context, _ []order.Cancel) (*order.CancelBatchResponse, error) {
|
||||
return nil, common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetServerTime returns the current exchange server time.
|
||||
func (e *EXMO) GetServerTime(_ context.Context, _ asset.Item) (time.Time, error) {
|
||||
return time.Time{}, common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// CancelAllOrders cancels all orders associated with a currency pair
|
||||
@@ -557,9 +608,8 @@ func (e *EXMO) CancelAllOrders(ctx context.Context, _ *order.Cancel) (order.Canc
|
||||
}
|
||||
|
||||
// GetOrderInfo returns order information based on order ID
|
||||
func (e *EXMO) GetOrderInfo(_ context.Context, _ string, _ currency.Pair, _ asset.Item) (order.Detail, error) {
|
||||
var orderDetail order.Detail
|
||||
return orderDetail, common.ErrNotYetImplemented
|
||||
func (e *EXMO) GetOrderInfo(_ context.Context, _ string, _ currency.Pair, _ asset.Item) (*order.Detail, error) {
|
||||
return nil, common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetDepositAddress returns a deposit address for a specified currency
|
||||
@@ -644,7 +694,7 @@ func (e *EXMO) GetFeeByType(ctx context.Context, feeBuilder *exchange.FeeBuilder
|
||||
}
|
||||
|
||||
// GetActiveOrders retrieves any orders that are active/open
|
||||
func (e *EXMO) GetActiveOrders(ctx context.Context, req *order.GetOrdersRequest) (order.FilteredOrders, error) {
|
||||
func (e *EXMO) GetActiveOrders(ctx context.Context, req *order.MultiOrderRequest) (order.FilteredOrders, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -683,7 +733,7 @@ func (e *EXMO) GetActiveOrders(ctx context.Context, req *order.GetOrdersRequest)
|
||||
|
||||
// GetOrderHistory retrieves account order information
|
||||
// Can Limit response to specific order status
|
||||
func (e *EXMO) GetOrderHistory(ctx context.Context, req *order.GetOrdersRequest) (order.FilteredOrders, error) {
|
||||
func (e *EXMO) GetOrderHistory(ctx context.Context, req *order.MultiOrderRequest) (order.FilteredOrders, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -695,12 +745,12 @@ func (e *EXMO) GetOrderHistory(ctx context.Context, req *order.GetOrdersRequest)
|
||||
|
||||
var allTrades []UserTrades
|
||||
for i := range req.Pairs {
|
||||
fpair, err := e.FormatExchangeCurrency(req.Pairs[i], asset.Spot)
|
||||
fPair, err := e.FormatExchangeCurrency(req.Pairs[i], asset.Spot)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
resp, err := e.GetUserTrades(ctx, fpair.String(), "", "10000")
|
||||
resp, err := e.GetUserTrades(ctx, fPair.String(), "", "10000")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -766,7 +816,7 @@ func (e *EXMO) GetAvailableTransferChains(ctx context.Context, cryptocurrency cu
|
||||
|
||||
methods, ok := chains[cryptocurrency.Upper().String()]
|
||||
if !ok {
|
||||
return nil, errors.New("no available chains")
|
||||
return nil, fmt.Errorf("%w no available chains for %v", currency.ErrCurrencyNotFound, cryptocurrency)
|
||||
}
|
||||
|
||||
var availChains []string
|
||||
|
||||
Reference in New Issue
Block a user