Binance

package module
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2025 License: MIT Imports: 19 Imported by: 0

README

Binance-Go

A simple Golang package for the Binance API

Documentation

Index

Constants

View Source
const (
	HTTP_REQUEST_ERR = iota
	HTTP_SIGNATURE_ERR
	RESPONSEBODY_READING_ERR
	ERROR_PROCESSING_ERR
	RESPONSE_HEADER_NOT_FOUND
	PARSING_ERROR
	WS_OPEN_ERR
	WS_SEND_MESSAGE_ERR
	REQUEST_TIMEOUT_ERR
)
View Source
const DAY = 24 * HOUR
View Source
const HOUR = 60 * MINUTE
View Source
const MINUTE = 60 * SECOND
View Source
const SECOND = 1000

Variables

View Source
var Constants = struct {
	Methods   Methods
	Websocket WebsocketConstants
}{
	Methods: Methods{
		GET:    "GET",
		POST:   "POST",
		PUT:    "PUT",
		PATCH:  "PATCH",
		DELETE: "DELETE",
	},
	Websocket: WebsocketConstants{
		MAX_STREAMS_PER_SOCKET:              1024,
		MAX_OUTGOING_MESSAGES_PER_SECOND:    5,
		CONNECTION_ATTEMPTS_PER_5MINS:       300,
		RESPONSE_TIMEOUT_SECONDS:            20,
		HEARTBEAT_CHECK_INTERVAL_SEC:        5,
		HEARTBEAT_CLOSE_ON_NO_HEARTBEAT_SEC: 20,
		EXPECTED_DISCONNECTION_TIME_SEC:     (DAY - 5*MINUTE) / 1000,
	},
}
View Source
var DevOptions = DevOpts{
	PRINT_HTTP_QUERIES:   false,
	PRINT_HTTP_RESPONSES: false,

	PRINT_ERRORS:     false,
	PRINT_ALL_ERRORS: false,

	WS_VERBOSE:      false,
	WS_VERBOSE_FULL: false,

	PRINT_WS_ERRORS: false,

	PRINT_WS_MESSAGES: false,
}
View Source
var FUTURES_Constants = struct {
	URLs [1]string

	SecurityTypes Futures_SecurityTypes_ENUM

	SymbolTypes      Futures_SymbolTypes_ENUM
	ContractTypes    Futures_ContractTypes_ENUM
	ContractStatuses Futures_ContractStatuses_ENUM

	OrderStatuses Futures_OrderStatuses_ENUM
	OrderTypes    Futures_OrderTypes_ENUM
	OrderSides    Futures_OrderSides_ENUM

	PositionSides Futures_PositionSides_ENUM

	TimeInForce  Futures_TimeInForce_ENUM
	WorkingTypes Futures_WorkingTypes_ENUM

	NewOrderRespTypes Futures_NewOrderRespTypes_ENUM

	ChartIntervals Futures_ChartIntervals_ENUM

	STPModes   Futures_STPModes_ENUM
	PriceMatch Futures_PriceMatch_ENUM

	SymbolFilterTypes  FUTURES_Symbol_FilterTypes_ENUM
	RateLimitTypes     Futures_RateLimitTypes_ENUM
	RateLimitIntervals Futures_RateLimitIntervals_ENUM

	Websocket Futures_Websocket_Constants
}{
	URLs: [1]string{"https://fapi.binance.com"},
	SecurityTypes: Futures_SecurityTypes_ENUM{
		NONE:        "NONE",
		MARKET_DATA: "MARKET_DATA",
		USER_STREAM: "USER_STREAM",
		TRADE:       "TRADE",
		USER_DATA:   "USER_DATA",
	},
	SymbolTypes: Futures_SymbolTypes_ENUM{
		FUTURE: "FUTURE",
	},
	ContractTypes: Futures_ContractTypes_ENUM{
		PERPETUAL:            "PERPETUAL",
		CURRENT_MONTH:        "CURRENT_MONTH",
		NEXT_MONTH:           "NEXT_MONTH",
		CURRENT_QUARTER:      "CURRENT_QUARTER",
		NEXT_QUARTER:         "NEXT_QUARTER",
		PERPETUAL_DELIVERING: "PERPETUAL_DELIVERING",
	},
	ContractStatuses: Futures_ContractStatuses_ENUM{
		PENDING_TRADING: "PENDING_TRADING",
		TRADING:         "TRADING",
		PRE_DELIVERING:  "PRE_DELIVERING",
		DELIVERING:      "DELIVERING",
		DELIVERED:       "DELIVERED",
		PRE_SETTLE:      "PRE_SETTLE",
		SETTLING:        "SETTLING",
		CLOSE:           "CLOSE",
	},
	OrderStatuses: Futures_OrderStatuses_ENUM{
		NEW:              "NEW",
		PARTIALLY_FILLED: "PARTIALLY_FILLED",
		FILLED:           "FILLED",
		CANCELED:         "CANCELED",
		REJECTED:         "REJECTED",
		EXPIRED:          "EXPIRED",
		EXPIRED_IN_MATCH: "EXPIRED_IN_MATCH",
	},
	OrderTypes: Futures_OrderTypes_ENUM{
		LIMIT:                "LIMIT",
		MARKET:               "MARKET",
		STOP:                 "STOP",
		STOP_MARKET:          "STOP_MARKET",
		TAKE_PROFIT:          "TAKE_PROFIT",
		TAKE_PROFIT_MARKET:   "TAKE_PROFIT_MARKET",
		TRAILING_STOP_MARKET: "TRAILING_STOP_MARKET",
	},
	OrderSides: Futures_OrderSides_ENUM{
		BUY:  "BUY",
		SELL: "SELL",
	},
	PositionSides: Futures_PositionSides_ENUM{
		BOTH:  "BOTH",
		LONG:  "LONG",
		SHORT: "SHORT",
	},
	TimeInForce: Futures_TimeInForce_ENUM{
		GTC: "GTC",
		IOC: "IOC",
		FOK: "FOK",
	},
	WorkingTypes: Futures_WorkingTypes_ENUM{
		MARK_PRICE:     "MARK_PRICE",
		CONTRACT_PRICE: "CONTRACT_PRICE",
	},
	NewOrderRespTypes: Futures_NewOrderRespTypes_ENUM{
		ACK:    "ACK",
		RESULT: "RESULT",
	},
	ChartIntervals: Futures_ChartIntervals_ENUM{
		MIN:      "1m",
		MINS_3:   "3m",
		MINS_5:   "5m",
		MINS_15:  "15m",
		MINS_30:  "30m",
		HOUR:     "1h",
		HOURS_2:  "2h",
		HOURS_4:  "4h",
		HOURS_6:  "6h",
		HOURS_8:  "8h",
		HOURS_12: "12h",
		DAY:      "1d",
		DAYS_3:   "3d",
		WEEK:     "1w",
		MONTH:    "1M",
	},
	STPModes: Futures_STPModes_ENUM{
		NONE:         "NONE",
		EXPIRE_TAKER: "EXPIRE_TAKER",
		EXPIRE_BOTH:  "EXPIRE_BOTH",
		EXPIRE_MAKER: "EXPIRE_MAKER",
	},
	PriceMatch: Futures_PriceMatch_ENUM{
		NONE:        "NONE",
		OPPONENT:    "OPPONENT",
		OPPONENT_5:  "OPPONENT_5",
		OPPONENT_10: "OPPONENT_10",
		OPPONENT_20: "OPPONENT_20",
		QUEUE:       "QUEUE",
		QUEUE_5:     "QUEUE_5",
		QUEUE_10:    "QUEUE_10",
		QUEUE_20:    "QUEUE_20",
	},
	SymbolFilterTypes: FUTURES_Symbol_FilterTypes_ENUM{
		PRICE_FILTER:        "PRICE_FILTER",
		LOT_SIZE:            "LOT_SIZE",
		MARKET_LOT_SIZE:     "MARKET_LOT_SIZE",
		MAX_NUM_ORDERS:      "MAX_NUM_ORDERS",
		MAX_NUM_ALGO_ORDERS: "MAX_NUM_ALGO_ORDERS",
		PERCENT_PRICE:       "PERCENT_PRICE",
		MIN_NOTIONAL:        "MIN_NOTIONAL",
	},
	RateLimitTypes: Futures_RateLimitTypes_ENUM{
		REQUEST_WEIGHT: "REQUEST_WEIGHT",
		ORDERS:         "ORDERS",
	},
	RateLimitIntervals: Futures_RateLimitIntervals_ENUM{
		SECOND: "SECOND",
		MINUTE: "MINUTE",
		DAY:    "DAY",
	},
	Websocket: Futures_Websocket_Constants{
		URLs: []string{"wss://fstream.binance.com"},
	},
}
View Source
var SPOT_Constants = struct {
	URLs                [6]string
	URL_Data_Only       string
	SecurityTypes       Spot_SecurityTypes_ENUM
	ExchangeFilterTypes Spot_Exchange_FilterTypes_ENUM
	SymbolFilterTypes   SPOT_Symbol_FilterTypes_ENUM
	SymbolStatuses      Spot_SymbolStatuses_ENUM
	Permissions         Spot_Permissions_ENUM
	OrderStatuses       Spot_OrderStatuses_ENUM
	ListStatusTypes     Spot_ListStatusTypes_ENUM
	ListOrderStatuses   Spot_ListOrderStatuses_ENUM
	ContingencyTypes    Spot_ContingencyTypes_ENUM
	AllocationTypes     Spot_AllocationTypes_ENUM
	OrderTypes          Spot_OrderTypes_ENUM
	NewOrderRespTypes   Spot_NewOrderRespTypes_ENUM
	WorkingFloors       Spot_WorkingFloors_ENUM
	OrderSides          Spot_OrderSides_ENUM
	TimeInForces        Spot_TimeInForces_ENUM
	RateLimitTypes      Spot_RateLimitTypes_ENUM
	RateLimitIntervals  Spot_RateLimitIntervals_ENUM
	STPModes            Spot_STPModes_ENUM
	ChartIntervals      Spot_ChartIntervals_ENUM

	Websocket Spot_Websocket_Constants
}{
	URLs:          [6]string{"https://api.binance.com", "https://api-gcp.binance.com", "https://api1.binance.com", "https://api2.binance.com", "https://api3.binance.com", "https://api4.binance.com"},
	URL_Data_Only: "https://data-api.binance.vision",
	SecurityTypes: Spot_SecurityTypes_ENUM{
		NONE:        "NONE",
		USER_STREAM: "USER_STREAM",
		TRADE:       "TRADE",
		USER_DATA:   "USER_DATA",
	},
	ExchangeFilterTypes: Spot_Exchange_FilterTypes_ENUM{
		EXCHANGE_MAX_NUM_ORDERS:         "EXCHANGE_MAX_NUM_ORDERS",
		EXCHANGE_MAX_NUM_ALGO_ORDERS:    "EXCHANGE_MAX_NUM_ALGO_ORDERS",
		EXCHANGE_MAX_NUM_ICEBERG_ORDERS: "EXCHANGE_MAX_NUM_ICEBERG_ORDERS",
	},
	SymbolFilterTypes: SPOT_Symbol_FilterTypes_ENUM{
		PRICE_FILTER:           "PRICE_FILTER",
		PERCENT_PRICE:          "PERCENT_PRICE",
		PERCENT_PRICE_BY_SIDE:  "PERCENT_PRICE_BY_SIDE",
		LOT_SIZE:               "LOT_SIZE",
		MIN_NOTIONAL:           "MIN_NOTIONAL",
		NOTIONAL:               "NOTIONAL",
		ICEBERG_PARTS:          "ICEBERG_PARTS",
		MARKET_LOT_SIZE:        "MARKET_LOT_SIZE",
		MAX_NUM_ORDERS:         "MAX_NUM_ORDERS",
		MAX_NUM_ALGO_ORDERS:    "MAX_NUM_ALGO_ORDERS",
		MAX_NUM_ICEBERG_ORDERS: "MAX_NUM_ICEBERG_ORDERS",
		MAX_POSITION:           "MAX_POSITION",
		TRAILING_DELTA:         "TRAILING_DELTA",
	},
	SymbolStatuses: Spot_SymbolStatuses_ENUM{
		PRE_TRADING:   "PRE_TRADING",
		TRADING:       "TRADING",
		POST_TRADING:  "POST_TRADING",
		END_OF_DAY:    "END_OF_DAY",
		HALT:          "HALT",
		AUCTION_MATCH: "AUCTION_MATCH",
		BREAK:         "BREAK",
	},
	Permissions: Spot_Permissions_ENUM{
		SPOT:        "SPOT",
		MARGIN:      "MARGIN",
		LEVERAGED:   "LEVERAGED",
		TRD_GRP_002: "TRD_GRP_002",
		TRD_GRP_003: "TRD_GRP_003",
		TRD_GRP_004: "TRD_GRP_004",
		TRD_GRP_005: "TRD_GRP_005",
		TRD_GRP_006: "TRD_GRP_006",
		TRD_GRP_007: "TRD_GRP_007",
		TRD_GRP_008: "TRD_GRP_008",
		TRD_GRP_009: "TRD_GRP_009",
		TRD_GRP_010: "TRD_GRP_010",
		TRD_GRP_011: "TRD_GRP_011",
		TRD_GRP_012: "TRD_GRP_012",
		TRD_GRP_013: "TRD_GRP_013",
		TRD_GRP_014: "TRD_GRP_014",
		TRD_GRP_015: "TRD_GRP_015",
		TRD_GRP_016: "TRD_GRP_016",
		TRD_GRP_017: "TRD_GRP_017",
		TRD_GRP_018: "TRD_GRP_018",
		TRD_GRP_019: "TRD_GRP_019",
		TRD_GRP_020: "TRD_GRP_020",
		TRD_GRP_021: "TRD_GRP_021",
		TRD_GRP_022: "TRD_GRP_022",
		TRD_GRP_023: "TRD_GRP_023",
		TRD_GRP_024: "TRD_GRP_024",
		TRD_GRP_025: "TRD_GRP_025",
	},
	OrderStatuses: Spot_OrderStatuses_ENUM{
		NEW:              "NEW",
		PENDING_NEW:      "PENDING_NEW",
		PARTIALLY_FILLED: "PARTIALLY_FILLED",
		FILLED:           "FILLED",
		CANCELED:         "CANCELED",
		PENDING_CANCEL:   "PENDING_CANCEL",
		REJECTED:         "REJECTED",
		EXPIRED:          "EXPIRED",
		EXPIRED_IN_MATCH: "EXPIRED_IN_MATCH",
	},
	ListStatusTypes: Spot_ListStatusTypes_ENUM{
		RESPONSE:     "RESPONSE",
		EXEC_STARTED: "EXEC_STARTED",
		ALL_DONE:     "ALL_DONE",
	},
	ListOrderStatuses: Spot_ListOrderStatuses_ENUM{
		EXECUTING: "EXECUTING",
		ALL_DONE:  "ALL_DONE",
		REJECT:    "REJECT",
	},
	ContingencyTypes: Spot_ContingencyTypes_ENUM{
		OCO: "OCO",
		OTO: "OTO",
	},
	AllocationTypes: Spot_AllocationTypes_ENUM{
		SOR: "SOR",
	},
	OrderTypes: Spot_OrderTypes_ENUM{
		LIMIT:             "LIMIT",
		MARKET:            "MARKET",
		STOP_LOSS:         "STOP_LOSS",
		STOP_LOSS_LIMIT:   "STOP_LOSS_LIMIT",
		TAKE_PROFIT:       "TAKE_PROFIT",
		TAKE_PROFIT_LIMIT: "TAKE_PROFIT_LIMIT",
		LIMIT_MAKER:       "LIMIT_MAKER",
	},
	NewOrderRespTypes: Spot_NewOrderRespTypes_ENUM{
		ACK:    "ACK",
		RESULT: "RESULT",
		FULL:   "FULL",
	},
	WorkingFloors: Spot_WorkingFloors_ENUM{
		EXCHANGE: "EXCHANGE",
		SOR:      "SOR",
	},
	OrderSides: Spot_OrderSides_ENUM{
		BUY:  "BUY",
		SELL: "SELL",
	},
	TimeInForces: Spot_TimeInForces_ENUM{
		GTC: "GTC",
		IOC: "IOC",
		FOK: "FOK",
	},
	RateLimitTypes: Spot_RateLimitTypes_ENUM{
		REQUEST_WEIGHT: "REQUEST_WEIGHT",
		ORDERS:         "ORDERS",
		RAW_REQUESTS:   "RAW_REQUESTS",
	},
	RateLimitIntervals: Spot_RateLimitIntervals_ENUM{
		SECOND: "SECOND",
		MINUTE: "MINUTE",
		DAY:    "DAY",
	},
	STPModes: Spot_STPModes_ENUM{
		NONE:         "NONE",
		EXPIRE_MAKER: "EXPIRE_MAKER",
		EXPIRE_TAKER: "EXPIRE_TAKER",
		EXPIRE_BOTH:  "EXPIRE_BOTH",
	},
	ChartIntervals: Spot_ChartIntervals_ENUM{
		SECOND:   "1s",
		MIN:      "1m",
		MINS_3:   "3m",
		MINS_5:   "5m",
		MINS_15:  "15m",
		MINS_30:  "30m",
		HOUR:     "1h",
		HOURS_2:  "2h",
		HOURS_4:  "4h",
		HOURS_6:  "6h",
		HOURS_8:  "8h",
		HOURS_12: "12h",
		DAY:      "1d",
		DAYS_3:   "3d",
		WEEK:     "1w",
		MONTH:    "1M",
	},
	Websocket: Spot_Websocket_Constants{
		URLs:                      []string{"wss://stream.binance.com:9443", "wss://stream.binance.com:443"},
		MARKET_DATA_ONLY_ENDPOINT: "wss://data-stream.binance.vision",
	},
}

Functions

func BinanceError

func BinanceError(resp *Response) (BinanceError *Error, UnmarshallError *Error)

Processes an erroneous 4XX HTTP Response Returns the library Error type In the case of an error parsing the error body, it returns a secondaly unmarshall error

func CreateQueryStringWS

func CreateQueryStringWS(streams []string, isCombined bool) string

func CreateSocket

func CreateSocket(baseURL string, streams []string, isCombined bool) (*Websocket, *Error)

func DeserializeNumber

func DeserializeNumber(data []byte, value interface{}) error

Deserializes any number into binary format Accepts any type (int, uint, float) and any size (8, 16, 32, 64)

func DeserializeString

func DeserializeString(data []byte) (string, error)

Deserialize a string from binary to string format

func DetectDotNumIndexes

