bybit

package module
v0.0.0-...-10b8117 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2021 License: MIT Imports: 11 Imported by: 0

README

bybit

bybit is an bybit client for the Go programing language.

Usage

import "github.com/hirokisan/bybit"

client := bybit.NewClient().WithAuth("your api key", "your api secret")
res, err := client.Wallet().Balance(bybit.CoinBTC)
// do as you want

Status

Market Data Endpoints
  • /v2/public/orderBook/L2
  • /v2/public/kline/list
  • /v2/public/tickers
  • /v2/public/trading-records
  • /v2/public/symbols
  • /v2/public/liq-records
  • /v2/public/mark-price-kline
  • /v2/public/index-price-kline
  • /v2/public/premium-index-kline
  • /v2/public/open-interest
  • /v2/public/big-deal
  • /v2/public/account-ratio
Account Data Endpoints
Inverse Perpetual
  • /v2/private/order/create
  • /v2/private/order/cancel
  • /v2/private/position/list
  • /v2/private/position/leverage/save
USDT Perpetual
  • /private/linear/order/create
  • /private/linear/order/cancel
  • /private/linear/position/list
  • /private/linear/position/set-leverage
  • /private/linear/trade/execution/list
Wallet Data Endpoints
  • /v2/private/wallet/balance

Documentation

Index

Constants

View Source
const (
	// MainNetBaseURL :
	MainNetBaseURL = "https://api.bybit.com"
	// TestNetBaseURL :
	TestNetBaseURL = "https://api-testnet.bybit.com"
)
View Source
const (
	// CoinBTC :
	CoinBTC = "BTC"
	// CoinETH :
	CoinETH = "ETH"
	// CoinEOS :
	CoinEOS = "EOS"
	// CoinXRP :
	CoinXRP = "XRP"
	// CoinUSDT :
	CoinUSDT = "USDT"
)
View Source
const (
	// SymbolInverseBTCUSD :
	SymbolInverseBTCUSD = SymbolInverse("BTCUSD")
	// SymbolInverseETHUSD :
	SymbolInverseETHUSD = SymbolInverse("ETHUSD")
	// SymbolInverseEOSUSD :
	SymbolInverseEOSUSD = SymbolInverse("EOSUSD")
	// SymbolInverseXRPUSD :
	SymbolInverseXRPUSD = SymbolInverse("XRPUSD")
)
View Source
const (
	// SymbolUSDTBTC :
	SymbolUSDTBTC = SymbolUSDT("BTCUSDT")
	// SymbolUSDTETH :
	SymbolUSDTETH = SymbolUSDT("ETHUSDT")
	// SymbolUSDTLTC :
	SymbolUSDTLTC = SymbolUSDT("LTCUSDT")
	// SymbolUSDTLINK :
	SymbolUSDTLINK = SymbolUSDT("LINKUSDT")
	// SymbolUSDTXTZ :
	SymbolUSDTXTZ = SymbolUSDT("XTZUSDT")
	// SymbolUSDTBCH :
	SymbolUSDTBCH = SymbolUSDT("BCHUSDT")
	// SymbolUSDTADA :
	SymbolUSDTADA = SymbolUSDT("ADAUSDT")
	// SymbolUSDTDOT :
	SymbolUSDTDOT = SymbolUSDT("DOTUSDT")
	// SymbolUSDTUNI :
	SymbolUSDTUNI = SymbolUSDT("UNIUSDT")
)
View Source
const (
	// SideNone : not defined officially
	SideNone = Side("None")
	// SideBuy :
	SideBuy = Side("Buy")
	// SideSell :
	SideSell = Side("Sell")
)
View Source
const (
	LastPrice = Triggers("LastPrice")
	MarkPrice = Triggers("MarkPrice")
)
View Source
const (
	// OrderTypeLimit :
	OrderTypeLimit = OrderType("Limit")
	// OrderTypeMarket :
	OrderTypeMarket = OrderType("Market")
)
View Source
const (
	// OrderStatusCreated :
	OrderStatusCreated = OrderStatus("Created")
	// OrderStatusRejected :
	OrderStatusRejected = OrderStatus("Rejected")
	// OrderStatusNew :
	OrderStatusNew = OrderStatus("New")
	// OrderStatusPartiallyFilled :
	OrderStatusPartiallyFilled = OrderStatus("PartiallyFilled")
	// OrderStatusFilled :
	OrderStatusFilled = OrderStatus("Filled")
	// OrderStatusCancelled :
	OrderStatusCancelled = OrderStatus("Cancelled")
	// OrderStatusPendingCancel :
	OrderStatusPendingCancel = OrderStatus("PendingCancel")
)
View Source
const (
	// TimeInForceGoodTillCancel :
	TimeInForceGoodTillCancel = TimeInForce("GoodTillCancel")
	// TimeInForceImmediateOrCancel :
	TimeInForceImmediateOrCancel = TimeInForce("ImmediateOrCancel")
	// TimeInForceFillOrKill :
	TimeInForceFillOrKill = TimeInForce("FillOrKill")
	// TimeInForcePostOnly :
	TimeInForcePostOnly = TimeInForce("PostOnly")
)
View Source
const (
	// Interval1 :
	Interval1 = Interval("1")
	// Interval3 :
	Interval3 = Interval("3")
	// Interval5 :
	Interval5 = Interval("5")
	// Interval15 :
	Interval15 = Interval("15")
	// Interval30 :
	Interval30 = Interval("30")
	// Interval60 :
	Interval60 = Interval("60")
	// Interval120 :
	Interval120 = Interval("120")
	// Interval240 :
	Interval240 = Interval("240")
	// Interval360 :
	Interval360 = Interval("360")
	// Interval720 :
	Interval720 = Interval("720")
	// IntervalD :
	IntervalD = Interval("D")
	// IntervalW :
	IntervalW = Interval("W")
	// IntervalM :
	IntervalM = Interval("M")
)
View Source
const (
	// TickDirectionPlusTick :
	TickDirectionPlusTick = TickDirection("PlusTick")
	// TickDirectionZeroPlusTick :
	TickDirectionZeroPlusTick = TickDirection("ZeroPlusTick")
	// TickDirectionMinusTick :
	TickDirectionMinusTick = TickDirection("MinusTick")
	// TickDirectionZeroMinusTick :
	TickDirectionZeroMinusTick = TickDirection("ZeroMinusTick")
)
View Source
const (
	// Period5min :
	Period5min = Period("5min")
	// Period15min :
	Period15min = Period("15min")
	// Period30min :
	Period30min = Period("30min")
	// Period1h :
	Period1h = Period("1h")
	// Period4h :
	Period4h = Period("4h")
	// Period1d :
	Period1d = Period("1d")
)
View Source
const (
	// TpSlModeFull :
	TpSlModeFull = TpSlMode("Full")
	// TpSlModePartial :
	TpSlModePartial = TpSlMode("Partial")
)
View Source
const (
	// ExecTypeTrade :
	ExecTypeTrade = ExecType("Trade")
	// ExecTypeAdlTrade :
	ExecTypeAdlTrade = ExecType("AdlTrade")
	// ExecTypeFunding :
	ExecTypeFunding = ExecType("Funding")
	// ExecTypeBustTrade :
	ExecTypeBustTrade = ExecType("BustTrade")
)

