Documentation ¶
Overview ¶
Package broker manages calls to binance api V3. Documentation about all endpoints and how should they be formed can be found at https://github.com/binance/binance-spot-api-docs
Index ¶
Constants ¶
View Source
const ( OrderTypeMarket = "MARKET" OrderSideSell = "SELL" OrderSideBuy = "BUY" MaxIdleConnections = 10 IdleConnTimeout = 30 * time.Second TestNet = "https://testnet.binance.vision/api/v3" APIV3 = "https://api.binance.com/api/v3" )
Variables ¶
View Source
var ( ErrBrokerNotFound = errors.New("not found") ErrBrokerDuplicatedEntry = errors.New("duplicated entry") )
Functions ¶
Types ¶
type Binance ¶
type Binance struct { APIKey string // APIKey is required for calls that need authentication Signer encode.Signer // Signer is used to encode calls to binance that include sensitive data, like APIKey }
Binance manages calls to binance api v3
func (Binance) Request ¶
func (as Binance) Request(ctx context.Context, method, endpoint string, keysAndValues ...string) (rd io.Reader, err error)
Request convert a bunch of key-value pairs into an url query, it takes the api endpoint and builds the binance api request. It returns the body of the response
type TestBinance ¶
type TestBinance struct { APIKey string // APIKey is required for calls that need authentication Signer encode.Signer // Signer is used to encode calls to binance that include sensitive data, like APIKey }
TestBinance manages calls to binance test api v3 if the endpoint has an test api. Currently, only order endpoint has a test api
func (TestBinance) Request ¶
func (as TestBinance) Request(ctx context.Context, method, endpoint string, keysAndValues ...string) (rd io.Reader, err error)
Request convert a bunch of key-value pairs into an url query, it takes the api endpoint and builds the binance api request. It returns the body of the response
Click to show internal directories.
Click to hide internal directories.