binance

package module
v0.0.0-...-9fe13e8 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2020 License: MIT Imports: 18 Imported by: 0

README

go-binance

A Golang SDK for binance API.

Build Status GoDoc Go Report Card codecov

All the REST APIs listed in binance API document are implemented, as well as the websocket APIs.

For best compatibility, please use Go >= 1.8.

Make sure you have read binance API document before continuing.

API List

Name Description Status
rest-api.md Details on the Rest API (/api) Implemented
web-socket-streams.md Details on available streams and payloads Implemented
user-data-stream.md Details on the dedicated account stream Implemented
wapi-api.md Details on the Withdrawal API (/wapi) Partially Implemented
margin-api.md Details on the Margin API (/sapi) Implemented
futures-api.md Details on the Futures API (/fapi) Partially Implemented

Installation

go get github.com/adshao/go-binance

Importing

import (
    "github.com/adshao/go-binance"
)

Documentation

GoDoc

REST API

Setup

Init client for API services. Get APIKey/SecretKey from your binance account.

var (
    apiKey = "your api key"
    secretKey = "your secret key"
)
client := binance.NewClient(apiKey, secretKey)
futuresClient := binance.NewFuturesClient(apiKey, secretKey)

A service instance stands for a REST API endpoint and is initialized by client.NewXXXService function.

Simply call API in chain style. Call Do() in the end to send HTTP request.

Following are some simple examples, please refer to godoc for full references.

Create Order

order, err := client.NewCreateOrderService().Symbol("BNBETH").
        Side(binance.SideTypeBuy).Type(binance.OrderTypeLimit).
        TimeInForce(binance.TimeInForceTypeGTC).Quantity("5").
        Price("0.0030000").Do(context.Background())
if err != nil {
    fmt.Println(err)
    return
}
fmt.Println(order)

// Use Test() instead of Do() for testing.

Get Order

order, err := client.NewGetOrderService().Symbol("BNBETH").
    OrderID(4432844).Do(context.Background())
if err != nil {
    fmt.Println(err)
    return
}
fmt.Println(order)

Cancel Order

_, err := client.NewCancelOrderService().Symbol("BNBETH").
    OrderID(4432844).Do(context.Background())
if err != nil {
    fmt.Println(err)
    return
}

List Open Orders

openOrders, err := client.NewListOpenOrdersService().Symbol("BNBETH").
    Do(context.Background())
if err != nil {
    fmt.Println(err)
    return
}
for _, o := range openOrders {
    fmt.Println(o)
}

List Orders

orders, err := client.NewListOrdersService().Symbol("BNBETH").
    Do(context.Background())
if err != nil {
    fmt.Println(err)
    return
}
for _, o := range orders {
    fmt.Println(o)
}

List Ticker Prices

prices, err := client.NewListPricesService().Do(context.Background())
if err != nil {
    fmt.Println(err)
    return
}
for _, p := range prices {
    fmt.Println(p)
}

Show Depth

res, err := client.NewDepthService().Symbol("LTCBTC").
    Do(context.Background())
if err != nil {
    fmt.Println(err)
    return
}
fmt.Println(res)

List Klines

klines, err := client.NewKlinesService().Symbol("LTCBTC").
    Interval("15m").Do(context.Background())
if err != nil {
    fmt.Println(err)
    return
}
for _, k := range klines {
    fmt.Println(k)
}

List Aggregate Trades

trades, err := client.NewAggTradesService().
    Symbol("LTCBTC").StartTime(1508673256594).EndTime(1508673256595).
    Do(context.Background())
if err != nil {
    fmt.Println(err)
    return
}
for _, t := range trades {
    fmt.Println(t)
}

Get Account

res, err := client.NewGetAccountService().Do(context.Background())
if err != nil {
    fmt.Println(err)
    return
}
fmt.Println(res)

Start User Stream

res, err := client.NewStartUserStreamService().Do(context.Background())
if err != nil {
    fmt.Println(err)
    return
}
fmt.Println(res)

Websocket

You don't need Client in websocket API. Just call binance.WsXxxServe(args, handler, errHandler).

Depth

wsDepthHandler := func(event *binance.WsDepthEvent) {
    fmt.Println(event)
}
errHandler := func(err error) {
    fmt.Println(err)
}
doneC, stopC, err := binance.WsDepthServe("LTCBTC", wsDepthHandler, errHandler)
if err != nil {
    fmt.Println(err)
    return
}
// use stopC to exit
go func() {
    time.Sleep(5 * time.Second)
    stopC <- struct{}{}
}()
// remove this if you do not want to be blocked here
<-doneC

Kline

wsKlineHandler := func(event *binance.WsKlineEvent) {
    fmt.Println(event)
}
errHandler := func(err error) {
    fmt.Println(err)
}
doneC, _, err := binance.WsKlineServe("LTCBTC", "1m", wsKlineHandler, errHandler)
if err != nil {
    fmt.Println(err)
    return
}
<-doneC

Aggregate

wsAggTradeHandler := func(event *binance.WsAggTradeEvent) {
    fmt.Println(event)
}
errHandler := func(err error) {
    fmt.Println(err)
}
doneC, _, err := binance.WsAggTradeServe("LTCBTC", wsAggTradeHandler, errHandler)
if err != nil {
    fmt.Println(err)
    return
}
<-doneC

User Data

wsHandler := func(message []byte) {
    fmt.Println(string(message))
}
errHandler := func(err error) {
    fmt.Println(err)
}
doneC, _, err := binance.WsUserDataServe(listenKey, wsHandler, errHandler)
if err != nil {
    fmt.Println(err)
    return
}
<-doneC

Documentation

Overview

Package binance is a Golang SDK for binance APIs.

Index

Constants

View Source
const (
	SideTypeBuy  SideType = "BUY"
	SideTypeSell SideType = "SELL"

	OrderTypeLimit           OrderType = "LIMIT"
	OrderTypeMarket          OrderType = "MARKET"
	OrderTypeLimitMaker      OrderType = "LIMIT_MAKER"
	OrderTypeStopLoss        OrderType = "STOP_LOSS"
	OrderTypeStopLossLimit   OrderType = "STOP_LOSS_LIMIT"
	OrderTypeTakeProfit      OrderType = "TAKE_PROFIT"
	OrderTypeTakeProfitLimit OrderType = "TAKE_PROFIT_LIMIT"

	TimeInForceTypeGTC TimeInForceType = "GTC"
	TimeInForceTypeIOC TimeInForceType = "IOC"
	TimeInForceTypeFOK TimeInForceType = "FOK"

	NewOrderRespTypeACK    NewOrderRespType = "ACK"
	NewOrderRespTypeRESULT NewOrderRespType = "RESULT"
	NewOrderRespTypeFULL   NewOrderRespType = "FULL"

	OrderStatusTypeNew             OrderStatusType = "NEW"
	OrderStatusTypePartiallyFilled OrderStatusType = "PARTIALLY_FILLED"
	OrderStatusTypeFilled          OrderStatusType = "FILLED"
	OrderStatusTypeCanceled        OrderStatusType = "CANCELED"
	OrderStatusTypePendingCancel   OrderStatusType = "PENDING_CANCEL"
	OrderStatusTypeRejected        OrderStatusType = "REJECTED"
	OrderStatusTypeExpired         OrderStatusType = "EXPIRED"

	SymbolTypeSpot SymbolType = "SPOT"

	SymbolStatusTypePreTrading   SymbolStatusType = "PRE_TRADING"
	SymbolStatusTypeTrading      SymbolStatusType = "TRADING"
	SymbolStatusTypePostTrading  SymbolStatusType = "POST_TRADING"
	SymbolStatusTypeEndOfDay     SymbolStatusType = "END_OF_DAY"
	SymbolStatusTypeHalt         SymbolStatusType = "HALT"
	SymbolStatusTypeAuctionMatch SymbolStatusType = "AUCTION_MATCH"
	SymbolStatusTypeBreak        SymbolStatusType = "BREAK"

	SymbolFilterTypeLotSize          SymbolFilterType = "LOT_SIZE"
	SymbolFilterTypePriceFilter      SymbolFilterType = "PRICE_FILTER"
	SymbolFilterTypePercentPrice     SymbolFilterType = "PERCENT_PRICE"
	SymbolFilterTypeMinNotional      SymbolFilterType = "MIN_NOTIONAL"
	SymbolFilterTypeIcebergParts     SymbolFilterType = "ICEBERG_PARTS"
	SymbolFilterTypeMarketLotSize    SymbolFilterType = "MARKET_LOT_SIZE"
	SymbolFilterTypeMaxNumAlgoOrders SymbolFilterType = "MAX_NUM_ALGO_ORDERS"

	MarginTransferTypeToMargin MarginTransferType = 1
	MarginTransferTypeToMain   MarginTransferType = 2

	FuturesTransferTypeToFutures FuturesTransferType = 1
	FuturesTransferTypeToMain    FuturesTransferType = 2

	MarginLoanStatusTypePending   MarginLoanStatusType = "PENDING"
	MarginLoanStatusTypeConfirmed MarginLoanStatusType = "CONFIRMED"
	MarginLoanStatusTypeFailed    MarginLoanStatusType = "FAILED"

	MarginRepayStatusTypePending   MarginRepayStatusType = "PENDING"
	MarginRepayStatusTypeConfirmed MarginRepayStatusType = "CONFIRMED"
	MarginRepayStatusTypeFailed    MarginRepayStatusType = "FAILED"

	FuturesTransferStatusTypePending   FuturesTransferStatusType = "PENDING"
	FuturesTransferStatusTypeConfirmed FuturesTransferStatusType = "CONFIRMED"
	FuturesTransferStatusTypeFailed    FuturesTransferStatusType = "FAILED"

	SideEffectTypeNoSideEffect SideEffectType = "NO_SIDE_EFFECT"
	SideEffectTypeMarginBuy    SideEffectType = "MARGIN_BUY"
	SideEffectTypeAutoRepay    SideEffectType = "AUTO_REPAY"
)