Variables

This section is empty.

Functions

func MinimumVolumeUSDT

func MinimumVolumeUSDT(symbol SymbolUSDT) float64

MinimumVolumeUSDT :

Types

type AccountRatioParam

type AccountRatioParam struct {
	Symbol SymbolInverse `json:"symbol"`
	Period Period        `json:"period"`

	Limit *int `json:"limit"`
}

AccountRatioParam :

type AccountRatioResponse

type AccountRatioResponse struct {
	CommonResponse `json:",inline"`
	Result         []AccountRatioResult `json:"result"`
}

AccountRatioResponse :

type AccountRatioResult

type AccountRatioResult struct {
	Symbol    SymbolInverse `json:"symbol"`
	BuyRatio  float64       `json:"buy_ratio"`
	SellRatio float64       `json:"sell_ratio"`
	Timestamp int           `json:"timestamp"`
}

AccountRatioResult :

type AccountService

type AccountService struct {
	Client *Client
}

AccountService :

func (*AccountService) CancelLinearOrder

func (s *AccountService) CancelLinearOrder(param CancelLinearOrderParam) (*CancelLinearOrderResponse, error)

CancelLinearOrder :

func (*AccountService) CancelOrder

func (s *AccountService) CancelOrder(param CancelOrderParam) (*CancelOrderResponse, error)

CancelOrder :

func (*AccountService) CreateLinearConditionalOrder

func (s *AccountService) CreateLinearConditionalOrder(param CreateLinearOrderParam) (*CreateLinearConditionalOrderResponse, error)

CreateLinearOrder :

func (*AccountService) CreateLinearOrder

func (s *AccountService) CreateLinearOrder(param CreateLinearOrderParam) (*CreateLinearOrderResponse, error)

CreateLinearConditionalOrder :

func (*AccountService) CreateOrder

func (s *AccountService) CreateOrder(param CreateOrderParam) (*CreateOrderResponse, error)

CreateOrder :

func (*AccountService) LinearExecutionList

LinearExecutionList : NOTE(TODO) : somehow got EOF 404(path not found)

func (*AccountService) ListLinearPosition

func (s *AccountService) ListLinearPosition(symbol SymbolUSDT) (*ListLinearPositionResponse, error)

ListLinearPosition :

func (*AccountService) ListLinearPositions

func (s *AccountService) ListLinearPositions() (*ListLinearPositionsResponse, error)

ListLinearPositions :

func (*AccountService) ListPosition

func (s *AccountService) ListPosition(symbol SymbolInverse) (*ListPositionResponse, error)

ListPosition :

func (*AccountService) ListPositions

func (s *AccountService) ListPositions() (*ListPositionsResponse, error)

ListPositions :

func (*AccountService) SaveLeverage

func (s *AccountService) SaveLeverage(param SaveLeverageParam) (*SaveLeverageResponse, error)

SaveLeverage :

func (*AccountService) SaveLinearLeverage

SaveLinearLeverage :

type Balance

type Balance struct {
	Equity           float64 `json:"equity"`
	AvailableBalance float64 `json:"available_balance"`
	UsedMargin       float64 `json:"used_margin"`
	OrderMargin      float64 `json:"order_margin"`
	PositionMargin   float64 `json:"position_margin"`
	OccClosingFee    float64 `json:"occ_closing_fee"`
	OccFundingFee    float64 `json:"occ_funding_fee"`
	WalletBalance    float64 `json:"wallet_balance"`
	RealisedPnl      float64 `json:"realised_pnl"`
	UnrealisedPnl    float64 `json:"unrealised_pnl"`
	CumRealisedPnl   float64 `json:"cum_realised_pnl"`
	GivenCash        float64 `json:"given_cash"`
	ServiceCash      float64 `json:"service_cash"`
}

Balance :

type BalanceResponse

type BalanceResponse struct {
	CommonResponse `json:",inline"`
	Result         BalanceResult `json:"result"`
}