func DetectDotNumIndexes(numStr string) (dotIndex int, numIndex int)

func Format_TickSize_str added in v0.0.10

func Format_TickSize_str(priceStr string, tickSize string) string

func GetStringNumberPrecision added in v0.0.12

func GetStringNumberPrecision(numStr string) int

func IsDifferentFromDefault

func IsDifferentFromDefault(value any) bool

Checks if a value is different from its default value.

func LOG_ALL_ERRORS added in v0.0.10

func LOG_ALL_ERRORS(a ...any)

func LOG_ERRORS

func LOG_ERRORS(a ...any)

func LOG_HTTP_QUERIES added in v0.0.10

func LOG_HTTP_QUERIES(a ...any)

func LOG_HTTP_RESPONSES added in v0.0.10

func LOG_HTTP_RESPONSES(a ...any)

func LOG_WS_ERRORS added in v0.0.10

func LOG_WS_ERRORS(a ...any)

func LOG_WS_MESSAGES added in v0.0.10

func LOG_WS_MESSAGES(a ...any)

func LOG_WS_VERBOSE

func LOG_WS_VERBOSE(a ...any)

func LOG_WS_VERBOSE_FULL

func LOG_WS_VERBOSE_FULL(a ...any)

func ParseFloat

func ParseFloat(floatStr string) (float64, error)

func ParseFuturesExchangeInfo

func ParseFuturesExchangeInfo(exchangeInfo_response *Response) (*Futures_ExchangeInfo, *Error)

func ParseInt

func ParseInt(intStr string) (int64, error)

func ParseSpotExchangeInfo

func ParseSpotExchangeInfo(exchangeInfo_response *Response) (*Spot_ExchangeInfo, *Error)

func Round_priceStr added in v0.0.10

func Round_priceStr(priceStr string, precision int) string

func SerializeNumber

func SerializeNumber(value interface{}) ([]byte, error)

Serializes any number into binary format Accepts any type (int, uint, float) and any size (8, 16, 32, 64)

func SerializeString

func SerializeString(value string) ([]byte, error)

Serialize a string from string to binary format

func ToFixed_Ceil added in v0.0.10

func ToFixed_Ceil(price float64, precision int) float64

func ToFixed_Floor added in v0.0.10

func ToFixed_Floor(price float64, precision int) float64

func ToFixed_Round added in v0.0.10

func ToFixed_Round(price float64, precision int) float64

Types

type APIKEYS

type APIKEYS struct {
	KEY    string
	SECRET string
}

func (*APIKEYS) Get

func (keys *APIKEYS) Get() (KEY string, SECRET string)

func (*APIKEYS) Set

func (keys *APIKEYS) Set(KEY string, SECRET string)

type Binance

type Binance struct {
	Opts BinanceOptions

	API APIKEYS

	Spot    Spot
	Futures Futures
	// contains filtered or unexported fields
}

func CreateClient

func CreateClient(APIKEY string, APISECRET string) *Binance

func CreateClientWithOptions

func CreateClientWithOptions(APIKEY string, APISECRET string, recvWindow int64) *Binance

func CreateReadClient

func CreateReadClient() *Binance

type BinanceConfig

type BinanceConfig struct {
	// contains filtered or unexported fields
}

type BinanceErrorResponse

type BinanceErrorResponse struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
}

type BinanceOptions

type BinanceOptions struct {
	// contains filtered or unexported fields
}

func (*BinanceOptions) Set_UpdateTimestampOffset

func (options *BinanceOptions) Set_UpdateTimestampOffset(value bool)

func (*BinanceOptions) Set_recvWindow

func (options *BinanceOptions) Set_recvWindow(recvWindow int64)

type CombinedStream_MSG

type CombinedStream_MSG struct {
	Stream string              `json:"stream"`
	Data   jsoniter.RawMessage `json:"data"`
}

type DevOpts added in v0.0.10

type DevOpts struct {
	PRINT_HTTP_QUERIES   bool
	PRINT_HTTP_RESPONSES bool

	// Might not log every error returned.
	// It only prints errors specifically handled by the library.
	PRINT_ERRORS bool
	// This is redundant.
	// Any *Error type generated by the library will be logged.
	PRINT_ALL_ERRORS bool

	// Prints all useful activity data and errors.
	// i.e: Forced reconnections, disconnections, etc...
	WS_VERBOSE bool
	// Prints all websocket data.
	// i.e: pings received, pongs sent, etc...
	WS_VERBOSE_FULL bool
	PRINT_WS_ERRORS bool

	// Recommended only for debugging.
	PRINT_WS_MESSAGES bool
}

type Error

type Error struct {
	// false => Error originating from binance's side
	// true =>
	IsLocalError bool

	StatusCode int

	Code int

	Message string
}

func LocalError

func LocalError(code int, msg string) *Error

func (*Error) Error

func (e *Error) Error() string

Implement the `Error` method to satisfy the `error` interface

type FUTURES_Symbol_FilterTypes_ENUM

type FUTURES_Symbol_FilterTypes_ENUM struct {
	PRICE_FILTER        string
	LOT_SIZE            string
	MARKET_LOT_SIZE     string
	MAX_NUM_ORDERS      string
	MAX_NUM_ALGO_ORDERS string
	PERCENT_PRICE       string
	MIN_NOTIONAL        string
}

type Futures

type Futures struct {
	API APIKEYS

	Websockets Futures_Websockets
	// contains filtered or unexported fields
}

func (*Futures) AccountConfiguration added in v0.0.17

func (futures *Futures) AccountConfiguration(recvWindow ...int64) (*Futures_AccountConfiguration, *Response, *Error)

func (*Futures) AccountInfo added in v0.0.17

func (futures *Futures) AccountInfo(recvWindow ...int64) (*Futures_AccountInfo, *Response, *Error)

func (*Futures) AggTrades

func (futures *Futures) AggTrades(symbol string, opt_params ...Futures_AggTrade_Params) ([]*Futures_AggTrade_Params, *Response, *Error)

func (*Futures) BookTicker added in v0.0.11

func (futures *Futures) BookTicker(symbol ...string) ([]*Futures_BookTicker, *Response, *Error)

If the symbol is not sent, bookTickers for all symbols will be returned in an array. The field X-MBX-USED-WEIGHT-1M in response header is not accurate from this endpoint, please ignore.

func (*Futures) Candlesticks

func (futures *Futures) Candlesticks(symbol string, interval string, opt_params ...*Futures_Candlesticks_Params) ([]*Futures_Candlestick, *Response, *Error)

func (*Futures) ChangeInitialLeverage added in v0.0.17

func (futures *Futures) ChangeInitialLeverage(symbol string, leverage int, recvWindow ...int64) (*Futures_ChangeInitialLeverage_Response, *Response, *Error)

func (*Futures) ChangeMarginType added in v0.0.17

func (futures *Futures) ChangeMarginType(symbol string, marginType string, recvWindow ...int64) (*Futures_ChangeMarginType_Response, *Response, *Error)

func (*Futures) ChangeMultiAssetsMode added in v0.0.17

func (futures *Futures) ChangeMultiAssetsMode(multiAssetsMargin bool, recvWindow ...int64) (*Futures_ChangeMultiAssetsMode_Response, *Response, *Error)

func (*Futures) ChangePositionMode added in v0.0.17

func (futures *Futures) ChangePositionMode(toHedgeMode bool, recvWindow ...int64) (*Futures_ChangePositionMode_Response, *Response, *Error)

func (*Futures) ContinuousContractCandlesticks

func (futures *Futures) ContinuousContractCandlesticks(symbol string, contractType string, interval string, opt_params ...*Futures_Candlesticks_Params) ([]*Futures_Candlestick, *Response, *Error)

Kline/candlestick bars for a specific contract type.

Klines are uniquely identified by their open time.

Contract Types: "PERPETUAL" | "CURRENT_QUARTER" | "NEXT_QUARTER"

func (*Futures) DeliveryPrice added in v0.0.11

func (futures *Futures) DeliveryPrice(pair string) ([]*Futures_DeliveryPrice, *Response, *Error)

func (*Futures) ExchangeInfo

func (futures *Futures) ExchangeInfo() (*Futures_ExchangeInfo, *Response, *Error)

func (*Futures) FundingRate added in v0.0.11

func (futures *Futures) FundingRate() ([]*Futures_FundingRate, *Response, *Error)

func (*Futures) FundingRateHistory added in v0.0.11

func (futures *Futures) FundingRateHistory(opt_params ...Futures_FundingRate_Params) ([]*Futures_FundingRate, *Response, *Error)

func (*Futures) HistoricalTrades

func (futures *Futures) HistoricalTrades(symbol string, opt_params ...Futures_HistoricalTrades_Params) ([]*Futures_Trade, *Response, *Error)

func (*Futures) IndexPriceCandlesticks

func (futures *Futures) IndexPriceCandlesticks(symbol string, interval string, opt_params ...*Futures_PriceCandlesticks_Params) ([]*Futures_PriceCandlestick, *Response, *Error)

func (*Futures) LeverageBrackets added in v0.0.17

func (futures *Futures) LeverageBrackets(symbol ...string) ([]*Futures_LeverageBrackets, *Response, *Error)

func (*Futures) LimitBuy added in v0.0.10

func (futures *Futures) LimitBuy(symbol string, price string, quantity string, timeInForce string, opt_params ...Futures_LimitOrder_Params) (*Futures_Order, *Response, *Error)

func (*Futures) LimitOrder added in v0.0.10

func (futures *Futures) LimitOrder(symbol string, side string, price string, quantity string, timeInForce string, opt_params ...Futures_LimitOrder_Params) (*Futures_Order, *Response, *Error)

func (*Futures) LimitSell added in v0.0.10

func (futures *Futures) LimitSell(symbol string, price string, quantity string, timeInForce string, opt_params ...Futures_LimitOrder_Params) (*Futures_Order, *Response, *Error)

func (*Futures) MarkPrice

func (futures *Futures) MarkPrice(symbol ...string) ([]*Futures_MarkPrice, *Response, *Error)

func (*Futures) MarkPriceCandlesticks

func (futures *Futures) MarkPriceCandlesticks(symbol string, contractType string, interval string, opt_params ...*Futures_PriceCandlesticks_Params) ([]*Futures_PriceCandlestick, *Response, *Error)

func (*Futures) MarketBuy added in v0.0.10

func (futures *Futures) MarketBuy(symbol string, side string, quantity string, opt_params ...Futures_MarketOrder_Params) (*Futures_Order, *Response, *Error)

func (*Futures) MarketOrder added in v0.0.10

func (futures *Futures) MarketOrder(symbol string, side string, quantity string, opt_params ...Futures_MarketOrder_Params) (*Futures_Order, *Response, *Error)

func (*Futures) MarketSell added in v0.0.10

func (futures *Futures) MarketSell(symbol string, side string, quantity string, opt_params ...Futures_MarketOrder_Params) (*Futures_Order, *Response, *Error)

func (*Futures) NewOrder added in v0.0.10

func (futures *Futures) NewOrder(symbol string, side string, Type string, opt_params ...Futures_Order_Params) (*Futures_Order, *Response, *Error)

func (*Futures) OpenInterest added in v0.0.11

func (futures *Futures) OpenInterest(symbol string) (*Futures_OpenInterest, *Response, *Error)

func (*Futures) OpenInterestStatistics added in v0.0.11

func (futures *Futures) OpenInterestStatistics(symbol string, period string, opt_params ...Futures_OpenInterestStatistics_Params) ([]*Futures_OpenInterestStatistics, *Response, *Error)

func (*Futures) OrderBook

func (futures *Futures) OrderBook(symbol string, limit ...int64) (*Futures_OrderBook, *Response, *Error)

func (*Futures) Ping

func (futures *Futures) Ping() (latency int64, request *Response, err *Error)

Test connectivity to the Rest API.

Weight: 1

Data Source: Memory

func (*Futures) PremiumIndexCandlesticks

func (futures *Futures) PremiumIndexCandlesticks(symbol string, contractType string, interval string, opt_params ...*Futures_PriceCandlesticks_Params) ([]*Futures_PriceCandlestick, *Response, *Error)

func (*Futures) PriceTicker added in v0.0.11

func (futures *Futures) PriceTicker(symbol ...string) ([]*Futures_PriceTicker, *Response, *Error)

If the symbol is not sent, bookTickers for all symbols will be returned in an array. The field X-MBX-USED-WEIGHT-1M in response header is not accurate from this endpoint, please ignore.

func (*Futures) PriceTicker_v1 added in v0.0.11

func (futures *Futures) PriceTicker_v1(symbol ...string) ([]*Futures_PriceTicker, *Response, *Error)

If the symbol is not sent, bookTickers for all symbols will be returned in an array.

func (*Futures) ServerTime

func (futures *Futures) ServerTime() (*Futures_Time, *Response, *Error)

func (*Futures) Ticker24h added in v0.0.11

func (futures *Futures) Ticker24h(symbol ...string) ([]*Futures_24hTicker, *Response, *Error)

If the symbol is not sent, bookTickers for all symbols will be returned in an array.

func (*Futures) Trades

func (futures *Futures) Trades(symbol string, limit ...int64) ([]*Futures_Trade, *Response, *Error)

type FuturesRequest

type FuturesRequest struct {
	// contains filtered or unexported fields
}

type FuturesWS_AggTrade

type FuturesWS_AggTrade struct {

	// Event type
	Event string `json:"e"`

	// Event time
	EventTime int64 `json:"E"`

	// Symbol
	Symbol string `json:"s"`

	// Aggregate trade ID
	AggTradeId int64 `json:"a"`

	// Price
	Price string `json:"p"`

	// Quantity
	Quantity string `json:"q"`

	// First trade ID
	FirstTradeId int64 `json:"f"`

	// Last trade ID
	LastTradeId int64 `json:"l"`

	// Trade time
	Timestamp int64 `json:"T"`

	// Is the buyer the market maker?
	IsMaker bool `json:"m"`
}

type FuturesWS_AggTrade_Socket

type FuturesWS_AggTrade_Socket struct {
	Handler *Futures_Websocket
}

func (*FuturesWS_AggTrade_Socket) CreateStreamName

func (*FuturesWS_AggTrade_Socket) CreateStreamName(symbol string) string

func (*FuturesWS_AggTrade_Socket) Subscribe

func (socket *FuturesWS_AggTrade_Socket) Subscribe(symbol ...string) (resp *FuturesWS_Subscribe_Response, hasTimedOut bool, err *Error)

func (*FuturesWS_AggTrade_Socket) Unsubscribe

func (socket *FuturesWS_AggTrade_Socket) Unsubscribe(symbol ...string) (resp *FuturesWS_Unsubscribe_Response, hasTimedOut bool, err *Error)

type FuturesWS_AllBookTickers_Socket

type FuturesWS_AllBookTickers_Socket struct {
	Handler *Futures_Websocket
}

func (*FuturesWS_AllBookTickers_Socket) CreateStreamName

func (*FuturesWS_AllBookTickers_Socket) CreateStreamName() string

func (*FuturesWS_AllBookTickers_Socket) Subscribe

func (socket *FuturesWS_AllBookTickers_Socket) Subscribe() (resp *FuturesWS_Subscribe_Response, hasTimedOut bool, err *Error)

func (*FuturesWS_AllBookTickers_Socket) Unsubscribe

func (socket *FuturesWS_AllBookTickers_Socket) Unsubscribe() (resp *FuturesWS_Unsubscribe_Response, hasTimedOut bool, err *Error)

type FuturesWS_AllMarkPrices_Socket

type FuturesWS_AllMarkPrices_Socket struct {
	Handler *Futures_Websocket
}

func (*FuturesWS_AllMarkPrices_Socket) CreateStreamName

func (*FuturesWS_AllMarkPrices_Socket) CreateStreamName(isFast bool) string

func (*FuturesWS_AllMarkPrices_Socket) Subscribe

func (socket *FuturesWS_AllMarkPrices_Socket) Subscribe(isFast ...bool) (resp *FuturesWS_Subscribe_Response, hasTimedOut bool, err *Error)

func (*FuturesWS_AllMarkPrices_Socket) Unsubscribe

func (socket *FuturesWS_AllMarkPrices_Socket) Unsubscribe(isFast ...bool) (resp *FuturesWS_Unsubscribe_Response, hasTimedOut bool, err *Error)

type FuturesWS_BookTicker

type FuturesWS_BookTicker struct {

	// event type
	Event string `json:"e"`

	// order book updateId
	UpdateId int64 `json:"u"`

	// event time
	EventTime int64 `json:"E"`

	// transaction time
	TransactTime int64 `json:"T"`

	// symbol
	Symbol string `json:"s"`

	// best bid price
	Bid string `json:"b"`

	// best bid qty
	BidQty string `json:"B"`

	// best ask price
	Ask string `json:"a"`

	// best ask qty
	AskQty string `json:"A"`
}

type FuturesWS_BookTicker_Socket

type FuturesWS_BookTicker_Socket struct {
	Handler *Futures_Websocket
}

func (*FuturesWS_BookTicker_Socket) CreateStreamName

func (*FuturesWS_BookTicker_Socket) CreateStreamName(symbol ...string) []string

func (*FuturesWS_BookTicker_Socket) Subscribe

func (socket *FuturesWS_BookTicker_Socket) Subscribe(symbol ...string) (resp *FuturesWS_Subscribe_Response, hasTimedOut bool, err *Error)

func (*FuturesWS_BookTicker_Socket) Unsubscribe

func (socket *FuturesWS_BookTicker_Socket) Unsubscribe(symbol ...string) (resp *FuturesWS_Unsubscribe_Response, hasTimedOut bool, err *Error)

type FuturesWS_ContractInfo

type FuturesWS_ContractInfo struct {

	// Event Type
	Event string `json:"e"`

	// Event Time
	EventTime int64 `json:"E"`

	// Symbol
	Symbol string `json:"s"`

	// Pair
	Pair string `json:"ps"`

	// Contract type
	ContractType string `json:"ct"`

	// Delivery date time
	DeliveryDate int64 `json:"dt"`

	// onboard date time
	OnboardDateTime int64 `json:"ot"`

	// Contract status
	ContractStatus string `json:"cs"`

	Bks []*FuturesWS_ContractInfo_Bracket `json:"bks"`
}

type FuturesWS_ContractInfo_Bracket

type FuturesWS_ContractInfo_Bracket struct {

	// Notional bracket
	NotionalBracket int64 `json:"bs"`

	// Floor notional of this bracket
	FloorNotional int64 `json:"bnf"`

	// Cap notional of this bracket
	MaxNotional int64 `json:"bnc"`

	// Maintenance ratio for this bracket
	MaintenanceRatio float64 `json:"mmr"`

	// Auxiliary number for quick calculation
	Auxiliary int64 `json:"cf"`

	// Min leverage for this bracket
	MinLeverage int64 `json:"mi"`

	// Max leverage for this bracket
	MaxLeverage int64 `json:"ma"`
}