Global enums

Variables

View Source
var (

	// WebsocketTimeout is an interval for sending ping/pong messages if WebsocketKeepalive is enabled
	WebsocketTimeout = time.Second * 60
	// WebsocketKeepalive enables sending ping/pong messages to check the connection stability
	WebsocketKeepalive = false
)

Functions

func NewFuturesClient

func NewFuturesClient(apiKey, secretKey string) *futures.Client

NewFuturesClient initialize client for futures API

func WsAggTradeServe

func WsAggTradeServe(symbol string, handler WsAggTradeHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)

WsAggTradeServe serve websocket aggregate handler with a symbol

func WsAllMarketsStatServe

func WsAllMarketsStatServe(handler WsAllMarketsStatHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)

WsAllMarketsStatServe serve websocket that push 24hr statistics for all market every second

func WsAllMiniMarketsStatServe

func WsAllMiniMarketsStatServe(handler WsAllMiniMarketsStatServeHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)

WsAllMiniMarketsStatServe serve websocket that push mini version of 24hr statistics for all market every second

func WsCombinedPartialDepthServe

func WsCombinedPartialDepthServe(symbolLevels map[string]string, handler WsPartialDepthHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)

WsCombinedPartialDepthServe is similar to WsPartialDepthServe, but it for multiple symbols

func WsDepthServe

func WsDepthServe(symbol string, handler WsDepthHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)

WsDepthServe serve websocket depth handler with a symbol

func WsFutureUserDataServe

func WsFutureUserDataServe(listenKey string, handler WsHandler, errHandler ErrHandler, wsConfig ...*WsConfig) (doneC, stopC chan struct{}, err error)

WsFutureUserDataServe serve user data handler with listen key

func WsKlineServe

func WsKlineServe(symbol string, interval string, handler WsKlineHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)

WsKlineServe serve websocket kline handler with a symbol and interval like 15m, 30s

func WsMarketStatServe

func WsMarketStatServe(symbol string, handler WsMarketStatHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)

WsMarketStatServe serve websocket that push 24hr statistics for single market every second

func WsPartialDepthServe

func WsPartialDepthServe(symbol string, levels string, handler WsPartialDepthHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)

WsPartialDepthServe serve websocket partial depth handler with a symbol

func WsTradeServe

func WsTradeServe(symbol string, handler WsTradeHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)

WsTradeServe serve websocket handler with a symbol

func WsUserDataServe

func WsUserDataServe(listenKey string, handler WsHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)

WsUserDataServe serve user data handler with listen key

Types

type Account

type Account struct {
	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"`
	Balances         []Balance `json:"balances"`
}

Account define account info

type AggTrade

type AggTrade struct {
	AggTradeID       int64  `json:"a"`
	Price            string `json:"p"`
	Quantity         string `json:"q"`
	FirstTradeID     int64  `json:"f"`
	LastTradeID      int64  `json:"l"`
	Timestamp        int64  `json:"T"`
	IsBuyerMaker     bool   `json:"m"`
	IsBestPriceMatch bool   `json:"M"`
}

AggTrade define aggregate trade info

type AggTradesService

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

AggTradesService list aggregate trades

func (*AggTradesService) Do

func (s *AggTradesService) Do(ctx context.Context, opts ...RequestOption) (res []*AggTrade, err error)

Do send request

func (*AggTradesService) EndTime

func (s *AggTradesService) EndTime(endTime int64) *AggTradesService

EndTime set endTime

func (*AggTradesService) FromID

func (s *AggTradesService) FromID(fromID int64) *AggTradesService

FromID set fromID

func (*AggTradesService) Limit

func (s *AggTradesService) Limit(limit int) *AggTradesService

Limit set limit

func (*AggTradesService) StartTime

func (s *AggTradesService) StartTime(startTime int64) *AggTradesService

StartTime set startTime

func (*AggTradesService) Symbol

func (s *AggTradesService) Symbol(symbol string) *AggTradesService

Symbol set symbol

type Ask

type Ask struct {
	Price    string
	Quantity string
}

Ask define ask info with price and quantity

type AveragePriceService

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

AveragePriceService show current average price for a symbol

func (*AveragePriceService) Do

func (s *AveragePriceService) Do(ctx context.Context, opts ...RequestOption) (res *AvgPrice, err error)

Do send request

func (*AveragePriceService) Symbol

func (s *AveragePriceService) Symbol(symbol string) *AveragePriceService

Symbol set symbol

type AvgPrice

type AvgPrice struct {
	Mins  int64  `json:"mins"`
	Price string `json:"price"`
}

AvgPrice define average price

type Balance

type Balance struct {
	Asset  string `json:"asset"`
	Free   string `json:"free"`
	Locked string `json:"locked"`
}

Balance define user balance of your account

type Bid

type Bid struct {
	Price    string
	Quantity string
}

Bid define bid info with price and quantity

type BookTicker

type BookTicker struct {
	Symbol      string `json:"symbol"`
	BidPrice    string `json:"bidPrice"`
	BidQuantity string `json:"bidQty"`
	AskPrice    string `json:"askPrice"`
	AskQuantity string `json:"askQty"`
}

BookTicker define book ticker info

type CancelMarginOrderResponse

type CancelMarginOrderResponse struct {
	Symbol                   string          `json:"symbol"`
	OrigClientOrderID        string          `json:"origClientOrderId"`
	OrderID                  string          `json:"orderId"`
	ClientOrderID            string          `json:"clientOrderId"`
	TransactTime             int64           `json:"transactTime"`
	Price                    string          `json:"price"`
	OrigQuantity             string          `json:"origQty"`
	ExecutedQuantity         string          `json:"executedQty"`
	CummulativeQuoteQuantity string          `json:"cummulativeQuoteQty"`
	Status                   OrderStatusType `json:"status"`
	TimeInForce              TimeInForceType `json:"timeInForce"`
	Type                     OrderType       `json:"type"`
	Side                     SideType        `json:"side"`
}

CancelMarginOrderResponse define response of canceling order

type CancelMarginOrderService

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

CancelMarginOrderService cancel an order

func (*CancelMarginOrderService) Do

Do send request

func (*CancelMarginOrderService) NewClientOrderID

func (s *CancelMarginOrderService) NewClientOrderID(newClientOrderID string) *CancelMarginOrderService

NewClientOrderID set newClientOrderID

func (*CancelMarginOrderService) OrderID

OrderID set orderID

func (*CancelMarginOrderService) OrigClientOrderID

func (s *CancelMarginOrderService) OrigClientOrderID(origClientOrderID string) *CancelMarginOrderService

OrigClientOrderID set origClientOrderID

func (*CancelMarginOrderService) Symbol

Symbol set symbol

type CancelOrderResponse

type CancelOrderResponse struct {
	Symbol                   string          `json:"symbol"`
	OrigClientOrderID        string          `json:"origClientOrderId"`
	OrderID                  int64           `json:"orderId"`
	ClientOrderID            string          `json:"clientOrderId"`
	TransactTime             int64           `json:"transactTime"`
	Price                    string          `json:"price"`
	OrigQuantity             string          `json:"origQty"`
	ExecutedQuantity         string          `json:"executedQty"`
	CummulativeQuoteQuantity string          `json:"cummulativeQuoteQty"`
	Status                   OrderStatusType `json:"status"`
	TimeInForce              TimeInForceType `json:"timeInForce"`
	Type                     OrderType       `json:"type"`
	Side                     SideType        `json:"side"`
}

CancelOrderResponse define response of canceling order

type CancelOrderService

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

CancelOrderService cancel an order

func (*CancelOrderService) Do

func (s *CancelOrderService) Do(ctx context.Context, opts ...RequestOption) (res *CancelOrderResponse, err error)

Do send request

func (*CancelOrderService) NewClientOrderID

func (s *CancelOrderService) NewClientOrderID(newClientOrderID string) *CancelOrderService

NewClientOrderID set newClientOrderID

func (*CancelOrderService) OrderID

func (s *CancelOrderService) OrderID(orderID int64) *CancelOrderService

OrderID set orderID

func (*CancelOrderService) OrigClientOrderID

func (s *CancelOrderService) OrigClientOrderID(origClientOrderID string) *CancelOrderService

OrigClientOrderID set origClientOrderID

func (*CancelOrderService) Symbol

func (s *CancelOrderService) Symbol(symbol string) *CancelOrderService

Symbol set symbol

type Client

type Client struct {
	APIKey     string
	SecretKey  string
	BaseURL    string
	UserAgent  string
	HTTPClient *http.Client
	Debug      bool
	Logger     *log.Logger
	// contains filtered or unexported fields
}

Client define API client

func NewClient

func NewClient(apiKey, secretKey string) *Client

NewClient initialize an API client instance with API key and secret key. You should always call this function before using this SDK. Services will be created by the form client.NewXXXService().

func (*Client) NewAggTradesService

func (c *Client) NewAggTradesService() *AggTradesService

NewAggTradesService init aggregate trades service

func (*Client) NewAveragePriceService

func (c *Client) NewAveragePriceService() *AveragePriceService

NewAveragePriceService init average price service

func (*Client) NewCancelMarginOrderService

func (c *Client) NewCancelMarginOrderService() *CancelMarginOrderService

NewCancelMarginOrderService init cancel order service

func (*Client) NewCancelOrderService

func (c *Client) NewCancelOrderService() *CancelOrderService

NewCancelOrderService init cancel order service