BalanceResponse :

type BalanceResult

type BalanceResult struct {
	Balance map[Coin]Balance
}

BalanceResult :

func (*BalanceResult) UnmarshalJSON

func (r *BalanceResult) UnmarshalJSON(data []byte) error

UnmarshalJSON :

type BigDealParam

type BigDealParam struct {
	Symbol SymbolInverse `json:"symbol"`

	Limit *int `json:"limit"`
}

BigDealParam :

type BigDealResponse

type BigDealResponse struct {
	CommonResponse `json:",inline"`
	Result         []BigDealResult `json:"result"`
}

BigDealResponse :

type BigDealResult

type BigDealResult struct {
	Symbol    SymbolInverse `json:"symbol"`
	Side      Side          `json:"side"`
	Timestamp int           `json:"timestamp"`
	Value     int           `json:"value"`
}

BigDealResult :

type CancelLinearOrder

type CancelLinearOrder struct {
	OrderID string `json:"order_id"`
}

CancelLinearOrder :

type CancelLinearOrderParam

type CancelLinearOrderParam struct {
	Symbol SymbolUSDT `json:"symbol"`

	OrderID     *string `json:"order_id,omitempty"`
	OrderLinkID *string `json:"order_link_id,omitempty"`
}

CancelLinearOrderParam :

type CancelLinearOrderResponse

type CancelLinearOrderResponse struct {
	CommonResponse `json:",inline"`
	Result         CancelLinearOrderResult `json:"result"`
}

CancelLinearOrderResponse :

type CancelLinearOrderResult

type CancelLinearOrderResult struct {
	CancelLinearOrder `json:",inline"`
}

CancelLinearOrderResult :

type CancelOrder

type CancelOrder struct {
	UserID        int           `json:"user_id"`
	OrderID       string        `json:"order_id"`
	Symbol        SymbolInverse `json:"symbol"`
	Side          Side          `json:"side"`
	OrderType     OrderType     `json:"order_type"`
	Price         float64       `json:"price"`
	Qty           float64       `json:"qty"`
	TimeInForce   TimeInForce   `json:"time_in_force"`
	OrderStatus   OrderStatus   `json:"order_status"`
	LastExecTime  float64       `json:"last_exec_time"`
	LastExecPrice float64       `json:"last_exec_price"`
	LeavesQty     float64       `json:"leaves_qty"`
	CumExecQty    float64       `json:"cum_exec_qty"`
	CumExecValue  float64       `json:"cum_exec_value"`
	CumExecFee    float64       `json:"cum_exec_fee"`
	RejectReason  string        `json:"reject_reason"`
	OrderLinkID   string        `json:"order_link_id"`
	CreatedAt     string        `json:"created_at"`
	UpdatedAt     string        `json:"updated_at"`
}

CancelOrder : so far, same as CreateOrder

type CancelOrderParam

type CancelOrderParam struct {
	Symbol SymbolInverse `json:"symbol"`

	OrderID     *string `json:"order_id,omitempty"`
	OrderLinkID *string `json:"order_link_id,omitempty"`
}

CancelOrderParam :

type CancelOrderResponse

type CancelOrderResponse struct {
	CommonResponse `json:",inline"`
	Result         CancelOrderResult `json:"result"`
}

CancelOrderResponse :

type CancelOrderResult

type CancelOrderResult struct {
	CancelOrder `json:",inline"`
}

CancelOrderResult :

type Client

type Client struct {
	BaseURL string
	Key     string
	Secret  string
}

Client :

func NewClient

func NewClient() *Client

NewClient :

func NewTestClient

func NewTestClient() *Client

NewTestClient :

func (*Client) Account

func (c *Client) Account() *AccountService

Account :

func (*Client) BuildPrivateURL

func (c *Client) BuildPrivateURL(path string, params map[string]string) (string, error)

BuildPrivateURL :

func (*Client) BuildPublicURL

func (c *Client) BuildPublicURL(path string, params map[string]string) (string, error)

BuildPublicURL :

func (*Client) HasAuth

func (c *Client) HasAuth() bool

HasAuth : check has auth key and secret

func (*Client) Market

func (c *Client) Market() *MarketService

Market :

func (*Client) Wallet

func (c *Client) Wallet() *WalletService

Wallet :

func (*Client) WithAuth

func (c *Client) WithAuth(key string, secret string) *Client

WithAuth :

type Coin

type Coin string

Coin :

type CommonResponse

type CommonResponse struct {
	RetCode          int    `json:"ret_code"`
	RetMsg           string `json:"ret_msg"`
	ExtCode          string `json:"ext_code"`
	ExtInfo          string `json:"ext_info"`
	TimeNow          string `json:"time_now"`
	RateLimitStatus  int    `json:"rate_limit_status"`
	RateLimitResetMs int    `json:"rate_limit_reset_ms"`
	RateLimit        int    `json:"rate_limit"`
}

CommonResponse :

type CreateLinearConditionalOrder

type CreateLinearConditionalOrder struct {
	StopOrderID    string    `json:"stop_order_id"`
	UserID         int       `json:"user_id"`
	Symbol         string    `json:"symbol"`
	Side           string    `json:"side"`
	OrderType      string    `json:"order_type"`
	Price          int       `json:"price"`
	Qty            int       `json:"qty"`
	TimeInForce    string    `json:"time_in_force"`
	OrderStatus    string    `json:"order_status"`
	BasePrice      string    `json:"base_price"`
	TriggerBy      string    `json:"trigger_by"`
	TriggerPrice   int       `json:"trigger_price"`
	OrderLinkID    string    `json:"order_link_id"`
	ReduceOnly     bool      `json:"reduce_only"`
	CloseOnTrigger bool      `json:"close_on_trigger"`
	CreatedTime    time.Time `json:"created_time"`
	UpdatedTime    time.Time `json:"updated_time"`
	TpTriggerBy    string    `json:"tp_trigger_by"`
	SlTriggerBy    string    `json:"sl_trigger_by"`
}

