Documentation ¶
Index ¶
- Constants
- func CompareCurrencyPairFormats(pair1 config.CurrencyPairFormatConfig, pair2 *config.CurrencyPairFormatConfig) bool
- func FilterOrdersByCurrencies(orders *[]OrderDetail, currencies []currency.Pair)
- func FilterOrdersBySide(orders *[]OrderDetail, orderSide OrderSide)
- func FilterOrdersByTickRange(orders *[]OrderDetail, startTicks, endTicks time.Time)
- func FilterOrdersByType(orders *[]OrderDetail, orderType OrderType)
- func FormatCurrency(p currency.Pair) currency.Pair
- func FormatExchangeCurrency(exchName string, p currency.Pair) currency.Pair
- func GetAndFormatExchangeCurrencies(exchName string, pairs []currency.Pair) (string, error)
- func GetExchangeAssetTypes(exchName string) ([]string, error)
- func GetExchangeFormatCurrencySeperator(exchName string) bool
- func SortOrdersByCurrency(orders *[]OrderDetail, reverse bool)
- func SortOrdersByDate(orders *[]OrderDetail, reverse bool)
- func SortOrdersByPrice(orders *[]OrderDetail, reverse bool)
- func SortOrdersBySide(orders *[]OrderDetail, reverse bool)
- func SortOrdersByType(orders *[]OrderDetail, reverse bool)
- type Account
- type AccountCurrencyInfo
- type AccountInfo
- type Base
- func (e *Base) FormatWithdrawPermissions() string
- func (e *Base) GetAPIURL() string
- func (e *Base) GetAPIURLDefault() string
- func (e *Base) GetAPIURLSecondaryDefault() string
- func (e *Base) GetAssetTypes() []string
- func (e *Base) GetAuthenticatedAPISupport(endpoint uint8) bool
- func (e *Base) GetAvailableCurrencies() currency.Pairs
- func (e *Base) GetClientBankAccounts(exchangeName, withdrawalCurrency string) (config.BankAccount, error)
- func (e *Base) GetEnabledCurrencies() currency.Pairs
- func (e *Base) GetExchangeBankAccounts(exchangeName, depositCurrency string) (config.BankAccount, error)
- func (e *Base) GetHTTPClient() *http.Client
- func (e *Base) GetHTTPClientUserAgent() string
- func (e *Base) GetLastPairsUpdateTime() int64
- func (e *Base) GetName() string
- func (e *Base) GetSecondaryAPIURL() string
- func (e *Base) GetWithdrawPermissions() uint32
- func (e *Base) IsEnabled() bool
- func (e *Base) SetAPIKeys(apiKey, apiSecret, clientID string, b64Decode bool)
- func (e *Base) SetAPIURL(ec *config.ExchangeConfig) error
- func (e *Base) SetAssetTypes() error
- func (e *Base) SetAutoPairDefaults() error
- func (e *Base) SetClientProxyAddress(addr string) error
- func (e *Base) SetCurrencies(pairs []currency.Pair, enabledPairs bool) error
- func (e *Base) SetCurrencyPairFormat() error
- func (e *Base) SetEnabled(enabled bool)
- func (e *Base) SetHTTPClient(h *http.Client)
- func (e *Base) SetHTTPClientTimeout(t time.Duration)
- func (e *Base) SetHTTPClientUserAgent(ua string)
- func (e *Base) SupportsAutoPairUpdates() bool
- func (e *Base) SupportsCurrency(p currency.Pair, enabledPairs bool) bool
- func (e *Base) SupportsRESTTickerBatchUpdates() bool
- func (e *Base) SupportsWithdrawPermissions(permissions uint32) bool
- func (e *Base) UpdateCurrencies(exchangeProducts currency.Pairs, enabled, force bool) error
- func (e *Base) WebsocketInit()
- func (e *Base) WebsocketSetup(connector func() error, ...) error
- type ByCurrency
- type ByDate
- type ByOrderSide
- type ByOrderType
- type ByPrice
- type CancelAllOrdersResponse
- type FeeBuilder
- type FeeType
- type Format
- type Formatting
- type FundHistory
- type GetOrdersRequest
- type IBotExchange
- type InternationalBankTransactionType
- type KlineData
- type ModifyOrder
- type ModifyOrderResponse
- type OrderCancellation
- type OrderDetail
- type OrderSide
- type OrderStatus
- type OrderType
- type SubmitOrderResponse
- type TickerData
- type TradeData
- type TradeHistory
- type Websocket
- func (w *Websocket) CanUseAuthenticatedEndpoints() bool
- func (w *Websocket) Connect() error
- func (w *Websocket) FormatFunctionality() string
- func (w *Websocket) GetDefaultURL() string
- func (w *Websocket) GetFunctionality() uint32
- func (w *Websocket) GetName() string
- func (w *Websocket) GetProxyAddress() string
- func (w *Websocket) GetSubscriptions() []WebsocketChannelSubscription
- func (w *Websocket) GetWebsocketURL() string
- func (w *Websocket) IsConnected() bool
- func (w *Websocket) IsConnecting() bool
- func (w *Websocket) IsEnabled() bool
- func (w *Websocket) ResubscribeToChannel(subscribedChannel WebsocketChannelSubscription)
- func (w *Websocket) SetCanUseAuthenticatedEndpoints(val bool)
- func (w *Websocket) SetChannelSubscriber(subscriber func(channelToSubscribe WebsocketChannelSubscription) error)
- func (w *Websocket) SetChannelUnsubscriber(unsubscriber func(channelToUnsubscribe WebsocketChannelSubscription) error)
- func (w *Websocket) SetConnector(connector func() error)
- func (w *Websocket) SetDefaultURL(defaultURL string)
- func (w *Websocket) SetExchangeName(exchName string)
- func (w *Websocket) SetProxyAddress(proxyAddr string) error
- func (w *Websocket) SetWebsocketURL(websocketURL string)
- func (w *Websocket) SetWsStatusAndConnection(enabled bool) error
- func (w *Websocket) Shutdown() error
- func (w *Websocket) SubscribeToChannels(channels []WebsocketChannelSubscription)
- func (w *Websocket) SupportsFunctionality(f uint32) bool
- func (w *Websocket) UnsubscribeToChannels(channels []WebsocketChannelSubscription)
- func (w *Websocket) WebsocketReset() error
- type WebsocketChannelSubscription
- type WebsocketOrderbookLocal
- func (w *WebsocketOrderbookLocal) FlushCache()
- func (w *WebsocketOrderbookLocal) LoadSnapshot(newOrderbook *orderbook.Base, exchName string, overwrite bool) error
- func (w *WebsocketOrderbookLocal) Update(bidTargets, askTargets []orderbook.Item, p currency.Pair, updated time.Time, ...) error
- func (w *WebsocketOrderbookLocal) UpdateUsingID(bidTargets, askTargets []orderbook.Item, p currency.Pair, ...) error
- type WebsocketOrderbookUpdate
- type WebsocketPositionUpdated
- type WebsocketResponse
- type WithdrawRequest
Constants ¶
const ( // WarningAuthenticatedRequestWithoutCredentialsSet error message for authenticated request without credentials set WarningAuthenticatedRequestWithoutCredentialsSet = "exchange %s authenticated HTTP request called but not supported due to unset/default API keys" // ErrExchangeNotFound is a stand for an error message ErrExchangeNotFound = "exchange not found in dataset" // DefaultHTTPTimeout is the default HTTP/HTTPS Timeout for exchange requests DefaultHTTPTimeout = time.Second * 15 )
const ( // No withdraw NoAPIWithdrawalMethods uint32 = 0 NoAPIWithdrawalMethodsText string = "NONE, WEBSITE ONLY" AutoWithdrawCrypto uint32 = (1 << 0) AutoWithdrawCryptoWithAPIPermission uint32 = (1 << 1) AutoWithdrawCryptoWithSetup uint32 = (1 << 2) AutoWithdrawCryptoText string = "AUTO WITHDRAW CRYPTO" AutoWithdrawCryptoWithAPIPermissionText string = "AUTO WITHDRAW CRYPTO WITH API PERMISSION" AutoWithdrawCryptoWithSetupText string = "AUTO WITHDRAW CRYPTO WITH SETUP" WithdrawCryptoWith2FA uint32 = (1 << 3) WithdrawCryptoWithSMS uint32 = (1 << 4) WithdrawCryptoWithEmail uint32 = (1 << 5) WithdrawCryptoWithWebsiteApproval uint32 = (1 << 6) WithdrawCryptoWithAPIPermission uint32 = (1 << 7) WithdrawCryptoWith2FAText string = "WITHDRAW CRYPTO WITH 2FA" WithdrawCryptoWithSMSText string = "WITHDRAW CRYPTO WITH SMS" WithdrawCryptoWithEmailText string = "WITHDRAW CRYPTO WITH EMAIL" WithdrawCryptoWithWebsiteApprovalText string = "WITHDRAW CRYPTO WITH WEBSITE APPROVAL" WithdrawCryptoWithAPIPermissionText string = "WITHDRAW CRYPTO WITH API PERMISSION" AutoWithdrawFiat uint32 = (1 << 8) AutoWithdrawFiatWithAPIPermission uint32 = (1 << 9) AutoWithdrawFiatWithSetup uint32 = (1 << 10) AutoWithdrawFiatText string = "AUTO WITHDRAW FIAT" AutoWithdrawFiatWithAPIPermissionText string = "AUTO WITHDRAW FIAT WITH API PERMISSION" AutoWithdrawFiatWithSetupText string = "AUTO WITHDRAW FIAT WITH SETUP" WithdrawFiatWith2FA uint32 = (1 << 11) WithdrawFiatWithSMS uint32 = (1 << 12) WithdrawFiatWithEmail uint32 = (1 << 13) WithdrawFiatWithWebsiteApproval uint32 = (1 << 14) WithdrawFiatWithAPIPermission uint32 = (1 << 15) WithdrawFiatWith2FAText string = "WITHDRAW FIAT WITH 2FA" WithdrawFiatWithSMSText string = "WITHDRAW FIAT WITH SMS" WithdrawFiatWithEmailText string = "WITHDRAW FIAT WITH EMAIL" WithdrawFiatWithWebsiteApprovalText string = "WITHDRAW FIAT WITH WEBSITE APPROVAL" WithdrawFiatWithAPIPermissionText string = "WITHDRAW FIAT WITH API PERMISSION" WithdrawCryptoViaWebsiteOnly uint32 = (1 << 16) WithdrawFiatViaWebsiteOnly uint32 = (1 << 17) WithdrawCryptoViaWebsiteOnlyText string = "WITHDRAW CRYPTO VIA WEBSITE ONLY" WithdrawFiatViaWebsiteOnlyText string = "WITHDRAW FIAT VIA WEBSITE ONLY" NoFiatWithdrawals uint32 = (1 << 18) NoFiatWithdrawalsText string = "NO FIAT WITHDRAWAL" UnknownWithdrawalTypeText string = "UNKNOWN" RestAuthentication uint8 = 0 WebsocketAuthentication uint8 = 1 )
Definitions for each type of withdrawal method for a given exchange
const ( NoWebsocketSupport uint32 = 0 WebsocketTickerSupported uint32 = 1 << (iota - 1) WebsocketOrderbookSupported WebsocketKlineSupported WebsocketTradeDataSupported WebsocketAccountSupported WebsocketAllowsRequests WebsocketSubscribeSupported WebsocketUnsubscribeSupported WebsocketAuthenticatedEndpointsSupported WebsocketAccountDataSupported WebsocketSubmitOrderSupported WebsocketCancelOrderSupported WebsocketWithdrawSupported WebsocketTickerSupportedText = "TICKER STREAMING SUPPORTED" WebsocketOrderbookSupportedText = "ORDERBOOK STREAMING SUPPORTED" WebsocketKlineSupportedText = "KLINE STREAMING SUPPORTED" WebsocketTradeDataSupportedText = "TRADE STREAMING SUPPORTED" WebsocketAccountSupportedText = "ACCOUNT STREAMING SUPPORTED" WebsocketAllowsRequestsText = "WEBSOCKET REQUESTS SUPPORTED" NoWebsocketSupportText = "WEBSOCKET NOT SUPPORTED" UnknownWebsocketFunctionality = "UNKNOWN FUNCTIONALITY BITMASK" WebsocketSubscribeSupportedText = "WEBSOCKET SUBSCRIBE SUPPORTED" WebsocketUnsubscribeSupportedText = "WEBSOCKET UNSUBSCRIBE SUPPORTED" WebsocketAuthenticatedEndpointsSupportedText = "WEBSOCKET AUTHENTICATED ENDPOINTS SUPPORTED" WebsocketAccountDataSupportedText = "WEBSOCKET ACCOUNT DATA SUPPORTED" WebsocketSubmitOrderSupportedText = "WEBSOCKET SUBMIT ORDER SUPPORTED" WebsocketCancelOrderSupportedText = "WEBSOCKET CANCEL ORDER SUPPORTED" WebsocketWithdrawSupportedText = "WEBSOCKET WITHDRAW SUPPORTED" // WebsocketNotEnabled alerts of a disabled websocket WebsocketNotEnabled = "exchange_websocket_not_enabled" // WebsocketTrafficLimitTime defines a standard time for no traffic from the // websocket connection WebsocketTrafficLimitTime = 5 * time.Second // WebsocketStateTimeout defines a const for when a websocket connection // times out, will be handled by the routine management system WebsocketStateTimeout = "TIMEOUT" )
Websocket functionality list and state consts
Variables ¶
This section is empty.
Functions ¶
func CompareCurrencyPairFormats ¶
func CompareCurrencyPairFormats(pair1 config.CurrencyPairFormatConfig, pair2 *config.CurrencyPairFormatConfig) bool
CompareCurrencyPairFormats checks and returns whether or not the two supplied config currency pairs match
func FilterOrdersByCurrencies ¶
func FilterOrdersByCurrencies(orders *[]OrderDetail, currencies []currency.Pair)
FilterOrdersByCurrencies removes any OrderDetails that do not match the provided currency list It is forgiving in that the provided currencies can match quote or base currencies
func FilterOrdersBySide ¶
func FilterOrdersBySide(orders *[]OrderDetail, orderSide OrderSide)
FilterOrdersBySide removes any OrderDetails that don't match the orderStatus provided
func FilterOrdersByTickRange ¶
func FilterOrdersByTickRange(orders *[]OrderDetail, startTicks, endTicks time.Time)
FilterOrdersByTickRange removes any OrderDetails outside of the tick range
func FilterOrdersByType ¶
func FilterOrdersByType(orders *[]OrderDetail, orderType OrderType)
FilterOrdersByType removes any OrderDetails that don't match the orderType provided
func FormatCurrency ¶
FormatCurrency is a method that formats and returns a currency pair based on the user currency display preferences
func FormatExchangeCurrency ¶
FormatExchangeCurrency is a method that formats and returns a currency pair based on the exchange currency format
func GetAndFormatExchangeCurrencies ¶
GetAndFormatExchangeCurrencies returns a pair.CurrencyItem string containing the exchanges formatted currency pairs
func GetExchangeAssetTypes ¶
GetExchangeAssetTypes returns the asset types the exchange supports (SPOT, binary, futures)
func GetExchangeFormatCurrencySeperator ¶
GetExchangeFormatCurrencySeperator returns whether or not a specific exchange contains a separator used for API requests
func SortOrdersByCurrency ¶
func SortOrdersByCurrency(orders *[]OrderDetail, reverse bool)
SortOrdersByCurrency the caller function to sort orders
func SortOrdersByDate ¶
func SortOrdersByDate(orders *[]OrderDetail, reverse bool)
SortOrdersByDate the caller function to sort orders
func SortOrdersByPrice ¶
func SortOrdersByPrice(orders *[]OrderDetail, reverse bool)
SortOrdersByPrice the caller function to sort orders
func SortOrdersBySide ¶
func SortOrdersBySide(orders *[]OrderDetail, reverse bool)
SortOrdersBySide the caller function to sort orders
func SortOrdersByType ¶
func SortOrdersByType(orders *[]OrderDetail, reverse bool)
SortOrdersByType the caller function to sort orders
Types ¶
type Account ¶
type Account struct { ID string Currencies []AccountCurrencyInfo }
Account defines a singular account type with asocciated currencies
type AccountCurrencyInfo ¶
AccountCurrencyInfo is a sub type to store currency name and value
type AccountInfo ¶
AccountInfo is a Generic type to hold each exchange's holdings in all enabled currencies
type Base ¶
type Base struct { Name string Enabled bool Verbose bool RESTPollingDelay time.Duration AuthenticatedAPISupport bool AuthenticatedWebsocketAPISupport bool APIWithdrawPermissions uint32 APIAuthPEMKeySupport bool APISecret, APIKey, APIAuthPEMKey, ClientID string TakerFee, MakerFee, Fee float64 BaseCurrencies currency.Currencies AvailablePairs currency.Pairs EnabledPairs currency.Pairs AssetTypes []string PairsLastUpdated int64 SupportsAutoPairUpdating bool SupportsRESTTickerBatching bool HTTPTimeout time.Duration HTTPUserAgent string HTTPDebugging bool WebsocketURL string APIUrl string APIUrlDefault string APIUrlSecondary string APIUrlSecondaryDefault string RequestCurrencyPairFormat config.CurrencyPairFormatConfig ConfigCurrencyPairFormat config.CurrencyPairFormatConfig Websocket *Websocket *request.Requester }
Base stores the individual exchange information
func (*Base) FormatWithdrawPermissions ¶
FormatWithdrawPermissions will return each of the exchange's compatible withdrawal methods in readable form
func (*Base) GetAPIURLDefault ¶
GetAPIURLDefault returns exchange default URL
func (*Base) GetAPIURLSecondaryDefault ¶
GetAPIURLSecondaryDefault returns exchange default secondary URL
func (*Base) GetAssetTypes ¶
GetAssetTypes returns the available asset types for an individual exchange
func (*Base) GetAuthenticatedAPISupport ¶
GetAuthenticatedAPISupport returns whether the exchange supports authenticated API requests
func (*Base) GetAvailableCurrencies ¶
GetAvailableCurrencies is a method that returns the available currency pairs of the exchange base
func (*Base) GetClientBankAccounts ¶
func (e *Base) GetClientBankAccounts(exchangeName, withdrawalCurrency string) (config.BankAccount, error)
GetClientBankAccounts returns banking details associated with a client for withdrawal purposes
func (*Base) GetEnabledCurrencies ¶
GetEnabledCurrencies is a method that returns the enabled currency pairs of the exchange base
func (*Base) GetExchangeBankAccounts ¶
func (e *Base) GetExchangeBankAccounts(exchangeName, depositCurrency string) (config.BankAccount, error)
GetExchangeBankAccounts returns banking details associated with an exchange for funding purposes
func (*Base) GetHTTPClient ¶
GetHTTPClient gets the exchanges HTTP client
func (*Base) GetHTTPClientUserAgent ¶
GetHTTPClientUserAgent gets the exchanges HTTP user agent
func (*Base) GetLastPairsUpdateTime ¶
GetLastPairsUpdateTime returns the unix timestamp of when the exchanges currency pairs were last updated
func (*Base) GetSecondaryAPIURL ¶
GetSecondaryAPIURL returns the set Secondary API URL
func (*Base) GetWithdrawPermissions ¶
GetWithdrawPermissions passes through the exchange's withdraw permissions
func (*Base) SetAPIKeys ¶
SetAPIKeys is a method that sets the current API keys for the exchange
func (*Base) SetAPIURL ¶
func (e *Base) SetAPIURL(ec *config.ExchangeConfig) error
SetAPIURL sets configuration API URL for an exchange
func (*Base) SetAssetTypes ¶
SetAssetTypes checks the exchange asset types (whether it supports SPOT, Binary or Futures) and sets it to a default setting if it doesn't exist
func (*Base) SetAutoPairDefaults ¶
SetAutoPairDefaults sets the default values for whether or not the exchange supports auto pair updating or not
func (*Base) SetClientProxyAddress ¶
SetClientProxyAddress sets a proxy address for REST and websocket requests
func (*Base) SetCurrencies ¶
SetCurrencies sets the exchange currency pairs for either enabledPairs or availablePairs
func (*Base) SetCurrencyPairFormat ¶
SetCurrencyPairFormat checks the exchange request and config currency pair formats and sets it to a default setting if it doesn't exist
func (*Base) SetEnabled ¶
SetEnabled is a method that sets if the exchange is enabled
func (*Base) SetHTTPClient ¶
SetHTTPClient sets exchanges HTTP client
func (*Base) SetHTTPClientTimeout ¶
SetHTTPClientTimeout sets the timeout value for the exchanges HTTP Client
func (*Base) SetHTTPClientUserAgent ¶
SetHTTPClientUserAgent sets the exchanges HTTP user agent
func (*Base) SupportsAutoPairUpdates ¶
SupportsAutoPairUpdates returns whether or not the exchange supports auto currency pair updating
func (*Base) SupportsCurrency ¶
SupportsCurrency returns true or not whether a currency pair exists in the exchange available currencies or not
func (*Base) SupportsRESTTickerBatchUpdates ¶
SupportsRESTTickerBatchUpdates returns whether or not the exhange supports REST batch ticker fetching
func (*Base) SupportsWithdrawPermissions ¶
SupportsWithdrawPermissions compares the supplied permissions with the exchange's to verify they're supported
func (*Base) UpdateCurrencies ¶
UpdateCurrencies updates the exchange currency pairs for either enabledPairs or availablePairs
func (*Base) WebsocketInit ¶
func (e *Base) WebsocketInit()
WebsocketInit initialises the websocket struct
func (*Base) WebsocketSetup ¶
func (e *Base) WebsocketSetup(connector func() error, subscriber func(channelToSubscribe WebsocketChannelSubscription) error, unsubscriber func(channelToUnsubscribe WebsocketChannelSubscription) error, exchangeName string, wsEnabled, verbose bool, defaultURL, runningURL string) error
WebsocketSetup sets main variables for websocket connection
type ByCurrency ¶
type ByCurrency []OrderDetail
ByCurrency used for sorting orders by order currency
func (ByCurrency) Len ¶
func (b ByCurrency) Len() int
func (ByCurrency) Less ¶
func (b ByCurrency) Less(i, j int) bool
func (ByCurrency) Swap ¶
func (b ByCurrency) Swap(i, j int)
type ByOrderSide ¶
type ByOrderSide []OrderDetail
ByOrderSide used for sorting orders by order side (buy sell)
func (ByOrderSide) Len ¶
func (b ByOrderSide) Len() int
func (ByOrderSide) Less ¶
func (b ByOrderSide) Less(i, j int) bool
func (ByOrderSide) Swap ¶
func (b ByOrderSide) Swap(i, j int)
type ByOrderType ¶
type ByOrderType []OrderDetail
ByOrderType used for sorting orders by order type
func (ByOrderType) Len ¶
func (b ByOrderType) Len() int
func (ByOrderType) Less ¶
func (b ByOrderType) Less(i, j int) bool
func (ByOrderType) Swap ¶
func (b ByOrderType) Swap(i, j int)
type CancelAllOrdersResponse ¶
CancelAllOrdersResponse returns the status from attempting to cancel all orders on an exchagne
type FeeBuilder ¶
type FeeBuilder struct { IsMaker bool PurchasePrice float64 Amount float64 FeeType FeeType FiatCurrency currency.Code BankTransactionType InternationalBankTransactionType Pair currency.Pair }
FeeBuilder is the type which holds all parameters required to calculate a fee for an exchange
type FundHistory ¶
type FundHistory struct { ExchangeName string Status string TransferID string Description string Timestamp time.Time Currency string Amount float64 Fee float64 TransferType string CryptoToAddress string CryptoFromAddress string CryptoTxID string BankTo string BankFrom string }
FundHistory holds exchange funding history data
type GetOrdersRequest ¶
type GetOrdersRequest struct { OrderType OrderType OrderSide OrderSide StartTicks time.Time EndTicks time.Time // Currencies Empty array = all currencies. Some endpoints only support singular currency enquiries Currencies []currency.Pair }
GetOrdersRequest used for GetOrderHistory and GetOpenOrders wrapper functions
type IBotExchange ¶
type IBotExchange interface { Setup(exch *config.ExchangeConfig) Start(wg *sync.WaitGroup) SetDefaults() GetName() string IsEnabled() bool SetEnabled(bool) GetTickerPrice(currency currency.Pair, assetType string) (ticker.Price, error) UpdateTicker(currency currency.Pair, assetType string) (ticker.Price, error) GetOrderbookEx(currency currency.Pair, assetType string) (orderbook.Base, error) UpdateOrderbook(currency currency.Pair, assetType string) (orderbook.Base, error) GetEnabledCurrencies() currency.Pairs GetAvailableCurrencies() currency.Pairs GetAssetTypes() []string GetAccountInfo() (AccountInfo, error) GetAuthenticatedAPISupport(endpoint uint8) bool SetCurrencies(pairs []currency.Pair, enabledPairs bool) error GetExchangeHistory(p currency.Pair, assetType string) ([]TradeHistory, error) SupportsAutoPairUpdates() bool GetLastPairsUpdateTime() int64 SupportsRESTTickerBatchUpdates() bool GetFeeByType(feeBuilder *FeeBuilder) (float64, error) GetWithdrawPermissions() uint32 FormatWithdrawPermissions() string SupportsWithdrawPermissions(permissions uint32) bool GetFundingHistory() ([]FundHistory, error) SubmitOrder(p currency.Pair, side OrderSide, orderType OrderType, amount, price float64, clientID string) (SubmitOrderResponse, error) ModifyOrder(action *ModifyOrder) (string, error) CancelOrder(order *OrderCancellation) error CancelAllOrders(orders *OrderCancellation) (CancelAllOrdersResponse, error) GetOrderInfo(orderID string) (OrderDetail, error) GetDepositAddress(cryptocurrency currency.Code, accountID string) (string, error) GetOrderHistory(getOrdersRequest *GetOrdersRequest) ([]OrderDetail, error) GetActiveOrders(getOrdersRequest *GetOrdersRequest) ([]OrderDetail, error) WithdrawCryptocurrencyFunds(withdrawRequest *WithdrawRequest) (string, error) WithdrawFiatFunds(withdrawRequest *WithdrawRequest) (string, error) WithdrawFiatFundsToInternationalBank(withdrawRequest *WithdrawRequest) (string, error) GetWebsocket() (*Websocket, error) SubscribeToWebsocketChannels(channels []WebsocketChannelSubscription) error UnsubscribeToWebsocketChannels(channels []WebsocketChannelSubscription) error AuthenticateWebsocket() error GetSubscriptions() ([]WebsocketChannelSubscription, error) }
IBotExchange enforces standard functions for all exchanges supported in GoCryptoTrader
type InternationalBankTransactionType ¶
type InternationalBankTransactionType uint8
InternationalBankTransactionType custom type for calculating fees based on fiat transaction types
const ( WireTransfer InternationalBankTransactionType = iota PerfectMoney Neteller AdvCash Payeer Skrill Simplex SEPA Swift RapidTransfer MisterTangoSEPA Qiwi VisaMastercard WebMoney Capitalist WesternUnion MoneyGram Contact )
Const declarations for international transaction types
type KlineData ¶
type KlineData struct { Timestamp time.Time Pair currency.Pair AssetType string Exchange string StartTime time.Time CloseTime time.Time Interval string OpenPrice float64 ClosePrice float64 HighPrice float64 LowPrice float64 Volume float64 }
KlineData defines kline feed
type ModifyOrder ¶
type ModifyOrder struct { OrderID string OrderType OrderSide Price float64 Amount float64 LimitPriceUpper float64 LimitPriceLower float64 CurrencyPair currency.Pair ImmediateOrCancel bool HiddenOrder bool FillOrKill bool PostOnly bool }
ModifyOrder is a an order modifyer
type ModifyOrderResponse ¶
type ModifyOrderResponse struct {
OrderID string
}
ModifyOrderResponse is an order modifying return type
type OrderCancellation ¶
type OrderCancellation struct { AccountID string OrderID string WalletAddress string Side OrderSide CurrencyPair currency.Pair }
OrderCancellation type required when requesting to cancel an order
type OrderDetail ¶
type OrderDetail struct { Exchange string AccountID string ID string CurrencyPair currency.Pair OrderSide OrderSide OrderType OrderType OrderDate time.Time Status string Price float64 Amount float64 ExecutedAmount float64 RemainingAmount float64 Fee float64 Trades []TradeHistory }
OrderDetail holds order detail data
type OrderSide ¶
type OrderSide string
OrderSide enforces a standard for OrderSides across the code base
type OrderStatus ¶
type OrderStatus string
OrderStatus defines order status types
const ( AnyOrderStatus OrderStatus = "ANY" NewOrderStatus OrderStatus = "NEW" ActiveOrderStatus OrderStatus = "ACTIVE" PartiallyFilledOrderStatus OrderStatus = "PARTIALLY_FILLED" FilledOrderStatus OrderStatus = "FILLED" CancelledOrderStatus OrderStatus = "CANCELED" PendingCancelOrderStatus OrderStatus = "PENDING_CANCEL" RejectedOrderStatus OrderStatus = "REJECTED" ExpiredOrderStatus OrderStatus = "EXPIRED" HiddenOrderStatus OrderStatus = "HIDDEN" UnknownOrderStatus OrderStatus = "UNKNOWN" )
All OrderStatus types
type OrderType ¶
type OrderType string
OrderType enforces a standard for Ordertypes across the code base
const ( AnyOrderType OrderType = "ANY" LimitOrderType OrderType = "LIMIT" MarketOrderType OrderType = "MARKET" ImmediateOrCancelOrderType OrderType = "IMMEDIATE_OR_CANCEL" StopOrderType OrderType = "STOP" TrailingStopOrderType OrderType = "TRAILINGSTOP" UnknownOrderType OrderType = "UNKNOWN" )
OrderType ...types
type SubmitOrderResponse ¶
SubmitOrderResponse is what is returned after submitting an order to an exchange
type TickerData ¶
type TickerData struct { Timestamp time.Time Pair currency.Pair AssetType string Exchange string ClosePrice float64 Quantity float64 OpenPrice float64 HighPrice float64 LowPrice float64 }
TickerData defines ticker feed
type TradeData ¶
type TradeData struct { Timestamp time.Time CurrencyPair currency.Pair AssetType string Exchange string EventType string EventTime int64 Price float64 Amount float64 Side string }
TradeData defines trade data
type TradeHistory ¶
type TradeHistory struct { Timestamp time.Time TID int64 Price float64 Amount float64 Exchange string Type string Fee float64 Description string }
TradeHistory holds exchange history data
type Websocket ¶
type Websocket struct { // Connected denotes a channel switch for diversion of request flow Connected chan struct{} // Disconnected denotes a channel switch for diversion of request flow Disconnected chan struct{} // DataHandler pipes websocket data to an exchange websocket data handler DataHandler chan interface{} // ShutdownC is the main shutdown channel which controls all websocket go funcs ShutdownC chan struct{} ShutdownConnectionMonitor chan struct{} // Orderbook is a local cache of orderbooks Orderbook WebsocketOrderbookLocal // Wg defines a wait group for websocket routines for cleanly shutting down // routines Wg sync.WaitGroup // TrafficAlert monitors if there is a halt in traffic throughput TrafficAlert chan struct{} // Functionality defines websocket stream capabilities Functionality uint32 // contains filtered or unexported fields }
Websocket defines a return type for websocket connections via the interface wrapper for routine processing in routines.go
func (*Websocket) CanUseAuthenticatedEndpoints ¶
CanUseAuthenticatedEndpoints gets canUseAuthenticatedEndpoints val in a thread safe manner
func (*Websocket) Connect ¶
Connect intiates a websocket connection by using a package defined connection function
func (*Websocket) FormatFunctionality ¶
FormatFunctionality will return each of the websocket connection compatible stream methods as a string
func (*Websocket) GetDefaultURL ¶
GetDefaultURL returns the default websocket URL
func (*Websocket) GetFunctionality ¶
GetFunctionality returns a functionality bitmask for the websocket connection
func (*Websocket) GetProxyAddress ¶
GetProxyAddress returns the current websocket proxy
func (*Websocket) GetSubscriptions ¶
func (w *Websocket) GetSubscriptions() []WebsocketChannelSubscription
GetSubscriptions returns a copied list of subscriptions subscriptions is a private member and cannot be manipulated
func (*Websocket) GetWebsocketURL ¶
GetWebsocketURL returns the running websocket URL
func (*Websocket) IsConnected ¶
IsConnected exposes websocket connection status
func (*Websocket) IsConnecting ¶
IsConnecting checks whether websocket is busy connecting
func (*Websocket) ResubscribeToChannel ¶
func (w *Websocket) ResubscribeToChannel(subscribedChannel WebsocketChannelSubscription)
ResubscribeToChannel calls unsubscribe func and removes it from subscribedChannels to trigger a subscribe event
func (*Websocket) SetCanUseAuthenticatedEndpoints ¶
SetCanUseAuthenticatedEndpoints sets canUseAuthenticatedEndpoints val in a thread safe manner
func (*Websocket) SetChannelSubscriber ¶
func (w *Websocket) SetChannelSubscriber(subscriber func(channelToSubscribe WebsocketChannelSubscription) error)
SetChannelSubscriber sets the function to use the base subscribe func
func (*Websocket) SetChannelUnsubscriber ¶
func (w *Websocket) SetChannelUnsubscriber(unsubscriber func(channelToUnsubscribe WebsocketChannelSubscription) error)
SetChannelUnsubscriber sets the function to use the base unsubscribe func
func (*Websocket) SetConnector ¶
SetConnector sets connection function
func (*Websocket) SetDefaultURL ¶
SetDefaultURL sets default websocket URL
func (*Websocket) SetExchangeName ¶
SetExchangeName sets exchange name
func (*Websocket) SetProxyAddress ¶
SetProxyAddress sets websocket proxy address
func (*Websocket) SetWebsocketURL ¶
SetWebsocketURL sets websocket URL
func (*Websocket) SetWsStatusAndConnection ¶
SetWsStatusAndConnection sets if websocket is enabled it will also connect/disconnect the websocket connection
func (*Websocket) Shutdown ¶
Shutdown attempts to shut down a websocket connection and associated routines by using a package defined shutdown function
func (*Websocket) SubscribeToChannels ¶
func (w *Websocket) SubscribeToChannels(channels []WebsocketChannelSubscription)
SubscribeToChannels appends supplied channels to channelsToSubscribe
func (*Websocket) SupportsFunctionality ¶
SupportsFunctionality returns if the functionality is supported as a boolean
func (*Websocket) UnsubscribeToChannels ¶
func (w *Websocket) UnsubscribeToChannels(channels []WebsocketChannelSubscription)
UnsubscribeToChannels removes supplied channels from channelsToSubscribe
func (*Websocket) WebsocketReset ¶
WebsocketReset sends the shutdown command, waits for channel/func closure and then reconnects
type WebsocketChannelSubscription ¶
type WebsocketChannelSubscription struct { Channel string Currency currency.Pair Params map[string]interface{} }
WebsocketChannelSubscription container for websocket subscriptions Currently only a one at a time thing to avoid complexity
func (*WebsocketChannelSubscription) Equal ¶
func (w *WebsocketChannelSubscription) Equal(subscribedChannel *WebsocketChannelSubscription) bool
Equal two WebsocketChannelSubscription to determine equality
type WebsocketOrderbookLocal ¶
type WebsocketOrderbookLocal struct {
// contains filtered or unexported fields
}
WebsocketOrderbookLocal defines a local cache of orderbooks for amending, appending and deleting changes and updates the main store in orderbook.go
func (*WebsocketOrderbookLocal) FlushCache ¶
func (w *WebsocketOrderbookLocal) FlushCache()
FlushCache flushes w.ob data to be garbage collected and refreshed when a connection is lost and reconnected
func (*WebsocketOrderbookLocal) LoadSnapshot ¶
func (w *WebsocketOrderbookLocal) LoadSnapshot(newOrderbook *orderbook.Base, exchName string, overwrite bool) error
LoadSnapshot loads initial snapshot of orderbook data, overite allows full orderbook to be completely rewritten because the exchange is a doing a full update not an incremental one
func (*WebsocketOrderbookLocal) Update ¶
func (w *WebsocketOrderbookLocal) Update(bidTargets, askTargets []orderbook.Item, p currency.Pair, updated time.Time, exchName, assetType string) error
Update updates a local cache using bid targets and ask targets then updates main cache in orderbook.go Volume == 0; deletion at price target Price target not found; append of price target Price target found; amend volume of price target
func (*WebsocketOrderbookLocal) UpdateUsingID ¶
func (w *WebsocketOrderbookLocal) UpdateUsingID(bidTargets, askTargets []orderbook.Item, p currency.Pair, exchName, assetType, action string) error
UpdateUsingID updates orderbooks using specified ID
type WebsocketOrderbookUpdate ¶
WebsocketOrderbookUpdate defines a websocket event in which the orderbook has been updated in the orderbook package
type WebsocketPositionUpdated ¶
type WebsocketPositionUpdated struct { Timestamp time.Time Pair currency.Pair AssetType string Exchange string }
WebsocketPositionUpdated reflects a change in orders/contracts on an exchange
type WebsocketResponse ¶
WebsocketResponse defines generalised data from the websocket connection
type WithdrawRequest ¶
type WithdrawRequest struct { // General withdraw information Description string OneTimePassword int64 AccountID string PIN int64 TradePassword string Amount float64 Currency currency.Code // Crypto related information Address string AddressTag string FeeAmount float64 // FIAT related information BankAccountName string BankAccountNumber float64 BankName string BankAddress string BankCity string BankCountry string BankPostalCode string SwiftCode string IBAN string BankCode float64 IsExpressWire bool // Intermediary bank information RequiresIntermediaryBank bool IntermediaryBankAccountNumber float64 IntermediaryBankName string IntermediaryBankAddress string IntermediaryBankCity string IntermediaryBankCountry string IntermediaryBankPostalCode string IntermediarySwiftCode string IntermediaryBankCode float64 IntermediaryIBAN string WireCurrency string }
WithdrawRequest used for wrapper crypto and FIAT withdraw methods
Directories ¶
Path | Synopsis |
---|---|
Package gemini exchange documentation can be found at https://docs.sandbox.gemini.com
|
Package gemini exchange documentation can be found at https://docs.sandbox.gemini.com |