type FuturesWS_ContractInfo_Socket

type FuturesWS_ContractInfo_Socket struct {
	Handler *Futures_Websocket
}

func (*FuturesWS_ContractInfo_Socket) CreateStreamName

func (*FuturesWS_ContractInfo_Socket) CreateStreamName() string

func (*FuturesWS_ContractInfo_Socket) Subscribe

func (socket *FuturesWS_ContractInfo_Socket) Subscribe() (resp *FuturesWS_Subscribe_Response, hasTimedOut bool, err *Error)

func (*FuturesWS_ContractInfo_Socket) Unsubscribe

func (socket *FuturesWS_ContractInfo_Socket) Unsubscribe() (resp *FuturesWS_Unsubscribe_Response, hasTimedOut bool, err *Error)

type FuturesWS_ListSubscriptions_Response

type FuturesWS_ListSubscriptions_Response struct {
	Id     string   `json:"id"`
	Result []string `json:"result"`
}

type FuturesWS_MarkPrice

type FuturesWS_MarkPrice struct {

	// Event type
	Event string `json:"e"`

	// Event time
	EventTime int64 `json:"E"`

	// Symbol
	Symbol string `json:"s"`

	// Mark price
	MarkPrice string `json:"p"`

	// Index price
	IndexPrice string `json:"i"`

	// Estimated Settle Price, only useful in the last hour before the settlement starts
	EstimatedSettlePrice string `json:"P"`

	// Funding rate
	FundingRate string `json:"r"`

	// Next funding time
	NextFundingTime int64 `json:"T"`
}

type FuturesWS_MarkPrice_Params

type FuturesWS_MarkPrice_Params struct {
	Symbol string
	IsFast bool
}

type FuturesWS_MarkPrice_Socket

type FuturesWS_MarkPrice_Socket struct {
	Handler *Futures_Websocket
}

func (*FuturesWS_MarkPrice_Socket) CreateStreamName

func (*FuturesWS_MarkPrice_Socket) CreateStreamName(symbol string, IsFast bool) string

func (*FuturesWS_MarkPrice_Socket) Subscribe

func (socket *FuturesWS_MarkPrice_Socket) Subscribe(params ...FuturesWS_MarkPrice_Params) (resp *FuturesWS_Subscribe_Response, hasTimedOut bool, err *Error)

func (*FuturesWS_MarkPrice_Socket) Unsubscribe

func (socket *FuturesWS_MarkPrice_Socket) Unsubscribe(params ...FuturesWS_MarkPrice_Params) (resp *FuturesWS_Unsubscribe_Response, hasTimedOut bool, err *Error)

type FuturesWS_PrivateMessage

type FuturesWS_PrivateMessage struct {
	Id string `json:"id"`
}

type FuturesWS_Subscribe_Response

type FuturesWS_Subscribe_Response struct {
	Id string `json:"id"`
}

type FuturesWS_Unsubscribe_Response

type FuturesWS_Unsubscribe_Response struct {
	Id string `json:"id"`
}

type Futures_24hTicker added in v0.0.11

type Futures_24hTicker struct {
	Symbol             string `json:"symbol"`
	PriceChange        string `json:"priceChange"`
	PriceChangePercent string `json:"priceChangePercent"`
	WeightedAvgPrice   string `json:"weightedAvgPrice"`
	LastPrice          string `json:"lastPrice"`
	LastQty            string `json:"lastQty"`
	Open               string `json:"openPrice"`
	High               string `json:"highPrice"`
	Low                string `json:"lowPrice"`
	Volume             string `json:"volume"`
	QuoteVolume        string `json:"quoteVolume"`
	OpenTime           int64  `json:"openTime"`
	CloseTime          int64  `json:"closeTime"`
	FirstId            int64  `json:"firstId"`
	LastId             int64  `json:"lastId"`
	Count              int64  `json:"count"`
}

type Futures_AccountConfiguration added in v0.0.17

type Futures_AccountConfiguration struct {
	FeeTier           int64 `json:"feeTier"`
	CanTrade          bool  `json:"canTrade"`
	CanDeposit        bool  `json:"canDeposit"`
	CanWithdraw       bool  `json:"canWithdraw"`
	DualSidePosition  bool  `json:"dualSidePosition"`
	UpdateTime        int64 `json:"updateTime"`
	MultiAssetsMargin bool  `json:"multiAssetsMargin"`
	TradeGroupId      int64 `json:"tradeGroupId"`
}

type Futures_AccountInfo added in v0.0.17

type Futures_AccountInfo struct {
	TotalInitialMargin          string
	TotalMaintMargin            string
	TotalWalletBalance          string
	TotalUnrealizedProfit       string
	TotalMarginBalance          string
	TotalPositionInitialMargin  string
	TotalOpenOrderInitialMargin string
	TotalCrossWalletBalance     string
	TotalCrossUnPnl             string
	AvailableBalance            string
	MaxWithdrawAmount           string
	Assets                      []*Futures_AccountInfo_Asset
	Positions                   []*Futures_AccountInfo_Position
}

type Futures_AccountInfo_Asset added in v0.0.17

type Futures_AccountInfo_Asset struct {
	Asset                  string `json:"asset"`
	WalletBalance          string `json:"walletBalance"`
	UnrealizedProfit       string `json:"unrealizedProfit"`
	MarginBalance          string `json:"marginBalance"`
	MaintMargin            string `json:"maintMargin"`
	InitialMargin          string `json:"initialMargin"`
	PositionInitialMargin  string `json:"positionInitialMargin"`
	OpenOrderInitialMargin string `json:"openOrderInitialMargin"`
	CrossWalletBalance     string `json:"crossWalletBalance"`
	CrossUnPnl             string `json:"crossUnPnl"`
	AvailableBalance       string `json:"availableBalance"`
	MaxWithdrawAmount      string `json:"maxWithdrawAmount"`
	UpdateTime             int64  `json:"updateTime"`
}

type Futures_AccountInfo_Position added in v0.0.17

type Futures_AccountInfo_Position struct {
	Symbol           string `json:"symbol"`
	PositionSide     string `json:"positionSide"`
	PositionAmt      string `json:"positionAmt"`
	UnrealizedProfit string `json:"unrealizedProfit"`
	IsolatedMargin   string `json:"isolatedMargin"`
	Notional         string `json:"notional"`
	IsolatedWallet   string `json:"isolatedWallet"`
	InitialMargin    string `json:"initialMargin"`
	MaintMargin      string `json:"maintMargin"`
	UpdateTime       int64  `json:"updateTime"`
}

type Futures_AggTrade

type Futures_AggTrade struct {
	AggTradeId   int64  `json:"a"`
	Price        string `json:"p"`
	Qty          string `json:"q"`
	FirstTradeId int64  `json:"f"`
	LastTradeId  int64  `json:"l"`
	Timestamp    int64  `json:"T"`
	IsBuyerMaker bool   `json:"m"`
}

type Futures_AggTrade_Params

type Futures_AggTrade_Params struct {
	// ID to get aggregate trades from INCLUSIVE.
	FromId int64
	// Timestamp in ms to get aggregate trades from INCLUSIVE.
	StartTime int64
	// Timestamp in ms to get aggregate trades until INCLUSIVE.
	EndTime int64
	// Default 500; max 1000.
	Limit int64
}

type Futures_Asset

type Futures_Asset struct {
	Asset string `json:"asset"`
	// whether the asset can be used as margin in Multi-Assets mode
	MarginAvailable bool `json:"marginAvailable"`
	// auto-exchange threshold in Multi-Assets margin mode
	AutoAssetExchange string `json:"autoAssetExchange"`
}

type Futures_BookTicker added in v0.0.11

type Futures_BookTicker struct {
	Symbol   string `json:"symbol"`
	BidPrice string `json:"bidPrice"`
	BidQty   string `json:"bidQty"`
	AskPrice string `json:"askPrice"`
	AskQty   string `json:"askQty"`
	Time     int64  `json:"time"`
}

type Futures_Candlestick

type Futures_Candlestick struct {
	// Kline open time
	OpenTime int64
	// Open price
	Open string
	// High price
	High string
	// Low price
	Low string
	// Close price
	Close string
	// Volume
	Volume string
	// Kline Close time
	CloseTime int64
	// Quote asset volume
	QuoteAssetVolume string
	// Number of trades
	TradeCount int64
	// Taker buy base asset volume
	TakerBuyBaseAssetVolume string
	// Taker buy quote asset volume
	TakerBuyQuoteAssetVolume string
	// Unused field, ignore.
	Unused string
}

type Futures_Candlesticks_Params

type Futures_Candlesticks_Params struct {
	StartTime int64
	EndTime   int64
	// Default 500; max 1500.
	Limit int64
}

type Futures_ChangeInitialLeverage_Response added in v0.0.17

type Futures_ChangeInitialLeverage_Response struct {
	Symbol           string `json:"symbol"`
	Leverage         int64  `json:"leverage"`
	MaxNotionalValue string `json:"maxNotionalValue"`
}

type Futures_ChangeMarginType_Response added in v0.0.17

type Futures_ChangeMarginType_Response struct {
	// 200 for success
	Code int `json:"code"`
	// "success"
	Msg string `json:"msg"`
}

func (*Futures_ChangeMarginType_Response) IsAlreadyChanged added in v0.0.17

func (response *Futures_ChangeMarginType_Response) IsAlreadyChanged(err *Error) bool

type Futures_ChangeMultiAssetsMode_Response added in v0.0.17

type Futures_ChangeMultiAssetsMode_Response struct {
	// 200 for success
	Code int `json:"code"`
	// "success"
	Msg string `json:"msg"`
}

func (*Futures_ChangeMultiAssetsMode_Response) IsAlreadyChanged added in v0.0.17

func (*Futures_ChangeMultiAssetsMode_Response) IsAlreadyChanged(err *Error) bool

type Futures_ChangePositionMode_Response added in v0.0.17

type Futures_ChangePositionMode_Response struct {
	// 200 for success
	Code int `json:"code"`
	// "success"
	Msg string `json:"msg"`
}

func (*Futures_ChangePositionMode_Response) IsAlreadyChanged added in v0.0.17

func (*Futures_ChangePositionMode_Response) IsAlreadyChanged(err *Error) bool

type Futures_ChartIntervals_ENUM

type Futures_ChartIntervals_ENUM struct {
	MIN      string
	MINS_3   string
	MINS_5   string
	MINS_15  string
	MINS_30  string
	HOUR     string
	HOURS_2  string
	HOURS_4  string
	HOURS_6  string
	HOURS_8  string
	HOURS_12 string
	DAY      string
	DAYS_3   string
	WEEK     string
	MONTH    string
}

type Futures_ContractStatuses_ENUM

type Futures_ContractStatuses_ENUM struct {
	PENDING_TRADING string
	TRADING         string
	PRE_DELIVERING  string
	DELIVERING      string
	DELIVERED       string
	PRE_SETTLE      string
	SETTLING        string
	CLOSE           string
}

type Futures_ContractTypes_ENUM

type Futures_ContractTypes_ENUM struct {
	PERPETUAL            string
	CURRENT_MONTH        string
	NEXT_MONTH           string
	CURRENT_QUARTER      string
	NEXT_QUARTER         string
	PERPETUAL_DELIVERING string
}

type Futures_DeliveryPrice added in v0.0.11

type Futures_DeliveryPrice struct {
	DeliveryTime  int64 `json:"deliveryTime"`
	DeliveryPrice int64 `json:"deliveryPrice"`
}

type Futures_ExchangeInfo

type Futures_ExchangeInfo struct {
	// Not used by binance
	ExchangeFilters any                      `json:"exchangeFilters"`
	RateLimits      []*Futures_RateLimitType `json:"rateLimits"`
	ServerTime      int64                    `json:"serverTime"`
	Assets_arr      []*Futures_Asset         `json:"assets"`
	Symbols_arr     []*Futures_Symbol        `json:"symbols"`
	Timezone        string                   `json:"timezone"`

	Assets  map[string]*Futures_Asset
	Symbols map[string]*Futures_Symbol
}

type Futures_ExchangeInfo_SORS

type Futures_ExchangeInfo_SORS struct {
	BaseAsset string   `json:"baseAsset"`
	Symbols   []string `json:"symbols"`
}

type Futures_FundingRate added in v0.0.11

type Futures_FundingRate struct {
	Symbol      string `json:"symbol"`
	FundingRate string `json:"fundingRate"`
	FundingTime int64  `json:"fundingTime"`
	MarkPrice   string `json:"markPrice"`
}

type Futures_FundingRate_Params added in v0.0.11

type Futures_FundingRate_Params struct {
	Symbol    string
	StartTime int64
	EndTime   int64
	Limit     int64
}

type Futures_HistoricalTrades_Params

type Futures_HistoricalTrades_Params struct {
	// Default 100, max 500.
	Limit int64
	// TradeId to fetch from. Default gets the most recent trades.
	FromId int64
}

type Futures_LeverageBrackets added in v0.0.17

type Futures_LeverageBrackets struct {
	Symbol string `json:"symbol"`

	// user symbol bracket multiplier, only appears when user's symbol bracket is adjusted
	NotionalCoef float64 `json:"notionalCoef"`

	Brackets []*Futures_LeverageBrackets_Bracket `json:"brackets"`
}

type Futures_LeverageBrackets_Bracket added in v0.0.17

type Futures_LeverageBrackets_Bracket struct {

	// Notional bracket
	Bracket int64 `json:"bracket"`

	// Max initial leverage for this bracket
	InitialLeverage int64 `json:"initialLeverage"`

	// Cap notional of this bracket
	NotionalCap int64 `json:"notionalCap"`

	// Notional threshold of this bracket
	NotionalFloor int64 `json:"notionalFloor"`

	// Maintenance ratio for this bracket
	MaintMarginRatio float64 `json:"maintMarginRatio"`

	// Auxiliary number for quick calculation
	Cum float64 `json:"cum"`
}

type Futures_LimitOrder_Params added in v0.0.10

type Futures_LimitOrder_Params struct {
	PositionSide            string
	ReduceOnly              bool
	NewClientOrderId        string
	WorkingType             string
	NewOrderRespType        string
	PriceMatch              string
	SelfTradePreventionMode string
	GoodTillDate            int64
	RecvWindow              int64
}

type Futures_MarkPrice

type Futures_MarkPrice struct {
	Symbol               string `json:"symbol"`
	MarkPrice            string `json:"markPrice"`
	IndexPrice           string `json:"indexPrice"`
	EstimatedSettlePrice string `json:"estimatedSettlePrice"`
	LastFundingRate      string `json:"lastFundingRate"`
	NextFundingTime      int64  `json:"nextFundingTime"`
	InterestRate         string `json:"interestRate"`
	Time                 int64  `json:"time"`
}

type Futures_MarketOrder_Params added in v0.0.10

type Futures_MarketOrder_Params struct {
	PositionSide            string
	ReduceOnly              bool
	NewClientOrderId        string
	WorkingType             string
	NewOrderRespType        string
	SelfTradePreventionMode string
	RecvWindow              int64
}

type Futures_NewOrderRespTypes_ENUM

type Futures_NewOrderRespTypes_ENUM struct {
	ACK    string
	RESULT string
}

type Futures_OpenInterest added in v0.0.11

type Futures_OpenInterest struct {
	Symbol       string `json:"symbol"`
	OpenInterest string `json:"openInterest"`
	Time         int64  `json:"time"`
}

type Futures_OpenInterestStatistics added in v0.0.11

type Futures_OpenInterestStatistics struct {
	Symbol               string `json:"symbol"`
	SumOpenInterest      string `json:"sumOpenInterest"`
	SumOpenInterestValue string `json:"sumOpenInterestValue"`
	Timestamp            string `json:"timestamp"`
}

type Futures_OpenInterestStatistics_Params added in v0.0.11

type Futures_OpenInterestStatistics_Params struct {
	Limit     int64
	StartTime int64
	EndTime   int64
}

type Futures_Order added in v0.0.10

type Futures_Order struct {
	ClientOrderId string `json:"clientOrderId"`

	CumQty string `json:"cumQty"`

	CumQuote string `json:"cumQuote"`

	ExecutedQty string `json:"executedQty"`

	OrderId int64 `json:"orderId"`

	AvgPrice string `json:"avgPrice"`

	OrigQty string `json:"origQty"`

	Price string `json:"price"`

	ReduceOnly bool `json:"reduceOnly"`

	Side string `json:"side"`

	PositionSide string `json:"positionSide"`

	Status string `json:"status"`

	// please ignore when order type is "TRAILING_STOP_MARKET"
	StopPrice string `json:"stopPrice"`

	// if Close-All
	ClosePosition bool `json:"closePosition"`

	Symbol string `json:"symbol"`

	TimeInForce string `json:"timeInForce"`

	Type string `json:"type"`

	OrigType string `json:"origType"`

	// activation price, only return with "TRAILING_STOP_MARKET" order
	ActivatePrice string `json:"activatePrice"`

	// callback rate, only return with "TRAILING_STOP_MARKET" order
	PriceRate string `json:"priceRate"`

	UpdateTime int64 `json:"updateTime"`

	WorkingType string `json:"workingType"`

	// if conditional order trigger is protected
	PriceProtect bool `json:"priceProtect"`

	// price match mode
	PriceMatch string `json:"priceMatch"`

	// self trading preventation mode
	SelfTradePreventionMode string `json:"selfTradePreventionMode"`

	// order pre-set auto cancel time for "TIF" "GTD" order
	GoodTillDate int64 `json:"goodTillDate"`
}

type Futures_OrderBook

type Futures_OrderBook struct {
	LastUpdateId int64       `json:"lastUpdateId"`
	Time         int64       `json:"E"`
	TransactTime int64       `json:"T"`
	Bids         [][2]string `json:"bids"`
	Asks         [][2]string `json:"asks"`
}

type Futures_OrderSides_ENUM

type Futures_OrderSides_ENUM struct {
	BUY  string
	SELL string
}

type Futures_OrderStatuses_ENUM

type Futures_OrderStatuses_ENUM struct {
	NEW              string
	PARTIALLY_FILLED string
	FILLED           string
	CANCELED         string
	REJECTED         string
	EXPIRED          string
	EXPIRED_IN_MATCH string
}

type Futures_OrderTypes_ENUM