func (*Client) NewCloseMarginUserStreamService

func (c *Client) NewCloseMarginUserStreamService() *CloseMarginUserStreamService

NewCloseMarginUserStreamService init closing margin user stream service

func (*Client) NewCloseUserStreamService

func (c *Client) NewCloseUserStreamService() *CloseUserStreamService

NewCloseUserStreamService init closing user stream service

func (*Client) NewCreateMarginOrderService

func (c *Client) NewCreateMarginOrderService() *CreateMarginOrderService

NewCreateMarginOrderService init creating margin order service

func (*Client) NewCreateOCOService

func (c *Client) NewCreateOCOService() *CreateOCOService

NewCreateOCOService init creating OCO service

func (*Client) NewCreateOrderService

func (c *Client) NewCreateOrderService() *CreateOrderService

NewCreateOrderService init creating order service

func (*Client) NewCreateWithdrawService

func (c *Client) NewCreateWithdrawService() *CreateWithdrawService

NewCreateWithdrawService init creating withdraw service

func (*Client) NewDepthService

func (c *Client) NewDepthService() *DepthService

NewDepthService init depth service

func (*Client) NewExchangeInfoService

func (c *Client) NewExchangeInfoService() *ExchangeInfoService

NewExchangeInfoService init exchange info service

func (*Client) NewFuturesTransferService

func (c *Client) NewFuturesTransferService() *FuturesTransferService

NewFuturesTransferService init futures transfer service

func (*Client) NewGetAccountService

func (c *Client) NewGetAccountService() *GetAccountService

NewGetAccountService init getting account service

func (*Client) NewGetAccountSnapshotService

func (c *Client) NewGetAccountSnapshotService() *GetAccountSnapshotService

NewGetAccountSnapshotService init getting account snapshot service

func (*Client) NewGetMarginAccountService

func (c *Client) NewGetMarginAccountService() *GetMarginAccountService

NewGetMarginAccountService init get margin account service

func (*Client) NewGetMarginAllPairsService

func (c *Client) NewGetMarginAllPairsService() *GetMarginAllPairsService

NewGetMarginAllPairsService init get margin all pairs service

func (*Client) NewGetMarginAssetService

func (c *Client) NewGetMarginAssetService() *GetMarginAssetService

NewGetMarginAssetService init get margin asset service

func (*Client) NewGetMarginOrderService

func (c *Client) NewGetMarginOrderService() *GetMarginOrderService

NewGetMarginOrderService init get order service

func (*Client) NewGetMarginPairService

func (c *Client) NewGetMarginPairService() *GetMarginPairService

NewGetMarginPairService init get margin pair service

func (*Client) NewGetMarginPriceIndexService

func (c *Client) NewGetMarginPriceIndexService() *GetMarginPriceIndexService

NewGetMarginPriceIndexService init get margin price index service

func (*Client) NewGetMaxBorrowableService

func (c *Client) NewGetMaxBorrowableService() *GetMaxBorrowableService

NewGetMaxBorrowableService init get max borrowable service

func (*Client) NewGetMaxTransferableService

func (c *Client) NewGetMaxTransferableService() *GetMaxTransferableService

NewGetMaxTransferableService init get max transferable service

func (*Client) NewGetOrderService

func (c *Client) NewGetOrderService() *GetOrderService

NewGetOrderService init get order service

func (*Client) NewGetWithdrawFeeService

func (c *Client) NewGetWithdrawFeeService() *GetWithdrawFeeService

NewGetWithdrawFeeService init get withdraw fee service

func (*Client) NewHistoricalTradesService

func (c *Client) NewHistoricalTradesService() *HistoricalTradesService

NewHistoricalTradesService init listing trades service

func (*Client) NewKeepaliveMarginUserStreamService

func (c *Client) NewKeepaliveMarginUserStreamService() *KeepaliveMarginUserStreamService

NewKeepaliveMarginUserStreamService init keep alive margin user stream service

func (*Client) NewKeepaliveUserStreamService

func (c *Client) NewKeepaliveUserStreamService() *KeepaliveUserStreamService

NewKeepaliveUserStreamService init keep alive user stream service

func (*Client) NewKlinesService

func (c *Client) NewKlinesService() *KlinesService

NewKlinesService init klines service

func (*Client) NewListBookTickersService

func (c *Client) NewListBookTickersService() *ListBookTickersService

NewListBookTickersService init listing booking tickers service

func (*Client) NewListDepositsService

func (c *Client) NewListDepositsService() *ListDepositsService

NewListDepositsService init listing deposits service

func (*Client) NewListFuturesTransferService

func (c *Client) NewListFuturesTransferService() *ListFuturesTransferService

NewListFuturesTransferService init list futures transfer service

func (*Client) NewListMarginLoansService

func (c *Client) NewListMarginLoansService() *ListMarginLoansService

NewListMarginLoansService init list margin loan service

func (*Client) NewListMarginOpenOrdersService

func (c *Client) NewListMarginOpenOrdersService() *ListMarginOpenOrdersService

NewListMarginOpenOrdersService init list margin open orders service

func (*Client) NewListMarginOrdersService

func (c *Client) NewListMarginOrdersService() *ListMarginOrdersService

NewListMarginOrdersService init list margin all orders service

func (*Client) NewListMarginRepaysService

func (c *Client) NewListMarginRepaysService() *ListMarginRepaysService

NewListMarginRepaysService init list margin repay service

func (*Client) NewListMarginTradesService

func (c *Client) NewListMarginTradesService() *ListMarginTradesService

NewListMarginTradesService init list margin trades service

func (*Client) NewListOpenOrdersService

func (c *Client) NewListOpenOrdersService() *ListOpenOrdersService

NewListOpenOrdersService init list open orders service

func (*Client) NewListOrdersService

func (c *Client) NewListOrdersService() *ListOrdersService

NewListOrdersService init listing orders service

func (*Client) NewListPriceChangeStatsService

func (c *Client) NewListPriceChangeStatsService() *ListPriceChangeStatsService

NewListPriceChangeStatsService init list prices change stats service

func (*Client) NewListPricesService

func (c *Client) NewListPricesService() *ListPricesService

NewListPricesService init listing prices service

func (*Client) NewListTradesService

func (c *Client) NewListTradesService() *ListTradesService

NewListTradesService init listing trades service

func (*Client) NewListWithdrawsService

func (c *Client) NewListWithdrawsService() *ListWithdrawsService

NewListWithdrawsService init listing withdraw service

func (*Client) NewMarginLoanService

func (c *Client) NewMarginLoanService() *MarginLoanService

NewMarginLoanService init margin account loan service

func (*Client) NewMarginRepayService

func (c *Client) NewMarginRepayService() *MarginRepayService

NewMarginRepayService init margin account repay service

func (*Client) NewMarginTransferService

func (c *Client) NewMarginTransferService() *MarginTransferService

NewMarginTransferService init margin account transfer service

func (*Client) NewPingService

func (c *Client) NewPingService() *PingService

NewPingService init ping service

func (*Client) NewRecentTradesService

func (c *Client) NewRecentTradesService() *RecentTradesService

NewRecentTradesService init recent trades service

func (*Client) NewServerTimeService

func (c *Client) NewServerTimeService() *ServerTimeService

NewServerTimeService init server time service

func (*Client) NewStartMarginUserStreamService

func (c *Client) NewStartMarginUserStreamService() *StartMarginUserStreamService

NewStartMarginUserStreamService init starting margin user stream service

func (*Client) NewStartUserStreamService

func (c *Client) NewStartUserStreamService() *StartUserStreamService

NewStartUserStreamService init starting user stream service

type CloseMarginUserStreamService

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

CloseMarginUserStreamService delete listen key

func (*CloseMarginUserStreamService) Do

Do send request

func (*CloseMarginUserStreamService) ListenKey

ListenKey set listen key

type CloseUserStreamService

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

CloseUserStreamService delete listen key

func (*CloseUserStreamService) Do

func (s *CloseUserStreamService) Do(ctx context.Context, opts ...RequestOption) (err error)

Do send request

func (*CloseUserStreamService) ListenKey

func (s *CloseUserStreamService) ListenKey(listenKey string) *CloseUserStreamService

ListenKey set listen key

type CreateMarginOrderService

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

CreateMarginOrderService create order

func (*CreateMarginOrderService) Do

Do send request

func (*CreateMarginOrderService) IcebergQuantity

func (s *CreateMarginOrderService) IcebergQuantity(icebergQuantity string) *CreateMarginOrderService

IcebergQuantity set icebergQuantity

func (*CreateMarginOrderService) NewClientOrderID

func (s *CreateMarginOrderService) NewClientOrderID(newClientOrderID string) *CreateMarginOrderService

NewClientOrderID set newClientOrderID

func (*CreateMarginOrderService) NewOrderRespType

func (s *CreateMarginOrderService) NewOrderRespType(newOrderRespType NewOrderRespType) *CreateMarginOrderService

NewOrderRespType set icebergQuantity

func (*CreateMarginOrderService) Price

Price set price

func (*CreateMarginOrderService) Quantity

Quantity set quantity

func (*CreateMarginOrderService) Side

Side set side

func (*CreateMarginOrderService) SideEffectType

func (s *CreateMarginOrderService) SideEffectType(sideEffectType SideEffectType) *CreateMarginOrderService

SideEffectType set sideEffectType

func (*CreateMarginOrderService) StopPrice

func (s *CreateMarginOrderService) StopPrice(stopPrice string) *CreateMarginOrderService

StopPrice set stopPrice

func (*CreateMarginOrderService) Symbol

Symbol set symbol

func (*CreateMarginOrderService) TimeInForce

TimeInForce set timeInForce

func (*CreateMarginOrderService) Type

Type set type