CreateLinearConditionalOrder :

type CreateLinearConditionalOrderParam

type CreateLinearConditionalOrderParam struct {
	Side           Side        `json:"side"`
	Symbol         SymbolUSDT  `json:"symbol"`
	OrderType      OrderType   `json:"order_type"`
	Qty            float64     `json:"qty"`
	TimeInForce    TimeInForce `json:"time_in_force"`
	ReduceOnly     bool        `json:"reduce_only"`
	CloseOnTrigger bool        `json:"close_on_trigger"`
	TriggerBy      Triggers    `json:"trigger_by"`

	Price       *float64 `json:"price,omitempty"`
	BasePrice   *float64 `json:"base_price,omitempty"`
	StopPx      *float64 `json:"stop_px,omitempty"`
	TakeProfit  *float64 `json:"take_profit,omitempty"`
	StopLoss    *float64 `json:"stop_loss,omitempty"`
	TpTriggerBy *string  `json:"tp_trigger_by"`
	SlTriggerBy *string  `json:"sl_trigger_by"`
	OrderLinkID *string  `json:"order_link_id,omitempty"`
}

type CreateLinearConditionalOrderResponse

type CreateLinearConditionalOrderResponse struct {
	CommonResponse `json:",inline"`
	Result         CreateLinearConditionalOrderResult `json:"result"`
}

CreateLinearConditionalOrderResponse :

type CreateLinearConditionalOrderResult

type CreateLinearConditionalOrderResult struct {
	CreateLinearConditionalOrder `json:",inline"`
}

CreateLinearConditionalOrderResult :

type CreateLinearOrder

type CreateLinearOrder struct {
	OrderID        string      `json:"order_id"`
	UserID         int         `json:"user_id"`
	Symbol         SymbolUSDT  `json:"symbol"`
	Side           Side        `json:"side"`
	OrderType      OrderType   `json:"order_type"`
	Price          float64     `json:"price"`
	Qty            float64     `json:"qty"`
	TimeInForce    TimeInForce `json:"time_in_force"`
	OrderStatus    OrderStatus `json:"order_status"`
	LastExecPrice  float64     `json:"last_exec_price"`
	CumExecQty     float64     `json:"cum_exec_qty"`
	CumExecValue   float64     `json:"cum_exec_value"`
	CumExecFee     float64     `json:"cum_exec_fee"`
	ReduceOnly     bool        `json:"reduce_only"`
	CloseOnTrigger bool        `json:"close_on_trigger"`
	OrderLinkID    string      `json:"order_link_id"`
	CreatedTime    string      `json:"created_time"`
	UpdatedTime    string      `json:"updated_time"`
	TakeProfit     float64     `json:"take_profit"`
	StopLoss       float64     `json:"stop_loss"`
	TpTriggerBy    string      `json:"tp_trigger_by"`
	SlTriggerBy    string      `json:"sl_trigger_by"`
}

CreateLinearOrder :

type CreateLinearOrderParam

type CreateLinearOrderParam struct {
	Side           Side        `json:"side"`
	Symbol         SymbolUSDT  `json:"symbol"`
	OrderType      OrderType   `json:"order_type"`
	Qty            float64     `json:"qty"`
	TimeInForce    TimeInForce `json:"time_in_force"`
	ReduceOnly     bool        `json:"reduce_only"`
	CloseOnTrigger bool        `json:"close_on_trigger"`

	Price       *float64 `json:"price,omitempty"`
	TakeProfit  *float64 `json:"take_profit,omitempty"`
	StopLoss    *float64 `json:"stop_loss,omitempty"`
	TpTriggerBy *string  `json:"tp_trigger_by"`
	SlTriggerBy *string  `json:"sl_trigger_by"`
	OrderLinkID *string  `json:"order_link_id,omitempty"`
}

CreateLinearOrderParam :

type CreateLinearOrderResponse

type CreateLinearOrderResponse struct {
	CommonResponse `json:",inline"`
	Result         CreateLinearOrderResult `json:"result"`
}

CreateLinearOrderResponse :

type CreateLinearOrderResult

type CreateLinearOrderResult struct {
	CreateLinearOrder `json:",inline"`
}

CreateLinearOrderResult :

type CreateOrder

type CreateOrder struct {
	UserID        int           `json:"user_id"`
	OrderID       string        `json:"order_id"`
	Symbol        SymbolInverse `json:"symbol"`
	Side          Side          `json:"side"`
	OrderType     OrderType     `json:"order_type"`
	Price         float64       `json:"price"`
	Qty           float64       `json:"qty"`
	TimeInForce   TimeInForce   `json:"time_in_force"`
	OrderStatus   OrderStatus   `json:"order_status"`
	LastExecTime  float64       `json:"last_exec_time"`
	LastExecPrice float64       `json:"last_exec_price"`
	LeavesQty     float64       `json:"leaves_qty"`
	CumExecQty    float64       `json:"cum_exec_qty"`
	CumExecValue  float64       `json:"cum_exec_value"`
	CumExecFee    float64       `json:"cum_exec_fee"`
	RejectReason  string        `json:"reject_reason"`
	OrderLinkID   string        `json:"order_link_id"`
	CreatedAt     string        `json:"created_at"`
	UpdatedAt     string        `json:"updated_at"`
}