type Futures_OrderTypes_ENUM struct {
	LIMIT                string
	MARKET               string
	STOP                 string
	STOP_MARKET          string
	TAKE_PROFIT          string
	TAKE_PROFIT_MARKET   string
	TRAILING_STOP_MARKET string
}

type Futures_Order_Params added in v0.0.10

type Futures_Order_Params struct {
	PositionSide            string `json:"positionSide"`
	TimeInForce             string `json:"timeInForce"`
	Quantity                string `json:"quantity"`
	ReduceOnly              bool   `json:"reduceOnly"`
	Price                   string `json:"price"`
	NewClientOrderId        string `json:"newClientOrderId"`
	StopPrice               string `json:"stopPrice"`
	ClosePosition           string `json:"closePosition"`
	ActivationPrice         string `json:"activationPrice"`
	CallbackRate            string `json:"callbackRate"`
	WorkingType             string `json:"workingType"`
	PriceProtect            string `json:"priceProtect"`
	NewOrderRespType        string `json:"newOrderRespType"`
	PriceMatch              string `json:"priceMatch"`
	SelfTradePreventionMode string `json:"selfTradePreventionMode"`
	GoodTillDate            int64  `json:"goodTillDate"`
	RecvWindow              int64  `json:"recvWindow"`
}

type Futures_PositionSides_ENUM

type Futures_PositionSides_ENUM struct {
	BOTH  string
	LONG  string
	SHORT string
}

type Futures_PriceCandlestick

type Futures_PriceCandlestick struct {
	// Kline open time
	OpenTime int64
	// Open price
	Open string
	// High price
	High string
	// Low price
	Low string
	// Close price
	Close string
	// Volume
	Ignore1 string
	// Kline Close time
	CloseTime int64
	// Quote asset volume
	Ignore2 string
	// Number of trades
	Ignore3 int64
	// Taker buy base asset volume
	Ignore4 string
	// Taker buy quote asset volume
	Ignore5 string
	// Unused field, ignore.
	Unused string
}

type Futures_PriceCandlesticks_Params

type Futures_PriceCandlesticks_Params struct {
	StartTime int64
	EndTime   int64
	// Default 500; max 1500.
	Limit int64
}

type Futures_PriceMatch_ENUM

type Futures_PriceMatch_ENUM struct {
	NONE        string
	OPPONENT    string
	OPPONENT_5  string
	OPPONENT_10 string
	OPPONENT_20 string
	QUEUE       string
	QUEUE_5     string
	QUEUE_10    string
	QUEUE_20    string
}

type Futures_PriceTicker added in v0.0.11

type Futures_PriceTicker struct {
	Symbol string `json:"symbol"`
	Price  string `json:"price"`
	Time   int64  `json:"time"`
}

type Futures_RateLimitIntervals_ENUM

type Futures_RateLimitIntervals_ENUM struct {
	SECOND string
	MINUTE string
	DAY    string
}

type Futures_RateLimitType

type Futures_RateLimitType struct {
	RateLimitType string `json:"rateLimitType"`
	Interval      string `json:"interval"`
	IntervalNum   int    `json:"intervalNum"`
	Limit         int    `json:"limit"`
}

type Futures_RateLimitTypes_ENUM

type Futures_RateLimitTypes_ENUM struct {
	REQUEST_WEIGHT string
	ORDERS         string
}

type Futures_STPModes_ENUM

type Futures_STPModes_ENUM struct {
	NONE         string
	EXPIRE_TAKER string
	EXPIRE_BOTH  string
	EXPIRE_MAKER string
}

type Futures_SecurityTypes_ENUM

type Futures_SecurityTypes_ENUM struct {
	NONE        string
	MARKET_DATA string
	USER_STREAM string
	TRADE       string
	USER_DATA   string
}

type Futures_Symbol

type Futures_Symbol struct {
	Symbol       string `json:"symbol"`
	Pair         string `json:"pair"`
	ContractType string `json:"contractType"`
	DeliveryDate int64  `json:"deliveryDate"`
	OnboardDate  int64  `json:"onboardDate"`
	Status       string `json:"status"`
	// ignore
	MaintMarginPercent string `json:"maintMarginPercent"`
	// ignore
	RequiredMarginPercent string   `json:"requiredMarginPercent"`
	BaseAsset             string   `json:"baseAsset"`
	QuoteAsset            string   `json:"quoteAsset"`
	PricePrecision        int64    `json:"pricePrecision"`
	QuantityPrecision     int64    `json:"quantityPrecision"`
	BaseAssetPrecision    int64    `json:"baseAssetPrecision"`
	QuoteAssetPrecision   int64    `json:"quoteAssetPrecision"`
	UnderlyingType        string   `json:"underlyingType"`
	UnderlyingSubType     []string `json:"underlyingSubType"`
	SettlePlan            int64    `json:"settlePlan"`
	TriggerProtect        string   `json:"triggerProtect"`
	Filters               Futures_SymbolFilters
	OrderType             []string `json:"orderType"`
	TimeInForce           []string `json:"timeInForce"`
	LiquidationFee        string   `json:"liquidationFee"`
	MarketTakeBound       string   `json:"marketTakeBound"`
}

func (*Futures_Symbol) LOT_SIZE added in v0.0.10

func (futuresSymbol *Futures_Symbol) LOT_SIZE(quantity float64) (isValid bool, reason string, suggestion float64, err *Error)

Checks if the quantity passes the "LOT_SIZE"

"reason" is returned on any failure, possible values are:

- "minQty" if the quantity < minQty. "suggestion" will be returned with the value "minQty".

- "maxQty" if the quantity > maxQty. "suggestion" will be returned with the value "maxQty".

- "stepSize" if the quantity % stepSize != 0. "suggestion" will be returned with the corrected value.

"suggestion" must be ignored if it is returned as 0. "suggestion" is always returned as "quantity" if it passes the filter.

func (*Futures_Symbol) LOT_SIZE_COMPACT added in v0.0.10

func (futuresSymbol *Futures_Symbol) LOT_SIZE_COMPACT(price float64) (isValid bool, err *Error)

Checks if the price passes the "LOT_SIZE"

func (*Futures_Symbol) MARKET_LOT_SIZE added in v0.0.10

func (futuresSymbol *Futures_Symbol) MARKET_LOT_SIZE(quantity float64) (isValid bool, reason string, suggestion float64, err *Error)

Checks if the quantity passes the "LOT_SIZE"

"reason" is returned on any failure, possible values are:

- "minQty" if the quantity < minQty. "suggestion" will be returned with the value "minQty".

- "maxQty" if the quantity > maxQty. "suggestion" will be returned with the value "maxQty".

- "stepSize" if the quantity % stepSize != 0. "suggestion" will be returned with the corrected value.

"suggestion" must be ignored if it is returned as 0. "suggestion" is always returned as "quantity" if it passes the filter.

func (*Futures_Symbol) MARKET_LOT_SIZE_COMPACT added in v0.0.10

func (futuresSymbol *Futures_Symbol) MARKET_LOT_SIZE_COMPACT(price float64) (isValid bool, err *Error)

Checks if the price passes the "MARKET_LOT_SIZE"

func (*Futures_Symbol) PRICE_FILTER added in v0.0.10

func (futuresSymbol *Futures_Symbol) PRICE_FILTER(price float64) (isValid bool, reason string, suggestion float64, err *Error)

Checks if the price passes the "PRICE_FILTER"

"reason" is returned on any failure, possible values are:

- "minPrice" if the price < minPrice. "suggestion" will be returned with the value "minPrice".

- "maxPrice" if the price > maxPrice. "suggestion" will be returned with the value "maxPrice".

- "tickSize" if the price % tickSize != 0. "suggestion" will be returned with the corrected value.

"suggestion" must be ignored if it is returned as 0. "suggestion" is always returned as "price" if it passes the filter.

func (*Futures_Symbol) PRICE_FILTER_COMPACT added in v0.0.10

func (futuresSymbol *Futures_Symbol) PRICE_FILTER_COMPACT(price float64) (isValid bool, err *Error)

Checks if the price passes the "PRICE_FILTER"

func (*Futures_Symbol) TruncPrice

func (futuresSymbol *Futures_Symbol) TruncPrice(priceStr string) string

Truncates a price string to the last significant digit

Symbol Filters rule "PRICE_FILTER" defines the highest precision the symbol accepts i.e: BTCUSDT has a precision of 2, meaning if you want to buy BTCUSDT at "123_456.7891", it would be truncated down to "123_456.78"

func (*Futures_Symbol) TruncPrice_float64

func (futuresSymbol *Futures_Symbol) TruncPrice_float64(price float64) string

Truncates a price string to the last significant digit

Symbol Filters rule "PRICE_FILTER" defines the highest precision the symbol accepts i.e: BTCUSDT has a precision of 2, meaning if you want to buy BTCUSDT at "123_456.7891", it would be truncated down to "123_456.78"

func (*Futures_Symbol) TruncQuantity added in v0.0.10

func (futuresSymbol *Futures_Symbol) TruncQuantity(quantity string, IsForMarketOrder bool) string

func (*Futures_Symbol) TruncQuantity_float64 added in v0.0.10

func (futuresSymbol *Futures_Symbol) TruncQuantity_float64(quantity float64, IsForMarketOrder bool) string

Truncates a price string to the last significant digit

Symbol Filters rule "LOT_SIZE" defines the highest precision the symbol's Quantity (via base asset) accepts And for MARKET orders the "MARKET_LOT_SIZE" also applies i.e: BTCUSDT has a precision of 5, meaning if you want to buy "0.12345678" BTC, it would be truncated down to "0.12345" BTC

func (*Futures_Symbol) UnmarshalJSON

func (symbol *Futures_Symbol) UnmarshalJSON(data []byte) error

type Futures_SymbolFilter_LOT_SIZE

type Futures_SymbolFilter_LOT_SIZE struct {
	FilterType string `json:"filterType"`
	MinQty     string `json:"minQty"`
	MaxQty     string `json:"maxQty"`
	StepSize   string `json:"stepSize"`
}

type Futures_SymbolFilter_MARKET_LOT_SIZE

type Futures_SymbolFilter_MARKET_LOT_SIZE struct {
	FilterType string `json:"filterType"`
	MinQty     string `json:"minQty"`
	MaxQty     string `json:"maxQty"`
	StepSize   string `json:"stepSize"`
}

type Futures_SymbolFilter_MAX_NUM_ALGO_ORDERS

type Futures_SymbolFilter_MAX_NUM_ALGO_ORDERS struct {
	FilterType string `json:"filterType"`
	Limit      int64  `json:"limit"`
}

type Futures_SymbolFilter_MAX_NUM_ORDERS

type Futures_SymbolFilter_MAX_NUM_ORDERS struct {
	FilterType string `json:"filterType"`
	Limit      int64  `json:"limit"`
}

type Futures_SymbolFilter_MIN_NOTIONAL

type Futures_SymbolFilter_MIN_NOTIONAL struct {
	FilterType string `json:"filterType"`
	Notional   string `json:"notional"`
}

type Futures_SymbolFilter_PERCENT_PRICE

type Futures_SymbolFilter_PERCENT_PRICE struct {
	FilterType        string `json:"filterType"`
	MultiplierUp      string `json:"multiplierUp"`
	MultiplierDown    string `json:"multiplierDown"`
	MultiplierDecimal string `json:"multiplierDecimal"`
}

type Futures_SymbolFilter_PRICE_FILTER

type Futures_SymbolFilter_PRICE_FILTER struct {
	FilterType string `json:"filterType"`
	MinPrice   string `json:"minPrice"`
	MaxPrice   string `json:"maxPrice"`
	TickSize   string `json:"tickSize"`
}

type Futures_SymbolTypes_ENUM

type Futures_SymbolTypes_ENUM struct {
	FUTURE string
}

type Futures_Time

type Futures_Time struct {
	ServerTime int64 `json:"serverTime"`

	Latency int64
}

type Futures_TimeInForce_ENUM

type Futures_TimeInForce_ENUM struct {
	GTC string
	IOC string
	FOK string
}

type Futures_Trade

type Futures_Trade struct {
	Id           int64  `json:"id"`
	Price        string `json:"price"`
	Qty          string `json:"qty"`
	QuoteQty     string `json:"quoteQty"`
	Timestamp    int64  `json:"time"`
	IsBuyerMaker bool   `json:"isBuyerMaker"`
}

type Futures_UserCommissionRate added in v0.0.17

type Futures_UserCommissionRate struct {
	Symbol              string `json:"symbol"`
	MakerCommissionRate string `json:"makerCommissionRate"`
	TakerCommissionRate string `json:"takerCommissionRate"`
}

type Futures_Websocket

type Futures_Websocket struct {
	Websocket *Websocket
	Conn      *ws.Conn
	// Host server's URL
	BaseURL string
	// contains filtered or unexported fields
}

func (*Futures_Websocket) Close

func (futures_ws *Futures_Websocket) Close() error

func (*Futures_Websocket) ListSubscriptions

func (futures_ws *Futures_Websocket) ListSubscriptions(timeout_sec ...int) (resp *FuturesWS_ListSubscriptions_Response, hasTimedOut bool, err *Error)

func (*Futures_Websocket) Reconnect

func (futures_ws *Futures_Websocket) Reconnect()

Forcefully reconnects the socket Also makes it a reconnecting socket if it weren't before Useless, but there nonetheless...

func (*Futures_Websocket) SetCloseListener

func (futures_ws *Futures_Websocket) SetCloseListener(f func(code int, text string))

This is called when the websocket closes indefinitely Meaning when you invoke the 'Close()' method Or any other way a websocket is set to never reconnect on a disconnection

func (*Futures_Websocket) SetDisconnectListener

func (futures_ws *Futures_Websocket) SetDisconnectListener(f func(code int, text string))

This is called when socket has been disconnected Called when the detected a disconnection and wants to reconnect afterwards Usually called right before the 'ReconnectingListener'

func (*Futures_Websocket) SetMessageListener

func (futures_ws *Futures_Websocket) SetMessageListener(f func(messageType int, msg []byte))

func (*Futures_Websocket) SetPingListener

func (futures_ws *Futures_Websocket) SetPingListener(f func(appData string))

func (*Futures_Websocket) SetPongListener

func (futures_ws *Futures_Websocket) SetPongListener(f func(appData string))

func (*Futures_Websocket) SetReconnectListener

func (futures_ws *Futures_Websocket) SetReconnectListener(f func())

This is called when the socket has successfully reconnected after a disconnection

func (*Futures_Websocket) SetReconnectingListener

func (futures_ws *Futures_Websocket) SetReconnectingListener(f func())

This is called when socket began reconnecting

func (*Futures_Websocket) Subscribe

func (futures_ws *Futures_Websocket) Subscribe(stream ...string) (resp *FuturesWS_Subscribe_Response, hasTimedOut bool, err *Error)

func (*Futures_Websocket) Unsubscribe

func (futures_ws *Futures_Websocket) Unsubscribe(stream ...string) (resp *FuturesWS_Unsubscribe_Response, hasTimedOut bool, err *Error)

type Futures_Websocket_Constants

type Futures_Websocket_Constants struct {
	URLs []string
}

type Futures_Websockets

type Futures_Websockets struct {
	// contains filtered or unexported fields
}

func (*Futures_Websockets) AggTrade

func (futures_ws *Futures_Websockets) AggTrade(publicOnMessage func(aggTrade *FuturesWS_AggTrade), symbol ...string) (*FuturesWS_AggTrade_Socket, *Error)

func (*Futures_Websockets) AllBookTickers

func (futures_ws *Futures_Websockets) AllBookTickers(publicOnMessage func(bookTickers []*FuturesWS_BookTicker)) (*FuturesWS_AllBookTickers_Socket, *Error)

func (*Futures_Websockets) AllMarkPrices

func (futures_ws *Futures_Websockets) AllMarkPrices(publicOnMessage func(markPrices []*FuturesWS_MarkPrice), isFast ...bool) (*FuturesWS_AllMarkPrices_Socket, *Error)

func (*Futures_Websockets) BookTicker

func (futures_ws *Futures_Websockets) BookTicker(publicOnMessage func(bookTicker *FuturesWS_BookTicker), symbol ...string) (*FuturesWS_BookTicker_Socket, *Error)

func (*Futures_Websockets) ContractInfo

func (futures_ws *Futures_Websockets) ContractInfo(publicOnMessage func(contractInfo *FuturesWS_ContractInfo)) (*FuturesWS_ContractInfo_Socket, *Error)

func (*Futures_Websockets) CreateSocket

func (*Futures_Websockets) CreateSocket(streams []string, isCombined bool) (*Futures_Websocket, *Error)

func (*Futures_Websockets) MarkPrice

func (futures_ws *Futures_Websockets) MarkPrice(publicOnMessage func(markPrice *FuturesWS_MarkPrice), params ...FuturesWS_MarkPrice_Params) (*FuturesWS_MarkPrice_Socket, *Error)

type Futures_WorkingTypes_ENUM

type Futures_WorkingTypes_ENUM struct {
	MARK_PRICE     string
	CONTRACT_PRICE string
}

type Methods

type Methods struct {
	GET    string
	POST   string
	PUT    string
	PATCH  string
	DELETE string
}

type RequestClient

type RequestClient struct {
	// contains filtered or unexported fields
}

func (*RequestClient) APIKEY_only

func (requestClient *RequestClient) APIKEY_only(method string, baseURL string, URL string, params map[string]interface{}) (*Response, *Error)

func (*RequestClient) Set_APIKEY

func (requestClient *RequestClient) Set_APIKEY(APIKEY string, APISECRET string)

func (*RequestClient) Signed

func (requestClient *RequestClient) Signed(method string, baseURL string, URL string, params map[string]interface{}) (*Response, *Error)

func (*RequestClient) Unsigned

func (requestClient *RequestClient) Unsigned(method string, baseURL string, URL string, params map[string]interface{}) (*Response, *Error)

type Response

