mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-14 15:09:51 +00:00
* Initial rework of rework of requester - WIP * Implementing and checking rate limits - WIP * implemented coinbene rate limiting shenanigans * add in remaining WIP * fixy * use authenticated rate limit * drop ceiling as this can be done with a counter later * add functionality to struct * purge config options for rate limiting so as to keep things minimal * prepare futures and swap rate limiting for implementation * Address linter issues * Addressed nits, fixed race * fix linter issue * remove global var as this was only setting when newrequester was called * moved rate limit functionality into its own file * Update Bitfinex with correct rate limit and test endpoints (WIP) * finish off bitfinex adjustments * fixes * fix linter issues * slowed rate for coinbasepro * drop rate limit for huobi as the doc times have intermittent 429 issues. * Set MACOSX_DEPLOYMENT_TARGET to remove linking warning * Addr Thrasher nits * Addr glorious nits * unexport do request function * fixed nitorinos * Fixed something I missed * move disabled rate limiter into loadexchange and use interface functionality * Add temp quick fix
78 lines
3.5 KiB
Go
78 lines
3.5 KiB
Go
package exchange
|
|
|
|
import (
|
|
"sync"
|
|
|
|
"github.com/thrasher-corp/gocryptotrader/config"
|
|
"github.com/thrasher-corp/gocryptotrader/currency"
|
|
"github.com/thrasher-corp/gocryptotrader/exchanges/account"
|
|
"github.com/thrasher-corp/gocryptotrader/exchanges/asset"
|
|
"github.com/thrasher-corp/gocryptotrader/exchanges/order"
|
|
"github.com/thrasher-corp/gocryptotrader/exchanges/orderbook"
|
|
"github.com/thrasher-corp/gocryptotrader/exchanges/ticker"
|
|
"github.com/thrasher-corp/gocryptotrader/exchanges/websocket/wshandler"
|
|
"github.com/thrasher-corp/gocryptotrader/exchanges/withdraw"
|
|
)
|
|
|
|
// IBotExchange enforces standard functions for all exchanges supported in
|
|
// GoCryptoTrader
|
|
type IBotExchange interface {
|
|
Setup(exch *config.ExchangeConfig) error
|
|
Start(wg *sync.WaitGroup)
|
|
SetDefaults()
|
|
GetName() string
|
|
IsEnabled() bool
|
|
SetEnabled(bool)
|
|
ValidateCredentials() error
|
|
FetchTicker(currency currency.Pair, assetType asset.Item) (*ticker.Price, error)
|
|
UpdateTicker(currency currency.Pair, assetType asset.Item) (*ticker.Price, error)
|
|
FetchOrderbook(currency currency.Pair, assetType asset.Item) (*orderbook.Base, error)
|
|
UpdateOrderbook(currency currency.Pair, assetType asset.Item) (*orderbook.Base, error)
|
|
FetchTradablePairs(assetType asset.Item) ([]string, error)
|
|
UpdateTradablePairs(forceUpdate bool) error
|
|
GetEnabledPairs(assetType asset.Item) currency.Pairs
|
|
GetAvailablePairs(assetType asset.Item) currency.Pairs
|
|
FetchAccountInfo() (account.Holdings, error)
|
|
UpdateAccountInfo() (account.Holdings, error)
|
|
GetAuthenticatedAPISupport(endpoint uint8) bool
|
|
SetPairs(pairs currency.Pairs, assetType asset.Item, enabled bool) error
|
|
GetAssetTypes() asset.Items
|
|
GetExchangeHistory(currencyPair currency.Pair, assetType asset.Item) ([]TradeHistory, error)
|
|
SupportsAutoPairUpdates() bool
|
|
SupportsRESTTickerBatchUpdates() bool
|
|
GetFeeByType(feeBuilder *FeeBuilder) (float64, error)
|
|
GetLastPairsUpdateTime() int64
|
|
GetWithdrawPermissions() uint32
|
|
FormatWithdrawPermissions() string
|
|
SupportsWithdrawPermissions(permissions uint32) bool
|
|
GetFundingHistory() ([]FundHistory, error)
|
|
SubmitOrder(s *order.Submit) (order.SubmitResponse, error)
|
|
ModifyOrder(action *order.Modify) (string, error)
|
|
CancelOrder(order *order.Cancel) error
|
|
CancelAllOrders(orders *order.Cancel) (order.CancelAllResponse, error)
|
|
GetOrderInfo(orderID string) (order.Detail, error)
|
|
GetDepositAddress(cryptocurrency currency.Code, accountID string) (string, error)
|
|
GetOrderHistory(getOrdersRequest *order.GetOrdersRequest) ([]order.Detail, error)
|
|
GetActiveOrders(getOrdersRequest *order.GetOrdersRequest) ([]order.Detail, error)
|
|
WithdrawCryptocurrencyFunds(withdrawRequest *withdraw.CryptoRequest) (string, error)
|
|
WithdrawFiatFunds(withdrawRequest *withdraw.FiatRequest) (string, error)
|
|
WithdrawFiatFundsToInternationalBank(withdrawRequest *withdraw.FiatRequest) (string, error)
|
|
SetHTTPClientUserAgent(ua string)
|
|
GetHTTPClientUserAgent() string
|
|
SetClientProxyAddress(addr string) error
|
|
SupportsWebsocket() bool
|
|
SupportsREST() bool
|
|
IsWebsocketEnabled() bool
|
|
GetWebsocket() (*wshandler.Websocket, error)
|
|
SubscribeToWebsocketChannels(channels []wshandler.WebsocketChannelSubscription) error
|
|
UnsubscribeToWebsocketChannels(channels []wshandler.WebsocketChannelSubscription) error
|
|
AuthenticateWebsocket() error
|
|
GetSubscriptions() ([]wshandler.WebsocketChannelSubscription, error)
|
|
GetDefaultConfig() (*config.ExchangeConfig, error)
|
|
GetBase() *Base
|
|
SupportsAsset(assetType asset.Item) bool
|
|
GetHistoricCandles(pair currency.Pair, rangesize, granularity int64) ([]Candle, error)
|
|
DisableRateLimiter() error
|
|
EnableRateLimiter() error
|
|
}
|