CreateOrder :

type CreateOrderParam

type CreateOrderParam struct {
	Side        Side          `json:"side"`
	Symbol      SymbolInverse `json:"symbol"`
	OrderType   OrderType     `json:"order_type"`
	Qty         int           `json:"qty"`
	TimeInForce TimeInForce   `json:"time_in_force"`

	Price          *float64 `json:"price,omitempty"`
	TakeProfit     *float64 `json:"take_profit,omitempty"`
	StopLoss       *float64 `json:"stop_loss,omitempty"`
	ReduceOnly     *bool    `json:"reduce_only,omitempty"`
	CloseOnTrigger *bool    `json:"close_on_trigger,omitempty"`
	OrderLinkID    *string  `json:"order_link_id,omitempty"`
}

CreateOrderParam :

type CreateOrderResponse

type CreateOrderResponse struct {
	CommonResponse `json:",inline"`
	Result         CreateOrderResult `json:"result"`
}

CreateOrderResponse :

type CreateOrderResult

type CreateOrderResult struct {
	CreateOrder `json:",inline"`
}

CreateOrderResult :

type ExecType

type ExecType string

ExecType :

type IndexPriceKlineParam

type IndexPriceKlineParam struct {
	Symbol   SymbolInverse `json:"symbol"`
	Interval Interval      `json:"interval"`
	From     int           `json:"from"`

	Limit *int `json:"limit"`
}

IndexPriceKlineParam :

type IndexPriceKlineResponse

type IndexPriceKlineResponse struct {
	CommonResponse `json:",inline"`
	Result         []IndexPriceKlineResult `json:"result"`
}

IndexPriceKlineResponse :

type IndexPriceKlineResult

type IndexPriceKlineResult struct {
	Symbol   SymbolInverse `json:"symbol"`
	Period   Period        `json:"period"`
	OpenTime int           `json:"open_time"`
	Open     string        `json:"open"`
	High     string        `json:"high"`
	Low      string        `json:"low"`
	Close    string        `json:"close"`
}

IndexPriceKlineResult :

type Interval

type Interval string

Interval :

type LeverageFilter

type LeverageFilter struct {
	MinLeverage  float64 `json:"min_leverage"`
	MaxLeverage  float64 `json:"max_leverage"`
	LeverageStep string  `json:"leverage_step"`
}

LeverageFilter :

type LinearExecutionList

type LinearExecutionList struct {
	OrderID          string     `json:"order_id"`
	OrderLinkID      string     `json:"order_link_id"`
	Side             Side       `json:"side"`
	Symbol           SymbolUSDT `json:"symbol"`
	OrderPrice       float64    `json:"order_price"`
	OrderQty         float64    `json:"order_qty"`
	OrderType        OrderType  `json:"order_type"`
	FeeRate          float64    `json:"fee_rate"`
	ExecPrice        float64    `json:"exec_price"`
	ExecType         ExecType   `json:"exec_type"`
	ExecQty          float64    `json:"exec_qty"`
	ExecFee          float64    `json:"exec_fee"`
	ExecValue        float64    `json:"exec_value"`
	LeavesQty        float64    `json:"leaves_qty"`
	ClosedSize       float64    `json:"closed_size"`
	LastLiquidityInd string     `json:"last_liquidity_ind"`
	TradeTimeMs      float64    `json:"trade_time_ms"`
}

LinearExecutionList :

type LinearExecutionListParam

type LinearExecutionListParam struct {
	Symbol SymbolUSDT `json:"symbol"`

	StartTime *int      `json:"start_time"`
	EndTime   *int      `json:"end_time"`
	ExecType  *ExecType `json:"exec_type"`
	Page      *int      `json:"page"`
	Limit     *int      `json:"limit"`
}

LinearExecutionListParam :

type LinearExecutionListResponse

type LinearExecutionListResponse struct {
	CommonResponse `json:",inline"`
	Result         LinearExecutionListResult `json:"result"`
}

LinearExecutionListResponse :

type LinearExecutionListResult

type LinearExecutionListResult struct {
	CurrentPage          int                   `json:"current_page"`
	LinearExecutionLists []LinearExecutionList `json:"data"`
}

LinearExecutionListResult :

type LinearTickersResponse

type LinearTickersResponse struct {
	CommonResponse `json:",inline"`
	Result         []LinearTickersResult `json:"result"`
}

LinearTickersResponse :

type LinearTickersResult

type LinearTickersResult struct {
	Symbol               SymbolUSDT    `json:"symbol"`
	BidPrice             string        `json:"bid_price"`
	AskPrice             string        `json:"ask_price"`
	LastPrice            string        `json:"last_price"`
	LastTickDirection    TickDirection `json:"last_tick_direction"`
	PrevPrice24h         string        `json:"prev_price_24h"`
	Price24hPcnt         string        `json:"price_24h_pcnt"`
	HighPrice24h         string        `json:"high_price_24h"`
	LowPrice24h          string        `json:"low_price_24h"`
	PrevPrice1h          string        `json:"prev_price_1h"`
	Price1hPcnt          string        `json:"price_1h_pcnt"`
	MarkPrice            string        `json:"mark_price"`
	IndexPrice           string        `json:"index_price"`
	OpenInterest         float64       `json:"open_interest"`
	OpenValue            string        `json:"open_value"`
	TotalTurnover        string        `json:"total_turnover"`
	Turnover24h          string        `json:"turnover_24h"`
	TotalVolume          float64       `json:"total_volume"`
	Volume24h            float64       `json:"volume_24h"`
	FundingRate          string        `json:"funding_rate"`
	PredictedFundingRate string        `json:"predicted_funding_rate"`
	NextFundingTime      string        `json:"next_funding_time"`
	CountdownHour        float64       `json:"countdown_hour"`
}