type Response struct {
	Status     string // e.g. "200 OK"
	StatusCode int    // e.g. 200
	Proto      string // e.g. "HTTP/1.0"
	ProtoMajor int    // e.g. 1
	ProtoMinor int    // e.g. 0

	// Header maps header keys to values. If the response had multiple
	// headers with the same key, they may be concatenated, with comma
	// delimiters.  (RFC 7230, section 3.2.2 requires that multiple headers
	// be semantically equivalent to a comma-delimited sequence.) When
	// Header values are duplicated by other fields in this struct (e.g.,
	// ContentLength, TransferEncoding, Trailer), the field values are
	// authoritative.
	//
	// Keys in the map are canonicalized (see CanonicalHeaderKey).
	Header http.Header

	Body []byte

	// ContentLength records the length of the associated content. The
	// value -1 indicates that the length is unknown. Unless Request.Method
	// is "HEAD", values >= 0 indicate that the given number of bytes may
	// be read from Body.
	ContentLength int64

	// Contains transfer encodings from outer-most to inner-most. Value is
	// nil, means that "identity" encoding is used.
	TransferEncoding []string

	// Close records whether the header directed that the connection be
	// closed after reading Body. The value is advice for clients: neither
	// ReadResponse nor Response.Write ever closes a connection.
	Close bool

	// Uncompressed reports whether the response was sent compressed but
	// was decompressed by the http package. When true, reading from
	// Body yields the uncompressed content instead of the compressed
	// content actually set from the server, ContentLength is set to -1,
	// and the "Content-Length" and "Content-Encoding" fields are deleted
	// from the responseHeader. To get the original response from
	// the server, set Transport.DisableCompression to true.
	Uncompressed bool

	// Trailer maps trailer keys to values in the same
	// format as Header.
	//
	// The Trailer initially contains only nil values, one for
	// each key specified in the server's "Trailer" header
	// value. Those values are not added to Header.
	//
	// Trailer must not be accessed concurrently with Read calls
	// on the Body.
	//
	// After Body.Read has returned io.EOF, Trailer will contain
	// any trailer values sent by the server.
	Trailer http.Header

	// Request is the request that was sent to obtain this Response.
	// Request's Body is nil (having already been consumed).
	// This is only populated for Client requests.
	Request *http.Request

	// TLS contains information about the TLS connection on which the
	// response was received. It is nil for unencrypted responses.
	// The pointer is shared between responses and should not be
	// modified.
	TLS *tls.ConnectionState
}

func (*Response) GetRequestTime

func (resp *Response) GetRequestTime() (time.Time, *Error)

func (*Response) GetUsedWeight

func (resp *Response) GetUsedWeight(interval string) (int64, *Error)

Fetches the current used weight returned the request.

interval: "1m", "3m", "1d", "1W", "1M", or simply ""

But most common and only one used as of writing this is "1m"

Returns an error if the header is not found

type SPOT_Symbol_FilterTypes_ENUM

type SPOT_Symbol_FilterTypes_ENUM struct {
	PRICE_FILTER           string
	PERCENT_PRICE          string
	PERCENT_PRICE_BY_SIDE  string
	LOT_SIZE               string
	MIN_NOTIONAL           string
	NOTIONAL               string
	ICEBERG_PARTS          string
	MARKET_LOT_SIZE        string
	MAX_NUM_ORDERS         string
	MAX_NUM_ALGO_ORDERS    string
	MAX_NUM_ICEBERG_ORDERS string
	MAX_POSITION           string
	TRAILING_DELTA         string
}

type Spot

type Spot struct {
	API APIKEYS

	Websockets Spot_Websockets
	// contains filtered or unexported fields
}

func (*Spot) AccountInfo

func (spot *Spot) AccountInfo(opt_params ...Spot_AccountInfo_Params) (*Spot_AccountInfo, *Response, *Error)

func (*Spot) AggTrades

func (spot *Spot) AggTrades(symbol string, opt_params ...*Spot_AggTrades_Params) ([]*Spot_AggTrade, *Response, *Error)

#Compressed/Aggregate trades list

Get compressed, aggregate trades. Trades that fill at the time, from the same taker order, with the same price will have the quantity aggregated.

Weight: 2

Parameters:

type Spot_AggTrades_Params struct {
	// Default 500; max 1000.
	Limit int64
	// ID to get aggregate trades from INCLUSIVE.
	FromId int64
	// Timestamp in ms to get aggregate trades from INCLUSIVE.
	StartTime int64
	// Timestamp in ms to get aggregate trades until INCLUSIVE.
	EndTime int64
}

func (*Spot) AveragePrice

func (spot *Spot) AveragePrice(symbol string) (*Spot_AveragePrice, *Response, *Error)

func (*Spot) BookTicker

func (spot *Spot) BookTicker(symbol ...string) ([]*Spot_BookTicker, *Response, *Error)

func (*Spot) Candlesticks

func (spot *Spot) Candlesticks(symbol string, interval string, opt_params ...*Spot_Candlesticks_Params) ([]*Spot_Candlestick, *Response, *Error)

Kline/Candlestick data

Kline/candlestick bars for a symbol. Klines are uniquely identified by their open time.

Weight: 2

Parameters:

type Spot_Candlesticks_Params struct {
	// Default: 0 (UTC)
	TimeZone  string
	StartTime int64
	EndTime   int64
	// Default 500; max 1000.
	// # Interval	interval value
	//
	// seconds:	"1s"
	//
	// minutes:	"1m", "3m", "5m", "15m", "30m"
	//
	// hours:	"1h", "2h", "4h", "6h", "8h", "12h"
	//
	// days:	"1d", "3d"
	//
	// weeks:	"1w"
	//
	// months:	"1M"
	Limit int64
}

Supported kline intervals (case-sensitive):

Interval interval value

seconds: "1s"

minutes: "1m", "3m", "5m", "15m", "30m"

hours: "1h", "2h", "4h", "6h", "8h", "12h"

days: "1d", "3d"

weeks: "1w"

months: "1M"

func (*Spot) ExchangeInfo

func (spot *Spot) ExchangeInfo() (*Spot_ExchangeInfo, *Response, *Error)

Exchange information

Current exchange trading rules and symbol information

Weight: 20

func (*Spot) ExchangeInfo_Params

func (spot *Spot) ExchangeInfo_Params(params *Spot_ExchangeInfo_Params) (*Spot_ExchangeInfo, *Response, *Error)

Exchange information

Current exchange trading rules and symbol information with optional parameters

Weight: 20

usage:

data, _, err := binance.Spot.ExchangeInfo_Params(&Spot_ExchangeInfo_Params{SymbolStatus: "TRADING", Permissions: []string{"SPOT"}})

Parameters:

type Spot_ExchangeInfo_Params struct {
	Symbol       string
	Symbols      []string
	Permissions  []string
	SymbolStatus string
	// The logic is flipped with "Dont Show" here
	// Because bools are always initialize as "false" while the exchange default is "true"
	DontShowPermissionSets bool
}

func (*Spot) LimitBuy

func (spot *Spot) LimitBuy(symbol string, price string, quantity string, opt_params ...Spot_LimitOrder_Params) (*Spot_Order, *Response, *Error)

func (*Spot) LimitMakerBuy

func (spot *Spot) LimitMakerBuy(symbol string, quantity string, price string, opt_params ...Spot_LimitMakerOrder_Params) (*Spot_Order, *Response, *Error)

func (*Spot) LimitMakerOrder

func (spot *Spot) LimitMakerOrder(symbol string, side string, quantity string, price string, opt_params ...Spot_LimitMakerOrder_Params) (*Spot_Order, *Response, *Error)

func (*Spot) LimitMakerSell

func (spot *Spot) LimitMakerSell(symbol string, side string, quantity string, price string, opt_params ...Spot_LimitMakerOrder_Params) (*Spot_Order, *Response, *Error)

func (*Spot) LimitOrder

func (spot *Spot) LimitOrder(symbol string, side string, price string, quantity string, opt_params ...Spot_LimitOrder_Params) (*Spot_Order, *Response, *Error)

func (*Spot) LimitSell

func (spot *Spot) LimitSell(symbol string, price string, quantity string, opt_params ...Spot_LimitOrder_Params) (*Spot_Order, *Response, *Error)

func (*Spot) MarketBuy

func (spot *Spot) MarketBuy(symbol string, side string, orderValue string, is_OrderValue_in_BaseAsset bool, opt_params ...Spot_MarketOrder_Params) (*Spot_Order, *Response, *Error)

func (*Spot) MarketOrder

func (spot *Spot) MarketOrder(symbol string, side string, orderValue string, is_OrderValue_in_BaseAsset bool, opt_params ...Spot_MarketOrder_Params) (*Spot_Order, *Response, *Error)

func (*Spot) MarketSell

func (spot *Spot) MarketSell(symbol string, side string, orderValue string, is_OrderValue_in_BaseAsset bool, opt_params ...Spot_MarketOrder_Params) (*Spot_Order, *Response, *Error)

func (*Spot) MiniTicker

func (spot *Spot) MiniTicker(opt_params *Spot_Ticker_Params) ([]*Spot_MiniTicker, *Response, *Error)

func (*Spot) MiniTicker_RollingWindow

func (spot *Spot) MiniTicker_RollingWindow(opt_params *Spot_Ticker_RollingWindow_Params) ([]*Spot_MiniTicker_RollingWindow, *Response, *Error)

func (*Spot) MiniTicker_RollingWindow24h

func (spot *Spot) MiniTicker_RollingWindow24h(symbol ...string) ([]*Spot_MiniTicker_RollingWindow24h, *Response, *Error)

func (*Spot) NewOrder

func (spot *Spot) NewOrder(symbol string, side string, Type string, opt_params ...Spot_Order_Params) (*Spot_Order, *Response, *Error)

func (*Spot) OldTrades

func (spot *Spot) OldTrades(symbol string, opt_params ...*Spot_OldTrades_Params) ([]*Spot_Trade, *Response, *Error)

Old trade lookup

Get older trades.

Weight: 25

Parameters:

type Spot_OldTrades_Params struct {
	// Default 500; max 1000.
	Limit int64
	// TradeId to fetch from. Default gets most recent trades.
	FromId int64
}

func (*Spot) OrderBook

func (spot *Spot) OrderBook(symbol string, limit ...int64) (*Spot_OrderBook, *Response, *Error)

Order Book

Weight adjusted based on the limit:

| ------------------------------ |

| Limit Request Weight |

| ------------------------------ |

| 1-100 => 5

| 101-500 => 25

| 501-1000 => 50

| 1001-5000 => 250

func (*Spot) Ping

func (spot *Spot) Ping() (latency int64, request *Response, err *Error)

Test connectivity to the Rest API.

Weight: 1

Data Source: Memory

func (*Spot) PriceTicker

func (spot *Spot) PriceTicker(symbol ...string) ([]*Spot_PriceTicker, *Response, *Error)

func (*Spot) QueryOrder

func (spot *Spot) QueryOrder(symbol string, orderId int64, opt_params ...Spot_QueryOrder_Params) (*Spot_Order, *Response, *Error)

func (*Spot) RecentTrades

func (spot *Spot) RecentTrades(symbol string, limit ...int64) ([]*Spot_Trade, *Response, *Error)

Recent trades list

Get recent trades.

Weight: 25

limit's default is 500, nax is 1000

func (*Spot) ServerTime

func (spot *Spot) ServerTime() (*Spot_Time, *Response, *Error)

Check server time

Test connectivity to the Rest API and get the current server time.

Weight: 1

Data Source: Memory

func (*Spot) Ticker

func (spot *Spot) Ticker(opt_params *Spot_Ticker_Params) ([]*Spot_Ticker, *Response, *Error)

func (*Spot) Ticker_RollingWindow

func (spot *Spot) Ticker_RollingWindow(opt_params *Spot_Ticker_RollingWindow_Params) ([]*Spot_Ticker_RollingWindow, *Response, *Error)

func (*Spot) Ticker_RollingWindow24h

func (spot *Spot) Ticker_RollingWindow24h(symbol ...string) ([]*Spot_Ticker_RollingWindow24h, *Response, *Error)

func (*Spot) UIKlines

func (spot *Spot) UIKlines(symbol string, interval string, opt_params ...*Spot_Candlesticks_Params) ([]*Spot_Candlestick, *Response, *Error)

type SpotRequest

type SpotRequest struct {
	// contains filtered or unexported fields
}

type SpotWS_AggTrade

type SpotWS_AggTrade struct {
	Event     string `json:"e"`
	EventTime int64  `json:"E"`
	Symbol    string `json:"s"`
	// Trade ID
	AggTradeId int64  `json:"a"`
	Price      string `json:"p"`
	Quantity   string `json:"q"`
	// First Trade ID
	FirstTradeId int64 `json:"f"`
	// Last Trade ID
	LastTradeId int64 `json:"l"`
	// Trade time
	Timestamp int64 `json:"T"`
	// Is the buyer the market maker?
	IsMaker bool `json:"m"`
	// Ignore
	Ignore bool `json:"M"`
}

type SpotWS_AggTrade_Socket

type SpotWS_AggTrade_Socket struct {
	Handler *Spot_Websocket
}

func (*SpotWS_AggTrade_Socket) CreateStreamName

func (*SpotWS_AggTrade_Socket) CreateStreamName(symbol string) string

func (*SpotWS_AggTrade_Socket) Subscribe

func (socket *SpotWS_AggTrade_Socket) Subscribe(symbol ...string) (resp *SpotWS_Subscribe_Response, hasTimedOut bool, err *Error)

func (*SpotWS_AggTrade_Socket) Unsubscribe

func (socket *SpotWS_AggTrade_Socket) Unsubscribe(symbol ...string) (resp *SpotWS_Unsubscribe_Response, hasTimedOut bool, err *Error)

type SpotWS_AllMiniTickers_Socket

type SpotWS_AllMiniTickers_Socket struct {
	Handler *Spot_Websocket
}

func (*SpotWS_AllMiniTickers_Socket) CreateStreamName

func (*SpotWS_AllMiniTickers_Socket) CreateStreamName() string

func (*SpotWS_AllMiniTickers_Socket) Subscribe

func (socket *SpotWS_AllMiniTickers_Socket) Subscribe() (resp *SpotWS_Subscribe_Response, hasTimedOut bool, err *Error)

func (*SpotWS_AllMiniTickers_Socket) Unsubscribe

func (socket *SpotWS_AllMiniTickers_Socket) Unsubscribe() (resp *SpotWS_Unsubscribe_Response, hasTimedOut bool, err *Error)

type SpotWS_AllRollingWindowStatistics_Socket

type SpotWS_AllRollingWindowStatistics_Socket struct {
	Handler *Spot_Websocket
}

func (*SpotWS_AllRollingWindowStatistics_Socket) CreateStreamName

func (*SpotWS_AllRollingWindowStatistics_Socket) CreateStreamName(WindowSize string) string

func (*SpotWS_AllRollingWindowStatistics_Socket) Subscribe

func (socket *SpotWS_AllRollingWindowStatistics_Socket) Subscribe(WindowSize ...string) (resp *SpotWS_Subscribe_Response, hasTimedOut bool, err *Error)

func (*SpotWS_AllRollingWindowStatistics_Socket) Unsubscribe

func (socket *SpotWS_AllRollingWindowStatistics_Socket) Unsubscribe(WindowSize ...string) (resp *SpotWS_Unsubscribe_Response, hasTimedOut bool, err *Error)

type SpotWS_AllTickers_Socket

type SpotWS_AllTickers_Socket struct {
	Handler *Spot_Websocket
}

func (*SpotWS_AllTickers_Socket) CreateStreamName

func (*SpotWS_AllTickers_Socket) CreateStreamName() string

func (*SpotWS_AllTickers_Socket) Subscribe

func (socket *SpotWS_AllTickers_Socket) Subscribe() (resp *SpotWS_Subscribe_Response, hasTimedOut bool, err *Error)

func (*SpotWS_AllTickers_Socket) Unsubscribe

func (socket *SpotWS_AllTickers_Socket) Unsubscribe() (resp *SpotWS_Unsubscribe_Response, hasTimedOut bool, err *Error)

type SpotWS_AveragePrice

type SpotWS_AveragePrice struct {

	// Event type
	Event string `json:"e"`

	// Event time
	EventTime int64 `json:"E"`

	// Symbol
	Symbol string `json:"s"`

	// Average price interval
	Interval string `json:"i"`

	// Average price
	AveragePrice string `json:"w"`

	// Last trade time
	Timestamp int64 `json:"T"`
}

type SpotWS_AveragePrice_Socket

type SpotWS_AveragePrice_Socket struct {
	Handler *Spot_Websocket
}

func (*SpotWS_AveragePrice_Socket) CreateStreamName

func (*SpotWS_AveragePrice_Socket) CreateStreamName(symbol string) string

func (*SpotWS_AveragePrice_Socket) Subscribe

func (socket *SpotWS_AveragePrice_Socket) Subscribe(symbol ...string) (resp *SpotWS_Subscribe_Response, hasTimedOut bool, err *Error)

func (*SpotWS_AveragePrice_Socket) Unsubscribe

func (socket *SpotWS_AveragePrice_Socket) Unsubscribe(symbol ...string) (resp *SpotWS_Unsubscribe_Response, hasTimedOut bool, err *Error)

type SpotWS_BookTicker

type SpotWS_BookTicker struct {

	// order book updateId
	UpdateId int64 `json:"u"`

	// symbol
	Symbol string `json:"s"`

	// best bid price
	Bid string `json:"b"`

	// best bid qty
	BidQty string `json:"B"`

	// best ask price
	Ask string `json:"a"`

	// best ask qty
	AskQty string `json:"A"`
}

type SpotWS_BookTicker_Socket

type SpotWS_BookTicker_Socket struct {
	Handler *Spot_Websocket
}

func (*SpotWS_BookTicker_Socket) CreateStreamName

func (*SpotWS_BookTicker_Socket) CreateStreamName(symbol string) string

func (*SpotWS_BookTicker_Socket) Subscribe

func (socket *SpotWS_BookTicker_Socket) Subscribe(symbol ...string) (resp *SpotWS_Subscribe_Response, hasTimedOut bool, err *Error)

func (*SpotWS_BookTicker_Socket) Unsubscribe

func (socket *SpotWS_BookTicker_Socket) Unsubscribe(symbol ...string) (resp *SpotWS_Unsubscribe_Response, hasTimedOut bool, err *Error)

type SpotWS_Candlestick

type SpotWS_Candlestick struct {

	// Kline start time
	OpenTime int64 `json:"t"`

	// Kline close time
	CloseTime int64 `json:"T"`

	// Symbol
	Symbol string `json:"s"`

	// Interval
	Interval string `json:"i"`

	// First trade ID
	FirstTradeId int64 `json:"f"`

	// Last trade ID
	LastTradeId int64 `json:"L"`

	// Open price
	Open string `json:"o"`

	// Close price
	Close string `json:"c"`

	// High price
	High string `json:"h"`

	// Low price
	Low string `json:"l"`

	// Base asset volume
	BaseAssetVolume string `json:"v"`

	// Number of trades
	TradeCount int64 `json:"n"`

	// Is this kline closed?
	IsClosed bool `json:"x"`

	// Quote asset volume
	QuoteAssetVolume string `json:"q"`

	// Taker buy base asset volume
	TakerBuyBaseAssetVolume string `json:"V"`

	// Taker buy quote asset volume
	TakerBuyQuoteAssetVolume string `json:"Q"`

	// Ignore
	Ignore string `json:"B"`
}

