Documentation ¶
Index ¶
- Constants
- Variables
- func AreAPICredentialsSet(exch exchange.IBotExchange) bool
- func ForceFileStandard(t *testing.T, pattern string) error
- func GetWebsocketInterfaceChannelOverride() chan interface{}
- func GetWebsocketStructChannelOverride() chan struct{}
- func NewTestWebsocket() *stream.Websocket
- func SetupCurrencyPairsForExchangeAsset(t *testing.T, exch exchange.IBotExchange, a asset.Item, cp ...currency.Pair)
- func SkipTestIfCannotManipulateOrders(t *testing.T, exch exchange.IBotExchange, canManipulateOrders bool)
- func SkipTestIfCredentialsUnset(t *testing.T, exch exchange.IBotExchange, canManipulateOrders ...bool)
- func TestFixtureToDataHandler(t *testing.T, seed, e exchange.IBotExchange, fixturePath string, ...)
- type CustomEx
- func (c *CustomEx) AuthenticateWebsocket(_ context.Context) error
- func (c *CustomEx) CancelAllOrders(_ context.Context, _ *order.Cancel) (order.CancelAllResponse, error)
- func (c *CustomEx) CancelBatchOrders(_ context.Context, _ []order.Cancel) (*order.CancelBatchResponse, error)
- func (c *CustomEx) CancelOrder(_ context.Context, _ *order.Cancel) error
- func (c *CustomEx) CheckOrderExecutionLimits(_ asset.Item, _ currency.Pair, _, _ float64, _ order.Type) error
- func (c *CustomEx) DisableRateLimiter() error
- func (c *CustomEx) EnableRateLimiter() error
- func (c *CustomEx) FetchAccountInfo(_ context.Context, _ asset.Item) (account.Holdings, error)
- func (c *CustomEx) FetchOrderbook(_ context.Context, _ currency.Pair, _ asset.Item) (*orderbook.Base, error)
- func (c *CustomEx) FetchTicker(_ context.Context, _ currency.Pair, _ asset.Item) (*ticker.Price, error)
- func (c *CustomEx) FetchTradablePairs(_ context.Context, _ asset.Item) (currency.Pairs, error)
- func (c *CustomEx) FlushWebsocketChannels() error
- func (c *CustomEx) FormatWithdrawPermissions() string
- func (c *CustomEx) GetAccountFundingHistory(_ context.Context) ([]exchange.FundingHistory, error)
- func (c *CustomEx) GetActiveOrders(_ context.Context, _ *order.MultiOrderRequest) (order.FilteredOrders, error)
- func (c *CustomEx) GetAssetTypes(_ bool) asset.Items
- func (c *CustomEx) GetAvailablePairs(_ asset.Item) (currency.Pairs, error)
- func (c *CustomEx) GetBase() *exchange.Base
- func (c *CustomEx) GetDepositAddress(_ context.Context, _ currency.Code, _, _ string) (*deposit.Address, error)
- func (c *CustomEx) GetEnabledPairs(_ asset.Item) (currency.Pairs, error)
- func (c *CustomEx) GetFeeByType(_ context.Context, _ *exchange.FeeBuilder) (float64, error)
- func (c *CustomEx) GetFuturesContractDetails(context.Context, asset.Item) ([]futures.Contract, error)
- func (c *CustomEx) GetHTTPClientUserAgent() (string, error)
- func (c *CustomEx) GetHistoricCandles(_ context.Context, _ currency.Pair, _ asset.Item, _ kline.Interval, ...) (*kline.Item, error)
- func (c *CustomEx) GetHistoricCandlesExtended(_ context.Context, _ currency.Pair, _ asset.Item, _ kline.Interval, ...) (*kline.Item, error)
- func (c *CustomEx) GetHistoricTrades(_ context.Context, _ currency.Pair, _ asset.Item, _, _ time.Time) ([]trade.Data, error)
- func (c *CustomEx) GetHistoricalFundingRates(_ context.Context, _ *fundingrate.HistoricalRatesRequest) (*fundingrate.HistoricalRates, error)
- func (c *CustomEx) GetLastPairsUpdateTime() int64
- func (c *CustomEx) GetLatestFundingRates(_ context.Context, _ *fundingrate.LatestRateRequest) ([]fundingrate.LatestRateResponse, error)
- func (c *CustomEx) GetName() string
- func (c *CustomEx) GetOrderExecutionLimits(_ asset.Item, _ currency.Pair) (order.MinMaxLevel, error)
- func (c *CustomEx) GetOrderHistory(_ context.Context, _ *order.MultiOrderRequest) (order.FilteredOrders, error)
- func (c *CustomEx) GetOrderInfo(_ context.Context, _ string, _ currency.Pair, _ asset.Item) (*order.Detail, error)
- func (c *CustomEx) GetRecentTrades(_ context.Context, _ currency.Pair, _ asset.Item) ([]trade.Data, error)
- func (c *CustomEx) GetServerTime(context.Context, asset.Item) (time.Time, error)
- func (c *CustomEx) GetSubscriptions() ([]subscription.Subscription, error)
- func (c *CustomEx) GetWebsocket() (*stream.Websocket, error)
- func (c *CustomEx) GetWithdrawPermissions() uint32
- func (c *CustomEx) GetWithdrawalsHistory(_ context.Context, _ currency.Code, _ asset.Item) ([]exchange.WithdrawalHistory, error)
- func (c *CustomEx) IsAssetWebsocketSupported(_ asset.Item) bool
- func (c *CustomEx) IsEnabled() bool
- func (c *CustomEx) IsWebsocketEnabled() bool
- func (c *CustomEx) ModifyOrder(_ context.Context, _ *order.Modify) (*order.ModifyResponse, error)
- func (c *CustomEx) SetClientProxyAddress(_ string) error
- func (c *CustomEx) SetDefaults()
- func (c *CustomEx) SetEnabled(bool)
- func (c *CustomEx) SetHTTPClientUserAgent(_ string) error
- func (c *CustomEx) SetPairs(_ currency.Pairs, _ asset.Item, _ bool) error
- func (c *CustomEx) Setup(_ *config.Exchange) error
- func (c *CustomEx) SubmitOrder(_ context.Context, _ *order.Submit) (*order.SubmitResponse, error)
- func (c *CustomEx) SubmitOrders(_ context.Context, _ ...*order.Submit) ([]*order.SubmitResponse, error)
- func (c *CustomEx) SubscribeToWebsocketChannels(_ []subscription.Subscription) error
- func (c *CustomEx) SupportsAsset(_ asset.Item) bool
- func (c *CustomEx) SupportsAutoPairUpdates() bool
- func (c *CustomEx) SupportsREST() bool
- func (c *CustomEx) SupportsRESTTickerBatchUpdates() bool
- func (c *CustomEx) SupportsWebsocket() bool
- func (c *CustomEx) SupportsWithdrawPermissions(_ uint32) bool
- func (c *CustomEx) UnsubscribeToWebsocketChannels(_ []subscription.Subscription) error
- func (c *CustomEx) UpdateAccountInfo(_ context.Context, _ asset.Item) (account.Holdings, error)
- func (c *CustomEx) UpdateOrderExecutionLimits(_ context.Context, _ asset.Item) error
- func (c *CustomEx) UpdateOrderbook(_ context.Context, _ currency.Pair, _ asset.Item) (*orderbook.Base, error)
- func (c *CustomEx) UpdateTicker(_ context.Context, _ currency.Pair, _ asset.Item) (*ticker.Price, error)
- func (c *CustomEx) UpdateTickers(_ context.Context, _ asset.Item) error
- func (c *CustomEx) UpdateTradablePairs(_ context.Context, _ bool) error
- func (c *CustomEx) ValidateAPICredentials(_ context.Context, _ asset.Item) error
- func (c *CustomEx) WithdrawCryptocurrencyFunds(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error)
- func (c *CustomEx) WithdrawFiatFunds(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error)
- func (c *CustomEx) WithdrawFiatFundsToInternationalBank(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error)
Constants ¶
const ( // WebsocketResponseDefaultTimeout used in websocket testing // Defines wait time for receiving websocket response before cancelling WebsocketResponseDefaultTimeout = 3 * time.Second // WebsocketResponseExtendedTimeout used in websocket testing // Defines wait time for receiving websocket response before cancelling WebsocketResponseExtendedTimeout = 15 * time.Second // WebsocketChannelOverrideCapacity used in websocket testing // Defines channel capacity as defaults size can block tests WebsocketChannelOverrideCapacity = 500 MockTesting = "Mock testing framework in use for %s exchange on REST endpoints only" LiveTesting = "Mock testing bypassed; live testing of REST endpoints in use for %s exchange" )
This package is only to be referenced in test files
Variables ¶
var EmptyStringPotentialPattern = `.*float64.*json:"[^"]*,string".*`
EmptyStringPotentialPattern is a regular expression pattern for a potential empty string into float64
Functions ¶
func AreAPICredentialsSet ¶
func AreAPICredentialsSet(exch exchange.IBotExchange) bool
AreAPICredentialsSet returns if the API credentials are set.
func ForceFileStandard ¶
ForceFileStandard will check all files in the current directory for a regular expression pattern. If the pattern is found the test will fail.
func GetWebsocketInterfaceChannelOverride ¶
func GetWebsocketInterfaceChannelOverride() chan interface{}
GetWebsocketInterfaceChannelOverride returns a new interface based channel with the capacity set to WebsocketChannelOverrideCapacity
func GetWebsocketStructChannelOverride ¶
func GetWebsocketStructChannelOverride() chan struct{}
GetWebsocketStructChannelOverride returns a new struct based channel with the capacity set to WebsocketChannelOverrideCapacity
func NewTestWebsocket ¶
NewTestWebsocket returns a test websocket object
func SetupCurrencyPairsForExchangeAsset ¶
func SetupCurrencyPairsForExchangeAsset(t *testing.T, exch exchange.IBotExchange, a asset.Item, cp ...currency.Pair)
SetupCurrencyPairsForExchangeAsset enables an asset for an exchange and adds the currency pair(s) to the available and enabled list of existing pairs if it is already enabled or part of the pairs, no error is raised
func SkipTestIfCannotManipulateOrders ¶
func SkipTestIfCannotManipulateOrders(t *testing.T, exch exchange.IBotExchange, canManipulateOrders bool)
SkipTestIfCannotManipulateOrders will only skip if the credentials are set correctly and can manipulate orders is set to false. It will continue normal operations if credentials are not set, giving better code coverage.
func SkipTestIfCredentialsUnset ¶
func SkipTestIfCredentialsUnset(t *testing.T, exch exchange.IBotExchange, canManipulateOrders ...bool)
SkipTestIfCredentialsUnset is a test helper function checking if the authenticated function can perform the required test.
func TestFixtureToDataHandler ¶
func TestFixtureToDataHandler(t *testing.T, seed, e exchange.IBotExchange, fixturePath string, reader func([]byte) error)
TestFixtureToDataHandler takes a new empty exchange and configures a new websocket handler for it, and squirts the json path contents to it It accepts a reader function, which is probably e.wsHandleData but could be anything
Types ¶
type CustomEx ¶
CustomEx creates a mock custom exchange
func (*CustomEx) AuthenticateWebsocket ¶
AuthenticateWebsocket is a mock method for CustomEx
func (*CustomEx) CancelAllOrders ¶
func (c *CustomEx) CancelAllOrders(_ context.Context, _ *order.Cancel) (order.CancelAllResponse, error)
CancelAllOrders is a mock method for CustomEx
func (*CustomEx) CancelBatchOrders ¶
func (c *CustomEx) CancelBatchOrders(_ context.Context, _ []order.Cancel) (*order.CancelBatchResponse, error)
CancelBatchOrders is a mock method for CustomEx
func (*CustomEx) CancelOrder ¶
CancelOrder is a mock method for CustomEx
func (*CustomEx) CheckOrderExecutionLimits ¶
func (c *CustomEx) CheckOrderExecutionLimits(_ asset.Item, _ currency.Pair, _, _ float64, _ order.Type) error
CheckOrderExecutionLimits is a mock method for CustomEx
func (*CustomEx) DisableRateLimiter ¶
DisableRateLimiter is a mock method for CustomEx
func (*CustomEx) EnableRateLimiter ¶
EnableRateLimiter is a mock method for CustomEx
func (*CustomEx) FetchAccountInfo ¶
FetchAccountInfo is a mock method for CustomEx
func (*CustomEx) FetchOrderbook ¶
func (c *CustomEx) FetchOrderbook(_ context.Context, _ currency.Pair, _ asset.Item) (*orderbook.Base, error)
FetchOrderbook is a mock method for CustomEx
func (*CustomEx) FetchTicker ¶
func (c *CustomEx) FetchTicker(_ context.Context, _ currency.Pair, _ asset.Item) (*ticker.Price, error)
FetchTicker is a mock method for CustomEx
func (*CustomEx) FetchTradablePairs ¶
FetchTradablePairs is a mock method for CustomEx
func (*CustomEx) FlushWebsocketChannels ¶
FlushWebsocketChannels is a mock method for CustomEx
func (*CustomEx) FormatWithdrawPermissions ¶
FormatWithdrawPermissions is a mock method for CustomEx
func (*CustomEx) GetAccountFundingHistory ¶
GetAccountFundingHistory is a mock method for CustomEx
func (*CustomEx) GetActiveOrders ¶
func (c *CustomEx) GetActiveOrders(_ context.Context, _ *order.MultiOrderRequest) (order.FilteredOrders, error)
GetActiveOrders is a mock method for CustomEx
func (*CustomEx) GetAssetTypes ¶
GetAssetTypes is a mock method for CustomEx
func (*CustomEx) GetAvailablePairs ¶
GetAvailablePairs is a mock method for CustomEx
func (*CustomEx) GetDepositAddress ¶
func (c *CustomEx) GetDepositAddress(_ context.Context, _ currency.Code, _, _ string) (*deposit.Address, error)
GetDepositAddress is a mock method for CustomEx
func (*CustomEx) GetEnabledPairs ¶
GetEnabledPairs is a mock method for CustomEx
func (*CustomEx) GetFeeByType ¶
GetFeeByType is a mock method for CustomEx
func (*CustomEx) GetFuturesContractDetails ¶
func (c *CustomEx) GetFuturesContractDetails(context.Context, asset.Item) ([]futures.Contract, error)
GetFuturesContractDetails returns all contracts from the exchange by asset type
func (*CustomEx) GetHTTPClientUserAgent ¶
GetHTTPClientUserAgent is a mock method for CustomEx
func (*CustomEx) GetHistoricCandles ¶
func (c *CustomEx) GetHistoricCandles(_ context.Context, _ currency.Pair, _ asset.Item, _ kline.Interval, _, _ time.Time) (*kline.Item, error)
GetHistoricCandles is a mock method for CustomEx
func (*CustomEx) GetHistoricCandlesExtended ¶
func (c *CustomEx) GetHistoricCandlesExtended(_ context.Context, _ currency.Pair, _ asset.Item, _ kline.Interval, _, _ time.Time) (*kline.Item, error)
GetHistoricCandlesExtended is a mock method for CustomEx
func (*CustomEx) GetHistoricTrades ¶
func (c *CustomEx) GetHistoricTrades(_ context.Context, _ currency.Pair, _ asset.Item, _, _ time.Time) ([]trade.Data, error)
GetHistoricTrades is a mock method for CustomEx
func (*CustomEx) GetHistoricalFundingRates ¶
func (c *CustomEx) GetHistoricalFundingRates(_ context.Context, _ *fundingrate.HistoricalRatesRequest) (*fundingrate.HistoricalRates, error)
GetHistoricalFundingRates returns funding rates for a given asset and currency for a time period
func (*CustomEx) GetLastPairsUpdateTime ¶
GetLastPairsUpdateTime is a mock method for CustomEx
func (*CustomEx) GetLatestFundingRates ¶
func (c *CustomEx) GetLatestFundingRates(_ context.Context, _ *fundingrate.LatestRateRequest) ([]fundingrate.LatestRateResponse, error)
GetLatestFundingRates returns the latest funding rates data
func (*CustomEx) GetOrderExecutionLimits ¶
func (c *CustomEx) GetOrderExecutionLimits(_ asset.Item, _ currency.Pair) (order.MinMaxLevel, error)
GetOrderExecutionLimits is a mock method for CustomEx
func (*CustomEx) GetOrderHistory ¶
func (c *CustomEx) GetOrderHistory(_ context.Context, _ *order.MultiOrderRequest) (order.FilteredOrders, error)
GetOrderHistory is a mock method for CustomEx
func (*CustomEx) GetOrderInfo ¶
func (c *CustomEx) GetOrderInfo(_ context.Context, _ string, _ currency.Pair, _ asset.Item) (*order.Detail, error)
GetOrderInfo is a mock method for CustomEx
func (*CustomEx) GetRecentTrades ¶
func (c *CustomEx) GetRecentTrades(_ context.Context, _ currency.Pair, _ asset.Item) ([]trade.Data, error)
GetRecentTrades is a mock method for CustomEx
func (*CustomEx) GetServerTime ¶
GetServerTime is a mock method for CustomEx
func (*CustomEx) GetSubscriptions ¶
func (c *CustomEx) GetSubscriptions() ([]subscription.Subscription, error)
GetSubscriptions is a mock method for CustomEx
func (*CustomEx) GetWebsocket ¶
GetWebsocket is a mock method for CustomEx
func (*CustomEx) GetWithdrawPermissions ¶
GetWithdrawPermissions is a mock method for CustomEx
func (*CustomEx) GetWithdrawalsHistory ¶
func (c *CustomEx) GetWithdrawalsHistory(_ context.Context, _ currency.Code, _ asset.Item) ([]exchange.WithdrawalHistory, error)
GetWithdrawalsHistory is a mock method for CustomEx
func (*CustomEx) IsAssetWebsocketSupported ¶
IsAssetWebsocketSupported is a mock method for CustomEx
func (*CustomEx) IsWebsocketEnabled ¶
IsWebsocketEnabled is a mock method for CustomEx
func (*CustomEx) ModifyOrder ¶
ModifyOrder is a mock method for CustomEx
func (*CustomEx) SetClientProxyAddress ¶
SetClientProxyAddress is a mock method for CustomEx
func (*CustomEx) SetDefaults ¶
func (c *CustomEx) SetDefaults()
SetDefaults is a mock method for CustomEx
func (*CustomEx) SetEnabled ¶
SetEnabled is a mock method for CustomEx
func (*CustomEx) SetHTTPClientUserAgent ¶
SetHTTPClientUserAgent is a mock method for CustomEx
func (*CustomEx) SubmitOrder ¶
SubmitOrder is a mock method for CustomEx
func (*CustomEx) SubmitOrders ¶ added in v1.0.7
func (c *CustomEx) SubmitOrders(_ context.Context, _ ...*order.Submit) ([]*order.SubmitResponse, error)
SubmitOrder is a mock method for CustomEx
func (*CustomEx) SubscribeToWebsocketChannels ¶
func (c *CustomEx) SubscribeToWebsocketChannels(_ []subscription.Subscription) error
SubscribeToWebsocketChannels is a mock method for CustomEx
func (*CustomEx) SupportsAsset ¶
SupportsAsset is a mock method for CustomEx
func (*CustomEx) SupportsAutoPairUpdates ¶
SupportsAutoPairUpdates is a mock method for CustomEx
func (*CustomEx) SupportsREST ¶
SupportsREST is a mock method for CustomEx
func (*CustomEx) SupportsRESTTickerBatchUpdates ¶
SupportsRESTTickerBatchUpdates is a mock method for CustomEx
func (*CustomEx) SupportsWebsocket ¶
SupportsWebsocket is a mock method for CustomEx
func (*CustomEx) SupportsWithdrawPermissions ¶
SupportsWithdrawPermissions is a mock method for CustomEx
func (*CustomEx) UnsubscribeToWebsocketChannels ¶
func (c *CustomEx) UnsubscribeToWebsocketChannels(_ []subscription.Subscription) error
UnsubscribeToWebsocketChannels is a mock method for CustomEx
func (*CustomEx) UpdateAccountInfo ¶
UpdateAccountInfo is a mock method for CustomEx
func (*CustomEx) UpdateOrderExecutionLimits ¶
UpdateOrderExecutionLimits is a mock method for CustomEx
func (*CustomEx) UpdateOrderbook ¶
func (c *CustomEx) UpdateOrderbook(_ context.Context, _ currency.Pair, _ asset.Item) (*orderbook.Base, error)
UpdateOrderbook is a mock method for CustomEx
func (*CustomEx) UpdateTicker ¶
func (c *CustomEx) UpdateTicker(_ context.Context, _ currency.Pair, _ asset.Item) (*ticker.Price, error)
UpdateTicker is a mock method for CustomEx
func (*CustomEx) UpdateTickers ¶
UpdateTickers is a mock method for CustomEx
func (*CustomEx) UpdateTradablePairs ¶
UpdateTradablePairs is a mock method for CustomEx
func (*CustomEx) ValidateAPICredentials ¶
ValidateAPICredentials is a mock method for CustomEx
func (*CustomEx) WithdrawCryptocurrencyFunds ¶
func (c *CustomEx) WithdrawCryptocurrencyFunds(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error)
WithdrawCryptocurrencyFunds is a mock method for CustomEx
func (*CustomEx) WithdrawFiatFunds ¶
func (c *CustomEx) WithdrawFiatFunds(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error)
WithdrawFiatFunds is a mock method for CustomEx
func (*CustomEx) WithdrawFiatFundsToInternationalBank ¶
func (c *CustomEx) WithdrawFiatFundsToInternationalBank(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error)
WithdrawFiatFundsToInternationalBank is a mock method for CustomEx