sdk

package
v0.2.11 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2026 License: MIT Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountSettings

type AccountSettings struct {
	FuturesMakerFee string `json:"futuresMakerFee"`
	FuturesTakerFee string `json:"futuresTakerFee"`
	SpotMakerFee    string `json:"spotMakerFee"`
	SpotTakerFee    string `json:"spotTakerFee"`
}

type CancelOrderRequest

type CancelOrderRequest struct {
	OrderID string `json:"orderId"`
	Symbol  string `json:"symbol"`
}

type CapitalBalance

type CapitalBalance struct {
	Available string `json:"available"`
	Locked    string `json:"locked"`
	Staked    string `json:"staked"`
}

type Client

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

func NewClient

func NewClient() *Client

func (*Client) CancelOpenOrders

func (c *Client) CancelOpenOrders(ctx context.Context, symbol, marketType string) error

func (*Client) CancelOrder

func (c *Client) CancelOrder(ctx context.Context, req CancelOrderRequest) (*Order, error)

func (*Client) ExecuteOrder

func (c *Client) ExecuteOrder(ctx context.Context, req CreateOrderRequest) (*Order, error)

ExecuteOrder is a compatibility wrapper for the preferred PlaceOrder name.

func (*Client) GetAccount

func (c *Client) GetAccount(ctx context.Context) (*AccountSettings, error)

func (*Client) GetBalances

func (c *Client) GetBalances(ctx context.Context) (map[string]CapitalBalance, error)

func (*Client) GetDepth

func (c *Client) GetDepth(ctx context.Context, symbol string, limit int) (*Depth, error)

GetDepth is a compatibility wrapper for the preferred GetOrderBook name.

func (*Client) GetFundingRates

func (c *Client) GetFundingRates(ctx context.Context) ([]FundingRate, error)

func (*Client) GetKlines

func (c *Client) GetKlines(ctx context.Context, symbol, interval string, startTime, endTime int64, priceType string) ([]Kline, error)

func (*Client) GetMarkets

func (c *Client) GetMarkets(ctx context.Context) ([]Market, error)

func (*Client) GetOpenOrders

func (c *Client) GetOpenOrders(ctx context.Context, marketType, symbol string) ([]Order, error)

func (*Client) GetOpenPositions

func (c *Client) GetOpenPositions(ctx context.Context, symbol string) ([]Position, error)

func (*Client) GetOrderBook

func (c *Client) GetOrderBook(ctx context.Context, symbol string, limit int) (*Depth, error)

func (*Client) GetTicker

func (c *Client) GetTicker(ctx context.Context, symbol string) (*Ticker, error)

func (*Client) GetTrades

func (c *Client) GetTrades(ctx context.Context, symbol string, limit int) ([]Trade, error)

func (*Client) PlaceOrder

func (c *Client) PlaceOrder(ctx context.Context, req CreateOrderRequest) (*Order, error)

func (*Client) WithCredentials

func (c *Client) WithCredentials(apiKey, privateKey string) *Client

type CreateOrderRequest

type CreateOrderRequest struct {
	Symbol      string `json:"symbol"`
	Side        string `json:"side"`
	OrderType   string `json:"orderType"`
	Quantity    string `json:"quantity"`
	Price       string `json:"price,omitempty"`
	TimeInForce string `json:"timeInForce,omitempty"`
	ReduceOnly  bool   `json:"reduceOnly,omitempty"`
	ClientID    uint32 `json:"clientId,omitempty"`
}

type Depth

type Depth struct {
	Asks         [][]string `json:"asks"`
	Bids         [][]string `json:"bids"`
	LastUpdateID string     `json:"lastUpdateId"`
	Timestamp    int64      `json:"timestamp"`
}

type DepthEvent

type DepthEvent struct {
	EventType       string     `json:"e"`
	EventTime       int64      `json:"E"`
	Symbol          string     `json:"s"`
	Asks            [][]string `json:"a"`
	Bids            [][]string `json:"b"`
	FirstUpdateID   int64      `json:"U"`
	FinalUpdateID   int64      `json:"u"`
	EngineTimestamp int64      `json:"T"`
}

type FundingRate

type FundingRate struct {
	Symbol               string `json:"symbol"`
	FundingRate          string `json:"fundingRate"`
	MarkPrice            string `json:"markPrice"`
	IndexPrice           string `json:"indexPrice"`
	NextFundingTimestamp int64  `json:"nextFundingTimestamp"`
}

type Kline

type Kline struct {
	Start       string `json:"start"`
	End         string `json:"end"`
	Open        string `json:"open"`
	High        string `json:"high"`
	Low         string `json:"low"`
	Close       string `json:"close"`
	Volume      string `json:"volume"`
	QuoteVolume string `json:"quoteVolume"`
	Trades      string `json:"trades"`
}

type Market

type Market struct {
	Symbol      string        `json:"symbol"`
	BaseSymbol  string        `json:"baseSymbol"`
	QuoteSymbol string        `json:"quoteSymbol"`
	MarketType  string        `json:"marketType"`
	Filters     MarketFilters `json:"filters"`
	Visible     bool          `json:"visible"`
}

type MarketFilters