type SpotWS_Candlestick_MSG

type SpotWS_Candlestick_MSG struct {

	// Event type
	Event string `json:"e"`

	// Event time
	EventTime int64 `json:"E"`

	// Symbol
	Symbol string `json:"s"`

	Candle *SpotWS_Candlestick `json:"k"`
}

type SpotWS_Candlestick_Socket

type SpotWS_Candlestick_Socket struct {
	Handler *Spot_Websocket
}

func (*SpotWS_Candlestick_Socket) CreateStreamName

func (*SpotWS_Candlestick_Socket) CreateStreamName(symbol string, interval string) string

func (*SpotWS_Candlestick_Socket) Subscribe

func (socket *SpotWS_Candlestick_Socket) Subscribe(identifiers ...SpotWS_Candlestick_StreamIdentifier) (resp *SpotWS_Subscribe_Response, hasTimedOut bool, err *Error)

func (*SpotWS_Candlestick_Socket) Unsubscribe

func (socket *SpotWS_Candlestick_Socket) Unsubscribe(identifiers ...SpotWS_Candlestick_StreamIdentifier) (resp *SpotWS_Unsubscribe_Response, hasTimedOut bool, err *Error)

type SpotWS_Candlestick_StreamIdentifier

type SpotWS_Candlestick_StreamIdentifier struct {
	Symbol   string
	Interval string
}

type SpotWS_Candlestick_TimezoneOffset_Socket

type SpotWS_Candlestick_TimezoneOffset_Socket struct {
	Handler *Spot_Websocket
}

func (*SpotWS_Candlestick_TimezoneOffset_Socket) CreateStreamName

func (*SpotWS_Candlestick_TimezoneOffset_Socket) CreateStreamName(symbol string, interval string) string

func (*SpotWS_Candlestick_TimezoneOffset_Socket) Subscribe

func (socket *SpotWS_Candlestick_TimezoneOffset_Socket) Subscribe(identifiers ...SpotWS_Candlestick_StreamIdentifier) (resp *SpotWS_Subscribe_Response, hasTimedOut bool, err *Error)

func (*SpotWS_Candlestick_TimezoneOffset_Socket) Unsubscribe

func (socket *SpotWS_Candlestick_TimezoneOffset_Socket) Unsubscribe(identifiers ...SpotWS_Candlestick_StreamIdentifier) (resp *SpotWS_Unsubscribe_Response, hasTimedOut bool, err *Error)

type SpotWS_DiffBookDepth

type SpotWS_DiffBookDepth struct {

	// Event type
	Event string `json:"e"`

	// Event time
	EventTime int64 `json:"E"`

	// Symbol
	Symbol string `json:"s"`

	// First update ID in event
	FirstUpdateId int64 `json:"U"`

	// Final update ID in event
	FinalUpdateId int64 `json:"u"`

	// Bids to be updated
	Bids [][2]string `json:"b"`

	// Asks to be updated
	Asks [][2]string `json:"a"`
}
{
	"Event": "depthUpdate", // Event type
	"EventTime": 1672515782136, // Event time
	"Symbol": "BNBBTC",      // Symbol
	"FirstUpdateId": 157,           // First update ID in event
	"FinalUpdateId": 160,           // Final update ID in event
	"Bids": [
	  [
		"0.0024",       // Price level to be updated
		"10"            // Quantity
	  ]
	],
	"Asks": [
	  [
		"0.0026",       // Price level to be updated
		"100"           // Quantity
	  ]
	]
  }

type SpotWS_DiffBookDepth_Socket

type SpotWS_DiffBookDepth_Socket struct {
	Handler *Spot_Websocket
}

func (*SpotWS_DiffBookDepth_Socket) CreateStreamName

func (*SpotWS_DiffBookDepth_Socket) CreateStreamName(symbol string, isFast bool) string

func (*SpotWS_DiffBookDepth_Socket) Subscribe

func (socket *SpotWS_DiffBookDepth_Socket) Subscribe(identifiers ...SpotWS_DiffBookDepth_StreamIdentifier) (resp *SpotWS_Subscribe_Response, hasTimedOut bool, err *Error)

func (*SpotWS_DiffBookDepth_Socket) Unsubscribe

func (socket *SpotWS_DiffBookDepth_Socket) Unsubscribe(identifiers ...SpotWS_DiffBookDepth_StreamIdentifier) (resp *SpotWS_Unsubscribe_Response, hasTimedOut bool, err *Error)

type SpotWS_DiffBookDepth_StreamIdentifier

type SpotWS_DiffBookDepth_StreamIdentifier struct {
	Symbol string

	// # Stream Push Interval
	//
	// false -> 1000ms updates
	//
	// true  -> 100ms updates
	IsFast bool
}

type SpotWS_ListSubscriptions_Response

type SpotWS_ListSubscriptions_Response struct {
	Id     string   `json:"id"`
	Result []string `json:"result"`
}

type SpotWS_MiniTicker

type SpotWS_MiniTicker struct {

	// Event type
	Event string `json:"e"`

	// Event time
	EventTime int64 `json:"E"`

	// Symbol
	Symbol string `json:"s"`

	// Close price
	Close string `json:"c"`

	// Open price
	Open string `json:"o"`

	// High price
	High string `json:"h"`

	// Low price
	Low string `json:"l"`

	// Total traded base asset volume
	BaseAssetVolume string `json:"v"`

	// Total traded quote asset volume
	QuoteAssetVolume string `json:"q"`
}

type SpotWS_MiniTicker_Socket

type SpotWS_MiniTicker_Socket struct {
	Handler *Spot_Websocket
}

func (*SpotWS_MiniTicker_Socket) CreateStreamName

func (*SpotWS_MiniTicker_Socket) CreateStreamName(symbol string) string

func (*SpotWS_MiniTicker_Socket) Subscribe

func (socket *SpotWS_MiniTicker_Socket) Subscribe(symbol ...string) (resp *SpotWS_Subscribe_Response, hasTimedOut bool, err *Error)

func (*SpotWS_MiniTicker_Socket) Unsubscribe

func (socket *SpotWS_MiniTicker_Socket) Unsubscribe(symbol ...string) (resp *SpotWS_Unsubscribe_Response, hasTimedOut bool, err *Error)

type SpotWS_PartialBookDepth

type SpotWS_PartialBookDepth struct {

	// Last update ID
	LastUpdateId int64 `json:"lastUpdateId"`

	// Bids to be updated
	// [
	//   [
	// 	"0.0024",         // Price level to be updated
	// 	"10"              // Quantity
	//   ]
	// ],
	// ...
	Bids [][2]string `json:"bids"`

	// Asks to be updated
	// [
	//   [
	// 	"0.0026",    // Price level to be updated
	// 	"100"        // Quantity
	//   ],
	//   ...
	// ]
	Asks [][2]string `json:"asks"`
}
{
	"LastUpdateId": 160,  // Last update ID
	"Bids": [             // Bids to be updated
	  [
		"0.0024",         // Price level to be updated
		"10"              // Quantity
	  ]
	],
	"Asks": [             // Asks to be updated
	  [
		"0.0026",         // Price level to be updated
		"100"             // Quantity
	  ]
	]
}

type SpotWS_PartialBookDepth_Socket

type SpotWS_PartialBookDepth_Socket struct {
	Handler *Spot_Websocket
}

func (*SpotWS_PartialBookDepth_Socket) CreateStreamName

func (*SpotWS_PartialBookDepth_Socket) CreateStreamName(symbol string, levels int, isFast bool) string

func (*SpotWS_PartialBookDepth_Socket) Subscribe

func (socket *SpotWS_PartialBookDepth_Socket) Subscribe(identifiers ...SpotWS_PartialBookDepth_StreamIdentifier) (resp *SpotWS_Subscribe_Response, hasTimedOut bool, err *Error)

func (*SpotWS_PartialBookDepth_Socket) Unsubscribe

func (socket *SpotWS_PartialBookDepth_Socket) Unsubscribe(identifiers ...SpotWS_PartialBookDepth_StreamIdentifier) (resp *SpotWS_Unsubscribe_Response, hasTimedOut bool, err *Error)

type SpotWS_PartialBookDepth_StreamIdentifier

type SpotWS_PartialBookDepth_StreamIdentifier struct {
	Symbol string

	// Accepted values: 5, 10 or 20
	Levels int

	// # Stream Push Interval
	//
	// false -> 1000ms updates
	//
	// true  -> 100ms updates
	IsFast bool
}

type SpotWS_PrivateMessage

type SpotWS_PrivateMessage struct {
	Id string `json:"id"`
}

type SpotWS_RollingWindowStatistic

type SpotWS_RollingWindowStatistic struct {

	// Event type
	Event string `json:"e"`

	// Event time
	EventTime int64 `json:"E"`

	// Symbol
	Symbol string `json:"s"`

	// Price change
	PriceChange string `json:"p"`

	// Price change percent
	PriceChangePercent string `json:"P"`

	// Open price
	Open string `json:"o"`

	// High price
	High string `json:"h"`

	// Low price
	Low string `json:"l"`

	// Last price
	LastPrice string `json:"c"`

	// Weighted average price
	WeightedAveragePrice string `json:"w"`

	// Total traded base asset volume
	BaseAssetVolume string `json:"v"`

	// Total traded quote asset volume
	QuoteAssetVolume string `json:"q"`

	// Statistics open time
	OpenTime int64 `json:"O"`

	// Statistics close time
	CloseTime int64 `json:"C"`

	// First trade ID
	FirstTradeId int64 `json:"F"`

	// Last trade Id
	LastTradeId int64 `json:"L"`

	// Total number of trades
	TradeCount int64 `json:"n"`
}

type SpotWS_RollingWindowStatistics_Socket

type SpotWS_RollingWindowStatistics_Socket struct {
	Handler *Spot_Websocket
}

func (*SpotWS_RollingWindowStatistics_Socket) CreateStreamName

func (*SpotWS_RollingWindowStatistics_Socket) CreateStreamName(symbol string, windowSize string) string

func (*SpotWS_RollingWindowStatistics_Socket) Subscribe

func (*SpotWS_RollingWindowStatistics_Socket) Unsubscribe

type SpotWS_RollingWindowStatistics_StreamIdentifier

type SpotWS_RollingWindowStatistics_StreamIdentifier struct {
	Symbol     string
	WindowSize string
}

type SpotWS_Subscribe_Response

type SpotWS_Subscribe_Response struct {
	Id string `json:"id"`
}

type SpotWS_Ticker

type SpotWS_Ticker struct {

	// Event type
	Event string `json:"e"`

	// Event time
	EventTime int64 `json:"E"`

	// Symbol
	Symbol string `json:"s"`

	// Price change
	PriceChange string `json:"p"`

	// Price change percent
	PriceChangePercent string `json:"P"`

	// Weighted average price
	WeightedAveragePrice string `json:"w"`

	// First trade(F)-1 price (first trade before the 24hr rolling window)
	PreviousFirstTradePrice string `json:"x"`

	// Last price
	LastPrice string `json:"c"`

	// Last quantity
	LastQty string `json:"Q"`

	// Best bid price
	Bid string `json:"b"`

	// Best bid quantity
	BidQty string `json:"B"`

	// Best ask price
	Ask string `json:"a"`

	// Best ask quantity
	AskQty string `json:"A"`

	// Open price
	Open string `json:"o"`

	// High price
	High string `json:"h"`

	// Low price
	Low string `json:"l"`

	// Total traded base asset volume
	BaseAssetVolume string `json:"v"`

	// Total traded quote asset volume
	QuoteAssetVolume string `json:"q"`

	// Statistics open time
	OpenTime int64 `json:"O"`

	// Statistics close time
	CloseTime int64 `json:"C"`

	// First trade ID
	FirstTradeId int64 `json:"F"`

	// Last trade Id
	LastTradeId int64 `json:"L"`

	// Total number of trades
	TradeCount int64 `json:"n"`
}

type SpotWS_Ticker_Socket

type SpotWS_Ticker_Socket struct {
	Handler *Spot_Websocket
}

func (*SpotWS_Ticker_Socket) CreateStreamName

func (*SpotWS_Ticker_Socket) CreateStreamName(symbol string) string

func (*SpotWS_Ticker_Socket) Subscribe

func (socket *SpotWS_Ticker_Socket) Subscribe(symbol ...string) (resp *SpotWS_Subscribe_Response, hasTimedOut bool, err *Error)

func (*SpotWS_Ticker_Socket) Unsubscribe

func (socket *SpotWS_Ticker_Socket) Unsubscribe(symbol ...string) (resp *SpotWS_Unsubscribe_Response, hasTimedOut bool, err *Error)

type SpotWS_Trade

type SpotWS_Trade struct {
	Event     string `json:"e"`
	EventTime int64  `json:"E"`
	Symbol    string `json:"s"`
	// Trade ID
	TradeID  int64  `json:"t"`
	Price    string `json:"p"`
	Quantity string `json:"q"`
	// Trade time
	Timestamp int64 `json:"T"`
	// Is the buyer the market maker?
	IsMaker bool `json:"m"`
	// Ignore
	Ignore bool `json:"M"`
}

type SpotWS_Trade_Socket

type SpotWS_Trade_Socket struct {
	Handler *Spot_Websocket
}

func (*SpotWS_Trade_Socket) CreateStreamName

func (*SpotWS_Trade_Socket) CreateStreamName(symbol string) string

func (*SpotWS_Trade_Socket) Subscribe

func (socket *SpotWS_Trade_Socket) Subscribe(symbol ...string) (resp *SpotWS_Subscribe_Response, hasTimedOut bool, err *Error)

func (*SpotWS_Trade_Socket) Unsubscribe

func (socket *SpotWS_Trade_Socket) Unsubscribe(symbol ...string) (resp *SpotWS_Unsubscribe_Response, hasTimedOut bool, err *Error)

type SpotWS_Unsubscribe_Response

type SpotWS_Unsubscribe_Response struct {
	Id string `json:"id"`
}

type Spot_AccountInfo

type Spot_AccountInfo struct {
	UID                        int64 `json:"uid"`
	MakerCommission            int64 `json:"makerCommission"`
	TakerCommission            int64 `json:"takerCommission"`
	BuyerCommission            int64 `json:"buyerCommission"`
	SellerCommission           int64 `json:"sellerCommission"`
	CanTrade                   bool  `json:"canTrade"`
	CanWithdraw                bool  `json:"canWithdraw"`
	CanDeposit                 bool  `json:"canDeposit"`
	Brokered                   bool  `json:"brokered"`
	RequireSelfTradePrevention bool  `json:"requireSelfTradePrevention"`
	PreventSor                 bool  `json:"preventSor"`
	UpdateTime                 int64 `json:"updateTime"`
	// "AccountType": "SPOT"
	AccountType string `json:"accountType"`
	//		"CommissionRates": {
	//		  "Maker": "0.00150000",
	//		  "Taker": "0.00150000",
	//		  "Buyer": "0.00000000",
	//		  "Seller": "0.00000000"
	//		}
	CommissionRates *Spot_AccountInfo_CommissionRates `json:"commissionRates"`
	// [
	//		{
	//			"Asset": "BTC",
	//			"Free": "4723846.89208129",
	//			"Locked": "0.00000000"
	//		},
	//		{
	//			"Asset": "LTC",
	//			"Free": "4763368.68006011",
	//			"Locked": "0.00000000"
	//		}
	//	]
	Balances []*Spot_AccountInfo_Balances `json:"balances"`
	// "Permissions": [
	//		"SPOT"
	//	]
	Permissions []string `json:"permissions"`
}

type Spot_AccountInfo_Balances

type Spot_AccountInfo_Balances struct {
	Asset  string `json:"asset"`
	Free   string `json:"free"`
	Locked string `json:"locked"`
}
{
	"Asset": "LTC",
	"Free": "4763368.68006011",
	"Locked": "0.00000000"
}

type Spot_AccountInfo_CommissionRates

type Spot_AccountInfo_CommissionRates struct {
	Maker  string `json:"maker"`
	Taker  string `json:"taker"`
	Buyer  string `json:"buyer"`
	Seller string `json:"seller"`
}
{
	"Maker": "0.00150000",
	"Taker": "0.00150000",
	"Buyer": "0.00000000",
	"Seller": "0.00000000"
}

type Spot_AccountInfo_Params

type Spot_AccountInfo_Params struct {
	OmitZeroBalances bool
	RecvWindow       int64
}

type Spot_AggTrade

type Spot_AggTrade struct {
	// Aggregate tradeId
	AggTradeId int64 `json:"a"`
	// Price
	Price string `json:"p"`
	// Quantity
	Quantity string `json:"q"`
	// First tradeId
	FirstTradeId int64 `json:"f"`
	// Last tradeId
	LastTradeId int64 `json:"l"`
	// Timestamp
	Timestamp int64 `json:"T"`
	// Was the buyer the maker?
	IsMaker bool `json:"m"`
	// Was the trade the best price match?
	IsBestMatch bool `json:"M"`
}

type Spot_AggTrades_Params

type Spot_AggTrades_Params struct {
	// Default 500; max 1000.
	Limit int64
	// ID to get aggregate trades from INCLUSIVE.
	FromId int64
	// Timestamp in ms to get aggregate trades from INCLUSIVE.
	StartTime int64
	// Timestamp in ms to get aggregate trades until INCLUSIVE.
	EndTime int64
}

type Spot_AllocationTypes_ENUM

type Spot_AllocationTypes_ENUM struct {
	SOR string
}

type Spot_AveragePrice

type Spot_AveragePrice struct {
	// Average price interval (in minutes)
	Mins int64 `json:"mins"`
	// Average price
	Price string `json:"price"`
	// Last trade time
	CloseTime int64 `json:"closeTime"`
}

type Spot_BookTicker

type Spot_BookTicker struct {
	Symbol string `json:"symbol"`

	BidPrice string `json:"bidPrice"`

	BidQty string `json:"bidQty"`

	AskPrice string `json:"askPrice"`

	AskQty string `json:"askQty"`
}

type Spot_Candlestick

type Spot_Candlestick struct {
	// Kline open time
	OpenTime int64
	// Open price
	Open string
	// High price
	High string
	// Low price
	Low string
	// Close price
	Close string
	// Volume
	Volume string
	// Kline Close time
	CloseTime int64
	// Quote asset volume
	QuoteAssetVolume string
	// Number of trades
	TradeCount int64
	// Taker buy base asset volume
	TakerBuyBaseAssetVolume string
	// Taker buy quote asset volume
	TakerBuyQuoteAssetVolume string
	// Unused field, ignore.
	Unused string
}

