Files
gocryptotrader/exchanges/interfaces.go
Ryan O'Hara-Reid 2c7e531c5c Initial kline trade converter && restructure wrapper functions (#454)
* Initial kline trade converter && restructure wrapper function

* Addr nits

* fix linter issues

* fix requested

* fix after merge interface issue with fakepassingexchange

* consistentizations

* Addr glorious nits

* Added in explicit interval strings for gctcli client (ease of use)

* rm value stutter

* Addr nits

* update protobuf and push regen

* go mod tidy

* change description of usage for granularity
2020-03-16 10:31:07 +11:00

80 lines
3.6 KiB
Go

package exchange
import (
"sync"
"time"
"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/kline"
"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/portfolio/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(p currency.Pair, a asset.Item) (*ticker.Price, error)
UpdateTicker(p currency.Pair, a asset.Item) (*ticker.Price, error)
FetchOrderbook(p currency.Pair, a asset.Item) (*orderbook.Base, error)
UpdateOrderbook(p currency.Pair, a asset.Item) (*orderbook.Base, error)
FetchTradablePairs(a asset.Item) ([]string, error)
UpdateTradablePairs(forceUpdate bool) error
GetEnabledPairs(a asset.Item) currency.Pairs
GetAvailablePairs(a asset.Item) currency.Pairs
FetchAccountInfo() (account.Holdings, error)
UpdateAccountInfo() (account.Holdings, error)
GetAuthenticatedAPISupport(endpoint uint8) bool
SetPairs(pairs currency.Pairs, a asset.Item, enabled bool) error
GetAssetTypes() asset.Items
GetExchangeHistory(p currency.Pair, a asset.Item) ([]TradeHistory, error)
SupportsAutoPairUpdates() bool
SupportsRESTTickerBatchUpdates() bool
GetFeeByType(f *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.Request) (*withdraw.ExchangeResponse, error)
WithdrawFiatFunds(withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)
WithdrawFiatFundsToInternationalBank(withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, 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(p currency.Pair, a asset.Item, timeStart, timeEnd time.Time, interval time.Duration) (kline.Item, error)
DisableRateLimiter() error
EnableRateLimiter() error
}