type CreateOCOResponse

type CreateOCOResponse struct {
	OrderListID       int64             `json:"orderListId"`
	ContingencyType   string            `json:"contingencyType"`
	ListStatusType    string            `json:"listStatusType"`
	ListOrderStatus   string            `json:"listOrderStatus"`
	ListClientOrderID string            `json:"listClientOrderId"`
	TransactionTime   int64             `json:"transactionTime"`
	Symbol            string            `json:"symbol"`
	Orders            []*OCOOrder       `json:"orders"`
	OrderReports      []*OCOOrderReport `json:"orderReports"`
}

CreateOCOResponse define create order response

type CreateOCOService

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

CreateOCOService create order

func (*CreateOCOService) Do

func (s *CreateOCOService) Do(ctx context.Context, opts ...RequestOption) (res *CreateOCOResponse, err error)

Do send request

func (*CreateOCOService) LimitClientOrderID

func (s *CreateOCOService) LimitClientOrderID(limitClientOrderID string) *CreateOCOService

LimitClientOrderID set limitClientOrderID

func (*CreateOCOService) NewOrderRespType

func (s *CreateOCOService) NewOrderRespType(newOrderRespType NewOrderRespType) *CreateOCOService

NewOrderRespType set icebergQuantity

func (*CreateOCOService) Price

func (s *CreateOCOService) Price(price string) *CreateOCOService

Price set price

func (*CreateOCOService) Quantity

func (s *CreateOCOService) Quantity(quantity string) *CreateOCOService

Quantity set quantity

func (*CreateOCOService) Side

Side set side

func (*CreateOCOService) StopClientOrderID

func (s *CreateOCOService) StopClientOrderID(stopClientOrderID string) *CreateOCOService

StopClientOrderID set stopClientOrderID

func (*CreateOCOService) StopIcebergQty

func (s *CreateOCOService) StopIcebergQty(stopIcebergQty string) *CreateOCOService

StopIcebergQty set stop limit price

func (*CreateOCOService) StopLimitPrice

func (s *CreateOCOService) StopLimitPrice(stopLimitPrice string) *CreateOCOService

StopLimitPrice set stop limit price

func (*CreateOCOService) StopLimitTimeInForce

func (s *CreateOCOService) StopLimitTimeInForce(stopLimitTimeInForce TimeInForceType) *CreateOCOService

StopLimitTimeInForce set stopLimitTimeInForce

func (*CreateOCOService) StopPrice

func (s *CreateOCOService) StopPrice(stopPrice string) *CreateOCOService

StopPrice set stop price

func (*CreateOCOService) Symbol

func (s *CreateOCOService) Symbol(symbol string) *CreateOCOService

Symbol set symbol

type CreateOrderResponse

type CreateOrderResponse struct {
	Symbol                   string          `json:"symbol"`
	OrderID                  int64           `json:"orderId"`
	ClientOrderID            string          `json:"clientOrderId"`
	TransactTime             int64           `json:"transactTime"`
	Price                    string          `json:"price"`
	OrigQuantity             string          `json:"origQty"`
	ExecutedQuantity         string          `json:"executedQty"`
	CummulativeQuoteQuantity string          `json:"cummulativeQuoteQty"`
	Status                   OrderStatusType `json:"status"`
	TimeInForce              TimeInForceType `json:"timeInForce"`
	Type                     OrderType       `json:"type"`
	Side                     SideType        `json:"side"`
	Fills                    []*Fill         `json:"fills"`
}

CreateOrderResponse define create order response

type CreateOrderService

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

CreateOrderService create order

func (*CreateOrderService) Do

func (s *CreateOrderService) Do(ctx context.Context, opts ...RequestOption) (res *CreateOrderResponse, err error)

Do send request

func (*CreateOrderService) IcebergQuantity

func (s *CreateOrderService) IcebergQuantity(icebergQuantity string) *CreateOrderService

IcebergQuantity set icebergQuantity

func (*CreateOrderService) NewClientOrderID

func (s *CreateOrderService) NewClientOrderID(newClientOrderID string) *CreateOrderService

NewClientOrderID set newClientOrderID

func (*CreateOrderService) NewOrderRespType

func (s *CreateOrderService) NewOrderRespType(newOrderRespType NewOrderRespType) *CreateOrderService

NewOrderRespType set icebergQuantity

func (*CreateOrderService) Price

func (s *CreateOrderService) Price(price string) *CreateOrderService

Price set price

func (*CreateOrderService) Quantity

func (s *CreateOrderService) Quantity(quantity string) *CreateOrderService

Quantity set quantity

func (*CreateOrderService) Side

Side set side

func (*CreateOrderService) StopPrice

func (s *CreateOrderService) StopPrice(stopPrice string) *CreateOrderService

StopPrice set stopPrice

func (*CreateOrderService) Symbol

func (s *CreateOrderService) Symbol(symbol string) *CreateOrderService

Symbol set symbol

func (*CreateOrderService) Test

func (s *CreateOrderService) Test(ctx context.Context, opts ...RequestOption) (err error)

Test send test api to check if the request is valid

func (*CreateOrderService) TimeInForce

func (s *CreateOrderService) TimeInForce(timeInForce TimeInForceType) *CreateOrderService

TimeInForce set timeInForce

func (*CreateOrderService) Type

func (s *CreateOrderService) Type(orderType OrderType) *CreateOrderService

Type set type

type CreateWithdrawService

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

CreateWithdrawService create withdraw

func (*CreateWithdrawService) Address

func (s *CreateWithdrawService) Address(address string) *CreateWithdrawService

Address set address

func (*CreateWithdrawService) Amount

Amount set amount

func (*CreateWithdrawService) Asset

Asset set asset

func (*CreateWithdrawService) Do

func (s *CreateWithdrawService) Do(ctx context.Context) (err error)

Do send request

func (*CreateWithdrawService) Name

Name set name

type Deposit

type Deposit struct {
	InsertTime int64   `json:"insertTime"`
	Amount     float64 `json:"amount"`
	Asset      string  `json:"asset"`
	Status     int     `json:"status"`
	TxID       string  `json:"txId"`
}

Deposit define deposit info

type DepositHistoryResponse

type DepositHistoryResponse struct {
	Success  bool       `json:"success"`
	Deposits []*Deposit `json:"depositList"`
}

DepositHistoryResponse define deposit history

type DepthResponse

type DepthResponse struct {
	LastUpdateID int64 `json:"lastUpdateId"`
	Bids         []Bid `json:"bids"`
	Asks         []Ask `json:"asks"`
}

DepthResponse define depth info with bids and asks

type DepthService

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

DepthService show depth info

func (*DepthService) Do

func (s *DepthService) Do(ctx context.Context, opts ...RequestOption) (res *DepthResponse, err error)

Do send request

func (*DepthService) Limit

func (s *DepthService) Limit(limit int) *DepthService

Limit set limit

func (*DepthService) Symbol

func (s *DepthService) Symbol(symbol string) *DepthService

Symbol set symbol

type ErrHandler

type ErrHandler func(err error)

ErrHandler handles errors

type ExchangeInfo

type ExchangeInfo struct {
	Timezone        string        `json:"timezone"`
	ServerTime      int64         `json:"serverTime"`
	RateLimits      []RateLimit   `json:"rateLimits"`
	ExchangeFilters []interface{} `json:"exchangeFilters"`
	Symbols         []Symbol      `json:"symbols"`
}

ExchangeInfo exchange info

type ExchangeInfoService

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

ExchangeInfoService exchange info service

func (*ExchangeInfoService) Do

func (s *ExchangeInfoService) Do(ctx context.Context, opts ...RequestOption) (res *ExchangeInfo, err error)

Do send request

type Fill

type Fill struct {
	Price           string `json:"price"`
	Quantity        string `json:"qty"`
	Commission      string `json:"commission"`
	CommissionAsset string `json:"commissionAsset"`
}

Fill may be returned in an array of fills in a CreateOrderResponse.

type FuturesTransfer

type FuturesTransfer struct {
	Asset     string                    `json:"asset"`
	TranID    int64                     `json:"tranId"`
	Amount    string                    `json:"amount"`
	Type      int64                     `json:"type"`
	Timestamp int64                     `json:"timestamp"`
	Status    FuturesTransferStatusType `json:"status"`
}

FuturesTransfer define futures transfer history item

type FuturesTransferHistory

type FuturesTransferHistory struct {
	Rows  []FuturesTransfer `json:"rows"`
	Total int64             `json:"total"`
}

FuturesTransferHistory define futures transfer history

type FuturesTransferService

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

FuturesTransferService transfer asset between spot account and futures account

func (*FuturesTransferService) Amount

Amount the amount to be transferred

func (*FuturesTransferService) Asset

Asset set asset being transferred, e.g., BTC

func (*FuturesTransferService) Do

Do send request

func (*FuturesTransferService) Type

Type 1: transfer from spot account to futures account 2: transfer from futures account to spot account

type FuturesTransferStatusType

type FuturesTransferStatusType string

FuturesTransferStatusType define futures transfer status type

type FuturesTransferType

type FuturesTransferType int

FuturesTransferType define futures transfer type

type GetAccountService

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

GetAccountService get account info

func (*GetAccountService) Do

func (s *GetAccountService) Do(ctx context.Context, opts ...RequestOption) (res *Account, err error)

Do send request

type GetAccountSnapshotService

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

GetAccountSnapshotService all account orders; active, canceled, or filled

func (*GetAccountSnapshotService) Do

func (s *GetAccountSnapshotService) Do(ctx context.Context, opts ...RequestOption) (res *Snapshot, err error)

Do send request

func (*GetAccountSnapshotService) EndTime

EndTime set endtime

func (*GetAccountSnapshotService) Limit

Limit set limit

func (*GetAccountSnapshotService) StartTime

StartTime set starttime

func (*GetAccountSnapshotService) Type

Type set account type ("SPOT", "MARGIN", "FUTURES")

type GetMarginAccountService

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

GetMarginAccountService get margin account info

func (*GetMarginAccountService) Do

func (s *GetMarginAccountService) Do(ctx context.Context, opts ...RequestOption) (res *MarginAccount, err error)

Do send request

type GetMarginAllPairsService

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

GetMarginAllPairsService get margin pair info

func (*GetMarginAllPairsService) Do

func (s *GetMarginAllPairsService) Do(ctx context.Context, opts ...RequestOption) (res []*MarginAllPair, err error)

Do send request

type GetMarginAssetService

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

GetMarginAssetService get margin asset info

func (*GetMarginAssetService) Asset

Asset set asset

func (*GetMarginAssetService) Do

func (s *GetMarginAssetService) Do(ctx context.Context, opts ...RequestOption) (res *MarginAsset, err error)

Do send request

type GetMarginOrderService

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

GetMarginOrderService get an order

func (*GetMarginOrderService) Do

func (s *GetMarginOrderService) Do(ctx context.Context, opts ...RequestOption) (res *Order, err error)

Do send request

func (*GetMarginOrderService) OrderID

func (s *GetMarginOrderService) OrderID(orderID int64) *GetMarginOrderService

OrderID set orderID

func (*GetMarginOrderService) OrigClientOrderID

func (s *GetMarginOrderService) OrigClientOrderID(origClientOrderID string) *GetMarginOrderService

OrigClientOrderID set origClientOrderID

func (*GetMarginOrderService) Symbol

Symbol set symbol

type GetMarginPairService

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

GetMarginPairService get margin pair info

func (*GetMarginPairService) Do

func (s *GetMarginPairService) Do(ctx context.Context, opts ...RequestOption) (res *MarginPair, err error)

Do send request

func (*GetMarginPairService) Symbol

Symbol set symbol

type GetMarginPriceIndexService

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

GetMarginPriceIndexService get margin price index

func (*GetMarginPriceIndexService) Do

Do send request

func (*GetMarginPriceIndexService) Symbol

Symbol set symbol

type GetMaxBorrowableService

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

GetMaxBorrowableService get max borrowable of asset

func (*GetMaxBorrowableService) Asset

Asset set asset

func (*GetMaxBorrowableService) Do

func (s *GetMaxBorrowableService) Do(ctx context.Context, opts ...RequestOption) (res *MaxBorrowable, err error)

Do send request

type GetMaxTransferableService

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

GetMaxTransferableService get max transferable of asset

func (*GetMaxTransferableService) Asset

Asset set asset

func (*GetMaxTransferableService) Do

Do send request

type GetOrderService

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

GetOrderService get an order

func (*GetOrderService) Do

func (s *GetOrderService) Do(ctx context.Context, opts ...RequestOption) (res *Order, err error)

Do send request

func (*GetOrderService) OrderID

func (s *GetOrderService) OrderID(orderID int64) *GetOrderService

OrderID set orderID

func (*GetOrderService) OrigClientOrderID

func (s *GetOrderService) OrigClientOrderID(origClientOrderID string) *GetOrderService

OrigClientOrderID set origClientOrderID

func (*GetOrderService) Symbol

func (s *GetOrderService) Symbol(symbol string) *GetOrderService

Symbol set symbol

type GetWithdrawFeeService

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

GetWithdrawFeeService get withdraw fee

func (*GetWithdrawFeeService) Asset

Asset set asset

func (*GetWithdrawFeeService) Do

func (s *GetWithdrawFeeService) Do(ctx context.Context, opts ...RequestOption) (res *WithdrawFee, err error)

Do send request

type HistoricalTradesService

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

HistoricalTradesService trades

func (*HistoricalTradesService) Do

func (s *HistoricalTradesService) Do(ctx context.Context, opts ...RequestOption) (res []*Trade, err error)

Do send request

func (*HistoricalTradesService) FromID

FromID set fromID

func (*HistoricalTradesService) Limit

Limit set limit

func (*HistoricalTradesService) Symbol

Symbol set symbol

type IcebergPartsFilter

type IcebergPartsFilter struct {
	Limit int `json:"limit"`
}

IcebergPartsFilter define iceberg part filter of symbol

type KeepaliveMarginUserStreamService

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

KeepaliveMarginUserStreamService update listen key

func (*KeepaliveMarginUserStreamService) Do

Do send request

func (*KeepaliveMarginUserStreamService) ListenKey

ListenKey set listen key

type KeepaliveUserStreamService

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

KeepaliveUserStreamService update listen key

func (*KeepaliveUserStreamService) Do

func (s *KeepaliveUserStreamService) Do(ctx context.Context, opts ...RequestOption) (err error)

Do send request

func (*KeepaliveUserStreamService) ListenKey

ListenKey set listen key

type Kline

type Kline struct {
	OpenTime                 int64  `json:"openTime"`
	Open                     string `json:"open"`
	High                     string `json:"high"`
	Low                      string `json:"low"`
	Close                    string `json:"close"`
	Volume                   string `json:"volume"`
	CloseTime                int64  `json:"closeTime"`
	QuoteAssetVolume         string `json:"quoteAssetVolume"`
	TradeNum                 int64  `json:"tradeNum"`
	TakerBuyBaseAssetVolume  string `json:"takerBuyBaseAssetVolume"`
	TakerBuyQuoteAssetVolume string `json:"takerBuyQuoteAssetVolume"`
}

Kline define kline info

type KlinesService

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

KlinesService list klines

func (*KlinesService) Do

func (s *KlinesService) Do(ctx context.Context, opts ...RequestOption) (res []*Kline, err error)

Do send request

func (*KlinesService) EndTime

func (s *KlinesService) EndTime(endTime int64) *KlinesService

EndTime set endTime

func (*KlinesService) Interval

func (s *KlinesService) Interval(interval string) *KlinesService

Interval set interval

func (*KlinesService) Limit

func (s *KlinesService) Limit(limit int) *KlinesService

Limit set limit

func (*KlinesService) StartTime

func (s *KlinesService) StartTime(startTime int64) *KlinesService

StartTime set startTime

func (*KlinesService) Symbol

func (s *KlinesService) Symbol(symbol string) *KlinesService

Symbol set symbol

type ListBookTickersService

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

ListBookTickersService list best price/qty on the order book for a symbol or symbols

func (*ListBookTickersService) Do

func (s *ListBookTickersService) Do(ctx context.Context, opts ...RequestOption) (res []*BookTicker, err error)

Do send request

func (*ListBookTickersService) Symbol

Symbol set symbol

type ListDepositsService

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

ListDepositsService list deposits

func (*ListDepositsService) Asset

Asset set asset

func (*ListDepositsService) Do

func (s *ListDepositsService) Do(ctx context.Context, opts ...RequestOption) (deposits []*Deposit, err error)

Do send request

func (*ListDepositsService) EndTime

func (s *ListDepositsService) EndTime(endTime int64) *ListDepositsService

EndTime set endTime

func (*ListDepositsService) StartTime

func (s *ListDepositsService) StartTime(startTime int64) *ListDepositsService

StartTime set startTime

func (*ListDepositsService) Status

func (s *ListDepositsService) Status(status int) *ListDepositsService

Status set status

type ListFuturesTransferService

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

ListFuturesTransferService list futures transfer

func (*ListFuturesTransferService) Asset

Asset set asset

func (*ListFuturesTransferService) Current

Current currently querying page. Start from 1. Default:1

func (*ListFuturesTransferService) Do

Do send request

func (*ListFuturesTransferService) EndTime

EndTime set end time

func (*ListFuturesTransferService) Size

Size default:10 max:100

func (*ListFuturesTransferService) StartTime

StartTime set start time

type ListMarginLoansService

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

ListMarginLoansService list loan record

func (*ListMarginLoansService) Asset

Asset set asset

func (*ListMarginLoansService) Current

Current currently querying page. Start from 1. Default:1

func (*ListMarginLoansService) Do

Do send request

func (*ListMarginLoansService) EndTime

EndTime set end time

func (*ListMarginLoansService) Size

Size default:10 max:100

func (*ListMarginLoansService) StartTime

func (s *ListMarginLoansService) StartTime(startTime int64) *ListMarginLoansService

StartTime set start time

func (*ListMarginLoansService) TxID

TxID set transaction id

type ListMarginOpenOrdersService

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

ListMarginOpenOrdersService list margin open orders

func (*ListMarginOpenOrdersService) Do

func (s *ListMarginOpenOrdersService) Do(ctx context.Context, opts ...RequestOption) (res []*Order, err error)

Do send request

func (*ListMarginOpenOrdersService) Symbol

Symbol set symbol

type ListMarginOrdersService

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

ListMarginOrdersService all account orders; active, canceled, or filled

func (*ListMarginOrdersService) Do

func (s *ListMarginOrdersService) Do(ctx context.Context, opts ...RequestOption) (res []*MarginAllOrder, err error)

Do send request

func (*ListMarginOrdersService) EndTime

EndTime set endtime

func (*ListMarginOrdersService) Limit

Limit set limit

func (*ListMarginOrdersService) OrderID

OrderID set orderID

func (*ListMarginOrdersService) StartTime

func (s *ListMarginOrdersService) StartTime(startTime int64) *ListMarginOrdersService

StartTime set starttime

func (*ListMarginOrdersService) Symbol

Symbol set symbol

type ListMarginRepaysService

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

ListMarginRepaysService list repay record

func (*ListMarginRepaysService) Asset

Asset set asset

func (*ListMarginRepaysService) Current

Current currently querying page. Start from 1. Default:1

func (*ListMarginRepaysService) Do

Do send request

func (*ListMarginRepaysService) EndTime

EndTime set end time

func (*ListMarginRepaysService) Size

Size default:10 max:100

func (*ListMarginRepaysService) StartTime

func (s *ListMarginRepaysService) StartTime(startTime int64) *ListMarginRepaysService

StartTime set start time

func (*ListMarginRepaysService) TxID

TxID set transaction id

type ListMarginTradesService

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

ListMarginTradesService list trades

func (*ListMarginTradesService) Do

func (s *ListMarginTradesService) Do(ctx context.Context, opts ...RequestOption) (res []*TradeV3, err error)

Do send request

func (*ListMarginTradesService) EndTime

EndTime set endtime

func (*ListMarginTradesService) FromID

FromID set fromID

func (*ListMarginTradesService) Limit

Limit set limit

func (*ListMarginTradesService) StartTime

func (s *ListMarginTradesService) StartTime(startTime int64) *ListMarginTradesService

StartTime set starttime

func (*ListMarginTradesService) Symbol

Symbol set symbol

type ListOpenOrdersService

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

ListOpenOrdersService list opened orders

func (*ListOpenOrdersService) Do

func (s *ListOpenOrdersService) Do(ctx context.Context, opts ...RequestOption) (res []*Order, err error)

Do send request

func (*ListOpenOrdersService) Symbol

Symbol set symbol

type ListOrdersService

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

ListOrdersService all account orders; active, canceled, or filled

func (*ListOrdersService) Do

func (s *ListOrdersService) Do(ctx context.Context, opts ...RequestOption) (res []*Order, err error)

Do send request

func (*ListOrdersService) EndTime

func (s *ListOrdersService) EndTime(endTime int64) *ListOrdersService

EndTime set endtime

func (*ListOrdersService) Limit

func (s *ListOrdersService) Limit(limit int) *ListOrdersService

Limit set limit

func (*ListOrdersService) OrderID

func (s *ListOrdersService) OrderID(orderID int64) *ListOrdersService

OrderID set orderID

func (*ListOrdersService) StartTime

func (s *ListOrdersService) StartTime(startTime int64) *ListOrdersService

StartTime set starttime

func (*ListOrdersService) Symbol

func (s *ListOrdersService) Symbol(symbol string) *ListOrdersService

Symbol set symbol

type ListPriceChangeStatsService

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

ListPriceChangeStatsService show stats of price change in last 24 hours for all symbols

func (*ListPriceChangeStatsService) Do

Do send request

func (*ListPriceChangeStatsService) Symbol

Symbol set symbol

type ListPricesService

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

ListPricesService list latest price for a symbol or symbols

func (*ListPricesService) Do

func (s *ListPricesService) Do(ctx context.Context, opts ...RequestOption) (res []*SymbolPrice, err error)

Do send request

func (*ListPricesService) Symbol

func (s *ListPricesService) Symbol(symbol string) *ListPricesService

Symbol set symbol

type ListTradesService

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

ListTradesService list trades

func (*ListTradesService) Do

func (s *ListTradesService) Do(ctx context.Context, opts ...RequestOption) (res []*TradeV3, err error)

Do send request

func (*ListTradesService) EndTime

func (s *ListTradesService) EndTime(endTime int64) *ListTradesService

EndTime set endtime

func (*ListTradesService) FromID

func (s *ListTradesService) FromID(fromID int64) *ListTradesService

FromID set fromID

func (*ListTradesService) Limit

func (s *ListTradesService) Limit(limit int) *ListTradesService

Limit set limit

func (*ListTradesService) StartTime

func (s *ListTradesService) StartTime(startTime int64) *ListTradesService

StartTime set starttime

func (*ListTradesService) Symbol

func (s *ListTradesService) Symbol(symbol string) *ListTradesService

Symbol set symbol

type ListWithdrawsService

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

ListWithdrawsService list withdraws

func (*ListWithdrawsService) Asset

Asset set asset

func (*ListWithdrawsService) Do

func (s *ListWithdrawsService) Do(ctx context.Context) (withdraws []*Withdraw, err error)

Do send request

func (*ListWithdrawsService) EndTime

func (s *ListWithdrawsService) EndTime(endTime int64) *ListWithdrawsService

EndTime set endTime

func (*ListWithdrawsService) StartTime

func (s *ListWithdrawsService) StartTime(startTime int64) *ListWithdrawsService

StartTime set startTime

func (*ListWithdrawsService) Status

func (s *ListWithdrawsService) Status(status int) *ListWithdrawsService

Status set status

type LotSizeFilter

type LotSizeFilter struct {
	MaxQuantity string `json:"maxQty"`
	MinQuantity string `json:"minQty"`
	StepSize    string `json:"stepSize"`
}

LotSizeFilter define lot size filter of symbol

type MarginAccount

type MarginAccount struct {
	BorrowEnabled       bool        `json:"borrowEnabled"`
	MarginLevel         string      `json:"marginLevel"`
	TotalAssetOfBTC     string      `json:"totalAssetOfBtc"`
	TotalLiabilityOfBTC string      `json:"totalLiabilityOfBtc"`
	TotalNetAssetOfBTC  string      `json:"totalNetAssetOfBtc"`
	TradeEnabled        bool        `json:"tradeEnabled"`
	TransferEnabled     bool        `json:"transferEnabled"`
	UserAssets          []UserAsset `json:"userAssets"`
}

MarginAccount define margin account info

type MarginAllOrder

type MarginAllOrder struct {
	ID            int64  `json:"id"`
	Price         string `json:"price"`
	Quantity      string `json:"qty"`
	QuoteQuantity string `json:"quoteQty"`
	Symbol        string `json:"symbol"`
	Time          int64  `json:"time"`
}

MarginAllOrder define item of margin all orders

type MarginAllPair

type MarginAllPair struct {
	ID            int64  `json:"id"`
	Symbol        string `json:"symbol"`
	Base          string `json:"base"`
	Quote         string `json:"quote"`
	IsMarginTrade bool   `json:"isMarginTrade"`
	IsBuyAllowed  bool   `json:"isBuyAllowed"`
	IsSellAllowed bool   `json:"isSellAllowed"`
}

MarginAllPair define margin pair info

type MarginAsset

type MarginAsset struct {
	FullName      string `json:"assetFullName"`
	Name          string `json:"assetName"`
	Borrowable    bool   `json:"isBorrowable"`
	Mortgageable  bool   `json:"isMortgageable"`
	UserMinBorrow string `json:"userMinBorrow"`
	UserMinRepay  string `json:"userMinRepay"`
}

MarginAsset define margin asset info

type MarginLoan

type MarginLoan struct {
	Asset     string               `json:"asset"`
	Principal string               `json:"principal"`
	Timestamp int64                `json:"timestamp"`
	Status    MarginLoanStatusType `json:"status"`
}

MarginLoan define margin loan

type MarginLoanResponse

type MarginLoanResponse struct {
	Rows  []MarginLoan `json:"rows"`
	Total int64        `json:"total"`
}

MarginLoanResponse define margin loan response

type MarginLoanService

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

MarginLoanService apply for a loan

func (*MarginLoanService) Amount

func (s *MarginLoanService) Amount(amount string) *MarginLoanService

Amount the amount to be transferred

func (*MarginLoanService) Asset

func (s *MarginLoanService) Asset(asset string) *MarginLoanService

Asset set asset being transferred, e.g., BTC

func (*MarginLoanService) Do

func (s *MarginLoanService) Do(ctx context.Context, opts ...RequestOption) (res *TransactionResponse, err error)

Do send request

type MarginLoanStatusType

type MarginLoanStatusType string

MarginLoanStatusType define margin loan status type

type MarginPair

type MarginPair struct {
	ID            int64  `json:"id"`
	Symbol        string `json:"symbol"`
	Base          string `json:"base"`
	Quote         string `json:"quote"`
	IsMarginTrade bool   `json:"isMarginTrade"`
	IsBuyAllowed  bool   `json:"isBuyAllowed"`
	IsSellAllowed bool   `json:"isSellAllowed"`
}

MarginPair define margin pair info

type MarginPriceIndex

type MarginPriceIndex struct {
	CalcTime int64  `json:"calcTime"`
	Price    string `json:"price"`
	Symbol   string `json:"symbol"`
}

MarginPriceIndex define margin price index

type MarginRepay

type MarginRepay struct {
	Asset     string                `json:"asset"`
	Amount    string                `json:"amount"`
	Interest  string                `json:"interest"`
	Principal string                `json:"principal"`
	Timestamp int64                 `json:"timestamp"`
	Status    MarginRepayStatusType `json:"status"`
	TxID      int64                 `json:"txId"`
}

MarginRepay define margin repay

type MarginRepayResponse

type MarginRepayResponse struct {
	Rows  []MarginRepay `json:"rows"`
	Total int64         `json:"total"`
}

MarginRepayResponse define margin repay response

type MarginRepayService

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

MarginRepayService repay loan for margin account

func (*MarginRepayService) Amount

func (s *MarginRepayService) Amount(amount string) *MarginRepayService

Amount the amount to be transferred

func (*MarginRepayService) Asset

func (s *MarginRepayService) Asset(asset string) *MarginRepayService

Asset set asset being transferred, e.g., BTC

func (*MarginRepayService) Do

func (s *MarginRepayService) Do(ctx context.Context, opts ...RequestOption) (res *TransactionResponse, err error)

Do send request

type MarginRepayStatusType

type MarginRepayStatusType string

MarginRepayStatusType define margin repay status type

type MarginTransferService

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

MarginTransferService transfer between spot account and margin account

func (*MarginTransferService) Amount

Amount the amount to be transferred

func (*MarginTransferService) Asset

Asset set asset being transferred, e.g., BTC

func (*MarginTransferService) Do

Do send request

func (*MarginTransferService) Type

Type 1: transfer from main account to margin account 2: transfer from margin account to main account

type MarginTransferType

type MarginTransferType int

MarginTransferType define margin transfer type

type MarketLotSizeFilter

type MarketLotSizeFilter struct {
	MaxQuantity string `json:"maxQty"`
	MinQuantity string `json:"minQty"`
	StepSize    string `json:"stepSize"`
}

MarketLotSizeFilter define market lot size filter of symbol

type MaxBorrowable

type MaxBorrowable struct {
	Amount string `json:"amount"`
}

MaxBorrowable define max borrowable response

type MaxNumAlgoOrdersFilter

type MaxNumAlgoOrdersFilter struct {
	MaxNumAlgoOrders int `json:"maxNumAlgoOrders"`
}

MaxNumAlgoOrdersFilter define max num algo orders filter of symbol

type MaxTransferable

type MaxTransferable struct {
	Amount string `json:"amount"`
}

MaxTransferable define max transferable response

type MinNotionalFilter

type MinNotionalFilter struct {
	MinNotional      string `json:"minNotional"`
	AveragePriceMins int    `json:"avgPriceMins"`
	ApplyToMarket    bool   `json:"applyToMarket"`
}

MinNotionalFilter define min notional filter of symbol

type NewOrderRespType

type NewOrderRespType string

NewOrderRespType define response JSON verbosity

type OCOOrder

type OCOOrder struct {
	Symbol        string `json:"symbol"`
	OrderID       int64  `json:"orderId"`
	ClientOrderID string `json:"clientOrderId"`
}

OCOOrder may be returned in an array of OCOOrder in a CreateOCOResponse.

type OCOOrderReport

type OCOOrderReport struct {
	Symbol                   string          `json:"symbol"`
	OrderID                  int64           `json:"orderId"`
	OrderListID              int64           `json:"orderListId"`
	ClientOrderID            string          `json:"clientOrderId"`
	TransactionTime          int64           `json:"transactionTime"`
	Price                    string          `json:"price"`
	OrigQuantity             string          `json:"origQty"`
	ExecutedQuantity         string          `json:"executedQty"`
	CummulativeQuoteQuantity string          `json:"cummulativeQuoteQty"`
	Status                   OrderStatusType `json:"status"`
	TimeInForce              TimeInForceType `json:"timeInForce"`
	Type                     OrderType       `json:"type"`
	Side                     SideType        `json:"side"`
	StopPrice                string          `json:"stopPrice"`
}

OCOOrderReport may be returned in an array of OCOOrderReport in a CreateOCOResponse.

type Order

type Order struct {
	Symbol                   string          `json:"symbol"`
	OrderID                  int64           `json:"orderId"`
	ClientOrderID            string          `json:"clientOrderId"`
	Price                    string          `json:"price"`
	OrigQuantity             string          `json:"origQty"`
	ExecutedQuantity         string          `json:"executedQty"`
	CummulativeQuoteQuantity string          `json:"cummulativeQuoteQty"`
	Status                   OrderStatusType `json:"status"`
	TimeInForce              TimeInForceType `json:"timeInForce"`
	Type                     OrderType       `json:"type"`
	Side                     SideType        `json:"side"`
	StopPrice                string          `json:"stopPrice"`
	IcebergQuantity          string          `json:"icebergQty"`
	Time                     int64           `json:"time"`
	UpdateTime               int64           `json:"updateTime"`
	IsWorking                bool            `json:"isWorking"`
}

Order define order info

type OrderStatusType

type OrderStatusType string

OrderStatusType define order status type

type OrderType

type OrderType string

OrderType define order type

type PercentPriceFilter

type PercentPriceFilter struct {
	AveragePriceMins int    `json:"avgPriceMins"`
	MultiplierUp     string `json:"multiplierUp"`
	MultiplierDown   string `json:"multiplierDown"`
}

PercentPriceFilter define percent price filter of symbol

type PingService

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

PingService ping server

func (*PingService) Do

func (s *PingService) Do(ctx context.Context, opts ...RequestOption) (err error)

Do send request

type PriceChangeStats

type PriceChangeStats 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"`
	BidPrice           string `json:"bidPrice"`
	AskPrice           string `json:"askPrice"`
	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"`
	FristID            int64  `json:"firstId"`
	LastID             int64  `json:"lastId"`
	Count              int64  `json:"count"`
}

PriceChangeStats define price change stats

type PriceFilter

type PriceFilter struct {
	MaxPrice string `json:"maxPrice"`
	MinPrice string `json:"minPrice"`
	TickSize string `json:"tickSize"`
}

PriceFilter define price filter of symbol

type RateLimit

type RateLimit struct {
	RateLimitType string `json:"rateLimitType"`
	Interval      string `json:"interval"`
	Limit         int64  `json:"limit"`
}

RateLimit struct

type RecentTradesService

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

RecentTradesService list recent trades

func (*RecentTradesService) Do

func (s *RecentTradesService) Do(ctx context.Context, opts ...RequestOption) (res []*Trade, err error)

Do send request

func (*RecentTradesService) Limit

func (s *RecentTradesService) Limit(limit int) *RecentTradesService

Limit set limit

func (*RecentTradesService) Symbol

func (s *RecentTradesService) Symbol(symbol string) *RecentTradesService

Symbol set symbol

type RequestOption

type RequestOption func(*request)

RequestOption define option type for request

func WithRecvWindow

func WithRecvWindow(recvWindow int64) RequestOption

WithRecvWindow set recvWindow param for the request

type ServerTimeService

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

ServerTimeService get server time

func (*ServerTimeService) Do

func (s *ServerTimeService) Do(ctx context.Context, opts ...RequestOption) (serverTime int64, err error)

Do send request

type SideEffectType

type SideEffectType string

SideEffectType define side effect type for orders

type SideType

type SideType string

SideType define side type of order

type Snapshot

type Snapshot struct {
	Code     int            `json:"code"`
	Msg      string         `json:"msg"`
	Snapshot []*SnapshotVos `json:"snapshotVos"`
}

Snapshot define snapshot

type SnapshotAssets

type SnapshotAssets struct {
	Asset         string `json:"asset"`
	MarginBalance string `json:"marginBalance"`
	WalletBalance string `json:"walletBalance"`
}

SnapshotAssets define snapshot assets

type SnapshotBalances

type SnapshotBalances struct {
	Asset  string `json:"asset"`
	Free   string `json:"free"`
	Locked string `json:"locked"`
}

SnapshotBalances define snapshot balances

type SnapshotData

type SnapshotData struct {
	MarginLevel         string `json:"marginLevel"`
	TotalAssetOfBtc     string `json:"totalAssetOfBtc"`
	TotalLiabilityOfBtc string `json:"totalLiabilityOfBtc"`
	TotalNetAssetOfBtc  string `json:"totalNetAssetOfBtc"`

	Balances   []*SnapshotBalances   `json:"balances"`
	UserAssets []*SnapshotUserAssets `json:"userAssets"`
	Assets     []*SnapshotAssets     `json:"assets"`
	Positions  []*SnapshotPositions  `json:"position"`
}

SnapshotData define content of a snapshot

type SnapshotPositions

type SnapshotPositions struct {
	EntryPrice       string `json:"entryPrice"`
	MarkPrice        string `json:"markPrice"`
	PositionAmt      string `json:"positionAmt"`
	Symbol           string `json:"symbol"`
	UnRealizedProfit string `json:"unRealizedProfit"`
}

SnapshotPositions define snapshot positions

type SnapshotUserAssets

type SnapshotUserAssets struct {
	Asset    string `json:"asset"`
	Borrowed string `json:"borrowed"`
	Free     string `json:"free"`
	Interest string `json:"interest"`
	Locked   string `json:"locked"`
	NetAsset string `json:"netAsset"`
}

SnapshotUserAssets define snapshot user assets

type SnapshotVos

type SnapshotVos struct {
	Data       *SnapshotData `json:"data"`
	Type       string        `json:"type"`
	UpdateTime int64         `json:"updateTime"`
}

SnapshotVos define content of a snapshot

type StartMarginUserStreamService

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

StartMarginUserStreamService create listen key for margin user stream service

func (*StartMarginUserStreamService) Do

func (s *StartMarginUserStreamService) Do(ctx context.Context, opts ...RequestOption) (listenKey string, err error)

Do send request

type StartUserStreamService

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

StartUserStreamService create listen key for user stream service

func (*StartUserStreamService) Do

func (s *StartUserStreamService) Do(ctx context.Context, opts ...RequestOption) (listenKey string, err error)

Do send request

type Symbol

type 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"`
	OrderTypes             []string                 `json:"orderTypes"`
	IcebergAllowed         bool                     `json:"icebergAllowed"`
	OcoAllowed             bool                     `json:"ocoAllowed"`
	IsSpotTradingAllowed   bool                     `json:"isSpotTradingAllowed"`
	IsMarginTradingAllowed bool                     `json:"isMarginTradingAllowed"`
	Filters                []map[string]interface{} `json:"filters"`
}

Symbol market symbol

func (*Symbol) IcebergPartsFilter

func (s *Symbol) IcebergPartsFilter() *IcebergPartsFilter

IcebergPartsFilter return iceberg part filter of symbol

func (*Symbol) LotSizeFilter

func (s *Symbol) LotSizeFilter() *LotSizeFilter

LotSizeFilter return lot size filter of symbol

func (*Symbol) MarketLotSizeFilter

func (s *Symbol) MarketLotSizeFilter() *MarketLotSizeFilter