type Spot_Candlesticks_Params

type Spot_Candlesticks_Params struct {
	// Default: 0 (UTC)
	TimeZone  string
	StartTime int64
	EndTime   int64
	// Default 500; max 1000.
	Limit int64
}

type Spot_ChartIntervals_ENUM

type Spot_ChartIntervals_ENUM struct {
	SECOND   string
	MIN      string
	MINS_3   string
	MINS_5   string
	MINS_15  string
	MINS_30  string
	HOUR     string
	HOURS_2  string
	HOURS_4  string
	HOURS_6  string
	HOURS_8  string
	HOURS_12 string
	DAY      string
	DAYS_3   string
	WEEK     string
	MONTH    string
}

type Spot_ContingencyTypes_ENUM

type Spot_ContingencyTypes_ENUM struct {
	OCO string
	OTO string
}

type Spot_ExchangeFilter_EXCHANGE_MAX_NUM_ALGO_ORDERS

type Spot_ExchangeFilter_EXCHANGE_MAX_NUM_ALGO_ORDERS struct {
	FilterType       string `json:"filterType"`
	MaxNumAlgoOrders int64  `json:"maxNumAlgoOrders"`
}

type Spot_ExchangeFilter_EXCHANGE_MAX_NUM_ICEBERG_ORDERS

type Spot_ExchangeFilter_EXCHANGE_MAX_NUM_ICEBERG_ORDERS struct {
	FilterType          string `json:"filterType"`
	MaxNumIcebergOrders int64  `json:"maxNumIcebergOrders"`
}

type Spot_ExchangeFilter_EXCHANGE_MAX_NUM_ORDERS

type Spot_ExchangeFilter_EXCHANGE_MAX_NUM_ORDERS struct {
	FilterType   string `json:"filterType"`
	MaxNumOrders int64  `json:"maxNumOrders"`
}

type Spot_ExchangeFilters

type Spot_ExchangeFilters struct {
	EXCHANGE_MAX_NUM_ORDERS         *Spot_ExchangeFilter_EXCHANGE_MAX_NUM_ORDERS
	EXCHANGE_MAX_NUM_ALGO_ORDERS    *Spot_ExchangeFilter_EXCHANGE_MAX_NUM_ALGO_ORDERS
	EXCHANGE_MAX_NUM_ICEBERG_ORDERS *Spot_ExchangeFilter_EXCHANGE_MAX_NUM_ICEBERG_ORDERS
}

type Spot_ExchangeInfo

type Spot_ExchangeInfo struct {
	Timezone        string                `json:"timezone"`
	ServerTime      int64                 `json:"serverTime"`
	RateLimits      []*Spot_RateLimitType `json:"rateLimits"`
	ExchangeFilters *Spot_ExchangeFilters
	Symbols_arr     []*Spot_Symbol `json:"symbols"`
	Symbols         map[string]*Spot_Symbol
	Sors            []*Spot_ExchangeInfo_SORS `json:"sors"`
}

func (*Spot_ExchangeInfo) UnmarshalJSON

func (exchangeInfo *Spot_ExchangeInfo) UnmarshalJSON(data []byte) error

type Spot_ExchangeInfo_Params

type Spot_ExchangeInfo_Params struct {
	Symbol       string
	Symbols      []string
	Permissions  []string
	SymbolStatus string
	// The logic is flipped with "Dont Show" here
	// Because bools are always initialized as "false" while the exchange default is "true"
	DontShowPermissionSets bool
}

type Spot_ExchangeInfo_SORS

type Spot_ExchangeInfo_SORS struct {
	BaseAsset string   `json:"baseAsset"`
	Symbols   []string `json:"symbols"`
}

type Spot_Exchange_FilterTypes_ENUM

type Spot_Exchange_FilterTypes_ENUM struct {
	EXCHANGE_MAX_NUM_ORDERS         string
	EXCHANGE_MAX_NUM_ALGO_ORDERS    string
	EXCHANGE_MAX_NUM_ICEBERG_ORDERS string
}

type Spot_LimitMakerOrder_Params

type Spot_LimitMakerOrder_Params struct {
	TimeInForce             string
	NewClientOrderId        string
	StrategyId              int64
	StrategyType            int64
	IcebergQty              string
	NewOrderRespType        string
	SelfTradePreventionMode string
	RecvWindow              int64
}

type Spot_LimitOrder_Params

type Spot_LimitOrder_Params struct {
	TimeInForce             string
	NewClientOrderId        string
	StrategyId              int64
	StrategyType            int64
	IcebergQty              string
	NewOrderRespType        string
	SelfTradePreventionMode string
	RecvWindow              int64
}

type Spot_ListOrderStatuses_ENUM

type Spot_ListOrderStatuses_ENUM struct {
	EXECUTING string
	ALL_DONE  string
	REJECT    string
}

type Spot_ListStatusTypes_ENUM

type Spot_ListStatusTypes_ENUM struct {
	RESPONSE     string
	EXEC_STARTED string
	ALL_DONE     string
}

type Spot_MarketOrder_Params

type Spot_MarketOrder_Params struct {
	NewClientOrderId        string
	StrategyId              int64
	StrategyType            int64
	NewOrderRespType        string
	SelfTradePreventionMode string
	RecvWindow              int64
}

type Spot_MiniTicker

type Spot_MiniTicker struct {
	Symbol string `json:"symbol"`

	OpenPrice string `json:"openPrice"`

	HighPrice string `json:"highPrice"`

	LowPrice string `json:"lowPrice"`

	LastPrice string `json:"lastPrice"`

	// Volume in base asset
	Volume string `json:"volume"`

	// Volume in quote asset
	QuoteVolume string `json:"quoteVolume"`

	OpenTime int64 `json:"openTime"`

	CloseTime int64 `json:"closeTime"`

	// Trade ID of the first trade in the interval
	FirstId int64 `json:"firstId"`

	// Trade ID of the last trade in the interval
	LastId int64 `json:"lastId"`

	// Number of trades in the interval
	Count int64 `json:"count"`
}

type Spot_MiniTicker_RollingWindow

type Spot_MiniTicker_RollingWindow struct {
	Symbol string `json:"symbol"`

	OpenPrice string `json:"openPrice"`

	HighPrice string `json:"highPrice"`

	LowPrice string `json:"lowPrice"`

	LastPrice string `json:"lastPrice"`

	Volume string `json:"volume"`

	// Sum of (price * volume) for all trades
	QuoteVolume string `json:"quoteVolume"`

	// Open time for ticker window
	OpenTime int64 `json:"openTime"`

	// Close time for ticker window
	CloseTime int64 `json:"closeTime"`

	// Trade IDs
	FirstId int64 `json:"firstId"`

	LastId int64 `json:"lastId"`

	// Number of trades in the interval
	Count int64 `json:"count"`
}

type Spot_MiniTicker_RollingWindow24h

type Spot_MiniTicker_RollingWindow24h struct {

	// Symbol Name
	Symbol string `json:"symbol"`

	// Opening price of the Interval
	OpenPrice string `json:"openPrice"`

	// Highest price in the interval
	HighPrice string `json:"highPrice"`

	// Lowest  price in the interval
	LowPrice string `json:"lowPrice"`

	// Closing price of the interval
	LastPrice string `json:"lastPrice"`

	// Total trade volume (in base asset)
	Volume string `json:"volume"`

	// Total trade volume (in quote asset)
	QuoteVolume string `json:"quoteVolume"`

	// Start of the ticker interval
	OpenTime int64 `json:"openTime"`

	// End of the ticker interval
	CloseTime int64 `json:"closeTime"`

	// First tradeId considered
	FirstId int64 `json:"firstId"`

	// Last tradeId considered
	LastId int64 `json:"lastId"`

	// Total trade count
	Count int64 `json:"count"`
}

type Spot_NewOrderRespTypes_ENUM

type Spot_NewOrderRespTypes_ENUM struct {
	ACK    string
	RESULT string
	FULL   string
}

type Spot_OldTrades_Params

type Spot_OldTrades_Params struct {
	// Default 500; max 1000.
	Limit int64
	// TradeId to fetch from. Default gets most recent trades.
	FromId int64
}

type Spot_Order

type Spot_Order struct {
	Symbol                  string              `json:"symbol"`
	OrderId                 int64               `json:"orderId"`
	OrderListId             int64               `json:"orderListId"`
	ClientOrderId           string              `json:"clientOrderId"`
	TransactTime            int64               `json:"transactTime"`
	Price                   string              `json:"price"`
	OrigQty                 string              `json:"origQty"`
	ExecutedQty             string              `json:"executedQty"`
	OrigQuoteOrderQty       string              `json:"origQuoteOrderQty"`
	CummulativeQuoteQty     string              `json:"cummulativeQuoteQty"`
	Status                  string              `json:"status"`
	TimeInForce             string              `json:"timeInForce"`
	Type                    string              `json:"type"`
	Side                    string              `json:"side"`
	WorkingTime             int64               `json:"workingTime"`
	SelfTradePreventionMode string              `json:"selfTradePreventionMode"`
	Fills                   []*Spot_Order_Fills `json:"fills"`
}

type Spot_OrderBook

type Spot_OrderBook struct {
	LastUpdateId int64 `json:"lastUpdateId"`
	//"bids": [
	//    [
	//      "4.00000000",     // PRICE
	//      "431.00000000"    // QTY
	//    ]
	//  ]
	Bids [][2]string `json:"bids"`
	// 	"asks": [
	//     [
	//       "4.00000200",
	//       "12.00000000"
	//     ]
	//   ]
	Asks [][2]string `json:"asks"`
}

type Spot_OrderSides_ENUM

type Spot_OrderSides_ENUM struct {
	BUY  string
	SELL string
}

type Spot_OrderStatuses_ENUM

type Spot_OrderStatuses_ENUM struct {
	NEW              string
	PENDING_NEW      string
	PARTIALLY_FILLED string
	FILLED           string
	CANCELED         string
	PENDING_CANCEL   string
	REJECTED         string
	EXPIRED          string
	EXPIRED_IN_MATCH string
}

type Spot_OrderTypes_ENUM

type Spot_OrderTypes_ENUM struct {
	LIMIT             string
	MARKET            string
	STOP_LOSS         string
	STOP_LOSS_LIMIT   string
	TAKE_PROFIT       string
	TAKE_PROFIT_LIMIT string
	LIMIT_MAKER       string
}

type Spot_Order_Fills

type Spot_Order_Fills struct {
	Price           string `json:"price"`
	Qty             string `json:"qty"`
	Commission      string `json:"commission"`
	CommissionAsset string `json:"commissionAsset"`
	TradeId         int64  `json:"tradeId"`
}

type Spot_Order_Params

type Spot_Order_Params struct {
	TimeInForce             string
	Quantity                string
	QuoteOrderQty           string
	Price                   string
	NewClientOrderId        string
	StrategyId              int64
	StrategyType            int64
	StopPrice               string
	TrailingDelta           int64
	IcebergQty              string
	NewOrderRespType        string
	SelfTradePreventionMode string
	RecvWindow              int64
}

type Spot_Permissions_ENUM

type Spot_Permissions_ENUM struct {
	SPOT        string
	MARGIN      string
	LEVERAGED   string
	TRD_GRP_002 string
	TRD_GRP_003 string
	TRD_GRP_004 string
	TRD_GRP_005 string
	TRD_GRP_006 string
	TRD_GRP_007 string
	TRD_GRP_008 string
	TRD_GRP_009 string
	TRD_GRP_010 string
	TRD_GRP_011 string
	TRD_GRP_012 string
	TRD_GRP_013 string
	TRD_GRP_014 string
	TRD_GRP_015 string
	TRD_GRP_016 string
	TRD_GRP_017 string
	TRD_GRP_018 string
	TRD_GRP_019 string
	TRD_GRP_020 string
	TRD_GRP_021 string
	TRD_GRP_022 string
	TRD_GRP_023 string
	TRD_GRP_024 string
	TRD_GRP_025 string
}

type Spot_PriceTicker

type Spot_PriceTicker struct {
	Symbol string `json:"symbol"`
	Price  string `json:"price"`
}

type Spot_QueryOrder_Params

type Spot_QueryOrder_Params struct {
	OrigClientOrderId string
	RecvWindow        int64
}

type Spot_RateLimitIntervals_ENUM

type Spot_RateLimitIntervals_ENUM struct {
	SECOND string
	MINUTE string
	DAY    string
}

type Spot_RateLimitType

type Spot_RateLimitType struct {
	RateLimitType string `json:"rateLimitType"`
	Interval      string `json:"interval"`
	IntervalNum   int    `json:"intervalNum"`
	Limit         int    `json:"limit"`
}

type Spot_RateLimitTypes_ENUM

type Spot_RateLimitTypes_ENUM struct {
	REQUEST_WEIGHT string
	ORDERS         string
	RAW_REQUESTS   string
}

type Spot_STPModes_ENUM

type Spot_STPModes_ENUM struct {
	NONE         string
	EXPIRE_MAKER string
	EXPIRE_TAKER string
	EXPIRE_BOTH  string
}

type Spot_SecurityTypes_ENUM

type Spot_SecurityTypes_ENUM struct {
	NONE        string
	USER_STREAM string
	TRADE       string
	USER_DATA   string
}

type Spot_Symbol

type Spot_Symbol struct {
	Symbol                          string   `json:"symbol"`
	Status                          string   `json:"status"`
	BaseAsset                       string   `json:"baseAsset"`
	BaseAssetPrecision              int      `json:"baseAssetPrecision"`
	QuoteAsset                      string   `json:"quoteAsset"`
	QuotePrecision                  int      `json:"quotePrecision"`
	BaseCommissionPrecision         int      `json:"baseCommissionPrecision"`
	QuoteCommissionPrecision        int      `json:"quoteCommissionPrecision"`
	OrderTypes                      []string `json:"orderTypes"`
	IcebergAllowed                  bool     `json:"icebergAllowed"`
	OcoAllowed                      bool     `json:"ocoAllowed"`
	OtoAllowed                      bool     `json:"otoAllowed"`
	QuoteOrderQtyMarketAllowed      bool     `json:"quoteOrderQtyMarketAllowed"`
	AllowTrailingStop               bool     `json:"allowTrailingStop"`
	CancelReplaceAllowedbool        bool     `json:"cancelReplaceAllowedbool"`
	IsSpotTradingAllowed            bool     `json:"isSpotTradingAllowed"`
	IsMarginTradingAllowed          bool     `json:"isMarginTradingAllowed"`
	Filters                         Spot_SymbolFilters
	Permissions                     []string   `json:"permissions"`
	PermissionSets                  [][]string `json:"permissionSets"`
	DefaultSelfTradePreventionMode  string     `json:"defaultSelfTradePreventionMode"`
	AllowedSelfTradePreventionModes []string   `json:"allowedSelfTradePreventionModes"`
}

func (*Spot_Symbol) LOT_SIZE added in v0.0.10

func (spotSymbol *Spot_Symbol) LOT_SIZE(quantity float64) (isValid bool, reason string, suggestion float64, err *Error)

Checks if the quantity passes the "LOT_SIZE"

"reason" is returned on any failure, possible values are:

- "minQty" if the quantity < minQty. "suggestion" will be returned with the value "minQty".

- "maxQty" if the quantity > maxQty. "suggestion" will be returned with the value "maxQty".

- "stepSize" if the quantity % stepSize != 0. "suggestion" will be returned with the corrected value.

"suggestion" must be ignored if it is returned as 0. "suggestion" is always returned as "quantity" if it passes the filter.

func (*Spot_Symbol) LOT_SIZE_COMPACT added in v0.0.10

func (spotSymbol *Spot_Symbol) LOT_SIZE_COMPACT(price float64) (isValid bool, err *Error)

Checks if the price passes the "LOT_SIZE"

func (*Spot_Symbol) MARKET_LOT_SIZE added in v0.0.10

func (spotSymbol *Spot_Symbol) MARKET_LOT_SIZE(quantity float64) (isValid bool, reason string, suggestion float64, err *Error)

Checks if the quantity passes the "LOT_SIZE"

"reason" is returned on any failure, possible values are:

- "minQty" if the quantity < minQty. "suggestion" will be returned with the value "minQty".

- "maxQty" if the quantity > maxQty. "suggestion" will be returned with the value "maxQty".

- "stepSize" if the quantity % stepSize != 0. "suggestion" will be returned with the corrected value.

"suggestion" must be ignored if it is returned as 0. "suggestion" is always returned as "quantity" if it passes the filter.

func (*Spot_Symbol) MARKET_LOT_SIZE_COMPACT added in v0.0.10

func (spotSymbol *Spot_Symbol) MARKET_LOT_SIZE_COMPACT(price float64) (isValid bool, err *Error)

Checks if the price passes the "MARKET_LOT_SIZE"

func (*Spot_Symbol) PRICE_FILTER added in v0.0.10

func (spotSymbol *Spot_Symbol) PRICE_FILTER(price float64) (isValid bool, reason string, suggestion float64, err *Error)

Checks if the price passes the "PRICE_FILTER"

"reason" is returned on any failure, possible values are:

- "minPrice" if the price < minPrice. "suggestion" will be returned with the value "minPrice".

- "maxPrice" if the price > maxPrice. "suggestion" will be returned with the value "maxPrice".

- "tickSize" if the price % tickSize != 0. "suggestion" will be returned with the corrected value.

"suggestion" must be ignored if it is returned as 0. "suggestion" is always returned as "price" if it passes the filter.

func (*Spot_Symbol) PRICE_FILTER_COMPACT added in v0.0.10

func (spotSymbol *Spot_Symbol) PRICE_FILTER_COMPACT(price float64) (isValid bool, err *Error)

Checks if the price passes the "PRICE_FILTER"

func (*Spot_Symbol) TruncPrice

func (spotSymbol *Spot_Symbol) TruncPrice(priceStr string) string

Truncates a price string to the last significant digit

Symbol Filters rule "PRICE_FILTER" defines the highest precision the symbol accepts i.e: BTCUSDT has a precision of 2, meaning if you want to buy BTCUSDT at "123_456.7891", it would be truncated down to "123_456.78"

func (*Spot_Symbol) TruncPrice_float64

func (spotSymbol *Spot_Symbol) TruncPrice_float64(price float64) string

Truncates a price string to the last significant digit

Symbol Filters rule "PRICE_FILTER" defines the highest precision the symbol accepts i.e: BTCUSDT has a precision of 2, meaning if you want to buy BTCUSDT at "123_456.7891", it would be truncated down to "123_456.78"

