exchange

package
v0.0.0-...-cf2d4bb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2017 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// WarningAuthenticatedRequestWithoutCredentialsSet error message for authenticated request without credentials set
	WarningAuthenticatedRequestWithoutCredentialsSet = "WARNING -- Exchange %s authenticated HTTP request called but not supported due to unset/default API keys."
	// ErrExchangeNotFound is a constant for an error message
	ErrExchangeNotFound = "Exchange not found in dataset."
)

Variables

This section is empty.

Functions

func FormatCurrency

func FormatCurrency(p pair.CurrencyPair) pair.CurrencyItem

FormatCurrency is a method that formats and returns a currency pair based on the user currency display preferences

func FormatExchangeCurrency

func FormatExchangeCurrency(exchName string, p pair.CurrencyPair) pair.CurrencyItem

FormatExchangeCurrency is a method that formats and returns a currency pair based on the user currency display preferences

func GetAndFormatExchangeCurrencies

func GetAndFormatExchangeCurrencies(exchName string, pairs []pair.CurrencyPair) (pair.CurrencyItem, error)

GetAndFormatExchangeCurrencies returns a pair.CurrencyItem string containing the exchanges formatted currency pairs

func GetExchangeAssetTypes

func GetExchangeAssetTypes(exchName string) ([]string, error)

GetExchangeAssetTypes returns the asset types the exchange supports (SPOT, binary, futures)

func GetExchangeFormatCurrencySeperator

func GetExchangeFormatCurrencySeperator(exchName string) bool

GetExchangeFormatCurrencySeperator returns whether or not a specific exchange contains a separator used for API requests

Types

type AccountCurrencyInfo

type AccountCurrencyInfo struct {
	CurrencyName string
	TotalValue   float64
	Hold         float64
}

AccountCurrencyInfo is a sub type to store currency name and value

type AccountInfo

type AccountInfo struct {
	ExchangeName string
	Currencies   []AccountCurrencyInfo
}

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
	Websocket                   bool
	RESTPollingDelay            time.Duration
	AuthenticatedAPISupport     bool
	APISecret, APIKey, ClientID string
	Nonce                       nonce.Nonce
	TakerFee, MakerFee, Fee     float64
	BaseCurrencies              []string
	AvailablePairs              []string
	EnabledPairs                []string
	AssetTypes                  []string
	WebsocketURL                string
	APIUrl                      string
	RequestCurrencyPairFormat   config.CurrencyPairFormatConfig
	ConfigCurrencyPairFormat    config.CurrencyPairFormatConfig
}

Base stores the individual exchange information

func (*Base) GetAuthenticatedAPISupport

func (e *Base) GetAuthenticatedAPISupport() bool

GetAuthenticatedAPISupport returns whether the exchange supports authenticated API requests

func (*Base) GetAvailableCurrencies

func (e *Base) GetAvailableCurrencies() []pair.CurrencyPair

GetAvailableCurrencies is a method that returns the available currency pairs of the exchange base

func (*Base) GetEnabledCurrencies

func (e *Base) GetEnabledCurrencies() []pair.CurrencyPair

GetEnabledCurrencies is a method that returns the enabled currency pairs of the exchange base

func (*Base) GetName

func (e *Base) GetName() string

GetName is a method that returns the name of the exchange base

func (*Base) IsEnabled

func (e *Base) IsEnabled() bool

IsEnabled is a method that returns if the current exchange is enabled

func (*Base) SetAPIKeys

func (e *Base) SetAPIKeys(APIKey, APISecret, ClientID string, b64Decode bool)

SetAPIKeys is a method that sets the current API keys for the exchange

func (*Base) SetAssetTypes

func (e *Base) SetAssetTypes() error

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) SetCurrencyPairFormat

func (e *Base) SetCurrencyPairFormat() error

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

func (e *Base) SetEnabled(enabled bool)

SetEnabled is a method that sets if the exchange is enabled

func (*Base) UpdateAvailableCurrencies

func (e *Base) UpdateAvailableCurrencies(exchangeProducts []string, force bool) error

UpdateAvailableCurrencies is a method that sets new pairs to the current exchange. Setting force to true upgrades the available currencies

func (*Base) UpdateEnabledCurrencies

func (e *Base) UpdateEnabledCurrencies(exchangeProducts []string, force bool) error

UpdateEnabledCurrencies is a method that sets new pairs to the current exchange. Setting force to true upgrades the enabled currencies

type IBotExchange

type IBotExchange interface {
	Setup(exch config.ExchangeConfig)
	Start()
	SetDefaults()
	GetName() string
	IsEnabled() bool
	GetTickerPrice(currency pair.CurrencyPair, assetType string) (ticker.Price, error)
	UpdateTicker(currency pair.CurrencyPair, assetType string) (ticker.Price, error)
	GetOrderbookEx(currency pair.CurrencyPair, assetType string) (orderbook.Base, error)
	UpdateOrderbook(currency pair.CurrencyPair, assetType string) (orderbook.Base, error)
	GetEnabledCurrencies() []pair.CurrencyPair
	GetExchangeAccountInfo() (AccountInfo, error)
	GetAuthenticatedAPISupport() bool
}

IBotExchange enforces standard functions for all exchanges supported in GoCryptoTrader

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL