common

package
v2.0.0-...-ef162b0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: MIT Imports: 14 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdaptKlinePeriodToSymbol

func AdaptKlinePeriodToSymbol(period model.KlinePeriod) string

func AdaptOrderClientIDOptionParameter

func AdaptOrderClientIDOptionParameter(params *url.Values)

func AdaptQtyOrPricePrecision

func AdaptQtyOrPricePrecision(sz string) int

Types

type BaseResp

type BaseResp struct {
	Code int             `json:"code,string"`
	Msg  string          `json:"msg"`
	Data json.RawMessage `json:"data"`
}

type ErrorResponseData

type ErrorResponseData struct {
	OrdID   string `json:"ordId"`
	ClOrdId string `json:"clOrdId"`
	SCode   string `json:"sCode"`
	SMsg    string `json:"sMsg"`
}

type OKxV5

type OKxV5 struct {
	UriOpts       UriOptions
	UnmarshalOpts UnmarshalerOptions
}

func New

func New() *OKxV5

func (*OKxV5) DoNoAuthRequest

func (okx *OKxV5) DoNoAuthRequest(httpMethod, reqUrl string, params *url.Values) ([]byte, []byte, error)

func (*OKxV5) GetDepth

func (okx *OKxV5) GetDepth(pair CurrencyPair, size int, opt ...OptionParameter) (*Depth, []byte, error)

func (*OKxV5) GetExchangeInfo

func (okx *OKxV5) GetExchangeInfo(instType string, opt ...OptionParameter) (map[string]CurrencyPair, []byte, error)

func (*OKxV5) GetFundingRate

func (okx *OKxV5) GetFundingRate(pair CurrencyPair, opts ...OptionParameter) (rate *FundingRate, responseBody []byte, err error)

func (*OKxV5) GetKline

func (okx *OKxV5) GetKline(pair CurrencyPair, period KlinePeriod, opt ...OptionParameter) ([]Kline, []byte, error)

func (*OKxV5) GetName

func (okx *OKxV5) GetName() string

func (*OKxV5) GetTicker

func (okx *OKxV5) GetTicker(pair CurrencyPair, opt ...OptionParameter) (*Ticker, []byte, error)

func (*OKxV5) NewPrvApi

func (okx *OKxV5) NewPrvApi(opts ...ApiOption) *Prv

func (*OKxV5) WithUnmarshalOption

func (okx *OKxV5) WithUnmarshalOption(opts ...UnmarshalerOption) *OKxV5

func (*OKxV5) WithUriOption

func (okx *OKxV5) WithUriOption(opts ...UriOption) *OKxV5

type Prv

type Prv struct {
	*OKxV5
	// contains filtered or unexported fields
}

func NewPrvApi

func NewPrvApi(opts ...options.ApiOption) *Prv

func (*Prv) CancelOrder

func (prv *Prv) CancelOrder(pair model.CurrencyPair, id string, opt ...model.OptionParameter) ([]byte, error)

func (*Prv) CreateOrder

func (prv *Prv) CreateOrder(pair model.CurrencyPair, qty, price float64, side model.OrderSide, orderTy model.OrderType, opts ...model.OptionParameter) (*model.Order, []byte, error)

func (*Prv) DoAuthRequest

func (prv *Prv) DoAuthRequest(httpMethod, reqUrl string, params *url.Values, headers map[string]string) ([]byte, []byte, error)

func (*Prv) DoSignParam

func (prv *Prv) DoSignParam(httpMethod, apiUri, apiSecret, reqBody string) (signStr, timestamp string)

func (*Prv) GetAccount

func (prv *Prv) GetAccount(coin string) (map[string]model.Account, []byte, error)

func (*Prv) GetHistoryOrders

func (prv *Prv) GetHistoryOrders(pair model.CurrencyPair, opt ...model.OptionParameter) ([]model.Order, []byte, error)

func (*Prv) GetOrderInfo

func (prv *Prv) GetOrderInfo(pair model.CurrencyPair, id string, opt ...model.OptionParameter) (*model.Order, []byte, error)

func (*Prv) GetPendingOrders

func (prv *Prv) GetPendingOrders(pair model.CurrencyPair, opt ...model.OptionParameter) ([]model.Order, []byte, error)

type RespUnmarshaler

type RespUnmarshaler struct {
}

func (*RespUnmarshaler) UnmarshalCancelOrderResponse

func (un *RespUnmarshaler) UnmarshalCancelOrderResponse(data []byte) error

func (*RespUnmarshaler) UnmarshalCreateOrderResponse

func (un *RespUnmarshaler) UnmarshalCreateOrderResponse(data []byte) (*Order, error)

func (*RespUnmarshaler) UnmarshalDepth

func (un *RespUnmarshaler) UnmarshalDepth(data []byte) (*Depth, error)

func (*RespUnmarshaler) UnmarshalGetAccountResponse

func (un *RespUnmarshaler) UnmarshalGetAccountResponse(data []byte) (map[string]Account, error)

func (*RespUnmarshaler) UnmarshalGetExchangeInfoResponse

func (un *RespUnmarshaler) UnmarshalGetExchangeInfoResponse(data []byte) (map[string]CurrencyPair, error)

func (*RespUnmarshaler) UnmarshalGetFundingRateResponse

func (un *RespUnmarshaler) UnmarshalGetFundingRateResponse(data []byte) (*FundingRate, error)

func (*RespUnmarshaler) UnmarshalGetFuturesAccountResponse

func (un *RespUnmarshaler) UnmarshalGetFuturesAccountResponse(data []byte) (map[string]FuturesAccount, error)

func (*RespUnmarshaler) UnmarshalGetHistoryOrdersResponse

func (un *RespUnmarshaler) UnmarshalGetHistoryOrdersResponse(data []byte) ([]Order, error)

func (*RespUnmarshaler) UnmarshalGetKlineResponse

func (un *RespUnmarshaler) UnmarshalGetKlineResponse(data []byte) ([]Kline, error)

func (*RespUnmarshaler) UnmarshalGetOrderInfoResponse

func (un *RespUnmarshaler) UnmarshalGetOrderInfoResponse(data []byte) (ord *Order, err error)

func (*RespUnmarshaler) UnmarshalGetPendingOrdersResponse

func (un *RespUnmarshaler) UnmarshalGetPendingOrdersResponse(data []byte) ([]Order, error)

func (*RespUnmarshaler) UnmarshalGetPositionsResponse

func (un *RespUnmarshaler) UnmarshalGetPositionsResponse(data []byte) ([]FuturesPosition, error)

func (*RespUnmarshaler) UnmarshalResponse

func (un *RespUnmarshaler) UnmarshalResponse(data []byte, res interface{}) error

func (*RespUnmarshaler) UnmarshalTicker

func (un *RespUnmarshaler) UnmarshalTicker(data []byte) (*Ticker, error)

Jump to

Keyboard shortcuts

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