MarketLotSizeFilter return market lot size filter of symbol

func (*Symbol) MaxNumAlgoOrdersFilter

func (s *Symbol) MaxNumAlgoOrdersFilter() *MaxNumAlgoOrdersFilter

MaxNumAlgoOrdersFilter return max num algo orders filter of symbol

func (*Symbol) MinNotionalFilter

func (s *Symbol) MinNotionalFilter() *MinNotionalFilter

MinNotionalFilter return min notional filter of symbol

func (*Symbol) PercentPriceFilter

func (s *Symbol) PercentPriceFilter() *PercentPriceFilter

PercentPriceFilter return percent price filter of symbol

func (*Symbol) PriceFilter

func (s *Symbol) PriceFilter() *PriceFilter

PriceFilter return price filter of symbol

type SymbolFilterType

type SymbolFilterType string

SymbolFilterType define symbol filter type

type SymbolPrice

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

SymbolPrice define symbol and price pair

type SymbolStatusType

type SymbolStatusType string

SymbolStatusType define symbol status type

type SymbolType

type SymbolType string

SymbolType define symbol type

type TimeInForceType

type TimeInForceType string

TimeInForceType define time in force type of order

type Trade

type Trade struct {
	ID           int64  `json:"id"`
	Price        string `json:"price"`
	Quantity     string `json:"qty"`
	Time         int64  `json:"time"`
	IsBuyerMaker bool   `json:"isBuyerMaker"`
	IsBestMatch  bool   `json:"isBestMatch"`
}

Trade define trade info

type TradeV3

type TradeV3 struct {
	ID              int64  `json:"id"`
	Symbol          string `json:"symbol"`
	OrderID         int64  `json:"orderId"`
	Price           string `json:"price"`
	Quantity        string `json:"qty"`
	QuoteQuantity   string `json:"quoteQty"`
	Commission      string `json:"commission"`
	CommissionAsset string `json:"commissionAsset"`
	Time            int64  `json:"time"`
	IsBuyer         bool   `json:"isBuyer"`
	IsMaker         bool   `json:"isMaker"`
	IsBestMatch     bool   `json:"isBestMatch"`
}

TradeV3 define v3 trade info

type TransactionResponse

type TransactionResponse struct {
	TranID int64 `json:"tranId"`
}

TransactionResponse define transaction response

type UserAsset

type UserAsset struct {
	Asset    string `json:"asset"`
	Borrowed string `json:"borrowed"`
	Free     string `json:"free"`
	Interest string `json:"interest"`
	Locked   string `json:"locked"`
	NetAsset string `json:"netAsset"`
}

UserAsset define user assets of margin account

type Withdraw

type Withdraw struct {
	Amount    float64 `json:"amount"`
	Address   string  `json:"address"`
	Asset     string  `json:"asset"`
	TxID      string  `json:"txId"`
	ApplyTime int64   `json:"applyTime"`
	Status    int     `json:"status"`
}

Withdraw define withdraw info

type WithdrawFee

type WithdrawFee struct {
	Fee float64 `json:"withdrawFee"` // docs specify string value but api returns decimal
}

WithdrawFee withdraw fee

type WithdrawHistoryResponse

type WithdrawHistoryResponse struct {
	Withdraws []*Withdraw `json:"withdrawList"`
	Success   bool        `json:"success"`
}

WithdrawHistoryResponse define withdraw history response

type WsAggTradeEvent

type WsAggTradeEvent struct {
	Event                 string `json:"e"`
	Time                  int64  `json:"E"`
	Symbol                string `json:"s"`
	AggTradeID            int64  `json:"a"`
	Price                 string `json:"p"`
	Quantity              string `json:"q"`
	FirstBreakdownTradeID int64  `json:"f"`
	LastBreakdownTradeID  int64  `json:"l"`
	TradeTime             int64  `json:"T"`
	IsBuyerMaker          bool   `json:"m"`
	Placeholder           bool   `json:"M"` // add this field to avoid case insensitive unmarshaling
}

WsAggTradeEvent define websocket aggregate trade event

type WsAggTradeHandler

type WsAggTradeHandler func(event *WsAggTradeEvent)

WsAggTradeHandler handle websocket aggregate trade event

type WsAllMarketsStatEvent

type WsAllMarketsStatEvent []*WsMarketStatEvent

WsAllMarketsStatEvent define array of websocket market statistics events

type WsAllMarketsStatHandler

type WsAllMarketsStatHandler func(event WsAllMarketsStatEvent)

WsAllMarketsStatHandler handle websocket that push all markets statistics for 24hr

type WsAllMiniMarketsStatEvent

type WsAllMiniMarketsStatEvent []*WsMiniMarketsStatEvent

WsAllMiniMarketsStatEvent define array of websocket market mini-ticker statistics events

type WsAllMiniMarketsStatServeHandler

type WsAllMiniMarketsStatServeHandler func(event WsAllMiniMarketsStatEvent)

WsAllMiniMarketsStatServeHandler handle websocket that push all mini-ticker market statistics for 24hr

type WsConfig

type WsConfig struct {
	Endpoint string
}

WsConfig webservice configuration

type WsDepthEvent

type WsDepthEvent struct {
	Event         string `json:"e"`
	Time          int64  `json:"E"`
	Symbol        string `json:"s"`
	UpdateID      int64  `json:"u"`
	FirstUpdateID int64  `json:"U"`
	Bids          []Bid  `json:"b"`
	Asks          []Ask  `json:"a"`
}

WsDepthEvent define websocket depth event

type WsDepthHandler

type WsDepthHandler func(event *WsDepthEvent)

WsDepthHandler handle websocket depth event

type WsHandler

type WsHandler func(message []byte)

WsHandler handle raw websocket message

type WsKline

type WsKline struct {
	StartTime            int64  `json:"t"`
	EndTime              int64  `json:"T"`
	Symbol               string `json:"s"`
	Interval             string `json:"i"`
	FirstTradeID         int64  `json:"f"`
	LastTradeID          int64  `json:"L"`
	Open                 string `json:"o"`
	Close                string `json:"c"`
	High                 string `json:"h"`
	Low                  string `json:"l"`
	Volume               string `json:"v"`
	TradeNum             int64  `json:"n"`
	IsFinal              bool   `json:"x"`
	QuoteVolume          string `json:"q"`
	ActiveBuyVolume      string `json:"V"`
	ActiveBuyQuoteVolume string `json:"Q"`
}

WsKline define websocket kline

type WsKlineEvent

type WsKlineEvent struct {
	Event  string  `json:"e"`
	Time   int64   `json:"E"`
	Symbol string  `json:"s"`
	Kline  WsKline `json:"k"`
}

WsKlineEvent define websocket kline event

type WsKlineHandler

type WsKlineHandler func(event *WsKlineEvent)

WsKlineHandler handle websocket kline event

type WsMarketStatEvent

type WsMarketStatEvent struct {
	Event              string `json:"e"`
	Time               int64  `json:"E"`
	Symbol             string `json:"s"`
	PriceChange        string `json:"p"`
	PriceChangePercent string `json:"P"`
	WeightedAvgPrice   string `json:"w"`
	PrevClosePrice     string `json:"x"`
	LastPrice          string `json:"c"`
	CloseQty           string `json:"Q"`
	BidPrice           string `json:"b"`
	BidQty             string `json:"B"`
	AskPrice           string `json:"a"`
	AskQty             string `json:"A"`
	OpenPrice          string `json:"o"`
	HighPrice          string `json:"h"`
	LowPrice           string `json:"l"`
	BaseVolume         string `json:"v"`
	QuoteVolume        string `json:"q"`
	OpenTime           int64  `json:"O"`
	CloseTime          int64  `json:"C"`
	FirstID            int64  `json:"F"`
	LastID             int64  `json:"L"`
	Count              int64  `json:"n"`
}

WsMarketStatEvent define websocket market statistics event

type WsMarketStatHandler

type WsMarketStatHandler func(event *WsMarketStatEvent)

WsMarketStatHandler handle websocket that push single market statistics for 24hr

type WsMiniMarketsStatEvent

type WsMiniMarketsStatEvent struct {
	Event       string `json:"e"`
	Time        int64  `json:"E"`
	Symbol      string `json:"s"`
	LastPrice   string `json:"c"`
	OpenPrice   string `json:"o"`
	HighPrice   string `json:"h"`
	LowPrice    string `json:"l"`
	BaseVolume  string `json:"v"`
	QuoteVolume string `json:"q"`
}

WsMiniMarketsStatEvent define websocket market mini-ticker statistics event

type WsPartialDepthEvent

type WsPartialDepthEvent struct {
	Symbol       string
	LastUpdateID int64 `json:"lastUpdateId"`
	Bids         []Bid `json:"bids"`
	Asks         []Ask `json:"asks"`
}

WsPartialDepthEvent define websocket partial depth book event

type WsPartialDepthHandler

type WsPartialDepthHandler func(event *WsPartialDepthEvent)

WsPartialDepthHandler handle websocket partial depth event

type WsTradeEvent

type WsTradeEvent struct {
	Event         string `json:"e"`
	Time          int64  `json:"E"`
	Symbol        string `json:"s"`
	TradeID       int64  `json:"t"`
	Price         string `json:"p"`
	Quantity      string `json:"q"`
	BuyerOrderID  int64  `json:"b"`
	SellerOrderID int64  `json:"a"`
	TradeTime     int64  `json:"T"`
	IsBuyerMaker  bool   `json:"m"`
	Placeholder   bool   `json:"M"` // add this field to avoid case insensitive unmarshaling
}

WsTradeEvent define websocket trade event

type WsTradeHandler

type WsTradeHandler func(event *WsTradeEvent)

WsTradeHandler handle websocket trade event

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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