type MarketFilters struct {
	Price    PriceFilter    `json:"price"`
	Quantity QuantityFilter `json:"quantity"`
}

type Order

type Order struct {
	OrderType             string `json:"orderType"`
	ID                    string `json:"id"`
	ClientID              uint32 `json:"clientId"`
	CreatedAt             int64  `json:"createdAt"`
	ExecutedQuantity      string `json:"executedQuantity"`
	ExecutedQuoteQuantity string `json:"executedQuoteQuantity"`
	Quantity              string `json:"quantity"`
	QuoteQuantity         string `json:"quoteQuantity"`
	Price                 string `json:"price"`
	ReduceOnly            bool   `json:"reduceOnly"`
	TimeInForce           string `json:"timeInForce"`
	Side                  string `json:"side"`
	Status                string `json:"status"`
	Symbol                string `json:"symbol"`
}

type OrderUpdateEvent

type OrderUpdateEvent struct {
	EventType             string      `json:"e"`
	EventTime             int64       `json:"E"`
	Symbol                string      `json:"s"`
	ClientID              StringValue `json:"c"`
	Side                  string      `json:"S"`
	OrderType             string      `json:"o"`
	TimeInForce           string      `json:"f"`
	Quantity              string      `json:"q"`
	QuoteQuantity         string      `json:"Q"`
	Price                 string      `json:"p"`
	OrderState            string      `json:"X"`
	OrderID               string      `json:"i"`
	TradeID               StringValue `json:"t"`
	FillQuantity          string      `json:"l"`
	ExecutedQuantity      string      `json:"z"`
	ExecutedQuoteQuantity string      `json:"Z"`
	FillPrice             string      `json:"L"`
	IsMaker               bool        `json:"m"`
	Fee                   string      `json:"n"`
	FeeSymbol             string      `json:"N"`
	EngineTimestamp       int64       `json:"T"`
	PostOnly              bool        `json:"y"`
}

type Position

type Position struct {
	BreakEvenPrice      string `json:"breakEvenPrice"`
	EntryPrice          string `json:"entryPrice"`
	EstLiquidationPrice string `json:"estLiquidationPrice"`
	NetCost             string `json:"netCost"`
	NetQuantity         string `json:"netQuantity"`
	NetExposureQuantity string `json:"netExposureQuantity"`
	NetExposureNotional string `json:"netExposureNotional"`
	PnlRealized         string `json:"pnlRealized"`
	PnlUnrealized       string `json:"pnlUnrealized"`
	Symbol              string `json:"symbol"`
	PositionID          string `json:"positionId"`
}

type PositionUpdateEvent

type PositionUpdateEvent struct {
	EventType        string      `json:"e"`
	EventTime        int64       `json:"E"`
	Symbol           string      `json:"s"`
	BreakEvenPrice   StringValue `json:"b"`
	EntryPrice       StringValue `json:"B"`
	MarkPrice        StringValue `json:"M"`
	NetQuantity      StringValue `json:"q"`
	ExposureQuantity StringValue `json:"Q"`
	ExposureNotional StringValue `json:"n"`
	PositionID       string      `json:"i"`
	PnlRealized      StringValue `json:"p"`
	PnlUnrealized    StringValue `json:"P"`
	EngineTimestamp  int64       `json:"T"`
}

type PriceFilter

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

type QuantityFilter

type QuantityFilter struct {
	MinQuantity string `json:"minQuantity"`
	StepSize    string `json:"stepSize"`
}

type StreamEnvelope

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

type StringValue

type StringValue string

func (StringValue) String

func (v StringValue) String() string

func (*StringValue) UnmarshalJSON

func (v *StringValue) UnmarshalJSON(data []byte) error

type Ticker

type Ticker struct {
	Symbol             string `json:"symbol"`
	FirstPrice         string `json:"firstPrice"`
	LastPrice          string `json:"lastPrice"`
	PriceChange        string `json:"priceChange"`
	PriceChangePercent string `json:"priceChangePercent"`
	High               string `json:"high"`
	Low                string `json:"low"`
	Volume             string `json:"volume"`
	QuoteVolume        string `json:"quoteVolume"`
	Trades             string `json:"trades"`
}

type Trade

type Trade struct {
	ID            int64  `json:"id"`
	Price         string `json:"price"`
	Quantity      string `json:"quantity"`
	QuoteQuantity string `json:"quoteQuantity"`
	Timestamp     int64  `json:"timestamp"`
	IsBuyerMaker  bool   `json:"isBuyerMaker"`
}

type WSClient

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

func NewWSClient

func NewWSClient() *WSClient

func (*WSClient) Close

func (c *WSClient) Close() error

func (*WSClient) Connect

func (c *WSClient) Connect(ctx context.Context) error

func (*WSClient) Subscribe

func (c *WSClient) Subscribe(ctx context.Context, stream string, private bool, handler func(json.RawMessage)) error

func (*WSClient) Unsubscribe

func (c *WSClient) Unsubscribe(ctx context.Context, stream string) error

func (*WSClient) WithCredentials

func (c *WSClient) WithCredentials(apiKey, privateKey string) *WSClient

Jump to

Keyboard shortcuts

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