Binance

package module
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2025 License: MIT Imports: 18 Imported by: 0

README

Binance-Go

A simple Golang package for the Binance API (No docs until v1.0.0)

TODO v1.0.0

SPOT
  • Finish the implementation of all REST and WS endpoints
  • Websocket API
FUTURES
  • Websocket API
Helper Functions
  • A function to fetch all candles between X and Y timestamps
  • A function to fetch all candles between X and Y timestamps, parse them to float64
  • A function to fetch all candles between X and Y timestamps, parse them to float64, serialize them and return []byte

Documentation

Index

Constants

View Source
const DAY = 24 * HOUR
View Source
const HOUR = 60 * MINUTE
View Source
const MILLISECOND = 1
View Source
const MINUTE = 60 * SECOND
View Source
const SECOND = 1000 * MILLISECOND
View Source
const WEEK = 7 * DAY

Variables

View Source
var COMPLEX_INTERVALS = struct {
	WEEK  rune
	MONTH rune
	YEAR  rune
}{
	WEEK:  'w',
	MONTH: 'M',
	YEAR:  'Y',
}
View Source
var Constants = struct {
	Methods Methods
}{
	Methods: Methods{
		GET:    "GET",
		POST:   "POST",
		PUT:    "PUT",
		PATCH:  "PATCH",
		DELETE: "DELETE",
	},
}
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
	MarginTypes      Futures_MarginTypes_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
	WebsocketAPI Futures_WebsocketAPI_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",
	},
	MarginTypes: Futures_MarginTypes_ENUM{
		CROSSED:  "CROSSED",
		ISOLATED: "ISOLATED",
	},
	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"},
	},
	WebsocketAPI: Futures_WebsocketAPI_Constants{
		URL:         "wss://ws-fapi.binance.com/ws-fapi/v1",
		Testnet_URL: "wss://testnet.binancefuture.com/ws-fapi/v1",

		DefaultRequestTimeout_sec: 10,
	},
}
View Source
var FuturesErrorCodes = errorcodes.Futures
View Source
var INTERVALS_mu sync.Mutex
View Source
var LibraryErrorCodes = errorcodes.Library

// Binance Error codes

View Source
var Logger = GoLogger{}
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
	WebsocketAPI Spot_WebsocketAPI_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",
	},
	WebsocketAPI: Spot_WebsocketAPI_Constants{
		URLs:        []string{"wss://ws-api.binance.com:443/ws-api/v3", "wss://ws-api.binance.com:9443/ws-api/v3"},
		Testnet_URL: "wss://ws-api.testnet.binance.vision/ws-api/v3",

		DefaultRequestTimeout_sec: 10,
	},
}
View Source
var STATIC_INTERVAL_CHARS = map[rune]int64{
	'x': MILLISECOND,
	's': SECOND,
	'm': MINUTE,
	'h': HOUR,
	'd': DAY,
}
View Source
var SpotErrorCodes = errorcodes.Spot
View Source
var Utils lib.Utils

Functions

This section is empty.

Types

type Binance

type Binance struct {
	Opts options

	API apikeys.KeyPair

	Spot    Spot
	Futures Futures
}

func NewClient added in v0.1.5

func NewClient(APIKEY string, APISECRET string, opt_params ...Options) *Binance

Create a Client with HMAC Key Pair

