binance

package
v0.0.0-...-b093a28 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BINANCE = "BINANCE"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiClient

type ApiClient struct {
	*retryablehttp.Client
	*rate.Limiter
}

func NewBinanceAPIClient

func NewBinanceAPIClient() *ApiClient

func (*ApiClient) GetAllOHLCVMarketData

func (apiClient *ApiClient) GetAllOHLCVMarketData(
	symbol models.Symbol,
	interval time.Duration,
	startTime time.Time,
	endTime time.Time,
) ([]*models.OHLCVMarketData, error)

GetAllOHLCVMarketData get CandleStick data from [startTime, endTime] with pagination

func (*ApiClient) GetExchangeIdentifier

func (apiClient *ApiClient) GetExchangeIdentifier() string

func (*ApiClient) GetOHLCVMarketData

func (apiClient *ApiClient) GetOHLCVMarketData(
	symbol models.Symbol,
	interval time.Duration,
	startTime time.Time,
	endTime time.Time,
) ([]*models.OHLCVMarketData, error)

GetOHLCVMarketData get CandleStick data from [startTime, endTime]

func (*ApiClient) GetRawMarketData

func (apiClient *ApiClient) GetRawMarketData() ([]*models.RawMarketData, error)

func (*ApiClient) GetSupportedPairs

func (apiClient *ApiClient) GetSupportedPairs() ([]*models.Symbol, error)

type CandleStickData

type CandleStickData struct {
	OpenTime                 float64
	OpenPrice                float64
	HighPrice                float64
	LowPrice                 float64
	ClosePrice               float64
	Volume                   float64
	CloseTime                float64
	QuoteAssetVolume         float64
	NumTrades                float64
	TakerBuyBaseAssetVolume  float64
	TakerBuyQuoteAssetVolume float64
}

CandleStickData https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md#klinecandlestick-data

func (*CandleStickData) UnmarshalJSON

func (candleStickResponse *CandleStickData) UnmarshalJSON(
	data []byte,
) (err error)

type ErrorResponse

type ErrorResponse struct {
	Code int64  `json:"code"`
	Msg  string `json:"msg"`
}

type ExchangeInfoResponse

type ExchangeInfoResponse struct {
	Timezone   string    `json:"timezone"`
	ServerTime int64     `json:"serverTime"`
	Symbols    []Symbols `json:"symbols"`
}

ExchangeInfoResponse https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md#exchange-information

type Interval

type Interval string
const (
	Minute Interval = "1m"
	Hour   Interval = "1h"
)

type Symbols

type Symbols struct {
	Symbol                     string   `json:"symbol"`
	Status                     string   `json:"status"`
	BaseAsset                  string   `json:"baseAsset"`
	BaseAssetPrecision         int      `json:"baseAssetPrecision"`
	QuoteAsset                 string   `json:"quoteAsset"`
	QuoteAssetPrecision        int      `json:"quoteAssetPrecision"`
	BaseCommissionPrecision    int      `json:"baseCommissionPrecision"`
	QuoteCommissionPrecision   int      `json:"quoteCommissionPrecision"`
	OrderTypes                 []string `json:"orderTypes"`
	IcebergAllowed             bool     `json:"icebergAllowed"`
	OcoAllowed                 bool     `json:"ocoAllowed"`
	QuoteOrderQtyMarketAllowed bool     `json:"quoteOrderQtyMarketAllowed"`
	IsSpotTradingAllowed       bool     `json:"isSpotTradingAllowed"`
	IsMarginTradingAllowed     bool     `json:"isMarginTradingAllowed"`
	Permissions                []string `json:"permissions"`
}

Jump to

Keyboard shortcuts

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