cmd/exchange_template, exchanges: Update templates and propogate to exchanges (#1777)

* 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>
This commit is contained in:
Samuael A.
2025-07-17 03:46:36 +03:00
committed by GitHub
parent 485397a0c7
commit 3f534a15f1
163 changed files with 20453 additions and 20313 deletions

View File

@@ -50,13 +50,13 @@ const (
exmoRequestRate = 180
)
// EXMO exchange struct
type EXMO struct {
// Exchange implements exchange.IBotExchange and contains additional specific api methods for interacting with EXMO
type Exchange struct {
exchange.Base
}
// GetTrades returns the trades for a symbol or symbols
func (e *EXMO) GetTrades(ctx context.Context, symbol string) (map[string][]Trades, error) {
func (e *Exchange) GetTrades(ctx context.Context, symbol string) (map[string][]Trades, error) {
v := url.Values{}
v.Set("pair", symbol)
result := make(map[string][]Trades)
@@ -65,7 +65,7 @@ func (e *EXMO) GetTrades(ctx context.Context, symbol string) (map[string][]Trade
}
// GetOrderbook returns the orderbook for a symbol or symbols
func (e *EXMO) GetOrderbook(ctx context.Context, symbol string) (map[string]Orderbook, error) {
func (e *Exchange) GetOrderbook(ctx context.Context, symbol string) (map[string]Orderbook, error) {
v := url.Values{}
v.Set("pair", symbol)
result := make(map[string]Orderbook)
@@ -74,7 +74,7 @@ func (e *EXMO) GetOrderbook(ctx context.Context, symbol string) (map[string]Orde
}
// GetTicker returns the ticker for a symbol or symbols
func (e *EXMO) GetTicker(ctx context.Context) (map[string]Ticker, error) {
func (e *Exchange) GetTicker(ctx context.Context) (map[string]Ticker, error) {
v := url.Values{}
result := make(map[string]Ticker)
urlPath := fmt.Sprintf("/v%s/%s", exmoAPIVersion, exmoTicker)
@@ -82,21 +82,21 @@ func (e *EXMO) GetTicker(ctx context.Context) (map[string]Ticker, error) {
}
// GetPairSettings returns the pair settings for a symbol or symbols
func (e *EXMO) GetPairSettings(ctx context.Context) (map[string]PairSettings, error) {
func (e *Exchange) GetPairSettings(ctx context.Context) (map[string]PairSettings, error) {
result := make(map[string]PairSettings)
urlPath := fmt.Sprintf("/v%s/%s", exmoAPIVersion, exmoPairSettings)
return result, e.SendHTTPRequest(ctx, exchange.RestSpot, urlPath, &result)
}
// GetCurrency returns a list of currencies
func (e *EXMO) GetCurrency(ctx context.Context) ([]string, error) {
func (e *Exchange) GetCurrency(ctx context.Context) ([]string, error) {
var result []string
urlPath := fmt.Sprintf("/v%s/%s", exmoAPIVersion, exmoCurrency)
return result, e.SendHTTPRequest(ctx, exchange.RestSpot, urlPath, &result)
}
// GetUserInfo returns the user info
func (e *EXMO) GetUserInfo(ctx context.Context) (UserInfo, error) {
func (e *Exchange) GetUserInfo(ctx context.Context) (UserInfo, error) {
var result UserInfo
return result, e.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpot, http.MethodPost, exmoUserInfo, url.Values{}, &result)
}
@@ -104,7 +104,7 @@ func (e *EXMO) GetUserInfo(ctx context.Context) (UserInfo, error) {
// CreateOrder creates an order
// Params: pair, quantity, price and type
// Type can be buy, sell, market_buy, market_sell, market_buy_total and market_sell_total
func (e *EXMO) CreateOrder(ctx context.Context, pair, orderType string, price, amount float64) (int64, error) {
func (e *Exchange) CreateOrder(ctx context.Context, pair, orderType string, price, amount float64) (int64, error) {
type response struct {
OrderID int64 `json:"order_id"`
Result bool `json:"result"`
@@ -122,7 +122,7 @@ func (e *EXMO) CreateOrder(ctx context.Context, pair, orderType string, price, a
}
// CancelExistingOrder cancels an order by the orderID
func (e *EXMO) CancelExistingOrder(ctx context.Context, orderID int64) error {
func (e *Exchange) CancelExistingOrder(ctx context.Context, orderID int64) error {
v := url.Values{}
v.Set("order_id", strconv.FormatInt(orderID, 10))
type response struct {
@@ -134,13 +134,13 @@ func (e *EXMO) CancelExistingOrder(ctx context.Context, orderID int64) error {
}
// GetOpenOrders returns the users open orders
func (e *EXMO) GetOpenOrders(ctx context.Context) (map[string]OpenOrders, error) {
func (e *Exchange) GetOpenOrders(ctx context.Context) (map[string]OpenOrders, error) {
result := make(map[string]OpenOrders)
return result, e.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpot, http.MethodPost, exmoOpenOrders, url.Values{}, &result)
}
// GetUserTrades returns the user trades
func (e *EXMO) GetUserTrades(ctx context.Context, pair, offset, limit string) (map[string][]UserTrades, error) {
func (e *Exchange) GetUserTrades(ctx context.Context, pair, offset, limit string) (map[string][]UserTrades, error) {
result := make(map[string][]UserTrades)
v := url.Values{}
v.Set("pair", pair)
@@ -157,7 +157,7 @@ func (e *EXMO) GetUserTrades(ctx context.Context, pair, offset, limit string) (m
}
// GetCancelledOrders returns a list of cancelled orders
func (e *EXMO) GetCancelledOrders(ctx context.Context, offset, limit string) ([]CancelledOrder, error) {
func (e *Exchange) GetCancelledOrders(ctx context.Context, offset, limit string) ([]CancelledOrder, error) {
var result []CancelledOrder
v := url.Values{}
@@ -173,7 +173,7 @@ func (e *EXMO) GetCancelledOrders(ctx context.Context, offset, limit string) ([]
}
// GetOrderTrades returns a history of order trade details for the specific orderID
func (e *EXMO) GetOrderTrades(ctx context.Context, orderID int64) (OrderTrades, error) {
func (e *Exchange) GetOrderTrades(ctx context.Context, orderID int64) (OrderTrades, error) {
var result OrderTrades
v := url.Values{}
v.Set("order_id", strconv.FormatInt(orderID, 10))
@@ -183,7 +183,7 @@ func (e *EXMO) GetOrderTrades(ctx context.Context, orderID int64) (OrderTrades,
// GetRequiredAmount calculates the sum of buying a certain amount of currency
// for the particular currency pair
func (e *EXMO) GetRequiredAmount(ctx context.Context, pair string, amount float64) (RequiredAmount, error) {
func (e *Exchange) GetRequiredAmount(ctx context.Context, pair string, amount float64) (RequiredAmount, error) {
v := url.Values{}
v.Set("pair", pair)
v.Set("quantity", strconv.FormatFloat(amount, 'f', -1, 64))
@@ -192,7 +192,7 @@ func (e *EXMO) GetRequiredAmount(ctx context.Context, pair string, amount float6
}
// GetCryptoDepositAddress returns a list of addresses for cryptocurrency deposits
func (e *EXMO) GetCryptoDepositAddress(ctx context.Context) (map[string]string, error) {
func (e *Exchange) GetCryptoDepositAddress(ctx context.Context) (map[string]string, error) {
var result any
err := e.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpot, http.MethodPost, exmoDepositAddress, url.Values{}, &result)
if err != nil {
@@ -218,7 +218,7 @@ func (e *EXMO) GetCryptoDepositAddress(ctx context.Context) (map[string]string,
// WithdrawCryptocurrency withdraws a cryptocurrency from the exchange to the desired address
// NOTE: This API function is available only after request to their tech support team
func (e *EXMO) WithdrawCryptocurrency(ctx context.Context, currency, address, invoice, transport string, amount float64) (int64, error) {
func (e *Exchange) WithdrawCryptocurrency(ctx context.Context, currency, address, invoice, transport string, amount float64) (int64, error) {
type response struct {
TaskID int64 `json:"task_id,string"`
Result bool `json:"result"`
@@ -244,7 +244,7 @@ func (e *EXMO) WithdrawCryptocurrency(ctx context.Context, currency, address, in
}
// GetWithdrawTXID gets the result of a withdrawal request
func (e *EXMO) GetWithdrawTXID(ctx context.Context, taskID int64) (string, error) {
func (e *Exchange) GetWithdrawTXID(ctx context.Context, taskID int64) (string, error) {
type response struct {
Status bool `json:"status"`
TXID string `json:"txid"`
@@ -258,7 +258,7 @@ func (e *EXMO) GetWithdrawTXID(ctx context.Context, taskID int64) (string, error
}
// ExcodeCreate creates an EXMO coupon
func (e *EXMO) ExcodeCreate(ctx context.Context, currency string, amount float64) (ExcodeCreate, error) {
func (e *Exchange) ExcodeCreate(ctx context.Context, currency string, amount float64) (ExcodeCreate, error) {
v := url.Values{}
v.Set("currency", currency)
v.Set("amount", strconv.FormatFloat(amount, 'f', -1, 64))
@@ -268,7 +268,7 @@ func (e *EXMO) ExcodeCreate(ctx context.Context, currency string, amount float64
}
// ExcodeLoad loads an EXMO coupon
func (e *EXMO) ExcodeLoad(ctx context.Context, excode string) (ExcodeLoad, error) {
func (e *Exchange) ExcodeLoad(ctx context.Context, excode string) (ExcodeLoad, error) {
v := url.Values{}
v.Set("code", excode)
@@ -277,7 +277,7 @@ func (e *EXMO) ExcodeLoad(ctx context.Context, excode string) (ExcodeLoad, error
}
// GetWalletHistory returns the users deposit/withdrawal history
func (e *EXMO) GetWalletHistory(ctx context.Context, date int64) (WalletHistory, error) {
func (e *Exchange) GetWalletHistory(ctx context.Context, date int64) (WalletHistory, error) {
v := url.Values{}
v.Set("date", strconv.FormatInt(date, 10))
@@ -286,7 +286,7 @@ func (e *EXMO) GetWalletHistory(ctx context.Context, date int64) (WalletHistory,
}
// SendHTTPRequest sends an unauthenticated HTTP request
func (e *EXMO) SendHTTPRequest(ctx context.Context, endpoint exchange.URL, path string, result any) error {
func (e *Exchange) SendHTTPRequest(ctx context.Context, endpoint exchange.URL, path string, result any) error {
urlPath, err := e.API.Endpoints.GetURL(endpoint)
if err != nil {
return err
@@ -306,7 +306,7 @@ func (e *EXMO) SendHTTPRequest(ctx context.Context, endpoint exchange.URL, path
}
// SendAuthenticatedHTTPRequest sends an authenticated HTTP request
func (e *EXMO) SendAuthenticatedHTTPRequest(ctx context.Context, epath exchange.URL, method, endpoint string, vals url.Values, result any) error {
func (e *Exchange) SendAuthenticatedHTTPRequest(ctx context.Context, epath exchange.URL, method, endpoint string, vals url.Values, result any) error {
creds, err := e.GetCredentials(ctx)
if err != nil {
return err
@@ -349,7 +349,7 @@ func (e *EXMO) SendAuthenticatedHTTPRequest(ctx context.Context, epath exchange.
}
// GetFee returns an estimate of fee based on type of transaction
func (e *EXMO) GetFee(feeBuilder *exchange.FeeBuilder) (float64, error) {
func (e *Exchange) GetFee(feeBuilder *exchange.FeeBuilder) (float64, error) {
var fee float64
switch feeBuilder.FeeType {
case exchange.CryptocurrencyTradeFee:
@@ -509,7 +509,7 @@ func getInternationalBankDepositFee(c currency.Code, amount float64, bankTransac
}
// GetCryptoPaymentProvidersList returns a map of all the supported cryptocurrency transfer settings
func (e *EXMO) GetCryptoPaymentProvidersList(ctx context.Context) (map[string][]CryptoPaymentProvider, error) {
func (e *Exchange) GetCryptoPaymentProvidersList(ctx context.Context) (map[string][]CryptoPaymentProvider, error) {
var result map[string][]CryptoPaymentProvider
path := "/v" + exmoAPIVersion + "/" + exmoCryptoPaymentProviderList
return result, e.SendHTTPRequest(ctx, exchange.RestSpot, path, &result)

View File

@@ -27,12 +27,12 @@ const (
)
var (
e *EXMO
e *Exchange
testPair = currency.NewBTCUSD().Format(currency.PairFormat{Uppercase: true, Delimiter: "_"})
)
func TestMain(m *testing.M) {
e = new(EXMO)
e = new(Exchange)
if err := testexch.Setup(e); err != nil {
log.Fatalf("EXMO Setup error: %s", err)
}

View File

@@ -30,7 +30,7 @@ import (
)
// SetDefaults sets the basic defaults for exmo
func (e *EXMO) SetDefaults() {
func (e *Exchange) SetDefaults() {
e.Name = "EXMO"
e.Enabled = true
e.Verbose = true
@@ -104,7 +104,7 @@ func (e *EXMO) SetDefaults() {
}
// Setup takes in the supplied exchange configuration details and sets params
func (e *EXMO) Setup(exch *config.Exchange) error {
func (e *Exchange) Setup(exch *config.Exchange) error {
if err := exch.Validate(); err != nil {
return err
}
@@ -116,7 +116,7 @@ func (e *EXMO) Setup(exch *config.Exchange) error {
}
// FetchTradablePairs returns a list of the exchanges tradable pairs
func (e *EXMO) FetchTradablePairs(ctx context.Context, a asset.Item) (currency.Pairs, error) {
func (e *Exchange) FetchTradablePairs(ctx context.Context, a asset.Item) (currency.Pairs, error) {
if !e.SupportsAsset(a) {
return nil, asset.ErrNotSupported
}
@@ -140,7 +140,7 @@ func (e *EXMO) FetchTradablePairs(ctx context.Context, a asset.Item) (currency.P
// UpdateTradablePairs updates the exchanges available pairs and stores
// them in the exchanges config
func (e *EXMO) UpdateTradablePairs(ctx context.Context, forceUpdate bool) error {
func (e *Exchange) UpdateTradablePairs(ctx context.Context, forceUpdate bool) error {
pairs, err := e.FetchTradablePairs(ctx, asset.Spot)
if err != nil {
return err
@@ -153,7 +153,7 @@ func (e *EXMO) UpdateTradablePairs(ctx context.Context, forceUpdate bool) error
}
// UpdateTickers updates the ticker for all currency pairs of a given asset type
func (e *EXMO) UpdateTickers(ctx context.Context, a asset.Item) error {
func (e *Exchange) UpdateTickers(ctx context.Context, a asset.Item) error {
if !e.SupportsAsset(a) {
return fmt.Errorf("%w: %v", asset.ErrNotSupported, a)
}
@@ -195,7 +195,7 @@ func (e *EXMO) UpdateTickers(ctx context.Context, a asset.Item) error {
}
// UpdateTicker updates and returns the ticker for a currency pair
func (e *EXMO) UpdateTicker(ctx context.Context, p currency.Pair, a asset.Item) (*ticker.Price, error) {
func (e *Exchange) UpdateTicker(ctx context.Context, p currency.Pair, a asset.Item) (*ticker.Price, error) {
if err := e.UpdateTickers(ctx, a); err != nil {
return nil, err
}
@@ -203,7 +203,7 @@ func (e *EXMO) UpdateTicker(ctx context.Context, p currency.Pair, a asset.Item)
}
// UpdateOrderbook updates and returns the orderbook for a currency pair
func (e *EXMO) UpdateOrderbook(ctx context.Context, p currency.Pair, assetType asset.Item) (*orderbook.Book, error) {
func (e *Exchange) UpdateOrderbook(ctx context.Context, p currency.Pair, assetType asset.Item) (*orderbook.Book, error) {
if p.IsEmpty() {
return nil, currency.ErrCurrencyPairEmpty
}
@@ -271,7 +271,7 @@ func (e *EXMO) UpdateOrderbook(ctx context.Context, p currency.Pair, assetType a
// UpdateAccountInfo retrieves balances for all enabled currencies for the
// Exmo exchange
func (e *EXMO) UpdateAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, error) {
func (e *Exchange) UpdateAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, error) {
result, err := e.GetUserInfo(ctx)
if err != nil {
return account.Holdings{}, err
@@ -316,7 +316,7 @@ func (e *EXMO) UpdateAccountInfo(ctx context.Context, assetType asset.Item) (acc
// GetAccountFundingHistory returns funding history, deposits and
// withdrawals
func (e *EXMO) GetAccountFundingHistory(ctx context.Context) ([]exchange.FundingHistory, error) {
func (e *Exchange) GetAccountFundingHistory(ctx context.Context) ([]exchange.FundingHistory, error) {
hist, err := e.GetWalletHistory(ctx, 0)
if err != nil {
return nil, err
@@ -339,7 +339,7 @@ func (e *EXMO) GetAccountFundingHistory(ctx context.Context) ([]exchange.Funding
}
// GetWithdrawalsHistory returns previous withdrawals data
func (e *EXMO) GetWithdrawalsHistory(ctx context.Context, _ currency.Code, _ asset.Item) ([]exchange.WithdrawalHistory, error) {
func (e *Exchange) GetWithdrawalsHistory(ctx context.Context, _ currency.Code, _ asset.Item) ([]exchange.WithdrawalHistory, error) {
hist, err := e.GetWalletHistory(ctx, 0)
if err != nil {
return nil, err
@@ -362,7 +362,7 @@ func (e *EXMO) GetWithdrawalsHistory(ctx context.Context, _ currency.Code, _ ass
}
// GetRecentTrades returns the most recent trades for a currency and asset
func (e *EXMO) GetRecentTrades(ctx context.Context, p currency.Pair, assetType asset.Item) ([]trade.Data, error) {
func (e *Exchange) GetRecentTrades(ctx context.Context, p currency.Pair, assetType asset.Item) ([]trade.Data, error) {
var err error
p, err = e.FormatExchangeCurrency(p, assetType)
if err != nil {
@@ -404,12 +404,12 @@ func (e *EXMO) GetRecentTrades(ctx context.Context, p currency.Pair, assetType a
}
// GetHistoricTrades returns historic trade data within the timeframe provided
func (e *EXMO) GetHistoricTrades(_ context.Context, _ currency.Pair, _ asset.Item, _, _ time.Time) ([]trade.Data, error) {
func (e *Exchange) GetHistoricTrades(_ context.Context, _ currency.Pair, _ asset.Item, _, _ time.Time) ([]trade.Data, error) {
return nil, common.ErrFunctionNotSupported
}
// SubmitOrder submits a new order
func (e *EXMO) SubmitOrder(ctx context.Context, s *order.Submit) (*order.SubmitResponse, error) {
func (e *Exchange) SubmitOrder(ctx context.Context, s *order.Submit) (*order.SubmitResponse, error) {
if err := s.Validate(e.GetTradingRequirements()); err != nil {
return nil, err
}
@@ -441,12 +441,12 @@ func (e *EXMO) SubmitOrder(ctx context.Context, s *order.Submit) (*order.SubmitR
// ModifyOrder will allow of changing orderbook placement and limit to
// market conversion
func (e *EXMO) ModifyOrder(_ context.Context, _ *order.Modify) (*order.ModifyResponse, error) {
func (e *Exchange) ModifyOrder(_ context.Context, _ *order.Modify) (*order.ModifyResponse, error) {
return nil, common.ErrFunctionNotSupported
}
// CancelOrder cancels an order by its corresponding ID number
func (e *EXMO) CancelOrder(ctx context.Context, o *order.Cancel) error {
func (e *Exchange) CancelOrder(ctx context.Context, o *order.Cancel) error {
if err := o.Validate(o.StandardCancel()); err != nil {
return err
}
@@ -460,17 +460,17 @@ 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) {
func (e *Exchange) 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) {
func (e *Exchange) GetServerTime(_ context.Context, _ asset.Item) (time.Time, error) {
return time.Time{}, common.ErrFunctionNotSupported
}
// CancelAllOrders cancels all orders associated with a currency pair
func (e *EXMO) CancelAllOrders(ctx context.Context, _ *order.Cancel) (order.CancelAllResponse, error) {
func (e *Exchange) CancelAllOrders(ctx context.Context, _ *order.Cancel) (order.CancelAllResponse, error) {
cancelAllOrdersResponse := order.CancelAllResponse{
Status: make(map[string]string),
}
@@ -491,12 +491,12 @@ 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) {
func (e *Exchange) GetOrderInfo(_ context.Context, _ string, _ currency.Pair, _ asset.Item) (*order.Detail, error) {
return nil, common.ErrFunctionNotSupported
}
// GetDepositAddress returns a deposit address for a specified currency
func (e *EXMO) GetDepositAddress(ctx context.Context, cryptocurrency currency.Code, _, chain string) (*deposit.Address, error) {
func (e *Exchange) GetDepositAddress(ctx context.Context, cryptocurrency currency.Code, _, chain string) (*deposit.Address, error) {
fullAddr, err := e.GetCryptoDepositAddress(ctx)
if err != nil {
return nil, err
@@ -536,7 +536,7 @@ func (e *EXMO) GetDepositAddress(ctx context.Context, cryptocurrency currency.Co
// WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is
// submitted
func (e *EXMO) WithdrawCryptocurrencyFunds(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error) {
func (e *Exchange) WithdrawCryptocurrencyFunds(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error) {
if err := withdrawRequest.Validate(); err != nil {
return nil, err
}
@@ -554,18 +554,18 @@ func (e *EXMO) WithdrawCryptocurrencyFunds(ctx context.Context, withdrawRequest
// WithdrawFiatFunds returns a withdrawal ID when a
// withdrawal is submitted
func (e *EXMO) WithdrawFiatFunds(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error) {
func (e *Exchange) WithdrawFiatFunds(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error) {
return nil, common.ErrFunctionNotSupported
}
// WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a
// withdrawal is submitted
func (e *EXMO) WithdrawFiatFundsToInternationalBank(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error) {
func (e *Exchange) WithdrawFiatFundsToInternationalBank(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error) {
return nil, common.ErrFunctionNotSupported
}
// GetFeeByType returns an estimate of fee based on type of transaction
func (e *EXMO) GetFeeByType(ctx context.Context, feeBuilder *exchange.FeeBuilder) (float64, error) {
func (e *Exchange) GetFeeByType(ctx context.Context, feeBuilder *exchange.FeeBuilder) (float64, error) {
if feeBuilder == nil {
return 0, fmt.Errorf("%T %w", feeBuilder, common.ErrNilPointer)
}
@@ -577,7 +577,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.MultiOrderRequest) (order.FilteredOrders, error) {
func (e *Exchange) GetActiveOrders(ctx context.Context, req *order.MultiOrderRequest) (order.FilteredOrders, error) {
err := req.Validate()
if err != nil {
return nil, err
@@ -613,7 +613,7 @@ func (e *EXMO) GetActiveOrders(ctx context.Context, req *order.MultiOrderRequest
// GetOrderHistory retrieves account order information
// Can Limit response to specific order status
func (e *EXMO) GetOrderHistory(ctx context.Context, req *order.MultiOrderRequest) (order.FilteredOrders, error) {
func (e *Exchange) GetOrderHistory(ctx context.Context, req *order.MultiOrderRequest) (order.FilteredOrders, error) {
err := req.Validate()
if err != nil {
return nil, err
@@ -669,24 +669,23 @@ func (e *EXMO) GetOrderHistory(ctx context.Context, req *order.MultiOrderRequest
// ValidateAPICredentials validates current credentials used for wrapper
// functionality
func (e *EXMO) ValidateAPICredentials(ctx context.Context, assetType asset.Item) error {
func (e *Exchange) ValidateAPICredentials(ctx context.Context, assetType asset.Item) error {
_, err := e.UpdateAccountInfo(ctx, assetType)
return e.CheckTransientError(err)
}
// GetHistoricCandles returns candles between a time period for a set time interval
func (e *EXMO) GetHistoricCandles(_ context.Context, _ currency.Pair, _ asset.Item, _ kline.Interval, _, _ time.Time) (*kline.Item, error) {
func (e *Exchange) GetHistoricCandles(_ context.Context, _ currency.Pair, _ asset.Item, _ kline.Interval, _, _ time.Time) (*kline.Item, error) {
return nil, common.ErrFunctionNotSupported
}
// GetHistoricCandlesExtended returns candles between a time period for a set time interval
func (e *EXMO) GetHistoricCandlesExtended(_ context.Context, _ currency.Pair, _ asset.Item, _ kline.Interval, _, _ time.Time) (*kline.Item, error) {
func (e *Exchange) GetHistoricCandlesExtended(_ context.Context, _ currency.Pair, _ asset.Item, _ kline.Interval, _, _ time.Time) (*kline.Item, error) {
return nil, common.ErrFunctionNotSupported
}
// GetAvailableTransferChains returns the available transfer blockchains for the specific
// cryptocurrency
func (e *EXMO) GetAvailableTransferChains(ctx context.Context, cryptocurrency currency.Code) ([]string, error) {
// GetAvailableTransferChains returns the available transfer blockchains for the specific cryptocurrency
func (e *Exchange) GetAvailableTransferChains(ctx context.Context, cryptocurrency currency.Code) ([]string, error) {
chains, err := e.GetCryptoPaymentProvidersList(ctx)
if err != nil {
return nil, err
@@ -712,22 +711,22 @@ func (e *EXMO) GetAvailableTransferChains(ctx context.Context, cryptocurrency cu
}
// GetFuturesContractDetails returns all contracts from the exchange by asset type
func (e *EXMO) GetFuturesContractDetails(context.Context, asset.Item) ([]futures.Contract, error) {
func (e *Exchange) GetFuturesContractDetails(context.Context, asset.Item) ([]futures.Contract, error) {
return nil, common.ErrFunctionNotSupported
}
// GetLatestFundingRates returns the latest funding rates data
func (e *EXMO) GetLatestFundingRates(context.Context, *fundingrate.LatestRateRequest) ([]fundingrate.LatestRateResponse, error) {
func (e *Exchange) GetLatestFundingRates(context.Context, *fundingrate.LatestRateRequest) ([]fundingrate.LatestRateResponse, error) {
return nil, common.ErrFunctionNotSupported
}
// UpdateOrderExecutionLimits updates order execution limits
func (e *EXMO) UpdateOrderExecutionLimits(_ context.Context, _ asset.Item) error {
func (e *Exchange) UpdateOrderExecutionLimits(_ context.Context, _ asset.Item) error {
return common.ErrNotYetImplemented
}
// GetCurrencyTradeURL returns the URL to the exchange's trade page for the given asset and currency pair
func (e *EXMO) GetCurrencyTradeURL(_ context.Context, a asset.Item, cp currency.Pair) (string, error) {
func (e *Exchange) GetCurrencyTradeURL(_ context.Context, a asset.Item, cp currency.Pair) (string, error) {
_, err := e.CurrencyPairs.IsPairEnabled(cp, a)
if err != nil {
return "", err