Documentation ¶
Index ¶
Constants ¶
View Source
const ( // Name is the name of the Binance provider. Name = "binance_api" // URL is the base URL of the Binance API. This includes the base and quote // currency pairs that need to be inserted into the URL. This URL should be utilized // by Non-US users. URL = "https://api.binance.com/api/v3/ticker/price?symbols=%s%s%s" Quotation = "%22" Separator = "," LeftBracket = "%5B" RightBracket = "%5D" )
Variables ¶
View Source
var DefaultNonUSAPIConfig = config.APIConfig{ Name: Name, Atomic: true, Enabled: true, Timeout: 3000 * time.Millisecond, Interval: 750 * time.Millisecond, ReconnectTimeout: 2000 * time.Millisecond, MaxQueries: 1, Endpoints: []config.Endpoint{{URL: URL}}, }
DefaultNonUSAPIConfig is the default configuration for the Binance API.
Functions ¶
func NewAPIHandler ¶
func NewAPIHandler( api config.APIConfig, ) (types.PriceAPIDataHandler, error)
NewAPIHandler returns a new Binance PriceAPIDataHandler.
Types ¶
type APIHandler ¶
type APIHandler struct {
// contains filtered or unexported fields
}
APIHandler implements the PriceAPIDataHandler interface for Binance. for more information about the Binance API, refer to the following link: https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md#public-api-endpoints
func (*APIHandler) CreateURL ¶
func (h *APIHandler) CreateURL( tickers []types.ProviderTicker, ) (string, error)
CreateURL returns the URL that is used to fetch data from the Binance API for the given tickers.
func (*APIHandler) ParseResponse ¶
func (h *APIHandler) ParseResponse( tickers []types.ProviderTicker, resp *http.Response, ) types.PriceResponse
ParseResponse parses the response from the Binance API and returns a GetResponse. Each of the tickers supplied will get a response or an error.
Click to show internal directories.
Click to hide internal directories.