LinearTickersResult :

type LiqRecordsParam

type LiqRecordsParam struct {
	Symbol SymbolInverse `json:"symbol"`

	From      *int `json:"from"`
	Limit     *int `json:"limit"`
	StartTime *int `json:"start_time"`
	EndTime   *int `json:"end_time"`
}

LiqRecordsParam :

type LiqRecordsResponse

type LiqRecordsResponse struct {
	CommonResponse `json:",inline"`
	Result         []LiqRecordsResult `json:"result"`
}

LiqRecordsResponse :

type LiqRecordsResult

type LiqRecordsResult struct {
	ID     float64       `json:"id"`
	Qty    float64       `json:"qty"`
	Side   Side          `json:"side"`
	Time   int           `json:"time"` // or float64
	Symbol SymbolInverse `json:"symbol"`
	Price  float64       `json:"price"`
}

LiqRecordsResult :

type ListKlineParam

type ListKlineParam struct {
	Symbol   SymbolInverse `json:"symbol"`
	Interval Interval      `json:"interval"`
	From     int           `json:"from"`

	Limit *int `json:"limit"`
}

ListKlineParam :

type ListKlineResponse

type ListKlineResponse struct {
	CommonResponse `json:",inline"`
	Result         []ListKlineResult `json:"result"`
}

ListKlineResponse :

type ListKlineResult

type ListKlineResult struct {
	Symbol   SymbolInverse `json:"symbol"`
	Interval string        `json:"interval"`
	OpenTime int           `json:"open_time`
	Open     string        `json:"open"`
	High     string        `json:"high"`
	Low      string        `json:"low"`
	Close    string        `json:"close"`
	Volume   string        `json:"volume"`
	Turnover string        `json:"turnover"`
}

ListKlineResult :

type ListLinearPositionResponse

type ListLinearPositionResponse struct {
	CommonResponse `json:",inline"`
	Result         []ListLinearPositionResult `json:"result"`
}

ListLinearPositionResponse :

type ListLinearPositionResult

type ListLinearPositionResult struct {
	UserID              int           `json:"user_id"`
	Symbol              SymbolInverse `json:"symbol"`
	Side                Side          `json:"side"`
	Size                float64       `json:"size"`
	PositionValue       float64       `json:"position_value"`
	EntryPrice          float64       `json:"entry_price"`
	LiqPrice            float64       `json:"liq_price"`
	BustPrice           float64       `json:"bust_price"`
	Leverage            float64       `json:"leverage"`
	AutoAddMargin       float64       `json:"auto_add_margin"`
	IsIsolated          bool          `json:"is_isolated"`
	PositionMargin      float64       `json:"position_margin"`
	OccClosingFee       float64       `json:"occ_closing_fee"`
	RealisedPnl         float64       `json:"realised_pnl"`
	CumRealisedPnl      float64       `json:"cum_realised_pnl"`
	FreeQty             float64       `json:"free_qty"`
	TpSlMode            TpSlMode      `json:"tp_sl_mode"`
	DeleverageIndicator int           `json:"deleverage_indicator"`
	UnrealisedPnl       float64       `json:"unrealised_pnl"`
	RiskID              int           `json:"risk_id"`
}

ListLinearPositionResult :

type ListLinearPositionsResponse

type ListLinearPositionsResponse struct {
	CommonResponse `json:",inline"`
	Result         []ListLinearPositionsResult `json:"result"`
}

ListLinearPositionsResponse :

type ListLinearPositionsResult

type ListLinearPositionsResult struct {
	IsValid                  bool `json:"is_valid"`
	ListLinearPositionResult `json:"data,inline"`
}

ListLinearPositionsResult :

type ListPositionResponse

type ListPositionResponse struct {
	CommonResponse `json:",inline"`
	Result         ListPositionResult `json:"result"`
}

ListPositionResponse :

type ListPositionResult

type ListPositionResult struct {
	ID                  int           `json:"id"`
	UserID              int           `json:"user_id"`
	RiskID              int           `json:"risk_id"`
	Symbol              SymbolInverse `json:"symbol"`
	Side                Side          `json:"side"`
	Size                float64       `json:"size"`
	PositionValue       string        `json:"position_value"`
	EntryPrice          string        `json:"entry_price"`
	IsIsolated          bool          `json:"is_isolated"`
	AutoAddMargin       float64       `json:"auto_add_margin"`
	Leverage            string        `json:"leverage"`
	EffectiveLeverage   string        `json:"effective_leverage"`
	PositionMargin      string        `json:"position_margin"`
	LiqPrice            string        `json:"liq_price"`
	BustPrice           string        `json:"bust_price"`
	OccClosingFee       string        `json:"occ_closing_fee"`
	OccFundingFee       string        `json:"occ_funding_fee"`
	TakeProfit          string        `json:"take_profit"`
	StopLoss            string        `json:"stop_loss"`
	TrailingStop        string        `json:"trailing_stop"`
	PositionStatus      string        `json:"position_status"`
	DeleverageIndicator int           `json:"deleverage_indicator"`
	OcCalcData          string        `json:"oc_calc_data"`
	OrderMargin         string        `json:"order_margin"`
	WalletBalance       string        `json:"wallet_balance"`
	RealisedPnl         string        `json:"realised_pnl"`
	UnrealisedPnl       float64       `json:"unrealised_pnl"`
	CumRealisedPnl      string        `json:"cum_realised_pnl"`
	CrossSeq            float64       `json:"cross_seq"`
	PositionSeq         float64       `json:"position_seq"`
	CreatedAt           string        `json:"created_at"`
	UpdatedAt           string        `json:"updated_at"`
}

ListPositionResult :

type ListPositionsResponse

type ListPositionsResponse struct {
	CommonResponse `json:",inline"`
	Result         []ListPositionsResult `json:"result"`
}

ListPositionsResponse :

type ListPositionsResult

type ListPositionsResult struct {
	IsValid            bool `json:"is_valid"`
	ListPositionResult `json:"data,inline"`
}

ListPositionsResult :

type LotSizeFilter

type LotSizeFilter struct {
	MaxTradingQty float64 `json:"max_trading_qty"`
	MinTradingQty float64 `json:"min_trading_qty"`
	QtyStep       float64 `json:"qty_step"`
}

LotSizeFilter :

type MarkPriceKlineParam

type MarkPriceKlineParam struct {
	Symbol   SymbolInverse `json:"symbol"`
	Interval Interval      `json:"interval"`
	From     int           `json:"from"`

	Limit *int `json:"limit"`
}

MarkPriceKlineParam :

type MarkPriceKlineResponse

type MarkPriceKlineResponse struct {
	CommonResponse `json:",inline"`
	Result         []MarkPriceKlineResult `json:"result"`
}

MarkPriceKlineResponse :

type MarkPriceKlineResult

type MarkPriceKlineResult struct {
	Symbol  SymbolInverse `json:"symbol"`
	Period  Period        `json:"period"`
	StartAt int           `json:"start_at"`
	Open    float64       `json:"open"`
	High    float64       `json:"high"`
	Low     float64       `json:"low"`
	Close   float64       `json:"close"`
}

MarkPriceKlineResult :

type MarketService

type MarketService struct {
	Client *Client
}

MarketService :

func (*MarketService) AccountRatio

func (s *MarketService) AccountRatio(param AccountRatioParam) (*AccountRatioResponse, error)

AccountRatio :

func (*MarketService) BigDeal

func (s *MarketService) BigDeal(param BigDealParam) (*BigDealResponse, error)

BigDeal :

func (*MarketService) IndexPriceKline

func (s *MarketService) IndexPriceKline(param IndexPriceKlineParam) (*IndexPriceKlineResponse, error)

IndexPriceKline :

func (*MarketService) LinearOrderBook

func (s *MarketService) LinearOrderBook(symbol SymbolUSDT) (*OrderBookResponse, error)

OrderBook :

func (*MarketService) LinearTickers

func (s *MarketService) LinearTickers(symbol SymbolUSDT) (*LinearTickersResponse, error)

LinearTickers :

func (*MarketService) LiqRecords

func (s *MarketService) LiqRecords(param LiqRecordsParam) (*LiqRecordsResponse, error)

LiqRecords :

func (*MarketService) ListKline

func (s *MarketService) ListKline(param ListKlineParam) (*ListKlineResponse, error)

ListKline :

func (*MarketService) MarkPriceKline

func (s *MarketService) MarkPriceKline(param MarkPriceKlineParam) (*MarkPriceKlineResponse, error)

MarkPriceKline :

func (*MarketService) OpenInterest

func (s *MarketService) OpenInterest(param OpenInterestParam) (*OpenInterestResponse, error)

OpenInterest :

func (*MarketService) OrderBook

func (s *MarketService) OrderBook(symbol SymbolInverse) (*OrderBookResponse, error)

OrderBook :

func (*MarketService) PremiumIndexKline

func (s *MarketService) PremiumIndexKline(param PremiumIndexKlineParam) (*PremiumIndexKlineResponse, error)

PremiumIndexKline :

func (*MarketService) Symbols

func (s *MarketService) Symbols() (*SymbolsResponse, error)

Symbols :

func (*MarketService) Tickers

func (s *MarketService) Tickers(symbol SymbolInverse) (*TickersResponse, error)

Tickers :

func (*MarketService) TradingRecords

func (s *MarketService) TradingRecords(param TradingRecordsParam) (*TradingRecordsResponse, error)

TradingRecords :

type OpenInterestParam

type OpenInterestParam struct {
	Symbol SymbolInverse `json:"symbol"`
	Period Period        `json:"period"`

	Limit *int `json:"limit"`
}

OpenInterestParam :

type OpenInterestResponse

type OpenInterestResponse struct {
	CommonResponse `json:",inline"`
	Result         []OpenInterestResult `json:"result"`
}

OpenInterestResponse :

type OpenInterestResult

type OpenInterestResult struct {
	OpenInterest int           `json:"open_interest"`
	Timestamp    int           `json:"timestamp"`
	Symbol       SymbolInverse `json:"symbol"`
}

OpenInterestResult :

type OrderBookResponse

type OrderBookResponse struct {
	CommonResponse `json:",inline"`
	Result         []OrderBookResult `json:"result"`
}

OrderBookResponse :

func (*OrderBookResponse) UnmarshalJSON