func (*Spot_Symbol) TruncQuantity added in v0.0.10

func (spotSymbol *Spot_Symbol) TruncQuantity(quantity string, IsForMarketOrder bool) string

func (*Spot_Symbol) TruncQuantity_float64 added in v0.0.10

func (spotSymbol *Spot_Symbol) TruncQuantity_float64(quantity float64, IsForMarketOrder bool) string

Truncates a price string to the last significant digit

Symbol Filters rule "LOT_SIZE" defines the highest precision the symbol's Quantity (via base asset) accepts And for MARKET orders the "MARKET_LOT_SIZE" also applies i.e: BTCUSDT has a precision of 5, meaning if you want to buy "0.12345678" BTC, it would be truncated down to "0.12345" BTC

func (*Spot_Symbol) UnmarshalJSON

func (symbol *Spot_Symbol) UnmarshalJSON(data []byte) error

type Spot_SymbolFilter_ICEBERG_PARTS

type Spot_SymbolFilter_ICEBERG_PARTS struct {
	FilterType string `json:"filterType"`
	Limit      int64  `json:"limit"`
}

type Spot_SymbolFilter_LOT_SIZE

type Spot_SymbolFilter_LOT_SIZE struct {
	FilterType string `json:"filterType"`
	MinQty     string `json:"minQty"`
	MaxQty     string `json:"maxQty"`
	StepSize   string `json:"stepSize"`
}

type Spot_SymbolFilter_MARKET_LOT_SIZE

type Spot_SymbolFilter_MARKET_LOT_SIZE struct {
	FilterType string `json:"filterType"`
	MinQty     string `json:"minQty"`
	MaxQty     string `json:"maxQty"`
	StepSize   string `json:"stepSize"`
}

type Spot_SymbolFilter_MAX_NUM_ALGO_ORDERS

type Spot_SymbolFilter_MAX_NUM_ALGO_ORDERS struct {
	FilterType       string `json:"filterType"`
	MaxNumAlgoOrders int64  `json:"maxNumAlgoOrders"`
}

type Spot_SymbolFilter_MAX_NUM_ICEBERG_ORDERS

type Spot_SymbolFilter_MAX_NUM_ICEBERG_ORDERS struct {
	FilterType          string `json:"filterType"`
	MaxNumIcebergOrders int64  `json:"maxNumIcebergOrders"`
}

type Spot_SymbolFilter_MAX_NUM_ORDERS

type Spot_SymbolFilter_MAX_NUM_ORDERS struct {
	FilterType   string `json:"filterType"`
	MaxNumOrders int64  `json:"maxNumOrders"`
}

type Spot_SymbolFilter_MAX_POSITION

type Spot_SymbolFilter_MAX_POSITION struct {
	FilterType  string `json:"filterType"`
	MaxPosition string `json:"maxPosition"`
}

type Spot_SymbolFilter_MIN_NOTIONAL

type Spot_SymbolFilter_MIN_NOTIONAL struct {
	FilterType    string `json:"filterType"`
	MinNotional   string `json:"minNotional"`
	ApplyToMarket bool   `json:"applyToMarket"`
	AvgPriceMins  int64  `json:"avgPriceMins"`
}

type Spot_SymbolFilter_NOTIONAL

type Spot_SymbolFilter_NOTIONAL struct {
	FilterType       string `json:"filterType"`
	MinNotional      string `json:"minNotional"`
	ApplyMinToMarket bool   `json:"applyMinToMarket"`
	MaxNotional      string `json:"maxNotional"`
	ApplyMaxToMarket bool   `json:"applyMaxToMarket"`
	AvgPriceMins     int64  `json:"avgPriceMins"`
}

type Spot_SymbolFilter_PERCENT_PRICE

type Spot_SymbolFilter_PERCENT_PRICE struct {
	FilterType     string `json:"filterType"`
	MultiplierUp   string `json:"multiplierUp"`
	MultiplierDown string `json:"multiplierDown"`
	AvgPriceMins   int64  `json:"avgPriceMins"`
}

type Spot_SymbolFilter_PERCENT_PRICE_BY_SIDE

type Spot_SymbolFilter_PERCENT_PRICE_BY_SIDE struct {
	FilterType        string `json:"filterType"`
	BidMultiplierUp   string `json:"bidMultiplierUp"`
	BidMultiplierDown string `json:"bidMultiplierDown"`
	AskMultiplierUp   string `json:"askMultiplierUp"`
	AskMultiplierDown string `json:"askMultiplierDown"`
	AvgPriceMins      int64  `json:"avgPriceMins"`
}

type Spot_SymbolFilter_PRICE_FILTER

type Spot_SymbolFilter_PRICE_FILTER struct {
	FilterType string `json:"filterType"`
	MinPrice   string `json:"minPrice"`
	MaxPrice   string `json:"maxPrice"`
	TickSize   string `json:"tickSize"`
}

type Spot_SymbolFilter_TRAILING_DELTA

type Spot_SymbolFilter_TRAILING_DELTA struct {
	FilterType            string `json:"filterType"`
	MinTrailingAboveDelta int64  `json:"minTrailingAboveDelta"`
	MaxTrailingAboveDelta int64  `json:"maxTrailingAboveDelta"`
	MinTrailingBelowDelta int64  `json:"minTrailingBelowDelta"`
	MaxTrailingBelowDelta int64  `json:"maxTrailingBelowDelta"`
}

type Spot_SymbolStatuses_ENUM

type Spot_SymbolStatuses_ENUM struct {
	PRE_TRADING   string
	TRADING       string
	POST_TRADING  string
	END_OF_DAY    string
	HALT          string
	AUCTION_MATCH string
	BREAK         string
}

type Spot_Ticker

type Spot_Ticker struct {
	Symbol string `json:"symbol"`

	// Absolute price change
	PriceChange string `json:"priceChange"`

	// Relative price change in percent
	PriceChangePercent string `json:"priceChangePercent"`

	// quoteVolume / volume
	WeightedAvgPrice string `json:"weightedAvgPrice"`

	OpenPrice string `json:"openPrice"`

	HighPrice string `json:"highPrice"`

	LowPrice string `json:"lowPrice"`

	LastPrice string `json:"lastPrice"`

	// Volume in base asset
	Volume string `json:"volume"`

	// Volume in quote asset
	QuoteVolume string `json:"quoteVolume"`

	OpenTime int64 `json:"openTime"`

	CloseTime int64 `json:"closeTime"`

	// Trade ID of the first trade in the interval
	FirstId int64 `json:"firstId"`

	// Trade ID of the last trade in the interval
	LastId int64 `json:"lastId"`

	// Number of trades in the interval
	Count int64 `json:"count"`
}

type Spot_Ticker_Params

type Spot_Ticker_Params struct {
	Symbols  []string
	Timezone string
}

type Spot_Ticker_RollingWindow

type Spot_Ticker_RollingWindow struct {
	Symbol string `json:"symbol"`

	// Absolute price change
	PriceChange string `json:"priceChange"`

	// Relative price change in percent
	PriceChangePercent string `json:"priceChangePercent"`

	// QuoteVolume / Volume
	WeightedAvgPrice string `json:"weightedAvgPrice"`

	OpenPrice string `json:"openPrice"`

	HighPrice string `json:"highPrice"`

	LowPrice string `json:"lowPrice"`

	LastPrice string `json:"lastPrice"`

	Volume string `json:"volume"`

	// Sum of (price * volume) for all trades
	QuoteVolume string `json:"quoteVolume"`

	// Open time for ticker window
	OpenTime int64 `json:"openTime"`

	// Close time for ticker window
	CloseTime int64 `json:"closeTime"`

	// Trade IDs
	FirstId int64 `json:"firstId"`

	LastId int64 `json:"lastId"`

	// Number of trades in the interval
	Count int64 `json:"count"`
}

type Spot_Ticker_RollingWindow24h

type Spot_Ticker_RollingWindow24h struct {
	Symbol string `json:"symbol"`

	PriceChange string `json:"priceChange"`

	PriceChangePercent string `json:"priceChangePercent"`

	WeightedAvgPrice string `json:"weightedAvgPrice"`

	PrevClosePrice string `json:"prevClosePrice"`

	LastPrice string `json:"lastPrice"`

	LastQty string `json:"lastQty"`

	BidPrice string `json:"bidPrice"`

	BidQty string `json:"bidQty"`

	AskPrice string `json:"askPrice"`

	AskQty string `json:"askQty"`

	OpenPrice string `json:"openPrice"`

	HighPrice string `json:"highPrice"`

	LowPrice string `json:"lowPrice"`

	Volume string `json:"volume"`

	QuoteVolume string `json:"quoteVolume"`

	OpenTime int64 `json:"openTime"`

	CloseTime int64 `json:"closeTime"`

	// First tradeId
	FirstId int64 `json:"firstId"`

	// Last tradeId
	LastId int64 `json:"lastId"`

	// Trade count
	Count int64 `json:"count"`
}

type Spot_Ticker_RollingWindow_Params

type Spot_Ticker_RollingWindow_Params struct {
	Symbols    []string
	WindowSize string
}

type Spot_Time

type Spot_Time struct {
	ServerTime int64 `json:"serverTime"`
	Latency    int64
}

type Spot_TimeInForces_ENUM

type Spot_TimeInForces_ENUM struct {
	GTC string
	IOC string
	FOK string
}

type Spot_Trade

type Spot_Trade struct {
	Id           int64  `json:"id"`
	Price        string `json:"price"`
	Qty          string `json:"qty"`
	QuoteQty     string `json:"quoteQty"`
	Time         int64  `json:"time"`
	IsBuyerMaker bool   `json:"isBuyerMaker"`
	IsBestMatch  bool   `json:"isBestMatch"`
}

type Spot_Websocket

type Spot_Websocket struct {
	Websocket *Websocket
	Conn      *ws.Conn
	// Host server's URL
	BaseURL string
	// contains filtered or unexported fields
}

func (*Spot_Websocket) Close

func (spot_ws *Spot_Websocket) Close() error

func (*Spot_Websocket) ListSubscriptions

func (spot_ws *Spot_Websocket) ListSubscriptions(timeout_sec ...int) (resp *SpotWS_ListSubscriptions_Response, hasTimedOut bool, err *Error)

func (*Spot_Websocket) Reconnect

func (spot_ws *Spot_Websocket) Reconnect()

Forcefully reconnects the socket Also makes it a reconnecting socket if it weren't before Useless, but there nonetheless...

func (*Spot_Websocket) SetCloseListener

func (spot_ws *Spot_Websocket) SetCloseListener(f func(code int, text string))

This is called when the websocket closes indefinitely Meaning when you invoke the 'Close()' method Or any other way a websocket is set to never reconnect on a disconnection

func (*Spot_Websocket) SetDisconnectListener

func (spot_ws *Spot_Websocket) SetDisconnectListener(f func(code int, text string))

This is called when socket has been disconnected Called when the detected a disconnection and wants to reconnect afterwards Usually called right before the 'ReconnectingListener'

func (*Spot_Websocket) SetMessageListener

func (spot_ws *Spot_Websocket) SetMessageListener(f func(messageType int, msg []byte))

func (*Spot_Websocket) SetPingListener

func (spot_ws *Spot_Websocket) SetPingListener(f func(appData string))

func (*Spot_Websocket) SetPongListener

func (spot_ws *Spot_Websocket) SetPongListener(f func(appData string))

func (*Spot_Websocket) SetReconnectListener

func (spot_ws *Spot_Websocket) SetReconnectListener(f func())

This is called when the socket has successfully reconnected after a disconnection

func (*Spot_Websocket) SetReconnectingListener

func (spot_ws *Spot_Websocket) SetReconnectingListener(f func())

This is called when socket began reconnecting

func (*Spot_Websocket) Subscribe

func (spot_ws *Spot_Websocket) Subscribe(stream ...string) (resp *SpotWS_Subscribe_Response, hasTimedOut bool, err *Error)

func (*Spot_Websocket) Unsubscribe

func (spot_ws *Spot_Websocket) Unsubscribe(stream ...string) (resp *SpotWS_Unsubscribe_Response, hasTimedOut bool, err *Error)

type Spot_Websocket_Constants

type Spot_Websocket_Constants struct {
	URLs                      []string
	MARKET_DATA_ONLY_ENDPOINT string
}

type Spot_Websockets

type Spot_Websockets struct {
	// contains filtered or unexported fields
}

func (*Spot_Websockets) AggTrade

func (spot_ws *Spot_Websockets) AggTrade(publicOnMessage func(aggTrade *SpotWS_AggTrade), symbol ...string) (*SpotWS_AggTrade_Socket, *Error)

func (*Spot_Websockets) AllMiniTickers

func (spot_ws *Spot_Websockets) AllMiniTickers(publicOnMessage func(miniTickers []*SpotWS_MiniTicker)) (*SpotWS_AllMiniTickers_Socket, *Error)

func (*Spot_Websockets) AllRollingWindowStatistics

func (spot_ws *Spot_Websockets) AllRollingWindowStatistics(publicOnMessage func(rwStats []*SpotWS_RollingWindowStatistic), WindowSize ...string) (*SpotWS_AllRollingWindowStatistics_Socket, *Error)

func (*Spot_Websockets) AllTickers

func (spot_ws *Spot_Websockets) AllTickers(publicOnMessage func(tickers []*SpotWS_Ticker)) (*SpotWS_AllTickers_Socket, *Error)

func (*Spot_Websockets) AveragePrice

func (spot_ws *Spot_Websockets) AveragePrice(publicOnMessage func(averagePrice *SpotWS_AveragePrice), symbol ...string) (*SpotWS_AveragePrice_Socket, *Error)

func (*Spot_Websockets) BookTicker

func (spot_ws *Spot_Websockets) BookTicker(publicOnMessage func(bookTicker *SpotWS_BookTicker), symbol ...string) (*SpotWS_BookTicker_Socket, *Error)

func (*Spot_Websockets) Candlestick_WithOffset

func (spot_ws *Spot_Websockets) Candlestick_WithOffset(publicOnMessage func(candlestick_msg *SpotWS_Candlestick_MSG), identifiers ...SpotWS_Candlestick_StreamIdentifier) (*SpotWS_Candlestick_TimezoneOffset_Socket, *Error)

func (*Spot_Websockets) Candlesticks

func (spot_ws *Spot_Websockets) Candlesticks(publicOnMessage func(candlestick_msg *SpotWS_Candlestick_MSG), identifiers ...SpotWS_Candlestick_StreamIdentifier) (*SpotWS_Candlestick_Socket, *Error)

func (*Spot_Websockets) CreateSocket

func (*Spot_Websockets) CreateSocket(streams []string, isCombined bool) (*Spot_Websocket, *Error)

func (*Spot_Websockets) DiffBookDepth

func (spot_ws *Spot_Websockets) DiffBookDepth(publicOnMessage func(diffBookDepth *SpotWS_DiffBookDepth), identifiers ...SpotWS_DiffBookDepth_StreamIdentifier) (*SpotWS_DiffBookDepth_Socket, *Error)

func (*Spot_Websockets) MiniTicker

func (spot_ws *Spot_Websockets) MiniTicker(publicOnMessage func(miniTicker *SpotWS_MiniTicker), symbol ...string) (*SpotWS_MiniTicker_Socket, *Error)

func (*Spot_Websockets) PartialBookDepth

func (spot_ws *Spot_Websockets) PartialBookDepth(publicOnMessage func(partialBookDepth *SpotWS_PartialBookDepth), identifiers ...SpotWS_PartialBookDepth_StreamIdentifier) (*SpotWS_PartialBookDepth_Socket, *Error)

func (*Spot_Websockets) RollingWindowStatistics

func (spot_ws *Spot_Websockets) RollingWindowStatistics(publicOnMessage func(rwStat *SpotWS_RollingWindowStatistic), identifiers ...SpotWS_RollingWindowStatistics_StreamIdentifier) (*SpotWS_RollingWindowStatistics_Socket, *Error)

func (*Spot_Websockets) Ticker

func (spot_ws *Spot_Websockets) Ticker(publicOnMessage func(ticker *SpotWS_Ticker), symbol ...string) (*SpotWS_Ticker_Socket, *Error)

func (*Spot_Websockets) Trade

func (spot_ws *Spot_Websockets) Trade(publicOnMessage func(trade *SpotWS_Trade), symbol ...string) (*SpotWS_Trade_Socket, *Error)

type Spot_WorkingFloors_ENUM

type Spot_WorkingFloors_ENUM struct {
	EXCHANGE string
	SOR      string
}

type Websocket

type Websocket struct {
	Conn *ws.Conn
	// Host server's URL
	BaseURL string
	Streams []string

	// This is to show the current state of the stream
	// false -> it's a raw stream
	// true -> it's a combined stream
	IsCombined bool

	// This happens when a response for a request has been received
	// This will get called first, even before the requesting function receives a response
	OnPrivateMessage func(msg []byte)
	OnMessage        func(messageType int, msg []byte)
	OnPing           func(appData string)
	OnPong           func(appData string)
	OnDisconnect     func(code int, text string)
	OnReconnecting   func()
	OnReconnect      func()
	OnClose          func(code int, text string)

	Creation_Timestamp       int64
	Last_Heartbeat_Timestamp int64
	// contains filtered or unexported fields
}

func (*Websocket) Close

func (websocket *Websocket) Close() error

This terminates the socket indefinitely

func (*Websocket) CloseHandler

func (websocket *Websocket) CloseHandler(code int, text string) error

func (*Websocket) PingHandler

func (websocket *Websocket) PingHandler(appData string) error

func (*Websocket) PongHandler

func (websocket *Websocket) PongHandler(appData string) error

func (*Websocket) Reconnect

func (websocket *Websocket) Reconnect()

func (*Websocket) RecordLastHeartbeat

func (websocket *Websocket) RecordLastHeartbeat()

func (*Websocket) SendRequest_sync

func (websocket *Websocket) SendRequest_sync(req map[string]interface{}, timeout_sec ...int) (data []byte, hasTimedOut bool, WS_send_err *Error)

type WebsocketConstants

type WebsocketConstants struct {
	MAX_STREAMS_PER_SOCKET              uint64
	MAX_OUTGOING_MESSAGES_PER_SECOND    uint64
	CONNECTION_ATTEMPTS_PER_5MINS       uint64
	RESPONSE_TIMEOUT_SECONDS            int64
	HEARTBEAT_CHECK_INTERVAL_SEC        int64
	HEARTBEAT_CLOSE_ON_NO_HEARTBEAT_SEC int64
	EXPECTED_DISCONNECTION_TIME_SEC     int64
}

Jump to

Keyboard shortcuts

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