HMAC API Keys are the system generated symmetric keys that are issued to you from the (!https://www.binance.com/en/my/settings/api-management)[API Management Page]

func NewClient_Ed25519 added in v0.1.5

func NewClient_Ed25519(APIKEY string, privKey_path string, opt_params ...Options) (*Binance, error)

Create a Client with Ed25519 Key Pair by providing the file paths

Ed25519 Keys must be user created (Binance doesn't issue them like the traditional HMAC Keys)

func NewClient_Ed25519_fromBase64 added in v0.1.5

func NewClient_Ed25519_fromBase64(APIKEY string, privKey_base64 string, opt_params ...Options) (*Binance, error)

Create a Client with Ed25519 Key Pair by providing them in Base64 format

Ed25519 Keys must be user created (Binance doesn't issue them like the traditional HMAC Keys)

func NewClient_RSA added in v0.1.5

func NewClient_RSA(APIKEY string, privKey_path string, opt_params ...Options) (*Binance, error)

Create a Client with Ed25519 Key Pair by providing the file paths

Ed25519 Keys must be user created (Binance doesn't issue them like the traditional HMAC Keys)

func NewClient_RSA_fromBase64 added in v0.1.5

func NewClient_RSA_fromBase64(APIKEY string, privKey_base64 string, opt_params ...Options) (*Binance, error)

Create a Client with RSA Key Pair by providing them in Base64 format

RSA Keys must be user created (Binance doesn't issue them like the traditional HMAC Keys)

func NewReadClient added in v0.1.5

func NewReadClient(opt_params ...Options) *Binance

Creates a Read-Only Client

type Binance_Interval

type Binance_Interval struct {
	Name       string
	Rune       rune
	BaseValue  int64
	Multiplier int64
	Value      int64
	Custom     bool
}

type Error

type Error = lib.Error // type alias re-export

Errors // Binance Error type

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 {
	Websockets   futures_ws
	WebsocketAPI Futures_WebsocketAPI

	Custom futures_Custom_Methods
	// contains filtered or unexported fields
}

func (*Futures) AccountConfiguration

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

func (*Futures) AccountInfo

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

func (*Futures) AccountInfo_v2

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

This is the older version of AccountInfo, it returns ALL account information of ALL symbols in the market, not just the symbols that have open positions or orders on the account

func (*Futures) AggTrades

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

func (*Futures) BookTicker

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

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

func (*Futures) ChangeMarginType

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

Margin Types:

- "ISOLATED"

- "CROSSED"

func (*Futures) ChangeMultiAssetsMode

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

func (*Futures) ChangePositionMode

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

func (*Futures) Close_UserData_ListenKey added in v0.1.5

func (futures *Futures) Close_UserData_ListenKey() (*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

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

func (*Futures) ExchangeInfo

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

func (*Futures) FundingRate

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

func (*Futures) FundingRateHistory

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) KeepAlive_UserData_ListenKey added in v0.1.5

func (futures *Futures) KeepAlive_UserData_ListenKey() (string, *Response, *Error)

func (*Futures) LeverageBrackets

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

func (*Futures) LimitBuy

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

func (*Futures) LimitOrder

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

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

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

func (*Futures) MarketOrder

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

func (*Futures) MarketSell

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

func (*Futures) NewOrder

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

func (*Futures) OpenInterest

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

func (*Futures) OpenInterestStatistics

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

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

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) StartUserDataStream added in v0.1.5

func (futures *Futures) StartUserDataStream() (string, *Response, *Error)

func (*Futures) SymbolConfiguration

func (futures *Futures) SymbolConfiguration(opt_params ...Futures_SymbolConfiguration_params) ([]*Futures_SymbolConfiguration, *Response, *Error)

func (*Futures) Ticker24h

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 FuturesWSAPI_BookTicker added in v0.1.3

type FuturesWSAPI_BookTicker struct {
	// 1027024
	LastUpdateID int `json:"lastUpdateId"`

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

	// "4.00000000"
	BidPrice string `json:"bidPrice"`

	// "431.00000000"
	BidQty string `json:"bidQty"`

	// "4.00000200"
	AskPrice string `json:"askPrice"`

	// "9.00000000"
	AskQty string `json:"askQty"`

	// 1589437530011   // Transaction time
	Time int64 `json:"time"`
}

type FuturesWSAPI_OrderBook added in v0.1.3

type FuturesWSAPI_OrderBook struct {
	// 1027024
	LastUpdateID int `json:"lastUpdateId"`

	// 1589436922972   // Message output time
	EventTime int64 `json:"E"`

	// 1589436922959   // Transaction time
	TransactionTime int64 `json:"T"`

	// [[ "4.00000000", "431.00000000" ]]
	Bids [][2]string `json:"bids"`

	// [[ "4.00000200", "12.00000000" ]]
	Asks [][2]string `json:"asks"`
}

type FuturesWSAPI_OrderBook_Params added in v0.1.3

type FuturesWSAPI_OrderBook_Params struct {
	Symbol string `json:"symbol"`
	// optional
	Limit int `json:"limit"`
}

type FuturesWSAPI_PriceTicker added in v0.1.3

type FuturesWSAPI_PriceTicker struct {
	// "BTCUSDT"
	Symbol string `json:"symbol"`

	// "6000.01"
	Price string `json:"price"`

	// 1589437530011   // Transaction time
	Time int64 `json:"time"`
}

type FuturesWS_AccountConfigUpdate added in v0.1.5

type FuturesWS_AccountConfigUpdate struct {
	// "ACCOUNT_CONFIG_UPDATE"        // Event Type
	EventType string `json:"e"`

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

	// 1611646737476                  // Transaction Time
	TransactionTime int64 `json:"T"`

	// Optional: symbol-specific leverage config update
	SymbolConfig *FuturesWS_AccountConfigUpdate_SymbolConfig `json:"ac,omitempty"`

	// Optional: account-wide configuration update
	AccountConfig *FuturesWS_AccountConfigUpdate_AccountConfig `json:"ai,omitempty"`
}

type FuturesWS_AccountConfigUpdate_AccountConfig added in v0.1.5

type FuturesWS_AccountConfigUpdate_AccountConfig struct {
	// true                           // Multi-Assets Mode
	MultiAssetsMode bool `json:"j"`
}

type FuturesWS_AccountConfigUpdate_SymbolConfig added in v0.1.5

type FuturesWS_AccountConfigUpdate_SymbolConfig struct {
	// "BTCUSDT"                      // Symbol
	Symbol string `json:"s"`

	// 25                             // Leverage
	Leverage int `json:"l"`
}

type FuturesWS_AccountUpdate added in v0.1.5

type FuturesWS_AccountUpdate struct {
	// "ACCOUNT_UPDATE"              // Event Type
	EventType string `json:"e"`

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

	// 1564745798938                 // Transaction Time
	TransactionTime int64 `json:"T"`

	// { ... }                       // Update Data
	Account FuturesWS_AccountUpdate_Account `json:"a"`
}

type FuturesWS_AccountUpdate_Account added in v0.1.5

type FuturesWS_AccountUpdate_Account struct {
	// "ORDER"                       // Event reason type
	Reason string `json:"m"`

	// [ { ... }, { ... } ]          // Balances
	Balances []FuturesWS_AccountUpdate_Balance `json:"B"`

	// [ { ... }, { ... }, { ... } ] // Positions
	Positions []FuturesWS_AccountUpdate_Position `json:"P"`
}

type FuturesWS_AccountUpdate_Balance added in v0.1.5

type FuturesWS_AccountUpdate_Balance struct {
	// "USDT"                        // Asset
	Asset string `json:"a"`

	// "122624.12345678"            // Wallet Balance
	WalletBalance string `json:"wb"`

	// "100.12345678"               // Cross Wallet Balance
	CrossWalletBalance string `json:"cw"`

	// "50.12345678"                // Balance Change except PnL and Commission
	BalanceChange string `json:"bc"`
}

type FuturesWS_AccountUpdate_Position added in v0.1.5

type FuturesWS_AccountUpdate_Position struct {
	// "BTCUSDT"                    // Symbol
	Symbol string `json:"s"`

	// "0"                          // Position Amount
	PositionAmount string `json:"pa"`

	// "0.00000"                    // Entry Price
	EntryPrice string `json:"ep"`

	// "0"                          // Breakeven Price
	BreakevenPrice string `json:"bep"`

	// "200"                        // (Pre-fee) Accumulated Realized
	AccumulatedRealized string `json:"cr"`

	// "0"                          // Unrealized PnL
	UnrealizedPnL string `json:"up"`

	// "isolated"                   // Margin Type
	MarginType string `json:"mt"`

	// "0.00000000"                 // Isolated Wallet
	IsolatedWallet string `json:"iw"`

	// "BOTH"                       // Position Side
	PositionSide string `json:"ps"`
}

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) (hasTimedOut bool, err error)

func (*FuturesWS_AggTrade_Socket) Unsubscribe

func (socket *FuturesWS_AggTrade_Socket) Unsubscribe(symbol ...string) (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() (hasTimedOut bool, err error)

func (*FuturesWS_AllBookTickers_Socket) Unsubscribe

func (socket *FuturesWS_AllBookTickers_Socket) Unsubscribe() (hasTimedOut bool, err error)

type FuturesWS_AllLiquidationOrders_Socket

type FuturesWS_AllLiquidationOrders_Socket struct {
	Handler *Futures_Websocket
}

func (*FuturesWS_AllLiquidationOrders_Socket) CreateStreamName

func (*FuturesWS_AllLiquidationOrders_Socket) CreateStreamName() string

func (*FuturesWS_AllLiquidationOrders_Socket) Subscribe

func (socket *FuturesWS_AllLiquidationOrders_Socket) Subscribe() (hasTimedOut bool, err error)

func (*FuturesWS_AllLiquidationOrders_Socket) Unsubscribe

func (socket *FuturesWS_AllLiquidationOrders_Socket) Unsubscribe() (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) (hasTimedOut bool, err error)

func (*FuturesWS_AllMarkPrices_Socket) Unsubscribe

func (socket *FuturesWS_AllMarkPrices_Socket) Unsubscribe(isFast ...bool) (hasTimedOut bool, err error)

type FuturesWS_AllMiniTickers_Socket

type FuturesWS_AllMiniTickers_Socket struct {
	Handler *Futures_Websocket
}

func (*FuturesWS_AllMiniTickers_Socket) CreateStreamName

func (*FuturesWS_AllMiniTickers_Socket) CreateStreamName() string

func (*FuturesWS_AllMiniTickers_Socket) Subscribe

func (socket *FuturesWS_AllMiniTickers_Socket) Subscribe() (hasTimedOut bool, err error)

func (*FuturesWS_AllMiniTickers_Socket) Unsubscribe

func (socket *FuturesWS_AllMiniTickers_Socket) Unsubscribe() (hasTimedOut bool, err error)

type FuturesWS_AllMultiAssetsModeAssetIndexes_Socket

type FuturesWS_AllMultiAssetsModeAssetIndexes_Socket struct {
	Handler *Futures_Websocket
}

func (*FuturesWS_AllMultiAssetsModeAssetIndexes_Socket) CreateStreamName

func (*FuturesWS_AllMultiAssetsModeAssetIndexes_Socket) Subscribe

func (socket *FuturesWS_AllMultiAssetsModeAssetIndexes_Socket) Subscribe() (hasTimedOut bool, err error)

func (*FuturesWS_AllMultiAssetsModeAssetIndexes_Socket) Unsubscribe

func (socket *FuturesWS_AllMultiAssetsModeAssetIndexes_Socket) Unsubscribe() (hasTimedOut bool, err error)

type FuturesWS_AllTickers_Socket

type FuturesWS_AllTickers_Socket struct {
	Handler *Futures_Websocket
}

func (*FuturesWS_AllTickers_Socket) CreateStreamName

func (*FuturesWS_AllTickers_Socket) CreateStreamName() string

func (*FuturesWS_AllTickers_Socket) Subscribe

func (socket *FuturesWS_AllTickers_Socket) Subscribe() (hasTimedOut bool, err error)

func (*FuturesWS_AllTickers_Socket) Unsubscribe

func (socket *FuturesWS_AllTickers_Socket) Unsubscribe() (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) (hasTimedOut bool, err error)

func (*FuturesWS_BookTicker_Socket) Unsubscribe

func (socket *FuturesWS_BookTicker_Socket) Unsubscribe(symbol ...string) (hasTimedOut bool, err error)

type FuturesWS_Candlestick

type FuturesWS_Candlestick struct {

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

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

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

	Kline *FuturesWS_Candlestick_Kline `json:"k"`
}

type FuturesWS_Candlestick_Kline

type FuturesWS_Candlestick_Kline struct {

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

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

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

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

	// 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"`

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

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

	// 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"`
}

func (*FuturesWS_Candlestick_Kline) ParseFloat added in v0.1.5

type FuturesWS_Candlestick_Kline_f64 added in v0.1.5

type FuturesWS_Candlestick_Kline_f64 struct {

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

type FuturesWS_Candlestick_Params

type FuturesWS_Candlestick_Params struct {
	Symbol   string
	Interval string
}

type FuturesWS_Candlesticks_Socket

type FuturesWS_Candlesticks_Socket struct {
	Handler *Futures_Websocket
}

func (*FuturesWS_Candlesticks_Socket) CreateStreamName

func (*FuturesWS_Candlesticks_Socket) CreateStreamName(params ...FuturesWS_Candlestick_Params) []string

func (*FuturesWS_Candlesticks_Socket) Subscribe

func (socket *FuturesWS_Candlesticks_Socket) Subscribe(params ...FuturesWS_Candlestick_Params) (hasTimedOut bool, err error)

func (*FuturesWS_Candlesticks_Socket) Unsubscribe

func (socket *FuturesWS_Candlesticks_Socket) Unsubscribe(params ...FuturesWS_Candlestick_Params) (hasTimedOut bool, err error)

type FuturesWS_CompositeIndexSymbolInfo

type FuturesWS_CompositeIndexSymbolInfo struct {

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

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

	Symbol string `json:"s"`

	Price int64 `json:"p"`

	BaseAsset string `json:"C"`

	Composition []*FuturesWS_CompositeIndexSymbolInfo_Composition
}

type FuturesWS_CompositeIndexSymbolInfo_Composition

type FuturesWS_CompositeIndexSymbolInfo_Composition struct {

	// Base asset
	BaseAsset string `json:"b"`

	// Quote asset
	QuoteAsset string `json:"q"`

	// Weight in quantity
	Weight string `json:"w"`

	// Weight in percentage
	WeightPercent string `json:"W"`

	// Index Price
	IndexPrice string `json:"i"`
}

type FuturesWS_CompositeIndexSymbolInfo_Socket

type FuturesWS_CompositeIndexSymbolInfo_Socket struct {
	Handler *Futures_Websocket
}

func (*FuturesWS_CompositeIndexSymbolInfo_Socket) CreateStreamName

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

func (*FuturesWS_CompositeIndexSymbolInfo_Socket) Subscribe

func (socket *FuturesWS_CompositeIndexSymbolInfo_Socket) Subscribe(symbol ...string) (hasTimedOut bool, err error)

func (*FuturesWS_CompositeIndexSymbolInfo_Socket) Unsubscribe

func (socket *FuturesWS_CompositeIndexSymbolInfo_Socket) Unsubscribe(symbol ...string) (hasTimedOut bool, err error)

type FuturesWS_ConditionalOrderTriggerReject added in v0.1.5

type FuturesWS_ConditionalOrderTriggerReject struct {
	// "CONDITIONAL_ORDER_TRIGGER_REJECT"    // Event Type
	EventType string `json:"e"`

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

	// 1685517224955                         // Message Send Time
	MessageSendTime int64 `json:"T"`

	// { ... }                                // Order Reject Info
	Order FuturesWS_ConditionalOrderTriggerReject_Order `json:"or"`
}

type FuturesWS_ConditionalOrderTriggerReject_Order added in v0.1.5

type FuturesWS_ConditionalOrderTriggerReject_Order struct {
	// "ETHUSDT"                              // Symbol
	Symbol string `json:"s"`

	// 155618472834                           // Order ID
	OrderID int64 `json:"i"`

	// "Due to the order..."                  // Reject Reason
	RejectReason string `json:"r"`
}

type FuturesWS_ContinuousCandlestick

type FuturesWS_ContinuousCandlestick struct {

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

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

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

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

	Kline *FuturesWS_ContinuousCandlestick_Kline `json:"k"`
}

type FuturesWS_ContinuousCandlestick_Kline

type FuturesWS_ContinuousCandlestick_Kline struct {

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

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

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

	// First updateId
	FirstUpdateId int64 `json:"f"`

	// Last updateId
	LastUpdateId 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"`

	// volume
	Volume 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 volume
	TakerBuyVolume string `json:"V"`

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

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

type FuturesWS_ContinuousCandlestick_Params

type FuturesWS_ContinuousCandlestick_Params struct {
	Symbol       string
	ContractType string
	Interval     string
}

type FuturesWS_ContinuousCandlestick_Socket

type FuturesWS_ContinuousCandlestick_Socket struct {
	Handler *Futures_Websocket
}

func (*FuturesWS_ContinuousCandlestick_Socket) CreateStreamName

func (*FuturesWS_ContinuousCandlestick_Socket) Subscribe

func (socket *FuturesWS_ContinuousCandlestick_Socket) Subscribe(params ...FuturesWS_ContinuousCandlestick_Params) (hasTimedOut bool, err error)

func (*FuturesWS_ContinuousCandlestick_Socket) Unsubscribe

func (socket *FuturesWS_ContinuousCandlestick_Socket) Unsubscribe(params ...FuturesWS_ContinuousCandlestick_Params) (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() (hasTimedOut bool, err error)

func (*FuturesWS_ContractInfo_Socket) Unsubscribe

func (socket *FuturesWS_ContractInfo_Socket) Unsubscribe() (hasTimedOut bool, err error)

type FuturesWS_DiffBookDepth

type FuturesWS_DiffBookDepth struct {

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

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

	TransactTime int64 `json:"T"`

	Symbol string `json:"s"`

	FirstUpdateId int64 `json:"U"`

	LastUpdateId int64 `json:"u"`

	Previous_LastUpdateId int64 `json:"pu"`

	// Bids to be updated
	//
	// [
	//     [
	//       "7405.96",      // Price level to be
	//       "3.340"         // Quantity
	//     ],
	// ]
	Bids [][2]string `json:"b"`

	// Asks to be updated
	//
	// [
	//     [
	//       "7405.96",      // Price level to be
	//       "3.340"         // Quantity
	//     ],
	// ]
	Asks [][2]string `json:"a"`
}

type FuturesWS_DiffBookDepth_Params

type FuturesWS_DiffBookDepth_Params struct {
	Symbol string

	// Possible values: "500ms", "250ms" or "100ms"
	//
	// Default: "250ms"
	UpdateSpeed string
}

type FuturesWS_DiffBookDepth_Socket

type FuturesWS_DiffBookDepth_Socket struct {
	Handler *Futures_Websocket
}

func (*FuturesWS_DiffBookDepth_Socket) CreateStreamName

func (*FuturesWS_DiffBookDepth_Socket) Subscribe

func (socket *FuturesWS_DiffBookDepth_Socket) Subscribe(params ...FuturesWS_DiffBookDepth_Params) (hasTimedOut bool, err error)

func (*FuturesWS_DiffBookDepth_Socket) Unsubscribe

func (socket *FuturesWS_DiffBookDepth_Socket) Unsubscribe(params ...FuturesWS_DiffBookDepth_Params) (hasTimedOut bool, err error)

type FuturesWS_GridUpdate added in v0.1.5

type FuturesWS_GridUpdate struct {
	// "GRID_UPDATE"                 // Event Type
	EventType string `json:"e"`

	// 1669262908216                // Transaction Time
	TransactionTime int64 `json:"T"`

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

	// { ... }                      // Grid Update
	Grid FuturesWS_GridUpdate_Grid `json:"gu"`
}

type FuturesWS_GridUpdate_Grid added in v0.1.5

type FuturesWS_GridUpdate_Grid struct {
	// 176057039                    // Strategy ID
	StrategyID int64 `json:"si"`

	// "GRID"                       // Strategy Type
	StrategyType string `json:"st"`

	// "WORKING"                    // Strategy Status
	StrategyStatus string `json:"ss"`

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

	// "-0.00300716"                // Realized PNL
	RealizedPNL string `json:"r"`

	// "16720"                      // Unmatched Average Price
	UnmatchedAvgPrice string `json:"up"`

	// "-0.001"                     // Unmatched Qty
	UnmatchedQty string `json:"uq"`

	// "-0.00300716"                // Unmatched Fee
	UnmatchedFee string `json:"uf"`

	// "0.0"                        // Matched PNL
	MatchedPNL string `json:"mp"`

	// 1669262908197                // Update Time
	UpdateTime int64 `json:"ut"`
}

type FuturesWS_LiquidationOrder

type FuturesWS_LiquidationOrder struct {

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

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

	Type *FuturesWS_LiquidationOrder_Order `json:"o"`
}

type FuturesWS_LiquidationOrder_Order

type FuturesWS_LiquidationOrder_Order struct {

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

	// Side
	Side string `json:"S"`

	// Order Type
	Type string `json:"o"`

	// Time in Force
	TimeInForce string `json:"f"`

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

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

	// Average Price
	AvgPrice string `json:"ap"`

	// Order Status
	Status string `json:"X"`

	// Order Last Filled Quantity
	LastFilledQty string `json:"l"`

	// Order Filled Accumulated Quantity
	CumQty string `json:"z"`

	// Order Trade Time
	TradeTime int64 `json:"T"`
}

type FuturesWS_LiquidationOrder_Socket

type FuturesWS_LiquidationOrder_Socket struct {
	Handler *Futures_Websocket
}

func (*FuturesWS_LiquidationOrder_Socket) CreateStreamName

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

func (*FuturesWS_LiquidationOrder_Socket) Subscribe

func (socket *FuturesWS_LiquidationOrder_Socket) Subscribe(symbol ...string) (hasTimedOut bool, err error)

func (*FuturesWS_LiquidationOrder_Socket) Unsubscribe

func (socket *FuturesWS_LiquidationOrder_Socket) Unsubscribe(symbol ...string) (hasTimedOut bool, err error)

type FuturesWS_ListenKeyExpired added in v0.1.5

type FuturesWS_ListenKeyExpired struct {
	// "listenKeyExpired"        // Event type
	EventType string `json:"e"`

	// "1736996475556"           // Event time
	EventTime string `json:"E"`

	// "WsCMN0a4KHUPTQuX6IUnqEZfB1inxmv1qR4kbf1LuEjur5VdbzqvyxqG9TSjVVxv"
	ListenKey string `json:"listenKey"`
}

type FuturesWS_ManagedOrderBook_Handler

type FuturesWS_ManagedOrderBook_Handler struct {
	DiffBookDepth_Socket *FuturesWS_DiffBookDepth_Socket

	Orderbooks struct {
		Mu      sync.Mutex
		Symbols map[string]struct {
			Orderbook *FuturesWS_ManagedOrderbook
			// contains filtered or unexported fields
		}
	}
}

func (*FuturesWS_ManagedOrderBook_Handler) Subscribe

func (handler *FuturesWS_ManagedOrderBook_Handler) Subscribe(params ...FuturesWS_DiffBookDepth_Params) (hasTimedOut bool, err error)

func (*FuturesWS_ManagedOrderBook_Handler) Unsubscribe

func (handler *FuturesWS_ManagedOrderBook_Handler) Unsubscribe(params ...FuturesWS_DiffBookDepth_Params) (hasTimedOut bool, err error)

type FuturesWS_ManagedOrderbook added in v0.1.4

type FuturesWS_ManagedOrderbook struct {
	Symbol       string
	LastUpdateId int64
	Bids         [][2]float64
	Asks         [][2]float64
	// contains filtered or unexported fields
}

type FuturesWS_MarginCall added in v0.1.5

type FuturesWS_MarginCall struct {
	// "MARGIN_CALL"               // Event Type
	EventType string `json:"e"`

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

	// "3.16812045"                // Cross Wallet Balance
	CrossWalletBalance string `json:"cw"`

	// [ { ... } ]                 // Position(s) of Margin Call
	Positions []FuturesWS_MarginCall_Position `json:"p"`
}

type FuturesWS_MarginCall_Position added in v0.1.5

type FuturesWS_MarginCall_Position struct {
	// "ETHUSDT"                   // Symbol
	Symbol string `json:"s"`

	// "LONG"                      // Position Side
	PositionSide string `json:"ps"`

	// "1.327"                     // Position Amount
	PositionAmount string `json:"pa"`

	// "CROSSED"                   // Margin Type
	MarginType string `json:"mt"`

	// "0"                         // Isolated Wallet
	IsolatedWallet string `json:"iw"`

	// "187.17127"                 // Mark Price
	MarkPrice string `json:"mp"`

	// "-1.166074"                 // Unrealized PnL
	UnrealizedPnL string `json:"up"`

	// "1.614445"                  // Maintenance Margin Required
	MaintenanceMargin string `json:"mm"`
}

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(params ...FuturesWS_MarkPrice_Params) []string

func (*FuturesWS_MarkPrice_Socket) Subscribe

func (socket *FuturesWS_MarkPrice_Socket) Subscribe(params ...FuturesWS_MarkPrice_Params) (hasTimedOut bool, err error)

func (*FuturesWS_MarkPrice_Socket) Unsubscribe

func (socket *FuturesWS_MarkPrice_Socket) Unsubscribe(params ...FuturesWS_MarkPrice_Params) (hasTimedOut bool, err error)

type FuturesWS_MiniTicker

type FuturesWS_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 FuturesWS_MiniTicker_Socket

type FuturesWS_MiniTicker_Socket struct {
	Handler *Futures_Websocket
}

func (*FuturesWS_MiniTicker_Socket) CreateStreamName

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

func (*FuturesWS_MiniTicker_Socket) Subscribe

func (socket *FuturesWS_MiniTicker_Socket) Subscribe(symbol ...string) (hasTimedOut bool, err error)

func (*FuturesWS_MiniTicker_Socket) Unsubscribe

func (socket *FuturesWS_MiniTicker_Socket) Unsubscribe(symbol ...string) (hasTimedOut bool, err error)

type FuturesWS_MultiAssetsModeAssetIndex

type FuturesWS_MultiAssetsModeAssetIndex struct {
	Event string `json:"e"`

	EventTime int64 `json:"E"`

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

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

	// bid buffer
	BidBuffer string `json:"b"`

	// ask buffer
	AskBuffer string `json:"a"`

	// bid rate
	BidRate string `json:"B"`

	// ask rate
	AskRate string `json:"A"`

	// auto exchange bid buffer
	AutoExchange_BidBuffer string `json:"q"`

	// auto exchange ask buffer
	AutoExchange_AskBuffer string `json:"g"`

	// auto exchange bid rate
	AutoExchange_BidRate string `json:"Q"`

	// auto exchange ask rate
	AutoExchange_AskRate string `json:"G"`
}

type FuturesWS_MultiAssetsModeAssetIndex_Socket

type FuturesWS_MultiAssetsModeAssetIndex_Socket struct {
	Handler *Futures_Websocket
}

func (*FuturesWS_MultiAssetsModeAssetIndex_Socket) CreateStreamName

func (*FuturesWS_MultiAssetsModeAssetIndex_Socket) CreateStreamName(assetSymbol ...string) []string

func (*FuturesWS_MultiAssetsModeAssetIndex_Socket) Subscribe

func (socket *FuturesWS_MultiAssetsModeAssetIndex_Socket) Subscribe(assetSymbol ...string) (hasTimedOut bool, err error)

func (*FuturesWS_MultiAssetsModeAssetIndex_Socket) Unsubscribe

func (socket *FuturesWS_MultiAssetsModeAssetIndex_Socket) Unsubscribe(assetSymbol ...string) (hasTimedOut bool, err error)

type FuturesWS_OrderTradeUpdate added in v0.1.5

type FuturesWS_OrderTradeUpdate struct {
	// "ORDER_TRADE_UPDATE"         // Event Type
	EventType string `json:"e"`

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

	// 1568879465650                // Transaction Time
	TransactionTime int64 `json:"T"`

	// { ... }                      // Order Data
	Order FuturesWS_OrderTradeUpdate_Order `json:"o"`
}

type FuturesWS_OrderTradeUpdate_Order added in v0.1.5

type FuturesWS_OrderTradeUpdate_Order struct {
	// "BTCUSDT"                    // Symbol
	Symbol string `json:"s"`

	// "TEST"                       // Client Order Id
	ClientOrderID string `json:"c"`

	// "SELL"                       // Side
	Side string `json:"S"`

	// "TRAILING_STOP_MARKET"       // Order Type
	OrderType string `json:"o"`

	// "GTC"                        // Time in Force
	TimeInForce string `json:"f"`

	// "0.001"                      // Original Quantity
	OrigQty string `json:"q"`

	// "0"                          // Original Price
	OrigPrice string `json:"p"`

	// "0"                          // Average Price
	AvgPrice string `json:"ap"`

	// "7103.04"                    // Stop Price
	StopPrice string `json:"sp"`

	// "NEW"                        // Execution Type
	ExecutionType string `json:"x"`

	// "NEW"                        // Order Status
	OrderStatus string `json:"X"`

	// 8886774                      // Order Id
	OrderID int64 `json:"i"`

	// "0"                          // Order Last Filled Quantity
	LastFilledQty string `json:"l"`

	// "0"                          // Order Filled Accumulated Quantity
	CumulativeFilledQty string `json:"z"`

	// "0"                          // Last Filled Price
	LastFilledPrice string `json:"L"`

	// "USDT"                       // Commission Asset
	CommissionAsset string `json:"N"`

	// "0"                          // Commission
	Commission string `json:"n"`

	// 1568879465650                // Order Trade Time
	TradeTime int64 `json:"T"`

	// 0                            // Trade Id
	TradeID int64 `json:"t"`

	// "0"                          // Bids Notional
	BidNotional string `json:"b"`

	// "9.91"                       // Ask Notional
	AskNotional string `json:"a"`

	// false                        // Is this trade the maker side?
	IsMaker bool `json:"m"`

	// false                        // Is this reduce only
	IsReduceOnly bool `json:"R"`

	// "CONTRACT_PRICE"             // Stop Price Working Type
	WorkingType string `json:"wt"`

	// "TRAILING_STOP_MARKET"       // Original Order Type
	OriginalOrderType string `json:"ot"`

	// "LONG"                       // Position Side
	PositionSide string `json:"ps"`

	// false                        // If Close-All
	CloseAll bool `json:"cp"`

	// "7476.89"                    // Activation Price
	ActivationPrice string `json:"AP"`

	// "5.0"                        // Callback Rate
	CallbackRate string `json:"cr"`

	// false                        // Price protection
	PriceProtect bool `json:"pP"`

	// 0                            // Ignore
	IgnoreSI int `json:"si"`

	// 0                            // Ignore
	IgnoreSS int `json:"ss"`

	// "0"                          // Realized Profit
	RealizedProfit string `json:"rp"`

	// "EXPIRE_TAKER"               // STP mode
	STPMode string `json:"V"`

	// "OPPONENT"                   // Price match mode
	PriceMatchMode string `json:"pm"`

	// 0                            // GTD order auto cancel time
	GTDCancelTime int64 `json:"gtd"`
}

type FuturesWS_PartialBookDepth

type FuturesWS_PartialBookDepth struct {

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

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

	TransactTime int64 `json:"T"`

	Symbol string `json:"s"`

	FirstUpdateId int64 `json:"U"`

	LastUpdateId string `json:"u"`

	Previous_LastUpdateId string `json:"pu"`

	// Bids to be updated
	//
	// [
	//     [
	//       "7405.96",      // Price level to be
	//       "3.340"         // Quantity
	//     ],
	// ]
	Bids [][2]string `json:"b"`

	// Asks to be updated
	//
	// [
	//     [
	//       "7405.96",      // Price level to be
	//       "3.340"         // Quantity
	//     ],
	// ]
	Asks [][2]string `json:"a"`
}

type FuturesWS_PartialBookDepth_Params

type FuturesWS_PartialBookDepth_Params struct {
	Symbol string

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

	// Possible values: "500ms", "250ms" or "100ms"
	//
	// Default: "250ms"
	UpdateSpeed string
}

type FuturesWS_PartialBookDepth_Socket

type FuturesWS_PartialBookDepth_Socket struct {
	Handler *Futures_Websocket
}

func (*FuturesWS_PartialBookDepth_Socket) CreateStreamName

func (*FuturesWS_PartialBookDepth_Socket) Subscribe

func (socket *FuturesWS_PartialBookDepth_Socket) Subscribe(params ...FuturesWS_PartialBookDepth_Params) (hasTimedOut bool, err error)

func (*FuturesWS_PartialBookDepth_Socket) Unsubscribe

func (socket *FuturesWS_PartialBookDepth_Socket) Unsubscribe(params ...FuturesWS_PartialBookDepth_Params) (hasTimedOut bool, err error)

type FuturesWS_StrategyUpdate added in v0.1.5

type FuturesWS_StrategyUpdate struct {
	// "STRATEGY_UPDATE"            // Event Type
	EventType string `json:"e"`

	// 1669261797627                // Transaction Time
	TransactionTime int64 `json:"T"`

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

	// { ... }                      // Strategy Update
	Strategy FuturesWS_StrategyUpdate_Strategy `json:"su"`
}

type FuturesWS_StrategyUpdate_Strategy added in v0.1.5

type FuturesWS_StrategyUpdate_Strategy struct {
	// 176054594                    // Strategy ID
	StrategyID int64 `json:"si"`

	// "GRID"                       // Strategy Type
	StrategyType string `json:"st"`

	// "NEW"                        // Strategy Status
	StrategyStatus string `json:"ss"`

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

	// 1669261797627                // Update Time
	UpdateTime int64 `json:"ut"`

	// 8007                         // opCode
	OpCode int `json:"c"`
}

type FuturesWS_Ticker

type FuturesWS_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"`

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

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

	// 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 FuturesWS_Ticker_Socket

type FuturesWS_Ticker_Socket struct {
	Handler *Futures_Websocket
}

func (*FuturesWS_Ticker_Socket) CreateStreamName

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

func (*FuturesWS_Ticker_Socket) Subscribe

func (socket *FuturesWS_Ticker_Socket) Subscribe(symbol ...string) (hasTimedOut bool, err error)

func (*FuturesWS_Ticker_Socket) Unsubscribe

func (socket *FuturesWS_Ticker_Socket) Unsubscribe(symbol ...string) (hasTimedOut bool, err error)

type FuturesWS_TradeLite added in v0.1.5

type FuturesWS_TradeLite struct {
	// "TRADE_LITE"                 // Event Type
	EventType string `json:"e"`

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

	// 1721895408214                // Transaction Time
	TransactionTime int64 `json:"T"`

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

	// "0.001"                      // Original Quantity
	OrigQty string `json:"q"`

	// "0"                          // Original Price
	OrigPrice string `json:"p"`

	// false                        // Is this trade the maker side?
	IsMaker bool `json:"m"`

	// "z8hcUoOsqEdKMeKPSABslD"     // Client Order Id
	ClientOrderID string `json:"c"`

	// "BUY"                        // Side
	Side string `json:"S"`

	// "64089.20"                   // Last Filled Price
	LastFilledPrice string `json:"L"`

	// "0.040"                      // Order Last Filled Quantity
	LastFilledQty string `json:"l"`

	// 109100866                    // Trade Id
	TradeID int64 `json:"t"`

	// 8886774                      // Order Id
	OrderID int64 `json:"i"`
}

type FuturesWS_UserData_Socket added in v0.1.5

type FuturesWS_UserData_Socket struct {

	// Ignore since it shouldn't ever be called
	OnListenKeyExpired              func(*FuturesWS_ListenKeyExpired)
	OnAccountUpdate                 func(*FuturesWS_AccountUpdate)
	OnMarginCall                    func(*FuturesWS_MarginCall)
	OnOrderTradeUpdate              func(*FuturesWS_OrderTradeUpdate)
	OnTradeLite                     func(*FuturesWS_TradeLite)
	OnAccountConfigUpdate           func(*FuturesWS_AccountConfigUpdate)
	OnStrategyUpdate                func(*FuturesWS_StrategyUpdate)
	OnGridUpdate                    func(*FuturesWS_GridUpdate)
	OnConditionalOrderTriggerReject func(*FuturesWS_ConditionalOrderTriggerReject)

	// Only called if there is a new event that is not yet supported by the library
	OnUnknownEvent func(event string, msg []byte)

	OnMessage   func(messageType int, msg []byte)
	OnReconnect func()
	OnError     func(error)
	OnClose     func()
	// contains filtered or unexported fields
}

func (*FuturesWS_UserData_Socket) Close added in v0.1.5

func (socket *FuturesWS_UserData_Socket) Close()

func (*FuturesWS_UserData_Socket) RestartUserDataStream added in v0.1.5

func (socket *FuturesWS_UserData_Socket) RestartUserDataStream() error

type Futures_24hTicker

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

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

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

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

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

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
}

func (*Futures_Candlestick) ParseFloat added in v0.1.5

func (kline *Futures_Candlestick) ParseFloat() (*Futures_Candlestick_f64, error)

type Futures_Candlestick_f64 added in v0.1.5

type Futures_Candlestick_f64 struct {
	// Kline open time
	OpenTime int64
	// Open price
	Open float64
	// High price
	High float64
	// Low price
	Low float64
	// Close price
	Close float64
	// Volume
	Volume float64
	// Kline Close time
	CloseTime int64
	// Quote asset volume
	QuoteAssetVolume float64
	// Number of trades
	TradeCount int64
	// Taker buy base asset volume
	TakerBuyBaseAssetVolume float64
	// Taker buy quote asset volume
	TakerBuyQuoteAssetVolume float64
	// 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

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

type Futures_ChangeMarginType_Response

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

func (*Futures_ChangeMarginType_Response) IsAlreadyChanged

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

type Futures_ChangeMultiAssetsMode_Response

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

func (*Futures_ChangeMultiAssetsMode_Response) IsAlreadyChanged

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

type Futures_ChangePositionMode_Response

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

func (*Futures_ChangePositionMode_Response) IsAlreadyChanged

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

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 struct {
		Mu  sync.Mutex
		Map map[string]*Futures_Asset
	}
	Symbols struct {
		Mu  sync.Mutex
		Map map[string]*Futures_Symbol
	}
}

type Futures_ExchangeInfo_SORS

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

type Futures_FundingRate

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

type Futures_FundingRate_Params

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

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

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

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_MarginTypes_ENUM added in v0.1.2

type Futures_MarginTypes_ENUM struct {
	CROSSED  string
	ISOLATED string
}

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

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

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

type Futures_OpenInterestStatistics

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

type Futures_OpenInterestStatistics_Params

type Futures_OpenInterestStatistics_Params struct {
	Limit     int64
	StartTime int64
	EndTime   int64
}

type Futures_Order

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

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

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

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

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

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

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

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

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

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

func (*Futures_Symbol) TruncQuantity_float64

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_SymbolConfiguration

type Futures_SymbolConfiguration struct {
	Symbol           string `json:"symbol"`
	MarginType       string `json:"marginType"`
	IsAutoAddMargin  bool   `json:"isAutoAddMargin"`
	Leverage         int    `json:"leverage"`
	MaxNotionalValue string `json:"maxNotionalValue"`
}

type Futures_SymbolConfiguration_params

type Futures_SymbolConfiguration_params struct {
	Symbol     string
	RecvWindow int
}

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

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

type Futures_UserDataStream_ListenKey added in v0.1.5

type Futures_UserDataStream_ListenKey struct {
	// "pqia91ma19a5s61cv6a81va65sdf19v8a65a1a5s61cv6a81va65sdf19v8a65a1"
	ListenKey string `json:"listenKey"`
}

type Futures_WSAPI_Socket added in v0.1.3

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

func (*Futures_WSAPI_Socket) BookTicker added in v0.1.3

func (socket *Futures_WSAPI_Socket) BookTicker(symbol ...string) (bookTickers []*FuturesWSAPI_BookTicker, resp *websockets.BinanceWebsocketAPI_Response, err error)

func (*Futures_WSAPI_Socket) GetRateLimits added in v0.1.3

func (socket *Futures_WSAPI_Socket) GetRateLimits() []websockets.RateLimit

func (*Futures_WSAPI_Socket) OrderBook added in v0.1.3

func (socket *Futures_WSAPI_Socket) OrderBook(symbol string, limit ...int) (orderbook *FuturesWSAPI_OrderBook, resp *websockets.BinanceWebsocketAPI_Response, err error)

func (*Futures_WSAPI_Socket) PriceTicker added in v0.1.3

func (socket *Futures_WSAPI_Socket) PriceTicker(symbol ...string) (priceTickers []*FuturesWSAPI_PriceTicker, resp *websockets.BinanceWebsocketAPI_Response, err error)

type Futures_Websocket

type Futures_Websocket struct {

	// You can use this to register your own callback
	OnMessage func(messageType int, msg []byte)
	// You can use this to register your own callback
	OnReconnect func()
	// contains filtered or unexported fields
}

func (*Futures_Websocket) Close

func (futures_ws *Futures_Websocket) Close()

func (*Futures_Websocket) ListSubscriptions

func (futures_ws *Futures_Websocket) ListSubscriptions(timeout_sec ...int) (subscriptions []string, err error)

func (*Futures_Websocket) Subscribe

func (futures_ws *Futures_Websocket) Subscribe(stream ...string) (hasTimedOut bool, err error)

func (*Futures_Websocket) Unsubscribe

func (futures_ws *Futures_Websocket) Unsubscribe(stream ...string) (hasTimedOut bool, err error)

type Futures_WebsocketAPI added in v0.1.3

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

func (*Futures_WebsocketAPI) NewWebsocketAPI added in v0.1.3

func (futures_WSAPI *Futures_WebsocketAPI) NewWebsocketAPI() (*Futures_WSAPI_Socket, error)

type Futures_WebsocketAPI_Constants added in v0.1.3

type Futures_WebsocketAPI_Constants struct {
	URL         string
	Testnet_URL string

	DefaultRequestTimeout_sec int
}

type Futures_Websocket_Constants

type Futures_Websocket_Constants struct {
	URLs []string
}

type Futures_WorkingTypes_ENUM

type Futures_WorkingTypes_ENUM struct {
	MARK_PRICE     string
	CONTRACT_PRICE string
}

type GoLogger

type GoLogger struct {
	PrintLogsLevel int

	LogLevel int
	LogFile  string
	// contains filtered or unexported fields
}

func (*GoLogger) DEBUG

func (logger *GoLogger) DEBUG(message string, err ...error)

func (*GoLogger) Disable

func (logger *GoLogger) Disable()

func (*GoLogger) ERROR

func (logger *GoLogger) ERROR(message string, err ...error)

func (*GoLogger) Enable

func (logger *GoLogger) Enable()

func (*GoLogger) IMPORTANT

func (logger *GoLogger) IMPORTANT(message string, err ...error)

func (*GoLogger) INFO

func (logger *GoLogger) INFO(message string, err ...error)

func (*GoLogger) SHOULDNT_HAPPEN

func (logger *GoLogger) SHOULDNT_HAPPEN(message string, err ...error)

func (*GoLogger) WARN

func (logger *GoLogger) WARN(message string, err ...error)

type Methods

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

type Options added in v0.1.5

type Options struct {
	// This sets the default recvWindow of the Binance instance
	RecvWindow int64

	// This is the timestamp offset that will be used throughout the Binance instance.
	//
	// Any signed request that requires a timestamp will add the Timestamp_offset value
	//
	// Used in the case of out-of-sync time clocks
	Timestamp_offset int64
}

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

	// This is added by the 'Binance-Go' library
	// It is simply the elapsed time between sending the request and receiving the response
	Latency int64

	// 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) GetLatency

func (resp *Response) GetLatency() (latency int64, err error)

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

func (*Response) WaitUsedWeight

func (resp *Response) WaitUsedWeight(interval string, weightLimit int64, nextRequestWeight ...int64) error

Extracts the used weight and the request time

If the used weight EXCEEDS "weightLimit"

It will wait until the next reset time before returning from the function call

In short, after each request, call this function, if the returned error is nil, you're free to continue with your next request

Usual interval used by binance is "1m"

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 {
	Websockets   spot_ws
	WebsocketAPI Spot_WebsocketAPI
	// 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) Close_UserData_ListenKey added in v0.1.5

func (spot *Spot) Close_UserData_ListenKey(listenKey string) (*Response, *Error)

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) KeepAlive_UserData_ListenKey added in v0.1.5

func (spot *Spot) KeepAlive_UserData_ListenKey(listenKey string) (*Response, *Error)

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, 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, 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, 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) StartUserDataStream added in v0.1.5

func (spot *Spot) StartUserDataStream() (string, *Response, *Error)

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 SpotWSAPI_Ping added in v0.1.3

type SpotWSAPI_Ping struct {
	// roundtrip time of the request in milliseconds
	Latency int64
}

type SpotWSAPI_ServerTime added in v0.1.3

type SpotWSAPI_ServerTime struct {
	ServerTime int64
	// roundtrip time of the request in milliseconds
	Latency int64
}

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 {
	Socket *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) (hasTimedOut bool, err error)

func (*SpotWS_AggTrade_Socket) Unsubscribe

func (socket *SpotWS_AggTrade_Socket) Unsubscribe(symbol ...string) (hasTimedOut bool, err error)

type SpotWS_AllMiniTickers_Socket

type SpotWS_AllMiniTickers_Socket struct {
	Socket *Spot_Websocket
}

func (*SpotWS_AllMiniTickers_Socket) CreateStreamName

func (*SpotWS_AllMiniTickers_Socket) CreateStreamName() string

func (*SpotWS_AllMiniTickers_Socket) Subscribe

func (socket *SpotWS_AllMiniTickers_Socket) Subscribe() (hasTimedOut bool, err error)

func (*SpotWS_AllMiniTickers_Socket) Unsubscribe

func (socket *SpotWS_AllMiniTickers_Socket) Unsubscribe() (hasTimedOut bool, err error)

type SpotWS_AllRollingWindowStatistics_Socket

type SpotWS_AllRollingWindowStatistics_Socket struct {
	Socket *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) (hasTimedOut bool, err error)

func (*SpotWS_AllRollingWindowStatistics_Socket) Unsubscribe

func (socket *SpotWS_AllRollingWindowStatistics_Socket) Unsubscribe(WindowSize ...string) (hasTimedOut bool, err error)

type SpotWS_AllTickers_Socket

type SpotWS_AllTickers_Socket struct {
	Socket *Spot_Websocket
}

func (*SpotWS_AllTickers_Socket) CreateStreamName

func (*SpotWS_AllTickers_Socket) CreateStreamName() string

func (*SpotWS_AllTickers_Socket) Subscribe

func (socket *SpotWS_AllTickers_Socket) Subscribe() (hasTimedOut bool, err error)

func (*SpotWS_AllTickers_Socket) Unsubscribe

func (socket *SpotWS_AllTickers_Socket) Unsubscribe() (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 {
	Socket *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) (hasTimedOut bool, err error)

func (*SpotWS_AveragePrice_Socket) Unsubscribe

func (socket *SpotWS_AveragePrice_Socket) Unsubscribe(symbol ...string) (hasTimedOut bool, err error)

type SpotWS_BalanceUpdate added in v0.1.5

type SpotWS_BalanceUpdate struct {
	// "balanceUpdate"           // Event Type
	Event string `json:"e"`

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

	// "BTC"                     // Asset
	Asset string `json:"a"`

	// "100.00000000"            // Balance Delta
	Delta string `json:"d"`

	// 1573200697068             // Clear Time
	ClearTime int64 `json:"T"`
}

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 {
	Socket *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) (hasTimedOut bool, err error)

func (*SpotWS_BookTicker_Socket) Unsubscribe

func (socket *SpotWS_BookTicker_Socket) Unsubscribe(symbol ...string) (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 {
	Socket *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) (hasTimedOut bool, err error)

func (*SpotWS_Candlestick_Socket) Unsubscribe

func (socket *SpotWS_Candlestick_Socket) Unsubscribe(identifiers ...SpotWS_Candlestick_StreamIdentifier) (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 {
	Socket *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) (hasTimedOut bool, err error)

func (*SpotWS_Candlestick_TimezoneOffset_Socket) Unsubscribe

func (socket *SpotWS_Candlestick_TimezoneOffset_Socket) Unsubscribe(identifiers ...SpotWS_Candlestick_StreamIdentifier) (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 {
	Socket *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) (hasTimedOut bool, err error)

func (*SpotWS_DiffBookDepth_Socket) Unsubscribe

func (socket *SpotWS_DiffBookDepth_Socket) Unsubscribe(identifiers ...SpotWS_DiffBookDepth_StreamIdentifier) (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_EventStreamTerminated added in v0.1.5

type SpotWS_EventStreamTerminated struct {
	// { "e": "eventStreamTerminated", "E": 1728973001334 }
	Event SpotWS_EventStreamTerminated_Event `json:"event"`
}

type SpotWS_EventStreamTerminated_Event added in v0.1.5

type SpotWS_EventStreamTerminated_Event struct {
	// "eventStreamTerminated"   // Event Type
	Event string `json:"e"`

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

type SpotWS_ExecutionReport added in v0.1.5

type SpotWS_ExecutionReport struct {
	// "executionReport"          // Event type
	Event string `json:"e"`

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

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

	// "mUvoqJxFIILMdfAW5iGSOW"   // Client order ID
	ClientOrderID string `json:"c"`

	// "BUY"                      // Side
	Side string `json:"S"`

	// "LIMIT"                    // Order type
	OrderType string `json:"o"`

	// "GTC"                      // Time in force
	TimeInForce string `json:"f"`

	// "1.00000000"               // Order quantity
	Quantity string `json:"q"`

	// "0.10264410"               // Order price
	Price string `json:"p"`

	// "0.00000000"               // Stop price
	StopPrice string `json:"P"`

	// "0.00000000"               // Iceberg quantity
	IcebergQty string `json:"F"`

	// -1                         // OrderListId
	OrderListID int64 `json:"g"`

	// ""                         // Original client order ID
	OrigClientOrderID string `json:"C"`

	// "NEW"                      // Current execution type
	ExecutionType string `json:"x"`

	// "NEW"                      // Current order status
	OrderStatus string `json:"X"`

	// "NONE"                     // Order reject reason
	RejectReason string `json:"r"`

	// 4293153                    // Order ID
	OrderID int64 `json:"i"`

	// "0.00000000"               // Last executed quantity
	LastExecutedQty string `json:"l"`

	// "0.00000000"               // Cumulative filled quantity
	CumulativeFilledQty string `json:"z"`

	// "0.00000000"               // Last executed price
	LastExecutedPrice string `json:"L"`

	// "0"                        // Commission amount
	Commission string `json:"n"`

	// null                       // Commission asset
	CommissionAsset *string `json:"N"`

	// 1499405658657              // Transaction time
	TransactionTime int64 `json:"T"`

	// -1                         // Trade ID
	TradeID int64 `json:"t"`

	// 3                          // Prevented Match Id
	PreventedMatchID int64 `json:"v"`

	// 8641984                    // Execution Id
	ExecutionID int64 `json:"I"`

	// true                       // Is the order on the book?
	IsOnBook bool `json:"w"`

	// false                      // Is this trade the maker side?
	IsMaker bool `json:"m"`

	// false                      // Ignore
	Ignore bool `json:"M"`

	// 1499405658657              // Order creation time
	OrderCreationTime int64 `json:"O"`

	// "0.00000000"               // Cumulative quote asset transacted quantity
	CumulativeQuoteQty string `json:"Z"`

	// "0.00000000"               // Last quote asset transacted quantity
	LastQuoteQty string `json:"Y"`

	// "0.00000000"               // Quote Order Quantity
	QuoteOrderQty string `json:"Q"`

	// 1499405658657              // Working Time
	WorkingTime int64 `json:"W"`

	// "NONE"                     // SelfTradePreventionMode
	SelfTradePreventionMode string `json:"V"`
}

type SpotWS_ExternalLockUpdate added in v0.1.5

type SpotWS_ExternalLockUpdate struct {
	// "externalLockUpdate"     // Event Type
	Event string `json:"e"`

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

	// "NEO"                    // Asset
	Asset string `json:"a"`

	// "10.00000000"            // Delta
	Delta string `json:"d"`

	// 1581557507268            // Transaction Time
	TransactionTime int64 `json:"T"`
}

type SpotWS_ListStatus added in v0.1.5

type SpotWS_ListStatus struct {
	// "listStatus"                // Event Type
	Event string `json:"e"`

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

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

	// 2                          // OrderListId
	OrderListID int64 `json:"g"`

	// "OCO"                      // Contingency Type
	ContingencyType string `json:"c"`

	// "EXEC_STARTED"             // List Status Type
	ListStatusType string `json:"l"`

	// "EXECUTING"                // List Order Status
	ListOrderStatus string `json:"L"`

	// "NONE"                     // List Reject Reason
	ListRejectReason string `json:"r"`

	// "F4QN4G8DlFATFlIUQ0cjdD"   // List Client Order ID
	ListClientOrderID string `json:"C"`

	// 1564035303625              // Transaction Time
	TransactionTime int64 `json:"T"`

	// [ { ... }, { ... } ]       // An array of objects
	Orders []SpotWS_ListStatus_Order `json:"O"`
}

type SpotWS_ListStatus_Order added in v0.1.5

type SpotWS_ListStatus_Order struct {
	// "ETHBTC"                   // Symbol
	Symbol string `json:"s"`

	// 17                         // OrderId
	OrderID int64 `json:"i"`

	// "AJYsMjErWJesZvqlJCTUgL"   // ClientOrderId
	ClientOrderID string `json:"c"`
}

type SpotWS_ListenKeyExpired added in v0.1.5

type SpotWS_ListenKeyExpired struct {
	// "listenKeyExpired"      // Event type
	Event string `json:"e"`

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

	// "OfYGbUzi3PraNagEkdKuFwUHn48brFsItTdsuiIXrucEvD0rhRXZ7I6URWfE8YE8"
	ListenKey string `json:"listenKey"`
}

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 {
	Socket *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) (hasTimedOut bool, err error)

func (*SpotWS_MiniTicker_Socket) Unsubscribe

func (socket *SpotWS_MiniTicker_Socket) Unsubscribe(symbol ...string) (hasTimedOut bool, err error)

type SpotWS_OutboundAccountPosition added in v0.1.5

type SpotWS_OutboundAccountPosition struct {
	// "outboundAccountPosition"   // Event type
	Event string `json:"e"`

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

	// 1564034571073               // Time of last account update
	LastUpdateTime int64 `json:"u"`

	// [ { "a": "ETH", "f": "10000.000000", "l": "0.000000" } ]   // Balances Array
	Balances []SpotWS_OutboundAccountPosition_Balance `json:"B"`
}

type SpotWS_OutboundAccountPosition_Balance added in v0.1.5

type SpotWS_OutboundAccountPosition_Balance struct {
	// "ETH"       // Asset
	Asset string `json:"a"`

	// "10000.000000"   // Free
	Free string `json:"f"`

	// "0.000000"       // Locked
	Locked string `json:"l"`
}

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 {
	Socket *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) (hasTimedOut bool, err error)

func (*SpotWS_PartialBookDepth_Socket) Unsubscribe

func (socket *SpotWS_PartialBookDepth_Socket) Unsubscribe(identifiers ...SpotWS_PartialBookDepth_StreamIdentifier) (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_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 {
	Socket *Spot_Websocket
}

func (*SpotWS_RollingWindowStatistics_Socket) CreateStreamName

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

func (*SpotWS_RollingWindowStatistics_Socket) Subscribe

func (socket *SpotWS_RollingWindowStatistics_Socket) Subscribe(identifiers ...SpotWS_RollingWindowStatistics_StreamIdentifier) (hasTimedOut bool, err error)

func (*SpotWS_RollingWindowStatistics_Socket) Unsubscribe

func (socket *SpotWS_RollingWindowStatistics_Socket) Unsubscribe(identifiers ...SpotWS_RollingWindowStatistics_StreamIdentifier) (hasTimedOut bool, err error)

type SpotWS_RollingWindowStatistics_StreamIdentifier

type SpotWS_RollingWindowStatistics_StreamIdentifier struct {
	Symbol     string
	WindowSize string
}

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 {
	Socket *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) (hasTimedOut bool, err error)

func (*SpotWS_Ticker_Socket) Unsubscribe

func (socket *SpotWS_Ticker_Socket) Unsubscribe(symbol ...string) (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 {
	Socket *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) (hasTimedOut bool, err error)

func (*SpotWS_Trade_Socket) Unsubscribe

func (socket *SpotWS_Trade_Socket) Unsubscribe(symbol ...string) (hasTimedOut bool, err error)

type SpotWS_UserData_Socket added in v0.1.5

type SpotWS_UserData_Socket struct {
	OnOutboundAccountPosition func(*SpotWS_OutboundAccountPosition)
	OnBalanceUpdate           func(*SpotWS_BalanceUpdate)
	OnExecutionReport         func(*SpotWS_ExecutionReport)
	OnListStatus              func(*SpotWS_ListStatus)
	// Ignore since it shouldn't ever be called
	OnListenKeyExpired func(*SpotWS_ListenKeyExpired)
	// Ignore since it shouldn't ever be called
	OnEventStreamterminated func(*SpotWS_EventStreamTerminated)
	OnExternalLockUpdate    func(*SpotWS_ExternalLockUpdate)

	// Only called if there is a new event that is not yet supported by the library
	OnUnknownEvent func(event string, msg []byte)

	OnMessage   func(messageType int, msg []byte)
	OnReconnect func()
	OnError     func(error)
	OnClose     func()
	// contains filtered or unexported fields
}

func (*SpotWS_UserData_Socket) Close added in v0.1.5

func (socket *SpotWS_UserData_Socket) Close()

func (*SpotWS_UserData_Socket) RestartUserDataStream added in v0.1.5

func (socket *SpotWS_UserData_Socket) RestartUserDataStream() error

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         struct {
		Mu  sync.Mutex
		Map 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

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

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

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

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

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

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

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

func (*Spot_Symbol) TruncQuantity_float64

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_UserDataStream_ListenKey added in v0.1.5

type Spot_UserDataStream_ListenKey struct {
	// "pqia91ma19a5s61cv6a81va65sdf19v8a65a1a5s61cv6a81va65sdf19v8a65a1"
	ListenKey string `json:"listenKey"`
}

type Spot_Websocket

type Spot_Websocket struct {

	// You can use this to register your own callback
	OnMessage func(messageType int, msg []byte)
	// You can use this to register your own callback
	OnReconnect func()
	// contains filtered or unexported fields
}

func (*Spot_Websocket) Close

func (spot_ws *Spot_Websocket) Close()

func (*Spot_Websocket) ListSubscriptions

func (spot_ws *Spot_Websocket) ListSubscriptions(timeout_sec ...int) (subscriptions []string, err error)

func (*Spot_Websocket) Subscribe

func (spot_ws *Spot_Websocket) Subscribe(stream ...string) (hasTimedOut bool, err error)

func (*Spot_Websocket) Unsubscribe

func (spot_ws *Spot_Websocket) Unsubscribe(stream ...string) (hasTimedOut bool, err error)

type Spot_WebsocketAPI

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

func (*Spot_WebsocketAPI) NewWebsocketAPI added in v0.1.3

func (spot_WSAPI *Spot_WebsocketAPI) NewWebsocketAPI() (*spot_WSAPI_Socket, error)

type Spot_WebsocketAPI_Constants

type Spot_WebsocketAPI_Constants struct {
	URLs        []string
	Testnet_URL string

	DefaultRequestTimeout_sec int
}

type Spot_Websocket_Constants

type Spot_Websocket_Constants struct {
	URLs                      []string
	MARKET_DATA_ONLY_ENDPOINT string
}

type Spot_WorkingFloors_ENUM

type Spot_WorkingFloors_ENUM struct {
	EXCHANGE string
	SOR      string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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