func (r *OrderBookResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON :

type OrderBookResult

type OrderBookResult struct {
	Symbol SymbolInverse `json:"symbol"`
	Price  float64       `json:"price"`
	Size   float64       `json:"size"`
	Side   Side          `json:"side"`
}

OrderBookResult :

type OrderStatus

type OrderStatus string

OrderStatus :

type OrderType

type OrderType string

OrderType :

type Period

type Period string

Period :

type PremiumIndexKlineParam

type PremiumIndexKlineParam struct {
	Symbol   SymbolInverse `json:"symbol"`
	Interval Interval      `json:"interval"`
	From     int           `json:"from"`

	Limit *int `json:"limit"`
}

PremiumIndexKlineParam :

type PremiumIndexKlineResponse

type PremiumIndexKlineResponse struct {
	CommonResponse `json:",inline"`
	Result         []PremiumIndexKlineResult `json:"result"`
}

PremiumIndexKlineResponse :

type PremiumIndexKlineResult

type PremiumIndexKlineResult struct {
	Symbol   SymbolInverse `json:"symbol"`
	Period   Period        `json:"period"`
	OpenTime int           `json:"open_time"`
	Open     string        `json:"open"`
	High     string        `json:"high"`
	Low      string        `json:"low"`
	Close    string        `json:"close"`
}

PremiumIndexKlineResult :

type PriceFilter

type PriceFilter struct {
	MinPrice string `json:"min_price"`
	MaxPrice string `json:"max_price"`
	TickSize string `json:"tick_size"`
}

PriceFilter :

type SaveLeverageParam

type SaveLeverageParam struct {
	Symbol   SymbolInverse `json:"symbol"`
	Leverage float64       `json:"leverage"`
}

SaveLeverageParam :

type SaveLeverageResponse

type SaveLeverageResponse struct {
	CommonResponse `json:",inline"`
	Result         float64 `json:"result"`
}

SaveLeverageResponse :

type SaveLinearLeverageParam

type SaveLinearLeverageParam struct {
	Symbol       SymbolUSDT `json:"symbol"`
	BuyLeverage  float64    `json:"buy_leverage"`
	SellLeverage float64    `json:"sell_leverage"`
}

SaveLinearLeverageParam :

type SaveLinearLeverageResponse

type SaveLinearLeverageResponse struct {
	CommonResponse `json:",inline"`
}

SaveLinearLeverageResponse :

type Side

type Side string

Side :

type SymbolInverse

type SymbolInverse string

SymbolInverse :

type SymbolUSDT

type SymbolUSDT string

SymbolUSDT :

type SymbolsResponse

type SymbolsResponse struct {
	CommonResponse `json:",inline"`
	Result         []SymbolsResult `json:"result"`
}

SymbolsResponse :

type SymbolsResult

type SymbolsResult struct {
	Name           string         `json:"name"`
	BaseCurrency   string         `json:"base_currency"`
	QuoteCurrency  string         `json:"quote_currency"`
	PriceScale     float64        `json:"price_scale"`
	TakerFee       string         `json:"taker_fee"`
	MakerFee       string         `json:"maker_fee"`
	LeverageFilter LeverageFilter `json:"leverage_filter"`
	PriceFilter    PriceFilter    `json:"price_filter"`
	LotSizeFilter  LotSizeFilter  `json:"lot_size_filter"`
}

SymbolsResult :

type TickDirection

type TickDirection string

TickDirection :

type TickersResponse

type TickersResponse struct {
	CommonResponse `json:",inline"`
	Result         []TickersResult `json:"result"`
}

TickersResponse :

type TickersResult

type TickersResult struct {
	Symbol               SymbolInverse `json:"symbol"`
	BidPrice             string        `json:"bid_price"`
	AskPrice             string        `json:"ask_price"`
	LastPrice            string        `json:"last_price"`
	LastTickDirection    TickDirection `json:"last_tick_direction"`
	PrevPrice24h         string        `json:"prev_price_24h"`
	Price24hPcnt         string        `json:"price_24h_pcnt"`
	HighPrice24h         string        `json:"high_price_24h"`
	LowPrice24h          string        `json:"low_price_24h"`
	PrevPrice1h          string        `json:"prev_price_1h"`
	Price1hPcnt          string        `json:"price_1h_pcnt"`
	MarkPrice            string        `json:"mark_price"`
	IndexPrice           string        `json:"index_price"`
	OpenInterest         float64       `json:"open_interest"`
	OpenValue            string        `json:"open_value"`
	TotalTurnover        string        `json:"total_turnover"`
	Turnover24h          string        `json:"turnover_24h"`
	TotalVolume          float64       `json:"total_volume"`
	Volume24h            float64       `json:"volume_24h"`
	FundingRate          string        `json:"funding_rate"`
	PredictedFundingRate string        `json:"predicted_funding_rate"`
	NextFundingTime      string        `json:"next_funding_time"`
	CountdownHour        float64       `json:"countdown_hour"`
}

TickersResult :

type TimeInForce

type TimeInForce string

TimeInForce :

type TpSlMode

type TpSlMode string

TpSlMode :

type TradingRecordsParam

type TradingRecordsParam struct {
	Symbol SymbolInverse `json:"symbol"`

	From  *int `json:"from"`
	Limit *int `json:"limit"`
}

TradingRecordsParam :

type TradingRecordsResponse

type TradingRecordsResponse struct {
	CommonResponse `json:",inline"`
	Result         []TradingRecordsResult `json:"result"`
}

TradingRecordsResponse :

type TradingRecordsResult

type TradingRecordsResult struct {
	ID     float64       `json:"id"`
	Symbol SymbolInverse `json:"symbol"`
	Price  float64       `json:"price"`
	Qty    float64       `json:"qty"`
	Side   Side          `json:"side"`
	Time   string        `json:"time"`
}

TradingRecordsResult :

type Triggers

type Triggers string

triggers :

type WalletService

type WalletService struct {
	Client *Client
}

WalletService :

func (*WalletService) Balance

func (s *WalletService) Balance(coin Coin) (*BalanceResponse, error)

Balance :

Jump to

Keyboard shortcuts

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